fix: align lua oop (#889)

This commit is contained in:
yetone
2024-11-23 20:23:05 +08:00
committed by GitHub
parent da41105fc8
commit 9d0e1cd4af
8 changed files with 38 additions and 31 deletions

View File

@@ -18,6 +18,7 @@ local Utils = require("avante.utils")
---@field spinner_timer uv_timer_t | nil
---@field spinner_active boolean
local PromptInput = {}
PromptInput.__index = PromptInput
---@class PromptInputOptions
---@field start_insert? boolean
@@ -29,7 +30,7 @@ local PromptInput = {}
---@param opts? PromptInputOptions
function PromptInput:new(opts)
opts = opts or {}
local obj = setmetatable({}, { __index = self })
local obj = setmetatable({}, PromptInput)
obj.bufnr = nil
obj.winid = nil
obj.shortcuts_hints_winid = nil
@@ -235,6 +236,7 @@ function PromptInput:setup_keymaps()
local bufnr = self.bufnr
local function get_input()
if not bufnr or not api.nvim_buf_is_valid(bufnr) then return "" end
local lines = api.nvim_buf_get_lines(bufnr, 0, -1, false)
return lines[1] or ""
end