Add Vim script API docs

This commit is contained in:
hrsh7th
2021-09-14 01:28:33 +09:00
parent 03f121fa23
commit 44ffee0e0c
3 changed files with 37 additions and 6 deletions

View File

@@ -307,7 +307,6 @@ core.confirm = function(e, option, callback)
table.insert(restore, keymap.t(string.rep('<C-g>U<Left><Del>', vim.fn.strchars(e:get_word()))))
table.insert(restore, string.sub(e.context.cursor_before_line, e:get_offset()))
keymap.feedkeys(table.concat(restore, ''), 'n', function()
--@see https://github.com/microsoft/vscode/blob/main/src/vs/editor/contrib/suggest/suggestController.ts#L334
if #(misc.safe(e:get_completion_item().additionalTextEdits) or {}) == 0 then
local pre = context.new()

View File

@@ -11,7 +11,7 @@ end
---@param callback function
---@return number
vim_source.to_callback = setmetatable({
callbacks = {}
callbacks = {},
}, {
__call = function(self, callback)
local id = misc.id('cmp.vim_source.to_callback')
@@ -20,7 +20,7 @@ vim_source.to_callback = setmetatable({
self.callbacks[id] = nil
end
return id
end
end,
})
---Convert to serializable args.
@@ -36,7 +36,7 @@ end
---@param id number
---@param methods string[]
vim_source.new = function (bridge_id, methods)
vim_source.new = function(bridge_id, methods)
local self = {}
for _, method in ipairs(methods) do
self[method] = (function(m)
@@ -49,4 +49,3 @@ vim_source.new = function (bridge_id, methods)
end
return vim_source