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:
Jongwook Choi 2024-03-21 14:05:55 -04:00 committed by GitHub
parent 66f0a031d9
commit 13451e7ee4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 6 deletions

View file

@ -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[]

View file

@ -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 }