aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/buf.lua
diff options
context:
space:
mode:
authorAlvaro Muñoz <alvaro@pwntester.com>2020-02-26 20:10:16 +0100
committerGitHub <noreply@github.com>2020-02-26 20:10:16 +0100
commitca8699378c765017575c102f3da8347833159a6c (patch)
treece993e9203ef77e96565c334c75d4c169baf3fc2 /runtime/lua/vim/lsp/buf.lua
parent78ec95ce7dc070899caf2b35f7058ba466fe7073 (diff)
downloadrneovim-ca8699378c765017575c102f3da8347833159a6c.tar.gz
rneovim-ca8699378c765017575c102f3da8347833159a6c.tar.bz2
rneovim-ca8699378c765017575c102f3da8347833159a6c.zip
LSP: implement documentHighlight (#11638)
* implement documentHighlight * fix bug * document highlight groups * use uppercase for help section title * documentation
Diffstat (limited to 'runtime/lua/vim/lsp/buf.lua')
-rw-r--r--runtime/lua/vim/lsp/buf.lua18
1 files changed, 18 insertions, 0 deletions
diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua
index 19deb5df45..52fa2ec93b 100644
--- a/runtime/lua/vim/lsp/buf.lua
+++ b/runtime/lua/vim/lsp/buf.lua
@@ -134,5 +134,23 @@ function M.references(context)
request('textDocument/references', params)
end
+--- Send request to server to resolve document highlights for the
+--- current text document position. This request can be associated
+--- to key mapping or to events such as `CursorHold`, eg:
+---
+--- <pre>
+--- vim.api.nvim_command [[autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()]]
+--- vim.api.nvim_command [[autocmd CursorHoldI <buffer> lua vim.lsp.buf.document_highlight()]]
+--- vim.api.nvim_command [[autocmd CursorMoved <buffer> lua vim.lsp.buf.clear_references()]]
+--- </pre>
+function M.document_highlight()
+ local params = util.make_position_params()
+ request('textDocument/documentHighlight', params)
+end
+
+function M.clear_references()
+ util.buf_clear_references()
+end
+
return M
-- vim:sw=2 ts=2 et