aboutsummaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/doc/lsp.txt2
-rw-r--r--runtime/lua/vim/lsp/semantic_tokens.lua14
2 files changed, 13 insertions, 3 deletions
diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt
index 89a6e89511..75d5c067b1 100644
--- a/runtime/doc/lsp.txt
+++ b/runtime/doc/lsp.txt
@@ -1340,7 +1340,7 @@ start({bufnr}, {client_id}, {opts}) *vim.lsp.semantic_tokens.start()*
|vim.lsp.buf_attach_client()|. To opt-out of semantic highlighting with a
server that supports it, you can delete the semanticTokensProvider table
from the {server_capabilities} of your client in your |LspAttach| callback
- or your configuration's `on_attach` callback. >lua
+ or your configuration's `on_attach` callback: >lua
client.server_capabilities.semanticTokensProvider = nil
<
diff --git a/runtime/lua/vim/lsp/semantic_tokens.lua b/runtime/lua/vim/lsp/semantic_tokens.lua
index f06d136801..b7ffedab2b 100644
--- a/runtime/lua/vim/lsp/semantic_tokens.lua
+++ b/runtime/lua/vim/lsp/semantic_tokens.lua
@@ -409,7 +409,17 @@ function STHighlighter:on_win(topline, botline)
strict = false,
})
- --TODO(jdrouhard): do something with the modifiers
+ -- TODO(bfredl) use single extmark when hl_group supports table
+ if #token.modifiers > 0 then
+ for _, modifier in pairs(token.modifiers) do
+ api.nvim_buf_set_extmark(self.bufnr, state.namespace, token.line, token.start_col, {
+ hl_group = '@' .. modifier,
+ end_col = token.end_col,
+ priority = vim.highlight.priorities.semantic_tokens,
+ strict = false,
+ })
+ end
+ end
token.extmark_added = true
end
@@ -494,7 +504,7 @@ local M = {}
--- opt-out of semantic highlighting with a server that supports it, you can
--- delete the semanticTokensProvider table from the {server_capabilities} of
--- your client in your |LspAttach| callback or your configuration's
---- `on_attach` callback.
+--- `on_attach` callback:
--- <pre>lua
--- client.server_capabilities.semanticTokensProvider = nil
--- </pre>