Implement enabled=false configuration

This commit is contained in:
hrsh7th
2021-09-13 00:59:48 +09:00
parent 1cec1ecb31
commit a78894a09a
9 changed files with 69 additions and 48 deletions

View File

@@ -4,7 +4,6 @@ local async = require('cmp.utils.async')
local float = require('cmp.float')
local config = require('cmp.config')
local autocmd = require('cmp.utils.autocmd')
local check = require('cmp.utils.check')
---@class cmp.MenuOption
---@field on_select fun(e: cmp.Entry)
@@ -70,7 +69,7 @@ end
---@param ctx cmp.Context
---@param sources cmp.Source[]
---@return cmp.Menu
menu.update = check.wrap(function(self, ctx, sources)
menu.update = function(self, ctx, sources)
local entries = {}
-- check the source triggered by character
@@ -138,11 +137,11 @@ menu.update = check.wrap(function(self, ctx, sources)
self.preselect = preselect
self.context = ctx
self:show()
end)
end
---Restore previous menu
---@param ctx cmp.Context
menu.restore = check.wrap(function(self, ctx)
menu.restore = function(self, ctx)
if not ctx.pumvisible then
if #self.items > 0 then
if self.offset <= ctx.cursor.col then
@@ -151,7 +150,7 @@ menu.restore = check.wrap(function(self, ctx)
end
end
end
end)
end
---Show completion item
menu.show = function(self)