File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -93,7 +93,19 @@ export class ChatReplayIntent implements IIntent {
93
93
}
94
94
95
95
private async makeEdit ( edits : FileEdits , stream : vscode . ChatResponseStream ) {
96
- const uri = Uri . file ( edits . path ) ;
96
+ let uri : Uri ;
97
+ if ( ! edits . path . startsWith ( '/' ) && ! edits . path . match ( / ^ [ a - z A - Z ] : / ) ) {
98
+ // Relative path - join with first workspace folder
99
+ const workspaceFolders = this . workspaceService . getWorkspaceFolders ( ) ;
100
+ if ( workspaceFolders . length > 0 ) {
101
+ uri = Uri . joinPath ( workspaceFolders [ 0 ] , edits . path ) ;
102
+ } else {
103
+ throw new Error ( 'No workspace folder available to resolve relative path: ' + edits . path ) ;
104
+ }
105
+ } else {
106
+ // Absolute path
107
+ uri = Uri . file ( edits . path ) ;
108
+ }
97
109
await this . ensureFileExists ( uri ) ;
98
110
99
111
stream . markdown ( '\n```\n' ) ;
Original file line number Diff line number Diff line change 3
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
4
*--------------------------------------------------------------------------------------------*/
5
5
6
-
6
+ import * as vscode from 'vscode' ;
7
7
import { ObservableGit } from '../../../platform/inlineEdits/common/observableGit' ;
8
8
import { WorkspaceDocumentEditHistory } from '../../../platform/inlineEdits/common/workspaceEditTracker/workspaceDocumentEditTracker' ;
9
9
import { Disposable } from '../../../util/vs/base/common/lifecycle' ;
@@ -30,8 +30,10 @@ export class WorkspaceEditRecorder extends Disposable {
30
30
this . _workspace . openDocuments . get ( ) . forEach ( doc => {
31
31
const edits = this . _workspaceDocumentEditHistory . getRecentEdits ( doc . id ) ;
32
32
if ( edits && edits . edits . replacements . length > 0 ) {
33
+ const docUri = vscode . Uri . parse ( doc . id . path ) ;
34
+ const relativePath = vscode . workspace . asRelativePath ( docUri , false ) ;
33
35
serializedEdits . push ( {
34
- path : doc . id . path ,
36
+ path : relativePath ,
35
37
edits : JSON . stringify ( edits . edits )
36
38
} ) ;
37
39
}
You can’t perform that action at this time.
0 commit comments