Skip to content

Commit f4f022f

Browse files
authored
fix(amazonq): Language server overrides should reference assets directly (#6333)
## Problem The language server initialization logic incorrectly handles custom server paths. When users specify a custom language server location through an environment variable, the code still appends `servers/aws-lsp-codewhisperer.js` to the path, leading to incorrect server resolution. ## Solution When a custom language server path is provided via environment variable (indicated by `location === 'override'`), use the specified asset directory path directly instead of appending the default server path. This allows users to have full control over the language server location. --- - 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 750145d commit f4f022f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/amazonq/src/lsp/activation.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ import path from 'path'
1212
export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
1313
try {
1414
const installResult = await new AmazonQLSPResolver().resolve()
15-
await startLanguageServer(ctx, path.join(installResult.assetDirectory, 'servers/aws-lsp-codewhisperer.js'))
15+
const serverLocation =
16+
installResult.location === 'override'
17+
? installResult.assetDirectory
18+
: path.join(installResult.assetDirectory, 'servers/aws-lsp-codewhisperer.js')
19+
await startLanguageServer(ctx, serverLocation)
1620
} catch (err) {
1721
const e = err as ToolkitError
1822
void vscode.window.showInformationMessage(`Unable to launch amazonq language server: ${e.message}`)

0 commit comments

Comments
 (0)