Skip to content

Commit a35923e

Browse files
committed
fix: add check to only hover if not on split hover
Signed-off-by: Guennadi Maximov C <g.maxc.fox@protonmail.com>
1 parent 5a3619f commit a35923e

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

lua/hoversplit/init.lua

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,18 @@ function M.update_hover_content()
2424
return
2525
end
2626

27-
vim.lsp.buf_request(bufnr, "textDocument/hover", vim.lsp.util.make_position_params(win, "utf-16"), function(err, result)
28-
if err or not (result and result.contents) then
29-
return
30-
end
31-
32-
local lines = vim.lsp.util.convert_input_to_markdown_lines(result.contents)
33-
vim.api.nvim_set_option_value("modifiable", true, { buf = M.hover_bufnr })
34-
vim.api.nvim_buf_set_lines(M.hover_bufnr, 0, -1, false, lines)
35-
vim.api.nvim_set_option_value("modifiable", false, { buf = M.hover_bufnr })
36-
end)
27+
if bufnr ~= M.hover_bufnr then
28+
vim.lsp.buf_request(bufnr, "textDocument/hover", vim.lsp.util.make_position_params(win, "utf-16"), function(err, result)
29+
if err or not (result and result.contents) then
30+
return
31+
end
32+
33+
local lines = vim.lsp.util.convert_input_to_markdown_lines(result.contents)
34+
vim.api.nvim_set_option_value("modifiable", true, { buf = M.hover_bufnr })
35+
vim.api.nvim_buf_set_lines(M.hover_bufnr, 0, -1, false, lines)
36+
vim.api.nvim_set_option_value("modifiable", false, { buf = M.hover_bufnr })
37+
end)
38+
end
3739
end
3840

3941
---@param vertical boolean

0 commit comments

Comments
 (0)