Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forward search not working with outdir #635

Closed
tiagovla opened this issue May 27, 2022 · 5 comments
Closed

Forward search not working with outdir #635

tiagovla opened this issue May 27, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@tiagovla
Copy link

This is a duplicate of #147. I could not get it to work with zathura + neovim.
It works fine if the aux/output files are inside the current directory, i.e. ..
It does not if the aux/output files are in a subfolder, e.g. ./build.

Versions

Texlab: 4.0.0
Latexmk: 4.77
Nvim: v0.8.0-dev

Settings

    settings = {
        texlab = {
            diagnosticsDelay = 50,
            build = {
                outputDirectory = "build",
                auxDirectory = "build",
                executable = "latexmk",
                args = {
                    "-pdf",
                    "-pdflatex=lualatex",
                    "-quiet",
                    "-interaction=nonstopmode",
                    "-synctex=1",
                    "-shell-escape",
                    "-pv",
                    "-f",
                    "-outdir=build",
                    "%f",
                },
            },
            forwardSearch = {
                args = { "--synctex-forward", "%l:1:%f", "%p" },
                executable = "zathura",
            },
            chktex = { onOpenAndSave = true, onEdit = false },
            formatterLineLength = 120,
        },
    }

Debugging

I noticed that zathura is not called if the pdf file is not present in the current directory (.).
If it is present, forward search succeeds using the current directory file path.
No info on texlab's logs.
I suspect texlab searches for the pdf file in the current directory, doesn't find it and errors out without calling zathura.

@pfoerster
Copy link
Member

Thanks for the detailed report. It looks like your configuration is not valid. The auxDirectory setting needs to be moved one level up: texlab.auxDirectory. The texlab.build.outputDirectory does not exist anymore so the value will be ignored.

@tiagovla
Copy link
Author

@pfoerster I tried it with texlab.auxDirectory too. It isn't working for me. I still get Search Error.

@pfoerster
Copy link
Member

@tiagovla From which directory are you calling nvim?
texlab currently searches the following directories for PDF files:

  • If texlab.rootDirectory is set: <current working directory>/<texlab.rootDirectory>/<file_name>.pdf
  • If texlab.auxDirectory is set: <current working directory>/<texlab.auxDirectory>/<file_name>.pdf
  • <directory of TeX file>/<file_name>.pdf

I think the problem is that the working directory cannot be relied on with this setup.

@pfoerster pfoerster added the bug Something isn't working label May 27, 2022
@tiagovla
Copy link
Author

I was calling nvim within a sub directory inside my .git project. I tried to move it to my project's root and it also didn't work.
I think I found the cause. Lspconfig was setting the root directory to my home instead of the .git path.
Now if my current working directory is the root directory it works.
It would be nice if texlab could check <current working directory>/<texlab.auxDirectory>/<file_name>.pdf anyways.

pfoerster added a commit that referenced this issue Jun 12, 2022
@pfoerster
Copy link
Member

pfoerster commented Jun 12, 2022

It would be nice if texlab could check /<texlab.auxDirectory>/<file_name>.pdf anyways.

This path is always checked even if texlab.rootDirectory is set. However, I added another set of paths to the search list, which should prevent this problem in the future:

<directory of TeX file>/<texlab.rootDirectory>/<file_name>.pdf
<directory of TeX file>/<texlab.auxDirectory>/<file_name>.pdf

EDIT: Released with v4.1.0

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Jul 7, 2022
### Added

- Add support for escaping placeholders in forward search ([#649](latex-lsp/texlab#649))
- Add support for diagnostic filtering ([#323](latex-lsp/texlab#323))
- Add pre-built binaries for the following targets:
  - `aarch64-unknown-linux-gnu`
  - `armv7-unknown-linux-gnueabihf`
  - `x86_64-unknown-linux-musl`
  - `aarch64-pc-windows-msvc`
  - `i686-pc-windows-msvc`

### Fixed

- Parse incomplete server options correctly ([#651](latex-lsp/texlab#651))

## [4.1.0] - 12.06.2022

### Added

- Add server commands to clean build directory ([#607](latex-lsp/texlab#607))

### Changed

- Improve output when hovering over BibTeX strings
- Improve the heuristic for finding build artifacts ([#635](latex-lsp/texlab#635))

### Fixed

- Allow brackets in included file paths ([#639](latex-lsp/texlab#639))
- Allow commands in included file paths ([#641](latex-lsp/texlab#641))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants