Skip to content

Commit a60c6ee

Browse files
committed
Simplify the message format
1 parent d482d4b commit a60c6ee

File tree

3 files changed

+20
-59
lines changed

3 files changed

+20
-59
lines changed

packages/core/src/amazonq/autoDebug/autoDebugController.ts

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -285,42 +285,18 @@ export class AutoDebugController implements vscode.Disposable {
285285
totalErrors: number,
286286
errorsBeingSent: number
287287
): string {
288-
const parts = [
289-
`Please help me fix the following code issues:`,
290-
'',
291-
`**File:** ${filePath}`,
292-
`**Language:** ${languageId}`,
293-
`**Errors being sent:** ${errorsBeingSent}`,
294-
totalErrors > errorsBeingSent ? `**Total errors in file:** ${totalErrors}` : '',
295-
'',
296-
'**Code:**',
297-
`\`\`\`${languageId}`,
298-
selectedText,
299-
'```',
300-
'',
301-
'**Issues to fix:**',
302-
]
288+
const parts = [`Please help me fix the following errors in ${filePath}`]
303289

304290
for (const problem of problems) {
305-
parts.push(`- **ERROR**: ${problem.diagnostic.message}`)
291+
const line = problem.diagnostic.range.start.line + 1
292+
const column = problem.diagnostic.range.start.character + 1
293+
const source = problem.source !== 'unknown' ? problem.source : 'Unknown'
306294
parts.push(
307-
` Location: Line ${problem.diagnostic.range.start.line + 1}, Column ${problem.diagnostic.range.start.character + 1}`
308-
)
309-
if (problem.source !== 'unknown') {
310-
parts.push(` Source: ${problem.source}`)
311-
}
312-
}
313-
314-
parts.push('')
315-
parts.push('Please fix the error')
316-
317-
if (totalErrors > errorsBeingSent) {
318-
parts.push(
319-
`Note: This file has ${totalErrors} total errors, but I'm only sending ${errorsBeingSent} errors at a time to avoid overwhelming the system.`
295+
`ERROR: ${problem.diagnostic.message} Location: Line ${line}, Column ${column} Source: ${source}`
320296
)
321297
}
322298

323-
return parts.filter(Boolean).join('\n')
299+
return parts.join('\n')
324300
}
325301

326302
/**

packages/core/src/amazonq/autoDebug/ide/codeActionsProvider.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,13 @@ export class AutoDebugCodeActionsProvider implements vscode.CodeActionProvider,
9797
diagnostics: vscode.Diagnostic[]
9898
): vscode.CodeAction {
9999
const action = new vscode.CodeAction(
100-
`Fix with Amazon Q (${diagnostics.length} issue${diagnostics.length !== 1 ? 's' : ''})`,
100+
`Amazon Q: Fix Problem (${diagnostics.length} issue${diagnostics.length !== 1 ? 's' : ''})`,
101101
vscode.CodeActionKind.QuickFix
102102
)
103103

104104
action.command = {
105105
command: 'amazonq.01.fixWithQ',
106-
title: 'Fix with Amazon Q',
106+
title: 'Amazon Q: Fix Problem',
107107
arguments: [range, diagnostics],
108108
}
109109

@@ -114,11 +114,11 @@ export class AutoDebugCodeActionsProvider implements vscode.CodeActionProvider,
114114
}
115115

116116
private createFixAllWithQAction(document: vscode.TextDocument): vscode.CodeAction {
117-
const action = new vscode.CodeAction('Fix All with Amazon Q', vscode.CodeActionKind.QuickFix)
117+
const action = new vscode.CodeAction('Amazon Q: Fix All Errors', vscode.CodeActionKind.QuickFix)
118118

119119
action.command = {
120120
command: 'amazonq.02.fixAllWithQ',
121-
title: 'Fix All with Amazon Q',
121+
title: 'Amazon Q: Fix All Errors',
122122
}
123123

124124
return action
@@ -129,11 +129,11 @@ export class AutoDebugCodeActionsProvider implements vscode.CodeActionProvider,
129129
range: vscode.Range,
130130
diagnostics: vscode.Diagnostic[]
131131
): vscode.CodeAction {
132-
const action = new vscode.CodeAction('Explain Problem with Amazon Q', vscode.CodeActionKind.QuickFix)
132+
const action = new vscode.CodeAction('Amazon Q: Explain Problem', vscode.CodeActionKind.QuickFix)
133133

134134
action.command = {
135135
command: 'amazonq.03.explainProblem',
136-
title: 'Explain Problem with Amazon Q',
136+
title: 'Amazon Q: Explain Problem',
137137
arguments: [range, diagnostics],
138138
}
139139

packages/core/src/amazonq/autoDebug/ide/contextMenuProvider.ts

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export class ContextMenuProvider implements vscode.Disposable {
2828
Commands.register(
2929
{
3030
id: 'amazonq.01.fixWithQ',
31-
name: 'Fix with Amazon Q',
31+
name: 'Amazon Q: Fix Problem',
3232
telemetryName: 'amazonq_openChat',
3333
},
3434
async (range?: vscode.Range, diagnostics?: vscode.Diagnostic[]) => {
@@ -42,7 +42,7 @@ export class ContextMenuProvider implements vscode.Disposable {
4242
Commands.register(
4343
{
4444
id: 'amazonq.02.fixAllWithQ',
45-
name: 'Fix All with Amazon Q',
45+
name: 'Amazon Q: Fix All Errors',
4646
telemetryName: 'amazonq_openChat',
4747
},
4848
async () => {
@@ -56,7 +56,7 @@ export class ContextMenuProvider implements vscode.Disposable {
5656
Commands.register(
5757
{
5858
id: 'amazonq.03.explainProblem',
59-
name: 'Explain Problem with Amazon Q',
59+
name: 'Amazon Q: Explain Problem',
6060
telemetryName: 'amazonq_openChat',
6161
},
6262
async (range?: vscode.Range, diagnostics?: vscode.Diagnostic[]) => {
@@ -271,30 +271,15 @@ export class ContextMenuProvider implements vscode.Disposable {
271271
}
272272

273273
private createFixMessage(selectedText: string, filePath: string, languageId: string, errorContexts: any[]): string {
274-
const parts = [
275-
'Please help me fix the following code issues:',
276-
'',
277-
`**File:** ${filePath}`,
278-
`**Language:** ${languageId}`,
279-
'',
280-
'**Code:**',
281-
`\`\`\`${languageId}`,
282-
selectedText,
283-
'```',
284-
'',
285-
'**Issues to fix:**',
286-
]
274+
const parts = [`Please help me fix the following errors in ${filePath}`]
287275

288276
for (const context of errorContexts) {
289-
parts.push(`- **${context.severity.toUpperCase()}**: ${context.message}`)
290-
if (context.location) {
291-
parts.push(` Location: Line ${context.location.line}, Column ${context.location.column}`)
292-
}
277+
const line = context.location ? context.location.line : 'Unknown'
278+
const column = context.location ? context.location.column : 'Unknown'
279+
const source = context.source || 'Unknown'
280+
parts.push(`ERROR: ${context.message} Location: Line ${line}, Column ${column} Source: ${source}`)
293281
}
294282

295-
parts.push('')
296-
parts.push('Please fix the error.')
297-
298283
return parts.join('\n')
299284
}
300285

0 commit comments

Comments
 (0)