Skip to content

Commit 7d9e047

Browse files
committed
fixup
1 parent 74eb6a4 commit 7d9e047

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { LanguageClient } from 'vscode-languageclient'
88
import { AmazonQChatViewProvider } from './webviewProvider'
99
import { registerCommands } from './commands'
1010
import { registerLanguageServerEventListener, registerMessageListeners } from './messages'
11-
import { focusAmazonQPanel, focusAmazonQPanelKeybinding } from 'aws-core-vscode/amazonq'
1211
import { globals } from 'aws-core-vscode/shared'
1312

1413
export function activate(languageClient: LanguageClient, encryptionKey: Buffer, mynahUIPath: string) {
@@ -19,10 +18,7 @@ export function activate(languageClient: LanguageClient, encryptionKey: Buffer,
1918
webviewOptions: {
2019
retainContextWhenHidden: true,
2120
},
22-
}),
23-
24-
focusAmazonQPanel.register(),
25-
focusAmazonQPanelKeybinding.register()
21+
})
2622
)
2723

2824
/**

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

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
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'
88
import { window } from 'vscode'
99
import { 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+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
import { LanguageServerResolver } from 'aws-core-vscode/shared'
1616

1717
export class AmazonQChatViewProvider implements WebviewViewProvider {
18-
public static readonly viewType = 'aws.AmazonQChatView'
18+
public static readonly viewType = 'aws.amazonq.AmazonQChatView'
1919
private readonly onDidResolveWebviewEmitter = new EventEmitter<void>()
2020
public readonly onDidResolveWebview = this.onDidResolveWebviewEmitter.event
2121

0 commit comments

Comments
 (0)