mirror of
https://github.com/neovim/neovim.git
synced 2025-09-05 19:08:15 +00:00
fix(lsp): don't create an 'LspAttach'
document_color
autocommand
This commit is contained in:

committed by
Christian Clason

parent
8495d96238
commit
18e8839c80
@@ -175,6 +175,18 @@ end
|
|||||||
local function buf_enable(bufnr)
|
local function buf_enable(bufnr)
|
||||||
reset_bufstate(bufnr, true)
|
reset_bufstate(bufnr, true)
|
||||||
|
|
||||||
|
api.nvim_buf_attach(bufnr, false, {
|
||||||
|
on_reload = function(_, buf)
|
||||||
|
buf_clear(buf)
|
||||||
|
if bufstates[buf].enabled then
|
||||||
|
buf_refresh(buf)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
on_detach = function(_, buf)
|
||||||
|
buf_disable(buf)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
api.nvim_create_autocmd('LspNotify', {
|
api.nvim_create_autocmd('LspNotify', {
|
||||||
buffer = bufnr,
|
buffer = bufnr,
|
||||||
group = document_color_augroup,
|
group = document_color_augroup,
|
||||||
@@ -191,25 +203,6 @@ local function buf_enable(bufnr)
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
api.nvim_create_autocmd('LspAttach', {
|
|
||||||
buffer = bufnr,
|
|
||||||
group = document_color_augroup,
|
|
||||||
desc = 'Enable document_color when LSP client attaches',
|
|
||||||
callback = function(args)
|
|
||||||
api.nvim_buf_attach(args.buf, false, {
|
|
||||||
on_reload = function(_, buf)
|
|
||||||
buf_clear(buf)
|
|
||||||
if bufstates[buf].enabled then
|
|
||||||
buf_refresh(buf)
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
on_detach = function(_, buf)
|
|
||||||
buf_disable(buf)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
api.nvim_create_autocmd('LspDetach', {
|
api.nvim_create_autocmd('LspDetach', {
|
||||||
buffer = bufnr,
|
buffer = bufnr,
|
||||||
group = document_color_augroup,
|
group = document_color_augroup,
|
||||||
|
Reference in New Issue
Block a user