Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(amazonq): @workspace command shown in all tab types #6022

Merged
merged 3 commits into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"type": "Bug Fix",
"description": "Amazon Q chat: @workspace command shown in all tab types"
justinmk3 marked this conversation as resolved.
Show resolved Hide resolved
}
13 changes: 13 additions & 0 deletions packages/core/src/amazonq/webview/ui/tabs/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,23 @@
*/
import { isSQLTransformReady } from '../../../../dev/config'
import { TabType } from '../storages/tabsStorage'
import { QuickActionCommandGroup } from '@aws/mynah-ui'

export type TabTypeData = {
title: string
placeholder: string
welcome: string
contextCommands?: QuickActionCommandGroup[]
}

const workspaceCommand: QuickActionCommandGroup = {
groupName: 'Mention code',
commands: [
{
command: '@workspace',
description: '(BETA) Reference all code in workspace.',
},
],
}

const commonTabData: TabTypeData = {
Expand All @@ -17,6 +29,7 @@ const commonTabData: TabTypeData = {
welcome: `Hi, I'm Amazon Q. I can answer your software development questions.
Ask me to explain, debug, or optimize your code.
You can enter \`/\` to see a list of quick actions. Add @workspace to beginning of your message to include your entire workspace as context.`,
contextCommands: [workspaceCommand],
}

export const TabTypeDataMap: Record<TabType, TabTypeData> = {
Expand Down
12 changes: 1 addition & 11 deletions packages/core/src/amazonq/webview/ui/tabs/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,7 @@ export class TabDataGenerator {
'Amazon Q Developer uses generative AI. You may need to verify responses. See the [AWS Responsible AI Policy](https://aws.amazon.com/machine-learning/responsible-ai/policy/).',
quickActionCommands: this.quickActionsGenerator.generateForTab(tabType),
promptInputPlaceholder: TabTypeDataMap[tabType].placeholder,
contextCommands: [
{
groupName: 'Mention code',
commands: [
{
command: '@workspace',
description: '(BETA) Reference all code in workspace.',
},
],
},
],
contextCommands: TabTypeDataMap[tabType].contextCommands,
chatItems: needWelcomeMessages
? [
{
Expand Down
Loading