mirror of
https://github.com/hrsh7th/nvim-cmp
synced 2024-09-16 20:54:03 +02:00
docs: fix invalid WindowConfig schema, should match to the docs (#1779)
Problem: `cmp.WindowConfig` was defined twice. Solution: Introduce `cmp.CompletionWindowOptions` and `cmp.DocumentationWindowOptions`. Make fields of these two class consistent with |cmp-config.window.*|
This commit is contained in:
parent
66f0a031d9
commit
13451e7ee4
2 changed files with 14 additions and 6 deletions
|
@ -107,10 +107,6 @@ cmp.ItemField = {
|
|||
---@field public async_budget integer Maximum time (in ms) an async function is allowed to run during one step of the event loop.
|
||||
---@field public max_view_entries integer
|
||||
|
||||
---@class cmp.WindowConfig
|
||||
---@field completion? cmp.WindowConfig
|
||||
---@field documentation? cmp.WindowConfig|nil
|
||||
|
||||
---@class cmp.CompletionConfig
|
||||
---@field public autocomplete? cmp.TriggerEvent[]|false
|
||||
---@field public completeopt? string
|
||||
|
@ -119,14 +115,24 @@ cmp.ItemField = {
|
|||
---@field public keyword_pattern? string
|
||||
|
||||
---@class cmp.WindowConfig
|
||||
---@field public completion? cmp.CompletionWindowOptions
|
||||
---@field public documentation? cmp.DocumentationWindowOptions|nil
|
||||
|
||||
---@class cmp.WindowOptions
|
||||
---@field public border? string|string[]
|
||||
---@field public winhighlight? string
|
||||
---@field public zindex? integer|nil
|
||||
---@field public max_width? integer|nil
|
||||
---@field public max_height? integer|nil
|
||||
|
||||
---@class cmp.CompletionWindowOptions: cmp.WindowOptions
|
||||
---@field public scrolloff? integer|nil
|
||||
---@field public col_offset? integer|nil
|
||||
---@field public side_padding? integer|nil
|
||||
---@field public scrollbar? boolean|true
|
||||
|
||||
---@class cmp.DocumentationWindowOptions: cmp.WindowOptions
|
||||
---@field public max_height? integer|nil
|
||||
---@field public max_width? integer|nil
|
||||
|
||||
---@class cmp.ConfirmationConfig
|
||||
---@field public default_behavior cmp.ConfirmBehavior
|
||||
---@field public get_commit_characters fun(commit_characters: string[]): string[]
|
||||
|
|
|
@ -118,6 +118,8 @@ end
|
|||
|
||||
custom_entries_view.open = function(self, offset, entries)
|
||||
local completion = config.get().window.completion
|
||||
assert(completion, 'config.get() must resolve window.completion with defaults')
|
||||
|
||||
self.offset = offset
|
||||
self.entries = {}
|
||||
self.column_width = { abbr = 0, kind = 0, menu = 0 }
|
||||
|
|
Loading…
Reference in a new issue