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

Add additional diagnostics #899

Merged
merged 11 commits into from
Jun 29, 2023
Merged

Add additional diagnostics #899

merged 11 commits into from
Jun 29, 2023

Conversation

pfoerster
Copy link
Member

  • Report a hint if
    • a label is unused
    • a label reference is undefined
    • a citation is undefined
    • a BibTeX entry is unused
  • Extract the diagnostics module to a separate crate

@pfoerster pfoerster marked this pull request as draft June 24, 2023 08:48
@clason
Copy link
Contributor

clason commented Jun 24, 2023

Nice! Some comments:

  1. Undefined references/citations should be an actual error (or at least a warning).
  2. Should only the unused label itself or the full \label command be tagged? I'd say the former, for symmetry with how undefined labels and unused bibtex keys are handled. (Also makes it easier to quickly distinguish unused labels and commented out label commands.)
  3. Unused labels/entries can spam the diagnostic list quite a bit; but I guess as these are the only hints, you can just filter them out.
  4. I have to admit I'm a bit on the fence about tagging unused bibtex keys; many people use their bibtex file as a sort of database, and I admit it looks a bit weird that such a structured file has keys sometimes colored, sometimes grayed out. On the other hand, it makes it much easier to clean up a bib file for submission, so having that diagnostic is certainly helpful.

@pfoerster
Copy link
Member Author

Undefined references/citations should be an actual error (or at least a warning).

Yeah, I think, texlab can be more confident here and report an error like we do for syntax errors.

I'd say the former, for symmetry with how undefined labels and unused bibtex keys are handled.

I agree, graying out the entire BibTeX entry does not look good and is very distracting (especially when using a very large file with many unused entries).

@pfoerster pfoerster marked this pull request as ready for review June 24, 2023 13:46
@pfoerster pfoerster merged commit d32de15 into master Jun 29, 2023
5 checks passed
@pfoerster pfoerster deleted the feature/improved-diagnostics branch June 29, 2023 17:22
@clason
Copy link
Contributor

clason commented Jul 5, 2023

Sorry for the necro-comment, but wanted to note this down shortly before I forget: Another additional diagnostic that could be very useful is a "duplicate label/bibtex entry" (probably a Warning?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants