Skip to content

Commit 83318dc

Browse files
fix(amazonq): auto save the current file when users trigger auto debug commands (aws#7883)
## Problem Amazon Q couldn't make changes to unsaved files. When users apply fix commands to unsaved files, Amazon Q couldn't fix those problems. ## Solution Auto save the file when users clicking on the fix commands. --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license. --------- Co-authored-by: invictus <[email protected]>
1 parent a942068 commit 83318dc

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

packages/amazonq/src/lsp/chat/autoDebug/commands.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ export class AutoDebugCommands implements vscode.Disposable {
9797
if (!editor) {
9898
return
9999
}
100+
const saved = await editor.document.save()
101+
if (!saved) {
102+
throw new Error('Failed to save document')
103+
}
100104
await this.controller.fixSpecificProblems(range, diagnostics)
101105
},
102106
'Fix with Amazon Q',
@@ -114,6 +118,10 @@ export class AutoDebugCommands implements vscode.Disposable {
114118
if (!editor) {
115119
return
116120
}
121+
const saved = await editor.document.save()
122+
if (!saved) {
123+
throw new Error('Failed to save document')
124+
}
117125
await this.controller.fixAllProblemsInFile(10) // 10 errors per batch
118126
},
119127
'Fix All with Amazon Q',

0 commit comments

Comments
 (0)