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

Nested input with full path from root directory does not work as expected #571

Closed
frederikrosenberg opened this issue Mar 1, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@frederikrosenberg
Copy link

Texlab version: 3.3.1
Latexmk version: 4.76

I'm currently not able to use a nested \input{} from within another \input{} if the second input is referencing the other file by the root directory instead of using a relative path.

Steps to reproduce:

  • Create a main.tex file and input a package
  • Create a new file located at content/first.tex
  • Create a new file located at content/first/second.tex
  • From main.tex input first.tex with \input{content/first}
  • From first.tex input second.tex with \input{content/first/second}

Expected behavior:
To be able to build from second.tex and have auto-completion.

latexmk is able to build with these inputs.

Current behavior:
Not able to build with :TexlabBuild from NeoVim from second.tex.
Auto-complete is not able to suggest functions from imported packages.

@pfoerster pfoerster added the bug Something isn't working label Mar 3, 2022
@pfoerster
Copy link
Member

Thanks for the very detailed report!

For this to work, the texlab.rootDirectory setting needs to be set to the directory containing the main.tex file (relative paths like the current working directory . are also possible if your editor sets the cwd of the server correctly). If you use relative paths, then the bug fix 2221dc8 is required.

@frederikrosenberg
Copy link
Author

Thanks for the quick answer!

I still have the problem with the new patch, when using nested imports all using the rootDirectory as reference like the issue stated. The rootDirectory is getting set correctly by my editor, even when in second.tex which does not have auto completion.

Folder structure:

main.tex
content/
├─ first.tex
├─ second/
│  ├─ second.tex

@frederikrosenberg
Copy link
Author

Actually, turns out that nvim-lspconfig does not set the root directory and just sets its as null.

It works if I manually set the root directory, thanks!

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue May 29, 2022
## [4.0.0] - 25.05.2022

### Added

- Add `--version` command line flag
- Provide pre-built binaries for `aarch64-apple-darwin` architecture ([#591](latex-lsp/texlab#591))
- Autocomplete files based on `\graphicspath` ([#590](latex-lsp/texlab#590))
- Release `texlab` on `crates.io` ([#399](latex-lsp/texlab#399))

### Changed

- _BREAKING_: Use client-side file watching instead of server-side notifications (`workspace/didChangeWatchedFiles`)
- _BREAKING_: Bump minimum supported Rust version to 1.58.1
- _BREAKING_: Do not use `citeproc-rs` to render citations. Instead, use a custom approach that tries to resemble the `BibLaTeX` output ([#629](latex-lsp/texlab#629))

### Fixed

- Parse `\subinputfrom` command correctly ([#610](latex-lsp/texlab#610))
- Parse verbatim environments correctly ([#490](latex-lsp/texlab#490))
- Stop capturing stdout when build exits ([#588](latex-lsp/texlab#588))
- Fix parsing of key-value pairs ([#573](latex-lsp/texlab#573))
- Normalize `texlab.rootDirectory` when resolving includes ([#571](latex-lsp/texlab#571))
- Allow optional arguments in environment definitions ([#570](latex-lsp/texlab#570))
- Allow `=` in include paths ([#568](latex-lsp/texlab#568))
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