setup.cmdline: support using a table (#1193)

This commit is contained in:
Amar Al-Zubaidi
2022-09-25 22:51:01 -04:00
committed by GitHub
parent 4dd7ab6c26
commit 83c097699d
2 changed files with 12 additions and 12 deletions

View File

@@ -57,10 +57,12 @@ end
---Set configuration for cmdline
---@param c cmp.ConfigSchema
---@param cmdtype string
config.set_cmdline = function(c, cmdtype)
local revision = (config.cmdline[cmdtype] or {}).revision or 1
config.cmdline[cmdtype] = c or {}
config.cmdline[cmdtype].revision = revision + 1
config.set_cmdline = function(c, cmdtypes)
for _, cmdtype in ipairs(type(cmdtypes) == 'table' and cmdtypes or { cmdtypes }) do
local revision = (config.cmdline[cmdtype] or {}).revision or 1
config.cmdline[cmdtype] = c or {}
config.cmdline[cmdtype].revision = revision + 1
end
end
---Set configuration as oneshot completion.