feat: make winblend configurable (#1861)

This commit is contained in:
Yi Ming 2024-03-24 19:44:34 +08:00 committed by GitHub
parent c34fa793ea
commit 97dc716fc9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 11 additions and 2 deletions

View file

@ -696,6 +696,12 @@ window.{completion,documentation}.border~
window.{completion,documentation}.winhighlight~
`string | cmp.WinhighlightConfig`
Specify the window's winhighlight option.
See |nvim_open_win|.
*cmp-config.window.{completion,documentation}.winblend*
window.{completion,documentation}.winblend~
`string | cmp.WinhighlightConfig`
Specify the window's winblend option.
See |nvim_open_win|.
*cmp-config.window.{completion,documentation}.zindex*

View file

@ -107,6 +107,7 @@ return function()
completion = {
border = { '', '', '', '', '', '', '', '' },
winhighlight = 'Normal:Pmenu,FloatBorder:Pmenu,CursorLine:PmenuSel,Search:None',
winblend = vim.o.pumblend,
scrolloff = 0,
col_offset = 0,
side_padding = 1,
@ -117,6 +118,7 @@ return function()
max_width = math.floor((WIDE_HEIGHT * 2) * (vim.o.columns / (WIDE_HEIGHT * 2 * 16 / 9))),
border = { '', '', '', ' ', '', '', '', ' ' },
winhighlight = 'FloatBorder:NormalFloat',
winblend = vim.o.pumblend,
},
},
}

View file

@ -121,6 +121,7 @@ cmp.ItemField = {
---@class cmp.WindowOptions
---@field public border? string|string[]
---@field public winhighlight? string
---@field public winblend? number
---@field public zindex? integer|nil
---@class cmp.CompletionWindowOptions: cmp.WindowOptions

View file

@ -201,7 +201,7 @@ custom_entries_view.open = function(self, offset, entries)
end
-- Apply window options (that might be changed) on the custom completion menu.
self.entries_win:option('winblend', vim.o.pumblend)
self.entries_win:option('winblend', completion.winblend)
self.entries_win:option('winhighlight', completion.winhighlight)
self.entries_win:option('scrolloff', completion.scrolloff)
self.entries_win:open({

View file

@ -100,7 +100,7 @@ docs_view.open = function(self, e, view)
end
-- Render window.
self.window:option('winblend', vim.o.pumblend)
self.window:option('winblend', documentation.winblend)
self.window:option('winhighlight', documentation.winhighlight)
local style = {
relative = 'editor',