Fix multiple setup.buffer
This commit is contained in:
@@ -26,9 +26,9 @@ end
|
||||
---@param c cmp.ConfigSchema
|
||||
---@param bufnr number|nil
|
||||
config.set_buffer = function(c, bufnr)
|
||||
local revision = (config.buffers[bufnr] or {}).revision or 1
|
||||
config.buffers[bufnr] = c
|
||||
config.buffers[bufnr].revision = config.buffers[bufnr].revision or 1
|
||||
config.buffers[bufnr].revision = config.buffers[bufnr].revision + 1
|
||||
config.buffers[bufnr].revision = revision + 1
|
||||
end
|
||||
|
||||
---@return cmp.ConfigSchema
|
||||
|
||||
@@ -48,10 +48,17 @@ end
|
||||
core.get_context = function(option)
|
||||
local prev = core.context:clone()
|
||||
prev.prev_context = nil
|
||||
core.context = context.new(prev, option)
|
||||
local ctx = context.new(prev, option)
|
||||
core.set_context(ctx)
|
||||
return core.context
|
||||
end
|
||||
|
||||
---Set new context
|
||||
---@param ctx cmp.Context
|
||||
core.set_context = function(ctx)
|
||||
core.context = ctx
|
||||
end
|
||||
|
||||
---Get sources that sorted by priority
|
||||
---@param statuses cmp.SourceStatus[]
|
||||
---@return cmp.Source[]
|
||||
@@ -149,6 +156,8 @@ end
|
||||
---Invoke completion
|
||||
---@param ctx cmp.Context
|
||||
core.complete = function(ctx)
|
||||
core.set_context(ctx)
|
||||
|
||||
local callback = function()
|
||||
local new = context.new(ctx)
|
||||
if new:changed(new.prev_context) then
|
||||
|
||||
Reference in New Issue
Block a user