mirror of
https://github.com/aljazceru/opencode.git
synced 2025-12-21 09:44:21 +01:00
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:
@@ -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),
|
||||
},
|
||||
},
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user