Skip to content

Commit 8af52de

Browse files
authored
fix(amazonq lsp): add getConnectionMetadata handler before auth initialiation (aws#6880)
## Problem auth init was sending an update credentials request before the handlers were registered ## Solution move the getConnectionMetadata registration before the initial auth call --- - 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 1647786 commit 8af52de

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

packages/amazonq/src/lsp/client.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,14 +93,7 @@ export async function startLanguageServer(
9393
const auth = new AmazonQLspAuth(client)
9494

9595
return client.onReady().then(async () => {
96-
await auth.init()
97-
const inlineManager = new InlineCompletionManager(client)
98-
inlineManager.registerInlineCompletion()
99-
if (Experiments.instance.get('amazonqChatLSP', false)) {
100-
activate(client, encryptionKey, resourcePaths.mynahUI)
101-
}
102-
103-
// Request handler for when the server wants to know about the clients auth connnection
96+
// Request handler for when the server wants to know about the clients auth connnection. Must be registered before the initial auth init call
10497
client.onRequest<ConnectionMetadata, Error>(notificationTypes.getConnectionMetadata.method, () => {
10598
return {
10699
sso: {
@@ -109,6 +102,13 @@ export async function startLanguageServer(
109102
}
110103
})
111104

105+
await auth.init()
106+
const inlineManager = new InlineCompletionManager(client)
107+
inlineManager.registerInlineCompletion()
108+
if (Experiments.instance.get('amazonqChatLSP', false)) {
109+
activate(client, encryptionKey, resourcePaths.mynahUI)
110+
}
111+
112112
// Temporary code for pen test. Will be removed when we switch to the real flare auth
113113
const authInterval = setInterval(async () => {
114114
try {

0 commit comments

Comments
 (0)