On Thu, Nov 6, 2025 at 4:34 AM Denis Bitouzé <[email protected]> wrote: > > Le 05/11/25 à 23h41, Hongyi Zhao a écrit : > > > The most significant advantage I've found is the on-the-fly > > diagnostics. The server flags issues like undefined labels, > > Arash has answered this point. > > > incorrect command usage, or missing packages as you type, often before > > you even think about compiling. > > The TeXstudio (TXS) LaTeX IDE has such a nice feature. Indeed, if you > insert a command/environment: > > - belonging to a package not loaded, > - that is misspelled, > > it is instantly highlighted so that you can fix the problem before you > compile. > > This feature is based on .cwl files, one per package (an also some for > TeX, LaTeX, etc.), that contain the commands/environments the package > define.Q Such .cwl files are manually created, essentially by Matthew > Bertucci and the VSCode extension LaTeX workshop: > > https://github.com/James-Yu/LaTeX-Workshop > > converts TXS's .cwl into JSON files for its own completer. See e.g.: > > ┌──── > │ > https://github.com/James-Yu/LaTeX-Workshop/blob/master/data/packages/graphicx.json > └──── > > You can see, at line: > > ┌──── > │ > https://github.com/James-Yu/LaTeX-Workshop/blob/91df98e9a2059abd686907b87c4d2d1ba18b7073/data/packages/graphicx.json#L57 > └──── > > that the nature of the arguments can be controlled. > > Of course, not all the packages are covered and there are mistakes > sometimes, and the final judge is the latex engine.
Maintaining such a large number of JSON files requires a substantial amount of work. Moreover, when the corresponding LaTeX packages are updated, it's necessary to check and update the associated JSON files here in a timely manner. Frankly speaking, I have no idea how the LSP server implements these features behind the scenes. > Maybe these json files files could be used by Emacs in order to offer > such a feature… > > > This shortens the feedback cycle dramatically and catches small > > mistakes instantly. > > Indeed. > > Regards. > -- > Denis Best, Zhao
