|
|
@ -443,15 +443,26 @@ require('lazy').setup({
|
|
|
|
-- When you move your cursor, the highlights will be cleared (the second autocommand).
|
|
|
|
-- 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)
|
|
|
|
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
|
|
|
if client and client.server_capabilities.documentHighlightProvider then
|
|
|
|
if client and client.server_capabilities.documentHighlightProvider then
|
|
|
|
|
|
|
|
local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false })
|
|
|
|
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
|
|
|
|
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
|
|
|
|
buffer = event.buf,
|
|
|
|
buffer = event.buf,
|
|
|
|
|
|
|
|
group = highlight_augroup,
|
|
|
|
callback = vim.lsp.buf.document_highlight,
|
|
|
|
callback = vim.lsp.buf.document_highlight,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
|
|
|
|
vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
|
|
|
|
buffer = event.buf,
|
|
|
|
buffer = event.buf,
|
|
|
|
|
|
|
|
group = highlight_augroup,
|
|
|
|
callback = vim.lsp.buf.clear_references,
|
|
|
|
callback = vim.lsp.buf.clear_references,
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd('LspDetach', {
|
|
|
|
|
|
|
|
group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }),
|
|
|
|
|
|
|
|
callback = function(event2)
|
|
|
|
|
|
|
|
vim.lsp.buf.clear_references()
|
|
|
|
|
|
|
|
vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf }
|
|
|
|
|
|
|
|
end,
|
|
|
|
|
|
|
|
})
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
-- The following autocommand is used to enable inlay hints in your
|
|
|
|
-- The following autocommand is used to enable inlay hints in your
|
|
|
@ -460,7 +471,7 @@ require('lazy').setup({
|
|
|
|
-- This may be unwanted, since they displace some of your code
|
|
|
|
-- This may be unwanted, since they displace some of your code
|
|
|
|
if client and client.server_capabilities.inlayHintProvider and vim.lsp.inlay_hint then
|
|
|
|
if client and client.server_capabilities.inlayHintProvider and vim.lsp.inlay_hint then
|
|
|
|
map('<leader>th', function()
|
|
|
|
map('<leader>th', function()
|
|
|
|
vim.lsp.inlay_hint.enable(0, not vim.lsp.inlay_hint.is_enabled())
|
|
|
|
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())
|
|
|
|
end, '[T]oggle Inlay [H]ints')
|
|
|
|
end, '[T]oggle Inlay [H]ints')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
end,
|
|
|
@ -754,7 +765,7 @@ require('lazy').setup({
|
|
|
|
'nvim-treesitter/nvim-treesitter',
|
|
|
|
'nvim-treesitter/nvim-treesitter',
|
|
|
|
build = ':TSUpdate',
|
|
|
|
build = ':TSUpdate',
|
|
|
|
opts = {
|
|
|
|
opts = {
|
|
|
|
ensure_installed = { 'bash', 'c', 'html', 'lua', 'luadoc', 'markdown', 'vim', 'vimdoc' },
|
|
|
|
ensure_installed = { 'bash', 'c', 'diff', 'html', 'lua', 'luadoc', 'markdown', 'vim', 'vimdoc' },
|
|
|
|
-- Autoinstall languages that are not installed
|
|
|
|
-- Autoinstall languages that are not installed
|
|
|
|
auto_install = true,
|
|
|
|
auto_install = true,
|
|
|
|
highlight = {
|
|
|
|
highlight = {
|
|
|
|