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

Bugfix bibitem undefined #1244

Closed nolanking90 closed 1 month ago

nolanking90 commented 1 month ago

Fixes #1171 Add a bibitem list to the latex Semantics struct, bibitem to CommandName and SyntaxKind enums, and handlers for processing bibitem nodes in a tex document. Added checks against the bibitem list for undefined references and unused references.

Tested in NVIM v0.11.0-dev-386+g545aafbeb w/ following minimum working example

\documentclass{article}

\begin{document}

See~\cite{ref1} % No error
See~\cite{ref2} % Undefied Reference Error

\begin{thebibliography}{9}
  \bibitem{ref1}
  Donald E. Knuth (1986) \emph{The \TeX{} Book}, Addison-Wesley Professional.

  \bibitem{ref3} % Unused Reference Warning
  An unused reference
\end{thebibliography}

\end{document}