feat: adding lua linter

This commit is contained in:
2026-03-18 23:29:02 -04:00
parent fe118e0885
commit 3a1472670b
85 changed files with 12927 additions and 12750 deletions

View File

@@ -53,10 +53,10 @@ function M.inject_code(target_path, code, prompt_type)
-- For generic, auto-add instead of prompting
M.inject_add(target_buf, code)
end
-- Mark buffer as modified and save
vim.bo[target_buf].modified = true
-- Auto-save the target file
vim.schedule(function()
if vim.api.nvim_buf_is_valid(target_buf) then
@@ -76,34 +76,34 @@ end
---@param opts table|nil { strategy = "replace"|"insert"|"append", range = { start_line, end_line } (1-based) }
---@return table { imports_added: number, body_lines: number, imports_merged: boolean }
function M.inject(bufnr, code, opts)
opts = opts or {}
local strategy = opts.strategy or "replace"
local range = opts.range
local lines = vim.split(code, "\n", { plain = true })
local body_lines = #lines
opts = opts or {}
local strategy = opts.strategy or "replace"
local range = opts.range
local lines = vim.split(code, "\n", { plain = true })
local body_lines = #lines
if not vim.api.nvim_buf_is_valid(bufnr) then
return { imports_added = 0, body_lines = 0, imports_merged = false }
end
if not vim.api.nvim_buf_is_valid(bufnr) then
return { imports_added = 0, body_lines = 0, imports_merged = false }
end
local line_count = vim.api.nvim_buf_line_count(bufnr)
local line_count = vim.api.nvim_buf_line_count(bufnr)
if strategy == "replace" and range and range.start_line and range.end_line then
local start_0 = math.max(0, range.start_line - 1)
local end_0 = math.min(line_count, range.end_line)
if end_0 < start_0 then
end_0 = start_0
end
vim.api.nvim_buf_set_lines(bufnr, start_0, end_0, false, lines)
elseif strategy == "insert" and range and range.start_line then
local at_0 = math.max(0, math.min(range.start_line - 1, line_count))
vim.api.nvim_buf_set_lines(bufnr, at_0, at_0, false, lines)
else
-- append
vim.api.nvim_buf_set_lines(bufnr, line_count, line_count, false, lines)
end
if strategy == "replace" and range and range.start_line and range.end_line then
local start_0 = math.max(0, range.start_line - 1)
local end_0 = math.min(line_count, range.end_line)
if end_0 < start_0 then
end_0 = start_0
end
vim.api.nvim_buf_set_lines(bufnr, start_0, end_0, false, lines)
elseif strategy == "insert" and range and range.start_line then
local at_0 = math.max(0, math.min(range.start_line - 1, line_count))
vim.api.nvim_buf_set_lines(bufnr, at_0, at_0, false, lines)
else
-- append
vim.api.nvim_buf_set_lines(bufnr, line_count, line_count, false, lines)
end
return { imports_added = 0, body_lines = body_lines, imports_merged = false }
return { imports_added = 0, body_lines = body_lines, imports_merged = false }
end
--- Inject code for refactor (replace entire file)