Improve typings

This commit is contained in:
hrsh7th
2022-07-24 12:44:53 +09:00
parent 89df2cb223
commit bf5593df8e
24 changed files with 154 additions and 130 deletions

View File

@@ -14,7 +14,7 @@ config.cache = cache.new()
---@type cmp.ConfigSchema
config.global = require('cmp.config.default')()
---@type table<number, cmp.ConfigSchema>
---@type table<integer, cmp.ConfigSchema>
config.buffers = {}
---@type table<string, cmp.ConfigSchema>
@@ -36,7 +36,7 @@ end
---Set configuration for buffer
---@param c cmp.ConfigSchema
---@param bufnr number|nil
---@param bufnr integer
config.set_buffer = function(c, bufnr)
local revision = (config.buffers[bufnr] or {}).revision or 1
config.buffers[bufnr] = c or {}
@@ -150,9 +150,6 @@ end
---Return the current menu is native or not.
config.is_native_menu = function()
local c = config.get()
if c.experimental and c.experimental.native_menu then
return true
end
if c.view and c.view.entries then
return c.view.entries == 'native' or c.view.entries.name == 'native'
end
@@ -164,6 +161,7 @@ end
---@return cmp.ConfigSchema
config.normalize = function(c)
-- make sure c is not 'nil'
---@type any
c = c == nil and {} or c
-- Normalize mapping.