mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
feat(lsp): support set title in lsp relate floatwindow (#21110)
This commit is contained in:
parent
126ef65e5b
commit
2bb244af31
@ -1330,7 +1330,9 @@ hover({_}, {result}, {ctx}, {config}) *vim.lsp.handlers.hover()*
|
|||||||
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(
|
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(
|
||||||
vim.lsp.handlers.hover, {
|
vim.lsp.handlers.hover, {
|
||||||
-- Use a sharp border with `FloatBorder` highlights
|
-- Use a sharp border with `FloatBorder` highlights
|
||||||
border = "single"
|
border = "single",
|
||||||
|
-- add the title in hover float window
|
||||||
|
title = "hover"
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
<
|
<
|
||||||
|
@ -317,7 +317,9 @@ end
|
|||||||
--- vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(
|
--- vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(
|
||||||
--- vim.lsp.handlers.hover, {
|
--- vim.lsp.handlers.hover, {
|
||||||
--- -- Use a sharp border with `FloatBorder` highlights
|
--- -- Use a sharp border with `FloatBorder` highlights
|
||||||
--- border = "single"
|
--- border = "single",
|
||||||
|
--- -- add the title in hover float window
|
||||||
|
--- title = "hover"
|
||||||
--- }
|
--- }
|
||||||
--- )
|
--- )
|
||||||
--- </pre>
|
--- </pre>
|
||||||
|
@ -1050,6 +1050,13 @@ function M.make_floating_popup_options(width, height, opts)
|
|||||||
col = 1
|
col = 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local title = (opts.border and opts.title) and opts.title or nil
|
||||||
|
local title_pos
|
||||||
|
|
||||||
|
if title then
|
||||||
|
title_pos = opts.title_pos or 'center'
|
||||||
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
anchor = anchor,
|
anchor = anchor,
|
||||||
col = col + (opts.offset_x or 0),
|
col = col + (opts.offset_x or 0),
|
||||||
@ -1061,6 +1068,8 @@ function M.make_floating_popup_options(width, height, opts)
|
|||||||
width = width,
|
width = width,
|
||||||
border = opts.border or default_border,
|
border = opts.border or default_border,
|
||||||
zindex = opts.zindex or 50,
|
zindex = opts.zindex or 50,
|
||||||
|
title = title,
|
||||||
|
title_pos = title_pos,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user