fix: align lua oop (#889)
This commit is contained in:
@@ -1,18 +1,20 @@
|
||||
local api = vim.api
|
||||
|
||||
---@class mentions_source
|
||||
---@class mentions_source : cmp.Source
|
||||
---@field mentions {description: string, command: AvanteMentions, details: string, shorthelp?: string, callback?: AvanteMentionCallback}[]
|
||||
---@field bufnr integer
|
||||
local mentions_source = {}
|
||||
mentions_source.__index = mentions_source
|
||||
|
||||
---@param mentions {description: string, command: AvanteMentions, details: string, shorthelp?: string, callback?: AvanteMentionCallback}[]
|
||||
---@param bufnr integer
|
||||
function mentions_source.new(mentions, bufnr)
|
||||
---@type cmp.Source
|
||||
return setmetatable({
|
||||
mentions = mentions,
|
||||
bufnr = bufnr,
|
||||
}, { __index = mentions_source })
|
||||
function mentions_source:new(mentions, bufnr)
|
||||
local instance = setmetatable({}, mentions_source)
|
||||
|
||||
instance.mentions = mentions
|
||||
instance.bufnr = bufnr
|
||||
|
||||
return instance
|
||||
end
|
||||
|
||||
function mentions_source:is_available() return api.nvim_get_current_buf() == self.bufnr end
|
||||
|
||||
Reference in New Issue
Block a user