From 3aef4dedcfd1ad408c6cb6c06e5e731feb528a1e Mon Sep 17 00:00:00 2001 From: Kujtim Hoxha Date: Fri, 4 Apr 2025 15:03:50 +0200 Subject: Improve LSP diagnostics handling for file operations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Split LSP file notification into separate functions - Add waitForLspDiagnostics function to wait for diagnostics after file changes - Move LSP diagnostics to after file operations in edit and write tools - Fix string splitting in diff generation - Reduce diagnostics timeout from 10 to 5 seconds 🤖 Generated with termai Co-Authored-By: termai --- internal/llm/tools/write.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'internal/llm/tools/write.go') diff --git a/internal/llm/tools/write.go b/internal/llm/tools/write.go index 1c32410f7..86c9be37e 100644 --- a/internal/llm/tools/write.go +++ b/internal/llm/tools/write.go @@ -100,7 +100,6 @@ func (w *writeTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error return NewTextErrorResponse(fmt.Sprintf("Failed to create parent directories: %s", err)), nil } - notifyLspOpenFile(ctx, filePath, w.lspClients) // Get old content for diff if file exists oldContent := "" if fileInfo != nil && !fileInfo.IsDir() { @@ -135,6 +134,8 @@ func (w *writeTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error // Record the file write recordFileWrite(filePath) recordFileRead(filePath) + // Wait for LSP diagnostics after writing the file + waitForLspDiagnostics(ctx, filePath, w.lspClients) result := fmt.Sprintf("File successfully written: %s", filePath) result = fmt.Sprintf("\n%s\n", result) -- cgit v1.2.3