aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp.lua
diff options
context:
space:
mode:
authorGregory Anders <8965202+gpanders@users.noreply.github.com>2022-12-08 10:55:09 -0700
committerGitHub <noreply@github.com>2022-12-08 10:55:09 -0700
commit9b14ad5fd9e15718aa938f7a426dddcc2edab4e3 (patch)
tree53d4bb16095fafb481aacdfe6e52febbfd66327c /runtime/lua/vim/lsp.lua
parent42009ac7df88bfffeea49a83e642fdc6cf9f9447 (diff)
parent9f035559defd9d575f37fd825954610065d9cf96 (diff)
downloadrneovim-9b14ad5fd9e15718aa938f7a426dddcc2edab4e3.tar.gz
rneovim-9b14ad5fd9e15718aa938f7a426dddcc2edab4e3.tar.bz2
rneovim-9b14ad5fd9e15718aa938f7a426dddcc2edab4e3.zip
Merge pull request #21100 from jdrouhard/lsp_semantic_tokens
LSP: semantic tokens support
Diffstat (limited to 'runtime/lua/vim/lsp.lua')
-rw-r--r--runtime/lua/vim/lsp.lua9
1 files changed, 9 insertions, 0 deletions
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua
index 9c42e9df52..3d3c856fcb 100644
--- a/runtime/lua/vim/lsp.lua
+++ b/runtime/lua/vim/lsp.lua
@@ -4,6 +4,7 @@ local lsp_rpc = require('vim.lsp.rpc')
local protocol = require('vim.lsp.protocol')
local util = require('vim.lsp.util')
local sync = require('vim.lsp.sync')
+local semantic_tokens = require('vim.lsp.semantic_tokens')
local api = vim.api
local nvim_err_writeln, nvim_buf_get_lines, nvim_command, nvim_buf_get_option, nvim_exec_autocmds =
@@ -25,6 +26,7 @@ local lsp = {
buf = require('vim.lsp.buf'),
diagnostic = require('vim.lsp.diagnostic'),
codelens = require('vim.lsp.codelens'),
+ semantic_tokens = semantic_tokens,
util = util,
-- Allow raw RPC access.
@@ -56,6 +58,8 @@ lsp._request_name_to_capability = {
['textDocument/formatting'] = { 'documentFormattingProvider' },
['textDocument/completion'] = { 'completionProvider' },
['textDocument/documentHighlight'] = { 'documentHighlightProvider' },
+ ['textDocument/semanticTokens/full'] = { 'semanticTokensProvider' },
+ ['textDocument/semanticTokens/full/delta'] = { 'semanticTokensProvider' },
}
-- TODO improve handling of scratch buffers with LSP attached.
@@ -1526,6 +1530,11 @@ function lsp.start_client(config)
-- TODO(ashkan) handle errors.
pcall(config.on_attach, client, bufnr)
end
+
+ if vim.tbl_get(client.server_capabilities, 'semanticTokensProvider', 'full') then
+ semantic_tokens.start(bufnr, client.id)
+ end
+
client.attached_buffers[bufnr] = true
end