Fix #217
This commit is contained in:
@@ -65,6 +65,12 @@ context.new = function(prev_context, option)
|
|||||||
return self
|
return self
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---Return the context is invalid or not.
|
||||||
|
---@return boolean
|
||||||
|
context.invalid = function(self)
|
||||||
|
return string.sub(self.mode, 1, 1) ~= 'i'
|
||||||
|
end
|
||||||
|
|
||||||
---Return context creation reason.
|
---Return context creation reason.
|
||||||
---@return cmp.ContextReason
|
---@return cmp.ContextReason
|
||||||
context.get_reason = function(self)
|
context.get_reason = function(self)
|
||||||
|
|||||||
@@ -243,6 +243,10 @@ end
|
|||||||
---Invoke completion
|
---Invoke completion
|
||||||
---@param ctx cmp.Context
|
---@param ctx cmp.Context
|
||||||
core.complete = function(ctx)
|
core.complete = function(ctx)
|
||||||
|
if ctx:invalid() then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
core.set_context(ctx)
|
core.set_context(ctx)
|
||||||
|
|
||||||
local callback = function()
|
local callback = function()
|
||||||
@@ -265,6 +269,9 @@ end
|
|||||||
---Update completion menu
|
---Update completion menu
|
||||||
core.filter = async.throttle(function()
|
core.filter = async.throttle(function()
|
||||||
local ctx = core.get_context()
|
local ctx = core.get_context()
|
||||||
|
if ctx:invalid() then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
-- To wait for processing source for that's timeout.
|
-- To wait for processing source for that's timeout.
|
||||||
local sources = {}
|
local sources = {}
|
||||||
|
|||||||
Reference in New Issue
Block a user