Skip to content

Commit 6e46123

Browse files
committed
fix(amazonq): Split trace server logs into separate output channel
1 parent dfff38c commit 6e46123

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

packages/amazonq/src/lsp/client.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { registerInlineCompletion } from '../app/inline/completion'
1111
import { AmazonQLspAuth, encryptionKey, notificationTypes } from './auth'
1212
import { AuthUtil } from 'aws-core-vscode/codewhisperer'
1313
import { ConnectionMetadata } from '@aws/language-server-runtimes/protocol'
14-
import { ResourcePaths, createServerOptions } from 'aws-core-vscode/shared'
14+
import { ResourcePaths, Settings, createServerOptions, globals } from 'aws-core-vscode/shared'
1515

1616
const localize = nls.loadMessageBundle()
1717

@@ -35,6 +35,9 @@ export async function startLanguageServer(extensionContext: vscode.ExtensionCont
3535

3636
const documentSelector = [{ scheme: 'file', language: '*' }]
3737

38+
const clientId = 'amazonq'
39+
const traceServerEnabled = Settings.instance.isSet(`${clientId}.trace.server`)
40+
3841
// Options to control the language client
3942
const clientOptions: LanguageClientOptions = {
4043
// Register the server for json documents
@@ -60,10 +63,20 @@ export async function startLanguageServer(extensionContext: vscode.ExtensionCont
6063
providesBearerToken: true,
6164
},
6265
},
66+
/**
67+
* When the trace server is enabled it outputs a ton of log messages so:
68+
* When trace server is enabled, logs go to a seperate "Amazon Q Language Server" output.
69+
* Otherwise, logs go to the regular "Amazon Q Logs" channel.
70+
*/
71+
...(traceServerEnabled
72+
? {}
73+
: {
74+
outputChannel: globals.logOutputChannel,
75+
}),
6376
}
6477

6578
const client = new LanguageClient(
66-
'amazonq',
79+
clientId,
6780
localize('amazonq.server.name', 'Amazon Q Language Server'),
6881
serverOptions,
6982
clientOptions

0 commit comments

Comments
 (0)