diff --git a/packages/amazonq/src/lsp/chat/autoDebug/commands.ts b/packages/amazonq/src/lsp/chat/autoDebug/commands.ts index 54dfd06a1dc..03ed804eee6 100644 --- a/packages/amazonq/src/lsp/chat/autoDebug/commands.ts +++ b/packages/amazonq/src/lsp/chat/autoDebug/commands.ts @@ -97,6 +97,10 @@ export class AutoDebugCommands implements vscode.Disposable { if (!editor) { return } + const saved = await editor.document.save() + if (!saved) { + throw new Error('Failed to save document') + } await this.controller.fixSpecificProblems(range, diagnostics) }, 'Fix with Amazon Q', @@ -114,6 +118,10 @@ export class AutoDebugCommands implements vscode.Disposable { if (!editor) { return } + const saved = await editor.document.save() + if (!saved) { + throw new Error('Failed to save document') + } await this.controller.fixAllProblemsInFile(10) // 10 errors per batch }, 'Fix All with Amazon Q',