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

Bib reference error for subimports #1145

Closed
brunotvs opened this issue Jun 24, 2024 · 8 comments · Fixed by #1160 or #1161
Closed

Bib reference error for subimports #1145

brunotvs opened this issue Jun 24, 2024 · 8 comments · Fixed by #1160 or #1161

Comments

@brunotvs
Copy link

The LSP displays an ‘undefined reference’ error in files imported with the import package.

@brunotvs
Copy link
Author

Actually, I found two behaviors that I consider undesirable:

  1. When I define a new command using import or subimport, TexLab appears to be unable to build the document tree.
\newcommand{\structure}[1]{
	\subimport{#1/}{document.tex}
}
  1. If I subimport file1.tex and, in file1.tex, I input file2.tex, TexLab does not seem to consider file2.tex as part of the same project as file1.tex.

@brunotvs
Copy link
Author

Created this repo showing the errors:
https://github.com/brunotvs/texlab_issue

@pfoerster
Copy link
Member

@brunotvs Currently, this is to be expected because the server does not implement the same logic as the TeX engine so in this case, it does not know that \structure{foo} resolves to \subimport{foo}{document.tex}. There two ways to solve this issue:

  1. Hard-code this case similar to texlab.experimental.labelDefinitionCommands (difficult to draw the line here on what is useful enough to be hard-coded into the server)
  2. Implement a (rudimentary) macro expansion engine in the server (very hard)

@brunotvs
Copy link
Author

brunotvs commented Jul 3, 2024

@pfoerster Okay, but what about nested subimports?

@brunotvs
Copy link
Author

brunotvs commented Jul 3, 2024

@pfoerster, in addition, can the .fls file be utilized?

@pfoerster
Copy link
Member

@pfoerster Okay, but what about nested subimports?

If they just use the plain \subimport command, they should work.

@pfoerster, in addition, can the .fls file be utilized?

Sure, #1160 adds a the .fls as an additional source for the project detection. With this changeset, your example will work now after compiling the document once.

@brunotvs
Copy link
Author

brunotvs commented Jul 4, 2024

Sure, #1160 adds a the .fls as an additional source for the project detection.

Awesome, sounds great.

If they just use the plain \subimport command, they should work.

@pfoerster I found that if I add a latexmkrc file, citation and refs from nested submimports stop working as per this repo

@pfoerster
Copy link
Member

@pfoerster I found that if I add a latexmkrc file, citation and refs from nested submimports stop working as per this repo

Thanks for the example. With #1161, your example should work as intended.

netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this issue Jan 31, 2025
## [5.21.0] - 2024-10-26

### Added

- Support starred variants in "Go to References" ([#1234](latex-lsp/texlab#1234))
- Add `texlab.latexindent.replacement` setting to allow passing a replacement flag to `latexindent` ([#1222](latex-lsp/texlab#1222))
- Don't require a label to show section numbers for document symbols ([#910](latex-lsp/texlab#910))
- Support navigating to files that are part of the `TEXINPUTS` similar to `BIBINPUTS` ([#1228](latex-lsp/texlab#1228))

### Fixed

- Fix opening `untitled` documents ([#1242](latex-lsp/texlab#1242))
- Handle `\bibitem` when checking for undefined references ([#1171](latex-lsp/texlab#1171))
- Fix false-positive syntax error when using a command inside a `\label` ([#879](latex-lsp/texlab#879))

## [5.20.0] - 2024-10-08

### Added

- Add `texlab.inlayHints.maxLength` setting to allow limiting inlay hint text length ([#1212](latex-lsp/texlab#1212))
- Allow suppressing diagnostics using `% texlab: ignore` magic comments ([#1211](latex-lsp/texlab#1211))

### Fixed

- Fix enabling `texlab.build.useFileList` setting
- Make "Goto Definition" work correctly with starred commands ([#1197](latex-lsp/texlab#1197))

## [5.19.0] - 2024-07-08

### Added

- Add `texlab.build.useFileList` setting to allow controlling whether to use the `.fls` files

### Changed

- Disable using `.fls` files for project detection by default

## [5.18.0] - 2024-07-06

### Added

- Parse `.fls` files to make the project detection more reliable ([#1145](latex-lsp/texlab#1145))

### Fixed

- Fix parsing commands with unicode characters inside BibTeX entries
  ([#1147](latex-lsp/texlab#1147))
- Improve detection of included files when non-ASCII characters are used ([#923](latex-lsp/texlab#923))
- Fix resolving includes starting from files included using `\subimport` ([#1145](latex-lsp/texlab#1145))

## [5.17.0] - 2024-06-23

### Added

- Add label commands from `zref` and `zref-clever` to the list of default label commands
  ([#1140](latex-lsp/texlab#1140))
- Add `texlab.experimental.labelDefinitionPrefixes` and
  `texlab.experimental.labelReferencePrefixes` options ([#1139](latex-lsp/texlab#1139))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants