File tree Expand file tree Collapse file tree
src/extension/replay/vscode-node Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,7 +11,20 @@ export class EditHelper {
1111 constructor ( private readonly workspaceService : IWorkspaceService ) { }
1212
1313 public async makeEdit ( edits : FileEdits , stream : ChatResponseStream ) {
14- const uri = Uri . file ( edits . path ) ;
14+ let uri : Uri ;
15+ if ( ! edits . path . startsWith ( '/' ) && ! edits . path . match ( / ^ [ a - z A - Z ] : / ) ) {
16+ // Relative path - join with first workspace folder
17+ const workspaceFolders = this . workspaceService . getWorkspaceFolders ( ) ;
18+ if ( workspaceFolders . length > 0 ) {
19+ uri = Uri . joinPath ( workspaceFolders [ 0 ] , edits . path ) ;
20+ } else {
21+ throw new Error ( 'No workspace folder available to resolve relative path: ' + edits . path ) ;
22+ }
23+ } else {
24+ // Absolute path
25+ uri = Uri . file ( edits . path ) ;
26+ }
27+
1528 await this . ensureFileExists ( uri ) ;
1629
1730 stream . markdown ( '\n```\n' ) ;
You can’t perform that action at this time.
0 commit comments