Enhance UI feedback and improve file diff visualization

- Improve diff display in permission dialogs with better formatting
- Add visual indicators for focus changes in permission dialogs
- Increase diagnostics timeout from 5 to 10 seconds
- Fix write tool to show proper diffs for existing files
- Update status component to properly handle messages

🤖 Generated with termai
Co-Authored-By: termai <noreply@termai.io>
This commit is contained in:
Kujtim Hoxha
2025-04-04 14:36:57 +02:00
parent 6bb1c84f7f
commit c185dc84d6
5 changed files with 87 additions and 22 deletions

View File

@@ -101,6 +101,15 @@ func (w *writeTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error
}
notifyLspOpenFile(ctx, filePath, w.lspClients)
// Get old content for diff if file exists
oldContent := ""
if fileInfo != nil && !fileInfo.IsDir() {
oldBytes, readErr := os.ReadFile(filePath)
if readErr == nil {
oldContent = string(oldBytes)
}
}
p := permission.Default.Request(
permission.CreatePermissionRequest{
Path: filePath,
@@ -109,7 +118,7 @@ func (w *writeTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error
Description: fmt.Sprintf("Create file %s", filePath),
Params: WritePermissionsParams{
FilePath: filePath,
Content: GenerateDiff("", params.Content),
Content: GenerateDiff(oldContent, params.Content),
},
},
)