feat: remove lint tool and add lsp integration

This commit is contained in:
2025-01-31 11:13:58 +01:00
parent 35bd0a7278
commit 58da08e26f
6 changed files with 177 additions and 63 deletions

View File

@@ -1,5 +1,5 @@
local handler = require("chatgpt_nvim.handler")
local lint = require("chatgpt_nvim.tools.lint")
local robust_lsp = require("chatgpt_nvim.tools.lsp_robust_diagnostics")
local M = {}
@@ -25,15 +25,10 @@ M.run = function(tool_call, conf, prompt_user_tool_accept, is_subpath, read_file
msg[#msg+1] = string.format("<final_file_content path=\"%s\">\n%s\n</final_file_content>", path, new_content)
msg[#msg+1] = "\nIMPORTANT: For any future changes to this file, use the final_file_content shown above as your reference.\n"
-- 2) Lint check if enabled
-- 2) If auto_lint => run robust LSP approach
if conf.auto_lint then
local output, err = lint.lint_file(path)
if output then
msg[#msg+1] = "\n--- Lint Results ---\n"
msg[#msg+1] = output
else
msg[#msg+1] = "\n(Lint) " .. (err or "Could not lint this file.")
end
local diag_str = robust_lsp.lsp_check_file_content(path, new_content, 3000) -- 3s wait
msg[#msg+1] = "\n" .. diag_str
end
return table.concat(msg, "")