docs(lsp): describe semantic tokens highlight groups with more details

Problem: Description of highlight groups for LSP semantic tokens can be
  more up to date and useful.
  Right now it misses several actually defined highlight groups and
  presents information about Vim highlight groups they are linked to.
  This is both outdated (they link to tree-sitter `@` groups now) and
  redundant (users can see this information with `:Inspect` over the
  group name itself).

Solution: Synchronize the list of groups with specification and provide
  actionable descriptions.
This commit is contained in:
Evgeni Chasnovski 2024-03-19 12:11:10 +02:00 committed by Christian Clason
parent c1c6c1ee12
commit 45032a941d

View File

@ -454,30 +454,44 @@ You probably want these inside a |ColorScheme| autocommand.
Use |LspTokenUpdate| and |vim.lsp.semantic_tokens.highlight_token()| for more Use |LspTokenUpdate| and |vim.lsp.semantic_tokens.highlight_token()| for more
complex highlighting. complex highlighting.
The following groups are linked by default to standard |group-name|s: The following is a list of standard captures used in queries for Nvim,
highlighted according to the current colorscheme (use |:Inspect| on one to see
the exact definition):
@lsp.type.class Structure @lsp.type.class Identifiers that declare or reference a class type
@lsp.type.decorator Function @lsp.type.comment Tokens that represent a comment
@lsp.type.enum Structure @lsp.type.decorator Identifiers that declare or reference decorators and annotations
@lsp.type.enumMember Constant @lsp.type.enum Identifiers that declare or reference an enumeration type
@lsp.type.event Type @lsp.type.enumMember Identifiers that declare or reference an enumeration property, constant, or member
@lsp.type.function Function @lsp.type.event Identifiers that declare an event property
@lsp.type.interface Structure @lsp.type.function Identifiers that declare a function
@lsp.type.keyword Keyword @lsp.type.interface Identifiers that declare or reference an interface type
@lsp.type.macro Macro @lsp.type.keyword Tokens that represent a language keyword
@lsp.type.method Function @lsp.type.macro Identifiers that declare a macro
@lsp.type.modifier Type @lsp.type.method Identifiers that declare a member function or method
@lsp.type.namespace Structure @lsp.type.modifier Tokens that represent a modifier
@lsp.type.number Number @lsp.type.namespace Identifiers that declare or reference a namespace, module, or package
@lsp.type.operator Operator @lsp.type.number Tokens that represent a number literal
@lsp.type.parameter Identifier @lsp.type.operator Tokens that represent an operator
@lsp.type.property Identifier @lsp.type.parameter Identifiers that declare or reference a function or method parameters
@lsp.type.regexp SpecialChar @lsp.type.property Identifiers that declare or reference a member property, member field, or member variable
@lsp.type.string String @lsp.type.regexp Tokens that represent a regular expression literal
@lsp.type.struct Structure @lsp.type.string Tokens that represent a string literal
@lsp.type.type Type @lsp.type.struct Identifiers that declare or reference a struct type
@lsp.type.typeParameter TypeDef @lsp.type.type Identifiers that declare or reference a type that is not covered above
@lsp.type.variable Identifier @lsp.type.typeParameter Identifiers that declare or reference a type parameter
@lsp.type.variable Identifiers that declare or reference a local or global variable
@lsp.mod.abstract Types and member functions that are abstract
@lsp.mod.async Functions that are marked async
@lsp.mod.declaration Declarations of symbols
@lsp.mod.defaultLibrary Symbols that are part of the standard library
@lsp.mod.definition Definitions of symbols, for example, in header files
@lsp.mod.deprecated Symbols that should no longer be used
@lsp.mod.documentation Occurrences of symbols in documentation
@lsp.mod.modification Variable references where the variable is assigned to
@lsp.mod.readonly Readonly variables and member fields (constants)
@lsp.mod.static Class members (static members)
============================================================================== ==============================================================================
EVENTS *lsp-events* EVENTS *lsp-events*