33 * SPDX-License-Identifier: Apache-2.0
44 */
55
6- import { focusAmazonQPanel } from 'aws-core- vscode/amazonq '
7- import { Commands , globals , placeholder } from 'aws-core-vscode/shared'
6+ import * as vscode from 'vscode'
7+ import { Commands , globals } from 'aws-core-vscode/shared'
88import { window } from 'vscode'
99import { AmazonQChatViewProvider } from './webviewProvider'
1010
@@ -18,15 +18,15 @@ export function registerCommands(provider: AmazonQChatViewProvider) {
1818 const triggerType = getCommandTriggerType ( data )
1919 const selection = getSelectedText ( )
2020
21- void focusAmazonQPanel . execute ( placeholder , 'aws.amazonq.sendToPrompt' ) . then ( ( ) => {
21+ void focusAmazonQPanel ( ) . then ( ( ) => {
2222 void provider . webview ?. postMessage ( {
2323 command : 'sendToPrompt' ,
2424 params : { selection : selection , triggerType } ,
2525 } )
2626 } )
2727 } ) ,
2828 Commands . register ( 'aws.amazonq.openTab' , ( ) => {
29- void focusAmazonQPanel . execute ( placeholder , 'aws.amazonq.openTab' ) . then ( ( ) => {
29+ void focusAmazonQPanel ( ) . then ( ( ) => {
3030 void provider . webview ?. postMessage ( {
3131 command : 'aws/chat/openTab' ,
3232 params : { } ,
@@ -58,11 +58,22 @@ function registerGenericCommand(commandName: string, genericCommand: string, pro
5858 const triggerType = getCommandTriggerType ( data )
5959 const selection = getSelectedText ( )
6060
61- void focusAmazonQPanel . execute ( placeholder , commandName ) . then ( ( ) => {
61+ void focusAmazonQPanel ( ) . then ( ( ) => {
6262 void provider . webview ?. postMessage ( {
6363 command : 'genericCommand' ,
6464 params : { genericCommand, selection, triggerType } ,
6565 } )
6666 } )
6767 } )
6868}
69+
70+ /**
71+ * Importing focusAmazonQPanel from aws-core-vscode/amazonq leads to several dependencies down the chain not resolving since AmazonQ chat
72+ * is currently only activated on node, but the language server is activated on both web and node.
73+ *
74+ * Instead, we just create our own as a temporary solution
75+ */
76+ async function focusAmazonQPanel ( ) {
77+ await vscode . commands . executeCommand ( 'aws.amazonq.AmazonQChatView.focus' )
78+ await vscode . commands . executeCommand ( 'aws.amazonq.AmazonCommonAuth.focus' )
79+ }
0 commit comments