Skip to content

feat(amazonq): add open settings command #7132

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
18 changes: 8 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 16 additions & 1 deletion packages/amazonq/src/lsp/chat/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import {
ChatPromptOptionAcknowledgedMessage,
STOP_CHAT_RESPONSE,
StopChatResponseMessage,
OPEN_SETTINGS,
OpenSettingsParams,
} from '@aws/chat-client-ui-types'
import {
ChatResult,
Expand Down Expand Up @@ -56,7 +58,14 @@ import { Disposable, LanguageClient, Position, TextDocumentIdentifier } from 'vs
import * as jose from 'jose'
import { AmazonQChatViewProvider } from './webviewProvider'
import { AuthUtil } from 'aws-core-vscode/codewhisperer'
import { amazonQDiffScheme, AmazonQPromptSettings, messages, openUrl } from 'aws-core-vscode/shared'
import {
amazonQDiffScheme,
AmazonQPromptSettings,
messages,
openSettingsId,
openUrl,
SettingsProps,
} from 'aws-core-vscode/shared'
import { DefaultAmazonQAppInitContext, messageDispatcher, EditorContentController } from 'aws-core-vscode/amazonq'
import { telemetry, TelemetryBase } from 'aws-core-vscode/telemetry'

Expand Down Expand Up @@ -188,6 +197,12 @@ export function registerMessageListeners(
}
break
}
case OPEN_SETTINGS: {
const params = message.params as OpenSettingsParams
const setting = params.settingKey as keyof SettingsProps
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might as well be as any, since as means this doesn't actually achieve any type-checking. and that avoids needing to export SettingsProps.

Comment on lines +201 to +202
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const params = message.params as OpenSettingsParams
const setting = params.settingKey as keyof SettingsProps
const params = message.params as any
const setting = params.settingKey as any

void openSettingsId(setting)
break
}
case INFO_LINK_CLICK_NOTIFICATION_METHOD:
case LINK_CLICK_NOTIFICATION_METHOD: {
const linkParams = message.params as LinkClickParams
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@
"devDependencies": {
"@aws-sdk/types": "^3.13.1",
"@aws/chat-client": "^0.1.4",
"@aws/chat-client-ui-types": "^0.1.24",
"@aws/chat-client-ui-types": "^0.1.28",
"@aws/language-server-runtimes": "^0.2.70",
"@aws/language-server-runtimes-types": "^0.1.21",
"@cspotcode/source-map-support": "^0.8.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/shared/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export { activate as activateLogger } from './logger/activation'
export { activate as activateTelemetry } from './telemetry/activation'
export { DefaultAwsContext } from './awsContext'
export { DefaultAWSClientBuilder, ServiceOptions } from './awsClientBuilder'
export { Settings, Experiments, DevSettings, AmazonQPromptSettings } from './settings'
export { Settings, Experiments, DevSettings, AmazonQPromptSettings, openSettingsId, SettingsProps } from './settings'
export * from './extensionUtilities'
export * from './extensionStartup'
export { RegionProvider } from './regions/regionProvider'
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/shared/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ export interface ResetableMemento extends vscode.Memento {
// at least for anything beyond primitive types.
const settingsProps = { ...toolkitSettings, ...amazonQSettings }

type SettingsProps = typeof settingsProps
export type SettingsProps = typeof settingsProps

type Split<T, S extends string> = T extends `${infer L}${S}${infer R}` ? [L, ...Split<R, S>] : [T]
type Pop<T> = T extends [...infer R, infer _] ? R : never
Expand Down
Loading