astoff / digestif

A language server for TeX and friends
Other
251 stars 6 forks source link
bibtex language-server latex tex

Digestif

CTAN LuaRocks

Digestif is a code analyzer, and a language server, for LaTeX, ConTeXt et caterva. It provides context-sensitive completion, documentation, code navigation, and related functionality to any text editor that speaks the LSP protocol.

Features

Installation

Digestif has minimal dependencies and can run on LuaTeX or on a standalone Lua interpreter. Correspondingly, there are two ways to install it.

LuaTeX with the self-installing script easy

The only dependencies for this are git and a recent TeX installation.

  1. Download the digestif wrapper script (or, on Windows, digestif.cmd).
  2. Place it in your $PATH (say, ~/.local/bin).
  3. Make it executable (chmod +x ~/.local/bin/digestif).

In the first run, the script will automatically download the package, by default to ~/.digestif. To update or uninstall, simply delete that folder.

Standalone Lua via LuaRocks

Run luarocks install digestif. This should be done either as root or with the --local option, in which case the executable script will land in ~/.luarocks/bin/digestif; make sure this is in your $PATH or adapt your text editor configuration accordingly.

Editor setup

Next, you need to enable Digestif as a language server in your favorite text editor.

Emacs with the Eglot package

Digestif works out-of-the-box with Eglot. Just install the package (M-x package-install RET eglot RET), open some TeX document and enable Eglot (M-x eglot). Voilà! Some hints:

Emacs with the lsp-mode package

To ensure that Digestif is used, add the following to your init file:

  (setq lsp-tex-server 'digestif)

Vim with the Coc plugin

See instructions here.

Sublime Text with the LSP package

See instructions here.

Other editors

It shouldn't be hard to set up other editors to use Digestif. Please open an issue if you want to include additional instructions here.

Supported TeX packages

Digestif tries to learn about the commands provided by a package by looking at its source code, but this has limitations, since the typical TeX literate documentation is ostensibly not machine readable.

For full support, a detailed “tags” file should be created for each package. Among other things, this file lists all defined macros together with their signatures and docstrings. To generate a stub tags file from a .sty, .cls or .dtx file, use the command

digestif --generate FILES

After filling in the missing details, the resulting tags file can be added to this repository (pull requests are welcome!). The format of the tags files should be more or less self explanatory. See the data folder for examples.

License

Digestif is available under the GNU General Public License, version 3 or later. For some files in the data directory, a different (free) license applies. See LICENSE.md for details.