Skip to content

Commit de076dd

Browse files
authored
Move LspDetach handler near kickstart-lsp-highlight group (nvim-lua#900)
Moved to make sure the kickstart-lsp-highlight group exists when the LspDetach handler is invoked. The LspDetach handler is used to clean up any lsp highlights that were enabled by CursorHold if the LSP is stopped or crashed.
1 parent bedff99 commit de076dd

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

init.lua

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,14 @@ require('lazy').setup({
526526
group = highlight_augroup,
527527
callback = vim.lsp.buf.clear_references,
528528
})
529+
530+
vim.api.nvim_create_autocmd('LspDetach', {
531+
group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }),
532+
callback = function(event2)
533+
vim.lsp.buf.clear_references()
534+
vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf }
535+
end,
536+
})
529537
end
530538

531539
-- The following autocommand is used to enable inlay hints in your
@@ -540,14 +548,6 @@ require('lazy').setup({
540548
end,
541549
})
542550

543-
vim.api.nvim_create_autocmd('LspDetach', {
544-
group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }),
545-
callback = function(event)
546-
vim.lsp.buf.clear_references()
547-
vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event.buf }
548-
end,
549-
})
550-
551551
-- LSP servers and clients are able to communicate to each other what features they support.
552552
-- By default, Neovim doesn't support everything that is in the LSP specification.
553553
-- When you add nvim-cmp, luasnip, etc. Neovim now has *more* capabilities.

0 commit comments

Comments
 (0)