Add SourceBaseApiParams
This commit is contained in:
@@ -340,8 +340,9 @@ end
|
||||
--- 1. Trigger keyword completion
|
||||
--- 2. Detect menu start offset
|
||||
--- 3. Reset completion state
|
||||
---@param params cmp.SourceBaseApiParams
|
||||
---@return string
|
||||
function source:get_keyword_pattern()
|
||||
function source:get_keyword_pattern(params)
|
||||
return '???'
|
||||
end
|
||||
|
||||
@@ -353,9 +354,9 @@ end
|
||||
|
||||
---Invoke completion (required).
|
||||
--- If you want to abort completion, just call the callback without arguments.
|
||||
---@param request cmp.CompletionRequest
|
||||
---@param params cmp.SourceCompletionApiParams
|
||||
---@param callback fun(response: lsp.CompletionResponse|nil)
|
||||
function source:complete(request, callback)
|
||||
function source:complete(params, callback)
|
||||
callback({
|
||||
{ label = 'January' },
|
||||
{ label = 'February' },
|
||||
|
||||
@@ -186,7 +186,9 @@ end
|
||||
---@return string
|
||||
source.get_keyword_pattern = function(self)
|
||||
if self.source.get_keyword_pattern then
|
||||
return self.source:get_keyword_pattern()
|
||||
return self.source:get_keyword_pattern({
|
||||
option = self:get_option(),
|
||||
})
|
||||
end
|
||||
return config.get().completion.keyword_pattern
|
||||
end
|
||||
|
||||
@@ -37,9 +37,11 @@ cmp.ScrollDirection.Down = 'down'
|
||||
---@field public buffer fun(c: cmp.ConfigSchema)
|
||||
---@field public global fun(c: cmp.ConfigSchema)
|
||||
|
||||
---@class cmp.CompletionRequest
|
||||
---@field public context cmp.Context
|
||||
---@class cmp.SourceBaseApiParams
|
||||
---@field public option table
|
||||
|
||||
---@class cmp.SourceCompletionApiParams : cmp.SourceBaseApiParams
|
||||
---@field public context cmp.Context
|
||||
---@field public offset number
|
||||
---@field public completion_context lsp.CompletionContext
|
||||
|
||||
|
||||
Reference in New Issue
Block a user