fix: suggestion instantiate (#554)
This commit is contained in:
parent
4a3b278a76
commit
7532e590d2
@ -25,24 +25,24 @@ local SUGGESTION_NS = api.nvim_create_namespace("avante_suggestion")
|
|||||||
---@field _timer? table
|
---@field _timer? table
|
||||||
---@field _contexts table
|
---@field _contexts table
|
||||||
local Suggestion = {}
|
local Suggestion = {}
|
||||||
|
Suggestion.__index = Suggestion
|
||||||
|
|
||||||
---@param id number
|
---@param id number
|
||||||
---@return avante.Suggestion
|
---@return avante.Suggestion
|
||||||
function Suggestion:new(id)
|
function Suggestion:new(id)
|
||||||
local o = { id = id, suggestions = {} }
|
local instance = setmetatable({}, self)
|
||||||
setmetatable(o, self)
|
instance.id = id
|
||||||
self.__index = self
|
instance.extmark_id = 1
|
||||||
self.extmark_id = 1
|
instance._timer = nil
|
||||||
self._timer = nil
|
instance._contexts = {}
|
||||||
self._contexts = {}
|
|
||||||
if Config.behaviour.auto_suggestions then
|
if Config.behaviour.auto_suggestions then
|
||||||
if not vim.g.avante_login or vim.g.avante_login == false then
|
if not vim.g.avante_login or vim.g.avante_login == false then
|
||||||
api.nvim_exec_autocmds("User", { pattern = Provider.env.REQUEST_LOGIN_PATTERN })
|
api.nvim_exec_autocmds("User", { pattern = Provider.env.REQUEST_LOGIN_PATTERN })
|
||||||
vim.g.avante_login = true
|
vim.g.avante_login = true
|
||||||
end
|
end
|
||||||
self:setup_autocmds()
|
instance:setup_autocmds()
|
||||||
end
|
end
|
||||||
return o
|
return instance
|
||||||
end
|
end
|
||||||
|
|
||||||
function Suggestion:destroy()
|
function Suggestion:destroy()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user