Skip to content

Commit

Permalink
feat: add winblend option for windows (#237)
Browse files Browse the repository at this point in the history
* add winblend support

* change fallback value
  • Loading branch information
pynappo authored Nov 2, 2024
1 parent 055b943 commit ca94ee0
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 1 deletion.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ MiniDeps.add({

sources = {
-- list of enabled providers
completion = {
completion = {
enabled_providers = { 'lsp', 'path', 'snippets', 'buffer' },
}

Expand Down Expand Up @@ -390,6 +390,7 @@ MiniDeps.add({
min_width = 15,
max_height = 10,
border = 'none',
winblend = 0,
winhighlight = 'Normal:BlinkCmpMenu,FloatBorder:BlinkCmpMenuBorder,CursorLine:BlinkCmpMenuSelection,Search:None',
-- keep the cursor X lines away from the top/bottom of the window
scrolloff = 2,
Expand Down Expand Up @@ -422,6 +423,7 @@ MiniDeps.add({
max_width = 60,
max_height = 20,
border = 'padded',
winblend = 0,
winhighlight = 'Normal:BlinkCmpDoc,FloatBorder:BlinkCmpDocBorder,CursorLine:BlinkCmpDocCursorLine,Search:None',
-- which directions to show the documentation window,
-- for each of the possible autocomplete window directions,
Expand All @@ -440,6 +442,7 @@ MiniDeps.add({
max_width = 100,
max_height = 10,
border = 'padded',
winblend = 0,
winhighlight = 'Normal:BlinkCmpSignatureHelp,FloatBorder:BlinkCmpSignatureHelpBorder',

-- which directions to show the window,
Expand Down
6 changes: 6 additions & 0 deletions lua/blink/cmp/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
--- @field direction_priority? ("n" | "s")[]
--- @field auto_show? boolean
--- @field selection? "preselect" | "manual" | "auto_insert"
--- @field winblend? number
--- @field winhighlight? string
--- @field scrolloff? number
--- @field draw? 'simple' | 'reversed' | 'minimal' | blink.cmp.CompletionDrawFn
Expand All @@ -141,13 +142,15 @@
--- @field auto_show? boolean
--- @field auto_show_delay_ms? number Delay before showing the documentation window
--- @field update_delay_ms? number Delay before updating the documentation window
--- @field winblend? number
--- @field winhighlight? string

--- @class blink.cmp.SignatureHelpConfig
--- @field min_width? number
--- @field max_width? number
--- @field max_height? number
--- @field border? blink.cmp.WindowBorder
--- @field winblend? number
--- @field winhighlight? string
--- @field direction_priority? ("n" | "s")[]

Expand Down Expand Up @@ -363,6 +366,7 @@ local config = {
min_width = 15,
max_height = 10,
border = 'none',
winblend = 0,
winhighlight = 'Normal:BlinkCmpMenu,FloatBorder:BlinkCmpMenuBorder,CursorLine:BlinkCmpMenuSelection,Search:None',
-- keep the cursor X lines away from the top/bottom of the window
scrolloff = 2,
Expand Down Expand Up @@ -397,6 +401,7 @@ local config = {
max_width = 80,
max_height = 20,
border = 'padded',
winblend = 0,
winhighlight = 'Normal:BlinkCmpDoc,FloatBorder:BlinkCmpDocBorder,CursorLine:BlinkCmpDocCursorLine,Search:None',
-- which directions to show the documentation window,
-- for each of the possible autocomplete window directions,
Expand All @@ -415,6 +420,7 @@ local config = {
max_width = 100,
max_height = 10,
border = 'padded',
winblend = 0,
winhighlight = 'Normal:BlinkCmpSignatureHelp,FloatBorder:BlinkCmpSignatureHelpBorder',

-- which directions to show the window,
Expand Down
1 change: 1 addition & 0 deletions lua/blink/cmp/windows/autocomplete.lua
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ function autocomplete.setup()
min_width = autocmp_config.min_width,
max_height = autocmp_config.max_height,
border = autocmp_config.border,
winblend = autocmp_config.winblend,
winhighlight = autocmp_config.winhighlight,
cursorline = false,
scrolloff = autocmp_config.scrolloff,
Expand Down
1 change: 1 addition & 0 deletions lua/blink/cmp/windows/documentation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ function docs.setup()
max_width = config.max_width,
max_height = config.max_height,
border = config.border,
winblend = config.winblend,
winhighlight = config.winhighlight,
wrap = true,
filetype = 'markdown',
Expand Down
2 changes: 2 additions & 0 deletions lua/blink/cmp/windows/lib/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ function win.new(config)
border = config.border or 'none',
wrap = config.wrap or false,
filetype = config.filetype or 'cmp_menu',
winblend = config.winblend or 0,
winhighlight = config.winhighlight or 'Normal:NormalFloat,FloatBorder:NormalFloat',
scrolloff = config.scrolloff or 0,
}
Expand Down Expand Up @@ -90,6 +91,7 @@ function win:open()
zindex = 1001,
border = self.config.border == 'padded' and { ' ', '', '', ' ', '', '', ' ', ' ' } or self.config.border,
})
vim.api.nvim_set_option_value('winblend', self.config.winblend, { win = self.id })
vim.api.nvim_set_option_value('winhighlight', self.config.winhighlight, { win = self.id })
vim.api.nvim_set_option_value('wrap', self.config.wrap, { win = self.id })
vim.api.nvim_set_option_value('foldenable', false, { win = self.id })
Expand Down
1 change: 1 addition & 0 deletions lua/blink/cmp/windows/signature.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ function signature.setup()
max_width = config.max_width,
max_height = config.max_height,
border = config.border,
winblend = config.winblend,
winhighlight = config.winhighlight,
wrap = true,
filetype = 'markdown',
Expand Down

0 comments on commit ca94ee0

Please sign in to comment.