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