Don't show diagnostic windows if there is already a floating window
This commit is contained in:
parent
d23279a4a4
commit
204f38c947
@ -18,6 +18,15 @@ capabilities.textDocument.completion.completionItem.resolveSupport = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OpenDiagFloat = function ()
|
||||||
|
for _, winid in pairs(vim.api.nvim_tabpage_list_wins(0)) do
|
||||||
|
if vim.api.nvim_win_get_config(winid).zindex then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
vim.diagnostic.open_float({focusable = false})
|
||||||
|
end
|
||||||
|
|
||||||
local on_attach = function(client, bufnr)
|
local on_attach = function(client, bufnr)
|
||||||
local function buf_set_keymap(...)
|
local function buf_set_keymap(...)
|
||||||
vim.api.nvim_buf_set_keymap(bufnr, ...)
|
vim.api.nvim_buf_set_keymap(bufnr, ...)
|
||||||
@ -51,7 +60,7 @@ local on_attach = function(client, bufnr)
|
|||||||
buf_set_keymap('n', '<space>v', '<cmd>Telescope diagnostics bufnr=0<cr>', opts)
|
buf_set_keymap('n', '<space>v', '<cmd>Telescope diagnostics bufnr=0<cr>', opts)
|
||||||
buf_set_keymap('n', '<A-o>', ':ClangdSwitchSourceHeader<CR>', opts)
|
buf_set_keymap('n', '<A-o>', ':ClangdSwitchSourceHeader<CR>', opts)
|
||||||
|
|
||||||
vim.cmd([[autocmd CursorHold <buffer> lua vim.diagnostic.open_float({focusable = false})]])
|
vim.cmd([[autocmd CursorHold <buffer> lua OpenDiagFloat()]])
|
||||||
|
|
||||||
-- Set some keybinds conditional on server capabilities
|
-- Set some keybinds conditional on server capabilities
|
||||||
if client.resolved_capabilities.document_formatting then
|
if client.resolved_capabilities.document_formatting then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user