mirror of
https://github.com/jdhao/nvim-config.git
synced 2025-06-08 14:14:33 +02:00
lsp: only show diagnostic once for each line if cursor is not moved
This will help use to check signature help without it being overwritten by diagnostic popups.
This commit is contained in:
parent
4899a82b35
commit
95b7ee5bc8
@ -31,8 +31,20 @@ local custom_attach = function(client, bufnr)
|
|||||||
source = 'always', -- show source in diagnostic popup window
|
source = 'always', -- show source in diagnostic popup window
|
||||||
prefix = ' '
|
prefix = ' '
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if not vim.b.diagnostics_pos then
|
||||||
|
vim.b.diagnostics_pos = { nil, nil }
|
||||||
|
end
|
||||||
|
|
||||||
|
local cursor_pos = vim.api.nvim_win_get_cursor(0)
|
||||||
|
if (cursor_pos[1] ~= vim.b.diagnostics_pos[1] or cursor_pos[2] ~= vim.b.diagnostics_pos[2]) and
|
||||||
|
#vim.diagnostic.get() > 0
|
||||||
|
then
|
||||||
vim.diagnostic.open_float(nil, opts)
|
vim.diagnostic.open_float(nil, opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
vim.b.diagnostics_pos = cursor_pos
|
||||||
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
-- Set some key bindings conditional on server capabilities
|
-- Set some key bindings conditional on server capabilities
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user