latex-lsp / texlab

An implementation of the Language Server Protocol for LaTeX
GNU General Public License v3.0
1.56k stars 53 forks source link

Give precedence to directories in `.latexmkrc` over those in `TexLab` settings #1265

Open anwaralameddin opened 2 weeks ago

anwaralameddin commented 2 weeks ago

When either of the files .texlabroot or .texlabroot is present in a directory that also contains .latexmkrc, TexLab reads relevant directories, like aux_dir and out_dir, from its configs rather than .latexmkrc. A conflict between .latexmkrc and TexLab settings, e.g. if $out_dir is used in .latexmkrc and texlab.build.pdfDirectory is not set, results in a failure when calling some of the methods and commands textDocument/forwardSearch, textDocument/publishDiagnostics, texlab.cleanAuxiliary and texlab.cleanArtifacts. The exact method(s) or command(s) affected depends on the conflicting variables and settings and whether texlab.build.executable is set to latexmk. This conflicts with the explanation in the Configuration wiki entry.

Given that TexLab configurations could be set "globally" in the editor's settings, and TexLab only detects .latexmkrc for the project, it may be more intuitive to alter ProjectRoot::walk_and_find to give precedence to directories in .latexmkrc over those in TexLab settings when texlab.build.executable is set to latexmk.