Skip to content

Commit 1e48e36

Browse files
authored
feat(amazonq): handle link clicks in /help (#7120)
## Problem links clicked in help and responsible ai policy don't open ## Solution implement info link and link click handlers --- - 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 e544eb0 commit 1e48e36

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

packages/amazonq/src/lsp/chat/messages.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,17 @@ import {
3939
ShowDocumentRequest,
4040
contextCommandsNotificationType,
4141
ContextCommandParams,
42+
LINK_CLICK_NOTIFICATION_METHOD,
43+
LinkClickParams,
44+
INFO_LINK_CLICK_NOTIFICATION_METHOD,
4245
} from '@aws/language-server-runtimes/protocol'
4346
import { v4 as uuidv4 } from 'uuid'
4447
import * as vscode from 'vscode'
4548
import { Disposable, LanguageClient, Position, TextDocumentIdentifier } from 'vscode-languageclient'
4649
import * as jose from 'jose'
4750
import { AmazonQChatViewProvider } from './webviewProvider'
4851
import { AuthUtil } from 'aws-core-vscode/codewhisperer'
49-
import { AmazonQPromptSettings, messages } from 'aws-core-vscode/shared'
52+
import { AmazonQPromptSettings, messages, openUrl } from 'aws-core-vscode/shared'
5053
import { DefaultAmazonQAppInitContext, messageDispatcher } from 'aws-core-vscode/amazonq'
5154

5255
export function registerLanguageServerEventListener(languageClient: LanguageClient, provider: AmazonQChatViewProvider) {
@@ -172,6 +175,12 @@ export function registerMessageListeners(
172175
}
173176
break
174177
}
178+
case INFO_LINK_CLICK_NOTIFICATION_METHOD:
179+
case LINK_CLICK_NOTIFICATION_METHOD: {
180+
const linkParams = message.params as LinkClickParams
181+
void openUrl(vscode.Uri.parse(linkParams.link))
182+
break
183+
}
175184
case chatRequestType.method: {
176185
const chatParams = { ...message.params } as ChatParams
177186
const partialResultToken = uuidv4()

0 commit comments

Comments
 (0)