Skip to content

Commit 1e2d0b8

Browse files
committed
remove redundant codes
1 parent 54346ff commit 1e2d0b8

File tree

3 files changed

+24
-57
lines changed

3 files changed

+24
-57
lines changed

packages/amazonq/src/lsp/autoDebug/codeActionsProvider.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,6 @@ export class AutoDebugCodeActionsProvider implements vscode.CodeActionProvider,
6363
// Add "Explain Problem" action
6464
actions.push(this.createExplainProblemAction(document, range, diagnostics))
6565
}
66-
67-
// Add "Detect Problems" action
68-
actions.push(this.createDetectProblemsAction(document, range))
6966
return actions
7067
}
7168

@@ -120,19 +117,7 @@ export class AutoDebugCodeActionsProvider implements vscode.CodeActionProvider,
120117
return action
121118
}
122119

123-
private createDetectProblemsAction(document: vscode.TextDocument, range: vscode.Range): vscode.CodeAction {
124-
const action = new vscode.CodeAction('Detect Problems with Amazon Q', vscode.CodeActionKind.Refactor)
125-
126-
action.command = {
127-
command: 'amazonq.autoDebug.detectProblems',
128-
title: 'Detect Problems with Amazon Q',
129-
}
130-
131-
return action
132-
}
133-
134120
public dispose(): void {
135-
this.logger.debug('AutoDebugCodeActionsProvider: Disposing code actions provider')
136121
vscode.Disposable.from(...this.disposables).dispose()
137122
}
138123
}

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

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,7 @@ export class AutoDebugCommands implements vscode.Disposable {
6060
async (range?: vscode.Range, diagnostics?: vscode.Diagnostic[]) => {
6161
await this.explainProblem(range, diagnostics)
6262
}
63-
),
64-
65-
// Detect Problems command
66-
Commands.register('amazonq.autoDebug.detectProblems', async () => {
67-
await this.detectProblems()
68-
})
63+
)
6964
)
7065

7166
// Add all disposables to context
@@ -142,26 +137,6 @@ export class AutoDebugCommands implements vscode.Disposable {
142137
}
143138
}
144139

145-
/**
146-
* Manually triggers problem detection
147-
*/
148-
private async detectProblems(): Promise<void> {
149-
try {
150-
this.logger.debug('AutoDebugCommands: Manual problem detection triggered')
151-
152-
const editor = vscode.window.activeTextEditor
153-
if (!editor) {
154-
return
155-
}
156-
157-
// Use the controller to detect problems
158-
await this.controller.detectProblems()
159-
} catch (error) {
160-
this.logger.error('AutoDebugCommands: Error detecting problems: %s', error)
161-
void vscode.window.showErrorMessage('Failed to detect problems')
162-
}
163-
}
164-
165140
/**
166141
* Dispose of all resources
167142
*/

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

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,24 +32,31 @@ export class AutoDebugContextMenuProvider implements vscode.Disposable {
3232
return false
3333
}
3434

35-
// Show for common programming languages
36-
const supportedLanguages = [
37-
'typescript',
38-
'javascript',
39-
'python',
40-
'java',
41-
'csharp',
42-
'cpp',
43-
'c',
44-
'go',
45-
'rust',
46-
'php',
47-
'ruby',
48-
'swift',
49-
'kotlin',
35+
// Exclude only non-programming file types that don't benefit from debugging
36+
const excludedLanguages = [
37+
'plaintext',
38+
'markdown',
39+
'json',
40+
'xml',
41+
'yaml',
42+
'yml',
43+
'csv',
44+
'log',
45+
'txt',
46+
'md',
47+
'html',
48+
'css',
49+
'scss',
50+
'sass',
51+
'less',
52+
'svg',
53+
'pdf',
54+
'image',
55+
'binary',
5056
]
5157

52-
return supportedLanguages.includes(document.languageId)
58+
// Show auto debug items for all languages except the excluded ones
59+
return !excludedLanguages.includes(document.languageId)
5360
}
5461

5562
/**

0 commit comments

Comments
 (0)