From 7d82aaa6f5a6403f3c4e330dcaba9bb36ecbef28 Mon Sep 17 00:00:00 2001 From: Chris Kipp Date: Wed, 24 Feb 2021 17:23:47 +0100 Subject: [LSP] Add in more docs for highlight groups with document_highlight() (#13614) Currently it's not 100% clear that without setting these, using the autocomds to utilize the `textDocument/documentHighlight` functionality, nothing will actually be visible since the highlight groups don't have any details. This just adds in a couple simple extra notes to make sure that's done --- runtime/lua/vim/lsp/buf.lua | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'runtime/lua') diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua index 00219b6d98..31116985e2 100644 --- a/runtime/lua/vim/lsp/buf.lua +++ b/runtime/lua/vim/lsp/buf.lua @@ -310,15 +310,21 @@ function M.workspace_symbol(query) request('workspace/symbol', 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: +--- Send request to the server to resolve document highlights for the current +--- text document position. This request can be triggered by a key mapping or +--- by events such as `CursorHold`, eg: --- ---
 --- vim.api.nvim_command [[autocmd CursorHold   lua vim.lsp.buf.document_highlight()]]
 --- vim.api.nvim_command [[autocmd CursorHoldI  lua vim.lsp.buf.document_highlight()]]
 --- vim.api.nvim_command [[autocmd CursorMoved  lua vim.lsp.buf.clear_references()]]
 --- 
+--- +--- Note: Usage of |vim.lsp.buf.document_highlight()| requires the following highlight groups +--- to be defined or you won't be able to see the actual highlights. +--- |LspReferenceText| +--- |LspReferenceRead| +--- |LspReferenceWrite| function M.document_highlight() local params = util.make_position_params() request('textDocument/documentHighlight', params) -- cgit