diff options
-rw-r--r-- | runtime/doc/lsp.txt | 4 | ||||
-rw-r--r-- | runtime/lua/vim/lsp/handlers.lua | 4 | ||||
-rw-r--r-- | runtime/lua/vim/lsp/util.lua | 9 |
3 files changed, 15 insertions, 2 deletions
diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index 036b0bbc6f..0255d78c4c 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -1330,7 +1330,9 @@ hover({_}, {result}, {ctx}, {config}) *vim.lsp.handlers.hover()* vim.lsp.handlers["textDocument/hover"] = vim.lsp.with( vim.lsp.handlers.hover, { -- Use a sharp border with `FloatBorder` highlights - border = "single" + border = "single", + -- add the title in hover float window + title = "hover" } ) < diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua index 8e5e75232f..39e2577294 100644 --- a/runtime/lua/vim/lsp/handlers.lua +++ b/runtime/lua/vim/lsp/handlers.lua @@ -317,7 +317,9 @@ end --- vim.lsp.handlers["textDocument/hover"] = vim.lsp.with( --- vim.lsp.handlers.hover, { --- -- Use a sharp border with `FloatBorder` highlights ---- border = "single" +--- border = "single", +--- -- add the title in hover float window +--- title = "hover" --- } --- ) --- </pre> diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua index b0f9c1660e..d89757ef0c 100644 --- a/runtime/lua/vim/lsp/util.lua +++ b/runtime/lua/vim/lsp/util.lua @@ -1050,6 +1050,13 @@ function M.make_floating_popup_options(width, height, opts) col = 1 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 { anchor = anchor, col = col + (opts.offset_x or 0), @@ -1061,6 +1068,8 @@ function M.make_floating_popup_options(width, height, opts) width = width, border = opts.border or default_border, zindex = opts.zindex or 50, + title = title, + title_pos = title_pos, } end |