-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathnvim-semantic-tokens.txt
138 lines (120 loc) · 6.41 KB
/
nvim-semantic-tokens.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
*nvim-treesitter* Treesitter configurations and abstraction layer for Neovim.
Minimum version of neovim: nightly
Authors:
Stephan Seitz <stephan.seitz@fau.de>
==============================================================================
HIGHLIGHTING *nvim-semantic-tokens*
*lsp-highlight-semantic-tokens*
Some language server support semantic highlighting via |lsp-semantic_tokens|.
Semantic tokens defined by the server can have a type (SemanticTokenTypes) and
a list of modifiers (SemanticTokenModifiers). More information on the
available types and modifiers can be found here:
https://code.visualstudio.com/api/language-extensions/semantic-highlight-guide#semantic-token-classification
https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_semanticTokens
Neovim will use the following highlight groups to highlight
SemanticTokenTypes:
*hl-LspNamespace*
LspNamespace
*hl-LspType*
LspType
*hl-LspClass*
LspClass
*hl-LspEnum*
LspEnum
*hl-LspInterface*
LspInterface
*hl-LspStruct*
LspStruct
*hl-LspTypeParameter*
LspTypeParameter
*hl-LspParameter*
LspParameter
*hl-LspVariable*
LspVariable
*hl-LspProperty*
LspProperty
*hl-LspEnumMember*
LspEnumMember
*hl-LspEvent*
LspEvent
*hl-LspFunction*
LspFunction
*hl-LspMethod*
LspMethod
*hl-LspMacro*
LspMacro
*hl-LspKeyword*
LspKeyword
*hl-LspModifier*
LspModifier
*hl-LspComment*
LspComment
*hl-LspString*
LspString
*hl-LspNumber*
LspNumber
*hl-LspRegex*
LspRegexp
*hl-LspOperator*
LspOperator
And the following highlight groups modifiers SemanticTokenModifiers:
*hl-Declaration*
LspDeclaration
*hl-Definition*
LspDefinition
*hl-Readonly*
LspReadonly
*hl-Static*
LspStatic
*hl-Deprecated*
LspDeprecated
*hl-Abstract*
LspAbstract
*hl-Async*
LspAsync
*hl-Modification*
LspModification
*hl-Documentation*
LspDocumentation
*hl-DefaultLibrary*
LspDefaultLibrary
==============================================================================
Lua module: vim.lsp.semantic_tokens *lsp-semantic_tokens*
*vim.lsp.semantic_tokens.on_full()*
on_full({err}, {response}, {ctx}, {config})
|lsp-handler| for the method `textDocument/semanticTokens/full`
This function can be configured with |vim.lsp.with()| with the following
options for `config`
`on_token`: A function with signature `function(ctx, token)` that is
called whenever a semantic token is received from the server from context
`ctx` (see |lsp-handler| for the definition of `ctx`). This can be used
for highlighting the tokens. `token` is a table:
>
{
line -- line number 0-based
start_char -- start character 0-based (in Unicode characters, not in byte offset as
-- required by most of Neovim's API. Conversion might be needed for further
-- processing!)
length -- length in characters of this token
type -- token type as string (see https://code.visualstudio.com/api/language-extensions/semantic-highlight-guide#semantic-token-classification)
modifiers -- token modifier as string (see https://code.visualstudio.com/api/language-extensions/semantic-highlight-guide#semantic-token-classification)
offset_encoding -- offset encoding used by the language server (see |lsp-sync|)
}
<
`on_invalidate_range`: A function with signature `function(ctx,
line_start, line_end)` called whenever tokens in a specific line range
(`line_start`, `line_end`) should be considered invalidated (see
|lsp-handler| for the definition of `ctx`). `line_end` can be -1 to
indicate invalidation until the end of the buffer.
*vim.lsp.semantic_tokens.on_refresh()*
on_refresh({err}, {_}, {ctx}, {_})
|lsp-handler| for the method `textDocument/semanticTokens/refresh`
refresh({bufnr}) *vim.lsp.semantic_tokens.refresh()*
Refresh the semantic tokens for the current buffer
It is recommended to trigger this using an autocmd or via keymap.
>
autocmd BufEnter,CursorHold,InsertLeave <buffer> lua require 'vim.lsp.semantic_tokens'.refresh(vim.api.nvim_get_current_buf())
<
Parameters: ~
{bufnr} number
vim:tw=78:ts=8:expandtab:noet:ft=help:norl: