-
Notifications
You must be signed in to change notification settings - Fork 277
fix(amazonq): enable external links to open in system browser #6142
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
base: main
Are you sure you want to change the base?
Changes from all commits
b455b0e
7ad3844
5ba3fcb
d63a7e4
983e3d8
24aff71
d186350
93ea8b1
5626dc5
33bd680
a08e3b0
943db12
e8b12e6
bc2d024
867e464
c7404ca
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -114,6 +114,9 @@ import software.aws.toolkits.jetbrains.services.codewhisperer.codescan.CodeWhisp | |
| import software.aws.toolkits.jetbrains.services.codewhisperer.codescan.CodeWhispererCodeScanManager | ||
| import software.aws.toolkits.jetbrains.services.codewhisperer.settings.CodeWhispererConfigurable | ||
| import software.aws.toolkits.jetbrains.services.codewhisperer.util.CodeWhispererConstants | ||
| import software.aws.toolkits.jetbrains.services.cwc.ChatConstants.FOOTER_INFO_LINK_CLICK | ||
| import software.aws.toolkits.jetbrains.services.cwc.ChatConstants.RESPONSE_BODY_LINK_CLICK | ||
| import software.aws.toolkits.jetbrains.services.cwc.ChatConstants.SOURCE_LINK_CLICK | ||
| import software.aws.toolkits.jetbrains.settings.MeetQSettings | ||
| import software.aws.toolkits.telemetry.MetricResult | ||
| import software.aws.toolkits.telemetry.Telemetry | ||
|
|
@@ -387,16 +390,16 @@ class BrowserConnector( | |
| handleChat(AmazonQChatServer.insertToCursorPosition, enrichedNode) | ||
| } | ||
|
|
||
| CHAT_LINK_CLICK -> { | ||
| handleChat(AmazonQChatServer.linkClick, node) | ||
| CHAT_LINK_CLICK, RESPONSE_BODY_LINK_CLICK -> { | ||
| node.get("params")?.get("link")?.asText()?.let { BrowserUtil.browse(it) } | ||
| } | ||
|
|
||
| CHAT_INFO_LINK_CLICK -> { | ||
| handleChat(AmazonQChatServer.infoLinkClick, node) | ||
| CHAT_INFO_LINK_CLICK, FOOTER_INFO_LINK_CLICK -> { | ||
| node.get("params")?.get("link")?.asText()?.let { BrowserUtil.browse(it) } | ||
| } | ||
|
|
||
| CHAT_SOURCE_LINK_CLICK -> { | ||
| handleChat(AmazonQChatServer.sourceLinkClick, node) | ||
| CHAT_SOURCE_LINK_CLICK, SOURCE_LINK_CLICK -> { | ||
| node.get("params")?.get("link")?.asText()?.let { BrowserUtil.browse(it) } | ||
|
Comment on lines
+393
to
+402
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think it is ridiculous that we have 6 different messages, all with the same payload format, that ask the client to open a browser link
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @rli Agreed on the 6 message types being excessive. Should I create a follow-up issue to consolidate these into a single OPEN_LINK message type?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i think the bigger question is where these new messages came from because i dont see a reference to them outside of vsc/jb
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These UI message types (source-link-click, response-body-link-click, footer-info-link-click) were originally created in VSCode and then ported to JetBrains, creating the same architectural redundancy in both codebases.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if these are needed, why don't eclipse and VS have references to this?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Eclipse uses a single PluginUtils.handleExternalLinkClick() method that directly calls the platform's browser API. No message types needed - just openURL(new URL(url)). |
||
| } | ||
|
|
||
| CHAT_FILE_CLICK -> { | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unnecessary diff
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The theme change is intentional - it fixes link styling to make them properly blue/visible. The old lookup was failing to find the right color, so links weren't visually distinguishable. This is part of the overall "fix links" scope since broken styling affects link usability. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are there implications to telemetry
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No telemetry impact. Telemetry is sent from the UI side (chat-client) before it reaches BrowserConnector:
// messager.ts
The old handleChat(AmazonQChatServer.linkClick, node) forwarded to the LSP server which has empty handlers (onLinkClick() {}). It wasn't contributing to telemetry - just a dead end that never opened the browser.