Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -372,8 +372,8 @@ private class AmazonQServerInstance(private val project: Project, private val cs
}

val node = if (SystemInfo.isWindows) "node.exe" else "node"
val cmd = GeneralCommandLine(
artifact.resolve(node).toString(),
val cmd = NodeExePatcher.patch(artifact.resolve(node))
.withParameters(
LspSettings.getInstance().getArtifactPath() ?: artifact.resolve("aws-lsp-codewhisperer.js").toString(),
"--stdio",
"--set-credentials-encryption-key",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

package software.aws.toolkits.jetbrains.services.amazonq.lsp

import com.intellij.execution.configurations.GeneralCommandLine
import software.aws.toolkits.core.utils.getLogger
import software.aws.toolkits.core.utils.info
import java.nio.file.Path

/**
* Hacky nonsense to support old glibc platforms like AL2
* @see https://github.com/microsoft/vscode/issues/231623

Check warning on line 13 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/NodeExePatcher.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unresolved reference in KDoc

Cannot resolve symbol 'https'
* @see https://github.com/aws/aws-toolkit-vscode/commit/6081f890bdbb91fcd8b60c4cc0abb65b15d4a38d

Check warning on line 14 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/NodeExePatcher.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unresolved reference in KDoc

Cannot resolve symbol 'https'
*/
object NodeExePatcher {
private const val GLIBC_LINKER_VAR = "VSCODE_SERVER_CUSTOM_GLIBC_LINKER"
private const val GLIBC_PATH_VAR = "VSCODE_SERVER_CUSTOM_GLIBC_PATH"

fun patch(node: Path): GeneralCommandLine {
val linker = System.getenv(GLIBC_LINKER_VAR)
val glibc = System.getenv(GLIBC_PATH_VAR)
val nodePath = node.toAbsolutePath().toString()

if (!linker.isNullOrEmpty() && !glibc.isNullOrEmpty()) {

Check notice on line 25 in plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/NodeExePatcher.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Return or assignment can be lifted out

'Return' can be lifted out of 'if'
return GeneralCommandLine(linker)
.withParameters("--library-path", glibc, nodePath)
.also {
getLogger<NodeExePatcher>().info { "Using glibc patch: $it" }
}
} else {
return GeneralCommandLine(nodePath)
}
}
}
Loading