Closed kristijanhusak closed 9 months ago
focusable
is just an option for the window, and has nothing to do with the feature that pressing twice focuses the window
How can I pass that option to the window that noice uses?
I came upon this issue since I wanted to toggle the Noice hovers instead of letting them auto open. Noice already has a feature to let you scroll through the hovers without focusing so I wanted a double tap of the hover key to close the hover. Some google searching led me to https://vi.stackexchange.com/questions/37225/how-do-i-close-a-hovered-window-with-lsp-information-escape-does-not-work
So if anyone is interested here is the solution adapted to Noice
vim.keymap.set({ 'n' }, 'K', function()
local base_win_id = vim.api.nvim_get_current_win()
local windows = vim.api.nvim_tabpage_list_wins(0)
for _, win_id in ipairs(windows) do
if win_id ~= base_win_id then
local win_cfg = vim.api.nvim_win_get_config(win_id)
if win_cfg.relative == "win" and win_cfg.win == base_win_id then
require("noice.lsp.docs").hide(require("noice.lsp.docs").get("hover"))
return
end
end
end
require("noice.lsp").hover()
end , { remap = false, silent = true, buffer = event.buf })
You can also apply this to signature help (substitute hover
with signature
in the code) but if you are using nvim-cmp you will need to lower the nvim-cmp window's z-index.
Did you check docs and existing issues?
Neovim version (nvim -v)
v0.10.0-dev-2121+g06aebfa99
Operating system/version
Arch linux
Describe the bug
focusable = false
option for LSP hover is not working (Docs link: https://neovim.io/doc/user/lsp.html#vim.lsp.util.open_floating_preview()) . It keeps focusing the hover when I press the trigger key twice.Steps To Reproduce
nvim -u repro.lua repro.lua
colorscheme
, press<Space>
<space>
again, it focuses the hoverExpected Behavior
Expected to not focus the hover since it's disabled via options. These are the steps to check how it works with built in settings:
28
and49-50
in provided repronvim -u repro.lua repro.lua
colorscheme
, press<Space>
<space>
again, it doesn't focus the hover windowRepro