Subject: bug#50816: 28.0.50; [eglot] Nonstandard SymbolKind values for imenu

From: Augusto Stoffel <[email-masked]>
Date: Sun, 26 Sep 2021 14:46:26 +0200

This more about the LSP spec than Eglot, but anyway: I would like to
make the Digestif server provide document outlines via the
`textDocument.documentSymbol' method.  This is not a big deal, and is
implemented internally by the Digestif library already.  Here's the
problem, though: what should I provide as the DocumentSymbol.kind?

The main constituents of a TeX document outline are chapters, sections
and environments.  However, the `kind' attribute of a DocumentSymbol is
not just some name, as one would reasonably expect.  Instead, it's a
number, which the LSP client then looks up in a hardcoded table [🤦].
So in theory one is constrained to the SymbolKinds mentioned in the
spec, none of which is remotely suitable for TeX.

Is there some Eglot-friendly way to get around this silly limitation?

Note that the TeX case may be extreme, but many "normal" programming
languages will have a couple of symbol kinds that don't quite fit that
table.  ELisp has faces, Haskell has typeclasses, and so on.

[🤦]:
https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#symbolKind