aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/semantic_tokens.lua
diff options
context:
space:
mode:
authorFolke Lemaitre <folke.lemaitre@gmail.com>2022-12-14 10:46:54 +0100
committerFolke Lemaitre <folke.lemaitre@gmail.com>2022-12-17 13:05:31 +0100
commitef91146efcece1b6d97152251e7137d301146189 (patch)
tree6897f68a62dca4b8611a1acc90037e56d01babc4 /runtime/lua/vim/lsp/semantic_tokens.lua
parent04da0432446fac57e391c31bd4de0a9c06b1626d (diff)
downloadrneovim-ef91146efcece1b6d97152251e7137d301146189.tar.gz
rneovim-ef91146efcece1b6d97152251e7137d301146189.tar.bz2
rneovim-ef91146efcece1b6d97152251e7137d301146189.zip
feat: `vim.inspect_pos`, `vim.show_pos`, `:Inspect`
Diffstat (limited to 'runtime/lua/vim/lsp/semantic_tokens.lua')
-rw-r--r--runtime/lua/vim/lsp/semantic_tokens.lua7
1 files changed, 4 insertions, 3 deletions
diff --git a/runtime/lua/vim/lsp/semantic_tokens.lua b/runtime/lua/vim/lsp/semantic_tokens.lua
index d4c414675c..e14d3e51cd 100644
--- a/runtime/lua/vim/lsp/semantic_tokens.lua
+++ b/runtime/lua/vim/lsp/semantic_tokens.lua
@@ -586,13 +586,13 @@ function M.stop(bufnr, client_id)
end
--- Return the semantic token(s) at the given position.
---- If called without argument, returns the token under the cursor.
+--- If called without arguments, returns the token under the cursor.
---
---@param bufnr number|nil Buffer number (0 for current buffer, default)
---@param row number|nil Position row (default cursor position)
---@param col number|nil Position column (default cursor position)
---
----@return table[]|nil tokens Table of tokens at position
+---@return table|nil (table|nil) List of tokens at position
function M.get_at_pos(bufnr, row, col)
if bufnr == nil or bufnr == 0 then
bufnr = api.nvim_get_current_buf()
@@ -609,7 +609,7 @@ function M.get_at_pos(bufnr, row, col)
end
local tokens = {}
- for _, client in pairs(highlighter.client_state) do
+ for client_id, client in pairs(highlighter.client_state) do
local highlights = client.current_result.highlights
if highlights then
local idx = binary_search(highlights, row)
@@ -621,6 +621,7 @@ function M.get_at_pos(bufnr, row, col)
end
if token.start_col <= col and token.end_col > col then
+ token.client_id = client_id
tokens[#tokens + 1] = token
end
end