Skip to content

Commit 9128f47

Browse files
authored
feat(amazonq): added show logs to the top menu bar dropdown (#7745)
## Problem Needed to add a new drop down show logs button at the top. Having just a web view button would lead to this functionality not work incase the LS doesnt work. ## Solution Added the same show logs functionality in the top drop down. <img width="933" height="448" alt="image" src="https://github.com/user-attachments/assets/00121f11-52b6-4aba-a183-4b2fd10c5c38" /> --- - 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.
1 parent 62fab80 commit 9128f47

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed

packages/amazonq/package.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,6 +408,11 @@
408408
"when": "(view == aws.amazonq.AmazonQChatView) && aws.codewhisperer.connected && !aws.isSageMakerUnifiedStudio",
409409
"group": "2_amazonQ@4"
410410
},
411+
{
412+
"command": "aws.amazonq.showLogs",
413+
"when": "view == aws.amazonq.AmazonQChatView",
414+
"group": "1_amazonQ@5"
415+
},
411416
{
412417
"command": "aws.amazonq.reconnect",
413418
"when": "(view == aws.amazonq.AmazonQChatView) && aws.codewhisperer.connectionExpired",
@@ -636,6 +641,12 @@
636641
"category": "%AWS.amazonq.title%",
637642
"enablement": "aws.codewhisperer.connected"
638643
},
644+
{
645+
"command": "aws.amazonq.showLogs",
646+
"title": "%AWS.command.codewhisperer.showLogs%",
647+
"category": "%AWS.amazonq.title%",
648+
"enablement": "aws.codewhisperer.connected"
649+
},
639650
{
640651
"command": "aws.amazonq.selectRegionProfile",
641652
"title": "Change Profile",

packages/core/package.nls.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@
275275
"AWS.command.codewhisperer.signout": "Sign Out",
276276
"AWS.command.codewhisperer.reconnect": "Reconnect",
277277
"AWS.command.codewhisperer.openReferencePanel": "Open Code Reference Log",
278+
"AWS.command.codewhisperer.showLogs": "Show Logs",
278279
"AWS.command.q.selectRegionProfile": "Select Profile",
279280
"AWS.command.q.transform.acceptChanges": "Accept",
280281
"AWS.command.q.transform.rejectChanges": "Reject",

packages/core/src/codewhisperer/activation.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
enableCodeSuggestions,
2424
toggleCodeSuggestions,
2525
showReferenceLog,
26+
showLogs,
2627
showSecurityScan,
2728
showLearnMore,
2829
showSsoSignIn,
@@ -299,6 +300,7 @@ export async function activate(context: ExtContext): Promise<void> {
299300
),
300301
vscode.window.registerWebviewViewProvider(ReferenceLogViewProvider.viewType, ReferenceLogViewProvider.instance),
301302
showReferenceLog.register(),
303+
showLogs.register(),
302304
showExploreAgentsView.register(),
303305
vscode.languages.registerCodeLensProvider(
304306
[...CodeWhispererConstants.platformLanguageIds],

packages/core/src/codewhisperer/commands/basicCommands.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,32 @@ export const showReferenceLog = Commands.declare(
147147
}
148148
)
149149

150+
export const showLogs = Commands.declare(
151+
{ id: 'aws.amazonq.showLogs', compositeKey: { 1: 'source' } },
152+
() => async (_: VsCodeCommandArg, source: CodeWhispererSource) => {
153+
if (_ !== placeholder) {
154+
source = 'ellipsesMenu'
155+
}
156+
157+
// Show warning message without buttons - just informational
158+
void vscode.window.showWarningMessage(
159+
'Log files may contain sensitive information such as account IDs, resource names, and other data. Be careful when sharing these logs.'
160+
)
161+
162+
// Get the log directory path
163+
const logFolderPath = globals.context.logUri?.fsPath
164+
const path = require('path')
165+
const logFilePath = path.join(logFolderPath, 'Amazon Q Logs.log')
166+
if (logFilePath) {
167+
// Open the log directory in the OS file explorer directly
168+
await vscode.commands.executeCommand('revealFileInOS', vscode.Uri.file(logFilePath))
169+
} else {
170+
// Fallback: show error if log path is not available
171+
void vscode.window.showErrorMessage('Log location not available.')
172+
}
173+
}
174+
)
175+
150176
export const showExploreAgentsView = Commands.declare(
151177
{ id: 'aws.amazonq.exploreAgents', compositeKey: { 1: 'source' } },
152178
() => async (_: VsCodeCommandArg, source: CodeWhispererSource) => {

0 commit comments

Comments
 (0)