Skip to content

Commit

Permalink
Add config fallback for empty latexmkrc files
Browse files Browse the repository at this point in the history
  • Loading branch information
pfoerster committed Apr 28, 2024
1 parent b09e46e commit 6b13ba6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Improve log file change detection under Windows
- Cleanup diagnostics of deleted files
- Let `\declaretheorem` accept a list of environment names instead of just a single name ([#1075](https://github.com/latex-lsp/texlab/issues/1075))
- Use configured directories if not set explicitly by `latexmkrc` file ([#1095](https://github.com/latex-lsp/texlab/issues/1095))

## [5.15.0] - 2024-04-21

Expand Down
25 changes: 18 additions & 7 deletions crates/base-db/src/deps/root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,27 +74,38 @@ impl ProjectRoot {
}

pub fn from_latexmkrc(workspace: &Workspace, dir: &Url) -> Option<Self> {
let config = workspace.config();
let rcfile = workspace
.iter()
.filter(|document| document.dir == *dir)
.find_map(|document| document.data.as_latexmkrc())?;

let compile_dir = dir.clone();
let src_dir = dir.clone();
let aux_dir = rcfile

let aux_dir_rc = rcfile
.aux_dir
.as_ref()
.and_then(|path| append_dir(dir, path, workspace).ok())
.unwrap_or_else(|| dir.clone());
.and_then(|path| append_dir(dir, path, workspace).ok());

let out_dir = rcfile
let out_dir_rc = rcfile
.out_dir
.as_ref()
.and_then(|path| append_dir(dir, path, workspace).ok())
.and_then(|path| append_dir(dir, path, workspace).ok());

let aux_dir = aux_dir_rc
.clone()
.or_else(|| append_dir(dir, &config.build.aux_dir, workspace).ok())
.unwrap_or_else(|| dir.clone());

let log_dir = aux_dir_rc
.or_else(|| append_dir(dir, &config.build.log_dir, workspace).ok())
.unwrap_or_else(|| dir.clone());

let pdf_dir = out_dir_rc
.or_else(|| append_dir(dir, &config.build.pdf_dir, workspace).ok())
.unwrap_or_else(|| dir.clone());

let log_dir = aux_dir.clone();
let pdf_dir = out_dir;
let additional_files = vec![];

Some(Self {
Expand Down

0 comments on commit 6b13ba6

Please sign in to comment.