Add config fallback for empty latexmkrc files (#1101)

This commit is contained in:
Patrick Förster 2024-05-01 11:41:42 +02:00 committed by GitHub
parent b09e46ebc8
commit 7dafafc942
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 19 additions and 7 deletions

View file

@ -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

View file

@ -74,6 +74,7 @@ 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)
@ -81,20 +82,30 @@ impl ProjectRoot {
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 {