From 8f2d6f7ce2ed287b9f553f0b2ad41d2c749ba019 Mon Sep 17 00:00:00 2001 From: glepnir Date: Wed, 6 Aug 2025 21:25:55 +0800 Subject: [PATCH] fix(lsp): show title when global winborder is set (#35181) Problem: make_floating_popup_options only shows when opts.border is explicitly set, ignoring global winborder setting Solution: check both opts.border and vim.o.winborder when determining whether to show title (cherry picked from commit 5b1b46ea5a4f5412a59c8295ed5b7f6454d1b532) --- runtime/lua/vim/lsp/util.lua | 2 +- test/functional/plugin/lsp/utils_spec.lua | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua index 9a82b7b2bd..d77b17965a 100644 --- a/runtime/lua/vim/lsp/util.lua +++ b/runtime/lua/vim/lsp/util.lua @@ -861,7 +861,7 @@ 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 = ((opts.border or vim.o.winborder ~= '') and opts.title) and opts.title or nil local title_pos --- @type 'left'|'center'|'right'? if title then diff --git a/test/functional/plugin/lsp/utils_spec.lua b/test/functional/plugin/lsp/utils_spec.lua index fac9a2c69d..f0fa659372 100644 --- a/test/functional/plugin/lsp/utils_spec.lua +++ b/test/functional/plugin/lsp/utils_spec.lua @@ -267,6 +267,14 @@ describe('vim.lsp.util', function() eq(56, opts.height) end) + + it('title with winborder option #35179', function() + local opts = exec_lua(function() + vim.o.winborder = 'single' + return vim.lsp.util.make_floating_popup_options(100, 100, { title = 'Title' }) + end) + eq('Title', opts.title) + end) end) end)