mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-21 09:44:21 +01:00
Improve LSP diagnostics handling for file operations
- 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 <noreply@termai.io>
This commit is contained in:
@@ -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("<result>\n%s\n</result>", result)
|
||||
|
||||
Reference in New Issue
Block a user