From 02aaa999d3db061e9cad2f96a8a06dc49164a428 Mon Sep 17 00:00:00 2001 From: Josh Pinkney Date: Tue, 22 Apr 2025 14:53:09 -0400 Subject: [PATCH] feat: add open settings command --- package-lock.json | 18 ++++++++---------- packages/amazonq/src/lsp/chat/messages.ts | 17 ++++++++++++++++- packages/core/package.json | 2 +- packages/core/src/shared/index.ts | 2 +- packages/core/src/shared/settings.ts | 2 +- 5 files changed, 27 insertions(+), 14 deletions(-) diff --git a/package-lock.json b/package-lock.json index a91b1d9aba5..b0fa0807bb9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10784,13 +10784,12 @@ } }, "node_modules/@aws/chat-client-ui-types": { - "version": "0.1.26", - "resolved": "https://registry.npmjs.org/@aws/chat-client-ui-types/-/chat-client-ui-types-0.1.26.tgz", - "integrity": "sha512-WlF0fP1nojueknr815dg6Ivs+Q3e5onvWTH1nI05jysSzUHjsWwFDBrsxqJXfaPIFhPrbQzHqoxHbhIwQ1OLuw==", + "version": "0.1.28", + "resolved": "https://registry.npmjs.org/@aws/chat-client-ui-types/-/chat-client-ui-types-0.1.28.tgz", + "integrity": "sha512-l6eCjmKdbuQIs9/lEyb8y2yaiUulzZr2RzFxhvhQXuIdUjYRX7vK9W0khYbnOMjLuuXpmAejF+UlnxAf4hREAQ==", "dev": true, - "license": "Apache-2.0", "dependencies": { - "@aws/language-server-runtimes-types": "^0.1.22" + "@aws/language-server-runtimes-types": "^0.1.23" } }, "node_modules/@aws/language-server-runtimes": { @@ -10827,11 +10826,10 @@ } }, "node_modules/@aws/language-server-runtimes-types": { - "version": "0.1.22", - "resolved": "https://registry.npmjs.org/@aws/language-server-runtimes-types/-/language-server-runtimes-types-0.1.22.tgz", - "integrity": "sha512-cyNrq6TqCcD9+vYUvvXJ5EJzfB4DrLtDBzBXgv/4zPIMRH0YwGEsRZLzPDwCPCxuZ5kGlal3GlBMkLkMCRGPdQ==", + "version": "0.1.23", + "resolved": "https://registry.npmjs.org/@aws/language-server-runtimes-types/-/language-server-runtimes-types-0.1.23.tgz", + "integrity": "sha512-sKmjgjncgOfa8J0bqOGn9Oc8TdCjmjJvqfSk4Dyj9+FsqPGzqwBmU3NE89kgz9DtvWf3NV6v7GaJj+Nprm+ztQ==", "dev": true, - "license": "Apache-2.0", "dependencies": { "vscode-languageserver-textdocument": "^1.0.12", "vscode-languageserver-types": "^3.17.5" @@ -26478,7 +26476,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", diff --git a/packages/amazonq/src/lsp/chat/messages.ts b/packages/amazonq/src/lsp/chat/messages.ts index c82d4c24570..4874566edfc 100644 --- a/packages/amazonq/src/lsp/chat/messages.ts +++ b/packages/amazonq/src/lsp/chat/messages.ts @@ -16,6 +16,8 @@ import { ChatPromptOptionAcknowledgedMessage, STOP_CHAT_RESPONSE, StopChatResponseMessage, + OPEN_SETTINGS, + OpenSettingsParams, } from '@aws/chat-client-ui-types' import { ChatResult, @@ -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' @@ -188,6 +197,12 @@ export function registerMessageListeners( } break } + case OPEN_SETTINGS: { + const params = message.params as OpenSettingsParams + const setting = params.settingKey as keyof SettingsProps + void openSettingsId(setting) + break + } case INFO_LINK_CLICK_NOTIFICATION_METHOD: case LINK_CLICK_NOTIFICATION_METHOD: { const linkParams = message.params as LinkClickParams diff --git a/packages/core/package.json b/packages/core/package.json index 5d60b72cc58..068ae2d5998 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -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", diff --git a/packages/core/src/shared/index.ts b/packages/core/src/shared/index.ts index 4cda5285f69..13deccde7fa 100644 --- a/packages/core/src/shared/index.ts +++ b/packages/core/src/shared/index.ts @@ -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' diff --git a/packages/core/src/shared/settings.ts b/packages/core/src/shared/settings.ts index 71a2f83a77c..25aef7ecab9 100644 --- a/packages/core/src/shared/settings.ts +++ b/packages/core/src/shared/settings.ts @@ -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 extends `${infer L}${S}${infer R}` ? [L, ...Split] : [T] type Pop = T extends [...infer R, infer _] ? R : never