Skip to content
This repository was archived by the owner on Oct 13, 2021. It is now read-only.

Commit 139fb6c

Browse files
authored
Merge pull request #386 from ranjithshegde/floating_opts
Add border to floating windows
2 parents 22624f0 + 713f3fc commit 139fb6c

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

doc/completion-nvim.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,17 @@ g:completion_enable_auto_signature *g:completion_enable_auto_signature*
123123

124124
default value: 1
125125

126+
g:completion_popup_border *g:completion_popup_border*
127+
128+
This variable sets border for auto hover popup and signature help popup.
129+
The variable is not created by default so that there is no border by
130+
default. You can set it as per neovim's popup/preview
131+
window sepcifications.
132+
133+
available options: 'single', 'double', 'rounded', 'solid' and 'shadow'
134+
135+
default value: variable not declared
136+
126137
g:completion_enable_auto_paren *g:completion_enable_auto_paren*
127138

128139
Enable the auto insert parenthesis feature. completion-nvim will

lua/completion/hover.lua

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,17 @@ local make_floating_popup_options = function(width, height, opts)
7373
col = opts.col - width - 1
7474
end
7575

76+
local default_border = {
77+
{"", "NormalFloat"},
78+
{"", "NormalFloat"},
79+
{"", "NormalFloat"},
80+
{" ", "NormalFloat"},
81+
{"", "NormalFloat"},
82+
{"", "NormalFloat"},
83+
{"", "NormalFloat"},
84+
{" ", "NormalFloat"},
85+
}
86+
7687
return {
7788
col = col,
7889
height = height,
@@ -81,6 +92,7 @@ local make_floating_popup_options = function(width, height, opts)
8192
focusable = false,
8293
style = 'minimal',
8394
width = width,
95+
border = vim.g.completion_popup_border or default_border
8496
}
8597
end
8698

lua/completion/signature_help.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,15 @@ M.autoOpenSignatureHelp = function()
4646

4747
-- if `lines` can be trimmed, it is modified in place
4848
local trimmed_lines_filetype = vim.lsp.util.try_trim_markdown_code_blocks(lines)
49+
local opts = {}
50+
if vim.g.completion_popup_border then
51+
opts.border = vim.g.completion_popup_border
52+
end
4953
local bufnr, _ = vim.lsp.util.open_floating_preview(
5054
-- TODO show popup when signatures is empty?
5155
vim.lsp.util.trim_empty_lines(lines),
5256
trimmed_lines_filetype,
53-
{}
57+
opts
5458
)
5559
-- setup a variable for floating window, fix #223
5660
vim.api.nvim_buf_set_var(bufnr, "lsp_floating", true)

0 commit comments

Comments
 (0)