diff --git a/doc/completion-nvim.txt b/doc/completion-nvim.txt index 8945e54..79fd524 100644 --- a/doc/completion-nvim.txt +++ b/doc/completion-nvim.txt @@ -123,6 +123,17 @@ g:completion_enable_auto_signature *g:completion_enable_auto_signature* default value: 1 +g:completion_popup_border *g:completion_popup_border* + + This variable sets border for auto hover popup and signature help popup. + The variable is not created by default so that there is no border by + default. You can set it as per neovim's popup/preview + window sepcifications. + + available options: 'single', 'double', 'rounded', 'solid' and 'shadow' + + default value: variable not declared + g:completion_enable_auto_paren *g:completion_enable_auto_paren* Enable the auto insert parenthesis feature. completion-nvim will diff --git a/lua/completion/hover.lua b/lua/completion/hover.lua index 293afaf..52bc439 100644 --- a/lua/completion/hover.lua +++ b/lua/completion/hover.lua @@ -73,6 +73,17 @@ local make_floating_popup_options = function(width, height, opts) col = opts.col - width - 1 end + local default_border = { + {"", "NormalFloat"}, + {"", "NormalFloat"}, + {"", "NormalFloat"}, + {" ", "NormalFloat"}, + {"", "NormalFloat"}, + {"", "NormalFloat"}, + {"", "NormalFloat"}, + {" ", "NormalFloat"}, + } + return { col = col, height = height, @@ -81,6 +92,7 @@ local make_floating_popup_options = function(width, height, opts) focusable = false, style = 'minimal', width = width, + border = vim.g.completion_popup_border or default_border } end diff --git a/lua/completion/signature_help.lua b/lua/completion/signature_help.lua index 2570636..061fecb 100644 --- a/lua/completion/signature_help.lua +++ b/lua/completion/signature_help.lua @@ -46,11 +46,15 @@ M.autoOpenSignatureHelp = function() -- if `lines` can be trimmed, it is modified in place local trimmed_lines_filetype = vim.lsp.util.try_trim_markdown_code_blocks(lines) + local opts = {} + if vim.g.completion_popup_border then + opts.border = vim.g.completion_popup_border + end local bufnr, _ = vim.lsp.util.open_floating_preview( -- TODO show popup when signatures is empty? vim.lsp.util.trim_empty_lines(lines), trimmed_lines_filetype, - {} + opts ) -- setup a variable for floating window, fix #223 vim.api.nvim_buf_set_var(bufnr, "lsp_floating", true)