chore: fix types (#173)
This commit is contained in:
parent
7d4be712f0
commit
25f8175662
@ -1165,6 +1165,10 @@ Available commands:
|
|||||||
start_line = tonumber(start_line)
|
start_line = tonumber(start_line)
|
||||||
---@cast end_line integer
|
---@cast end_line integer
|
||||||
end_line = tonumber(end_line)
|
end_line = tonumber(end_line)
|
||||||
|
if end_line == nil then
|
||||||
|
Utils.error("Invalid end line number", { once = true, title = "Avante" })
|
||||||
|
return
|
||||||
|
end
|
||||||
selected_code_content_with_line_numbers = prepend_line_number(
|
selected_code_content_with_line_numbers = prepend_line_number(
|
||||||
table.concat(api.nvim_buf_get_lines(self.code.bufnr, start_line - 1, end_line, false), "\n"),
|
table.concat(api.nvim_buf_get_lines(self.code.bufnr, start_line - 1, end_line, false), "\n"),
|
||||||
start_line
|
start_line
|
||||||
|
@ -80,7 +80,11 @@ function M.get_visual_selection_and_range()
|
|||||||
-- Extract partial content of the last line
|
-- Extract partial content of the last line
|
||||||
-- lines[#lines] = string.sub(lines[#lines], 1, end_col)
|
-- lines[#lines] = string.sub(lines[#lines], 1, end_col)
|
||||||
-- Concatenate all lines in the selection into a string
|
-- Concatenate all lines in the selection into a string
|
||||||
content = table.concat(lines, "\n")
|
if type(lines) == "table" then
|
||||||
|
content = table.concat(lines, "\n")
|
||||||
|
else
|
||||||
|
content = lines
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if not content then
|
if not content then
|
||||||
return nil
|
return nil
|
||||||
@ -143,10 +147,13 @@ function M.notify(msg, opts)
|
|||||||
"\n"
|
"\n"
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
---@diagnostic disable-next-line: undefined-field
|
||||||
if opts.stacktrace then
|
if opts.stacktrace then
|
||||||
|
---@diagnostic disable-next-line: undefined-field
|
||||||
msg = msg .. M.pretty_trace({ level = opts.stacklevel or 2 })
|
msg = msg .. M.pretty_trace({ level = opts.stacklevel or 2 })
|
||||||
end
|
end
|
||||||
local lang = opts.lang or "markdown"
|
local lang = opts.lang or "markdown"
|
||||||
|
---@diagnostic disable-next-line: undefined-field
|
||||||
local n = opts.once and vim.notify_once or vim.notify
|
local n = opts.once and vim.notify_once or vim.notify
|
||||||
n(msg, opts.level or vim.log.levels.INFO, {
|
n(msg, opts.level or vim.log.levels.INFO, {
|
||||||
on_open = function(win)
|
on_open = function(win)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user