-
Notifications
You must be signed in to change notification settings - Fork 747
fix(amazonq): enable agentic chat in AL2 #7212
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 8 commits
c2e4003
e58211c
0ae577c
20925f5
d78b731
44d04b3
bd8140c
0c18b2c
deb8bc9
746378d
d5e15f4
ae87b1b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| { | ||
| "type": "Bug Fix", | ||
| "description": "Enable Amazon Q LSP in AL2 instances" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ | |
| import vscode, { env, version } from 'vscode' | ||
| import * as nls from 'vscode-nls' | ||
| import * as crypto from 'crypto' | ||
| import * as path from 'path' | ||
| import { LanguageClient, LanguageClientOptions, RequestType, State } from 'vscode-languageclient' | ||
| import { InlineCompletionManager } from '../app/inline/completion' | ||
| import { AmazonQLspAuth, encryptionKey, notificationTypes } from './auth' | ||
|
|
@@ -32,14 +33,21 @@ import { | |
| getLogger, | ||
| undefinedIfEmpty, | ||
| getOptOutPreference, | ||
| isAmazonInternalOs, | ||
| fs, | ||
| } from 'aws-core-vscode/shared' | ||
| import { activate } from './chat/activation' | ||
| import { AmazonQResourcePaths } from './lspInstaller' | ||
| import { ConfigSection, isValidConfigSection, toAmazonQLSPLogLevel } from './config' | ||
| import { chmodSync } from 'fs' // eslint-disable-line no-restricted-imports | ||
|
|
||
| const localize = nls.loadMessageBundle() | ||
| const logger = getLogger('amazonqLsp.lspClient') | ||
|
|
||
| export async function hasGlibcPatch(): Promise<boolean> { | ||
| return await fs.exists('/opt/vsc-sysroot/lib64/ld-linux-x86-64.so.2') | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. follow up: Check if aarch64 has this issue or not. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like you've only configured this for Please check out my overall comment. |
||
| } | ||
|
|
||
| export async function startLanguageServer( | ||
| extensionContext: vscode.ExtensionContext, | ||
| resourcePaths: AmazonQResourcePaths | ||
|
|
@@ -55,18 +63,32 @@ export async function startLanguageServer( | |
| '--pre-init-encryption', | ||
| '--set-credentials-encryption-key', | ||
| ] | ||
|
|
||
| const documentSelector = [{ scheme: 'file', language: '*' }] | ||
|
|
||
| const clientId = 'amazonq' | ||
| const traceServerEnabled = Settings.instance.isSet(`${clientId}.trace.server`) | ||
|
|
||
| // apply the GLIBC 2.28 path to node js runtime binary | ||
| if (isAmazonInternalOs() && (await hasGlibcPatch())) { | ||
| const nodeWrapper = ` | ||
| #! /bin/bash | ||
| exec /opt/vsc-sysroot/lib64/ld-linux-x86-64.so.2 --library-path /opt/vsc-sysroot/lib64 ${resourcePaths.node} "$@" | ||
| ` | ||
justinmk3 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| const nodeWrapperPath = path.join(path.dirname(resourcePaths.node), 'node-wrapper') | ||
| await fs.writeFile(nodeWrapperPath, nodeWrapper) | ||
| chmodSync(nodeWrapperPath, 0o755) | ||
| resourcePaths.node = nodeWrapperPath | ||
| getLogger('amazonqLsp').info(`Patched node runtime with GLIBC to ${resourcePaths.node}`) | ||
| } | ||
|
|
||
| const serverOptions = createServerOptions({ | ||
| encryptionKey, | ||
| executable: resourcePaths.node, | ||
| serverModule, | ||
| execArgv: argv, | ||
| }) | ||
|
|
||
| const documentSelector = [{ scheme: 'file', language: '*' }] | ||
|
|
||
| const clientId = 'amazonq' | ||
| const traceServerEnabled = Settings.instance.isSet(`${clientId}.trace.server`) | ||
|
|
||
| await validateNodeExe(resourcePaths.node, resourcePaths.lsp, argv, logger) | ||
|
|
||
| // Options to control the language client | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.