clearing the highlight groups: >lua
-- Hide semantic highlights for functions
vim.api.nvim_set_hl(0, '@lsp.type.function', {})
-- Hide all semantic highlights
for _, group in ipairs(vim.fn.getcompletion("@lsp", "highlight")) do
vim.api.nvim_set_hl(0, group, {})
end
<
You probably want these inside a |ColorScheme| autocommand.
Use |LspTokenUpdate| and |vim.lsp.semantic_tokens.highlight_token()| for more
complex highlighting.
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 Identifiers that declare or reference a class type
@lsp.type.comment Tokens that represent a comment
@lsp.type.decorator Identifiers that declare or reference decorators and annotations
@lsp.type.enum Identifiers that declare or reference an enumeration type
@lsp.type.enumMember Identifiers that declare or reference an enumeration property, constant, or member
@lsp.type.event Identifiers that declare an event property
@lsp.type.function Identifiers that declare a function
@lsp.type.interface Identifiers that declare or reference an interface type
@lsp.type.keyword Tokens that represent a language keyword
@lsp.type.macro Identifiers that declare a macro
@lsp.type.method Identifiers that declare a member function or method
@lsp.type.modifier Tokens that represent a modifier
@lsp.type.namespace Identifiers that declare or reference a namespace, module, or package
@lsp.type.number Tokens that represent a number literal
@lsp.type.operator Tokens that represent an operator
@lsp.type.parameter Identifiers that declare or reference a function or method parameters
@lsp.type.property Identifiers that declare or reference a member property, member field, or member variable
@lsp.type.regexp Tokens that represent a regular expression literal
@lsp.type.string Tokens that represent a string literal
@lsp.type.struct Identifiers that declare or reference a struct type
@lsp.type.type Identifiers that declare or reference a type that is not covered above
@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*
LspAttach *LspAttach*
After an LSP client performs "initialize" and attaches to a buffer. The
|autocmd-pattern| is the buffer name. The client ID is passed in the
Lua handler |event-data| argument.
Example: >lua
vim.api.nvim_create_autocmd('LspAttach', {
callback = function(ev)
local client = vim.lsp.get_client_by_id(ev.data.client_id)
-- ...
end
})
<
Note: If the LSP server performs dynamic registration, capabilities may be
registered any time _after_ LspAttach. In that case you may want to handle
the "registerCapability" event.
Example: >lua
vim.lsp.handlers['client/registerCapability'] = (function(overridden)