refactor(cmp): Extract get_chat_mentions for third-party cmp source usage (#2027)

This commit is contained in:
aniaan
2025-05-12 20:19:42 +08:00
committed by GitHub
parent 786d95464c
commit aae4cc4014
4 changed files with 35 additions and 34 deletions

View File

@@ -1,11 +1,11 @@
local api = vim.api
---@class mentions_source : cmp.Source
---@field get_mentions fun(): {description: string, command: AvanteMentions, details: string, shorthelp?: string, callback?: AvanteMentionCallback}[]
---@field get_mentions fun(): AvanteMention[]
local MentionsSource = {}
MentionsSource.__index = MentionsSource
---@param get_mentions fun(): {description: string, command: AvanteMentions, details: string, shorthelp?: string, callback?: AvanteMentionCallback}[]
---@param get_mentions fun(): AvanteMention[]
function MentionsSource:new(get_mentions)
local instance = setmetatable({}, MentionsSource)