How to highlight a symbol under the cursor and its references? #428
Answered
by
antosha417
arbitrary-dev
asked this question in
Q&A
-
In
|
Beta Was this translation helpful? Give feedback.
Answered by
antosha417
Jul 12, 2022
Replies: 1 comment 5 replies
-
In order to do it I have this in metals_config.on_attach = function(client, bufnr)
if client.server_capabilities.documentHighlightProvider then
vim.api.nvim_create_augroup("lsp_document_highlight", { clear = true })
vim.api.nvim_create_autocmd('CursorHold', {
buffer = bufnr,
group = 'lsp_document_highlight',
callback = vim.lsp.buf.document_highlight
})
vim.api.nvim_create_autocmd('CursorMoved', {
buffer = bufnr,
group = 'lsp_document_highlight',
callback = vim.lsp.buf.clear_references
})
end
end |
Beta Was this translation helpful? Give feedback.
5 replies
Answer selected by
arbitrary-dev
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In order to do it I have this in
on_attach
function