add capabilities check
This commit is contained in:
parent
51842d8064
commit
1e3ba58a40
11
init.lua
11
init.lua
@ -395,9 +395,7 @@ require('lazy').setup({
|
||||
|
||||
-- Shortcut for searching your neovim configuration files
|
||||
vim.keymap.set('n', '<leader>sn', function()
|
||||
builtin.find_files {
|
||||
cwd = vim.fn.stdpath 'config',
|
||||
}
|
||||
builtin.find_files { cwd = vim.fn.stdpath 'config' }
|
||||
end, { desc = '[S]earch [N]eovim files' })
|
||||
end,
|
||||
},
|
||||
@ -488,9 +486,7 @@ require('lazy').setup({
|
||||
|
||||
-- Execute a code action, usually your cursor needs to be on top of an error
|
||||
-- or a suggestion from your LSP for this to activate.
|
||||
map('<leader>ca', function()
|
||||
vim.lsp.buf.code_action { context = { only = { 'quickfix', 'refactor', 'source' } } }
|
||||
end, '[C]ode [A]ction')
|
||||
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
|
||||
|
||||
-- Opens a popup that displays documentation about the word under your cursor
|
||||
-- See `:help K` for why this keymap
|
||||
@ -508,6 +504,8 @@ require('lazy').setup({
|
||||
-- See `:help CursorHold` for information about when this is executed
|
||||
--
|
||||
-- When you move your cursor, the highlights will be cleared (the second autocommand).
|
||||
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
||||
if client and client.server_capabilities.documentHighlightProvider then
|
||||
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
|
||||
buffer = event.buf,
|
||||
callback = vim.lsp.buf.document_highlight,
|
||||
@ -517,6 +515,7 @@ require('lazy').setup({
|
||||
buffer = event.buf,
|
||||
callback = vim.lsp.buf.clear_references,
|
||||
})
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user