diff --git a/src/main/kotlin/snyk/common/EnvironmentHelper.kt b/src/main/kotlin/snyk/common/EnvironmentHelper.kt index 3b763e98a..1f66c2b28 100644 --- a/src/main/kotlin/snyk/common/EnvironmentHelper.kt +++ b/src/main/kotlin/snyk/common/EnvironmentHelper.kt @@ -1,5 +1,6 @@ package snyk.common +import com.intellij.util.EnvironmentUtil import com.intellij.util.net.HttpConfigurable import io.snyk.plugin.pluginSettings import snyk.pluginInfo @@ -11,6 +12,8 @@ object EnvironmentHelper { environment: MutableMap, apiToken: String, ) { + // first of all, use IntelliJ environment tool, to spice up env + environment.putAll(EnvironmentUtil.getEnvironmentMap()) val endpoint = getEndpointUrl() val oauthEnabledEnvVar = "INTERNAL_SNYK_OAUTH_ENABLED" diff --git a/src/main/kotlin/snyk/common/lsp/LanguageServerWrapper.kt b/src/main/kotlin/snyk/common/lsp/LanguageServerWrapper.kt index 39a723749..738908310 100644 --- a/src/main/kotlin/snyk/common/lsp/LanguageServerWrapper.kt +++ b/src/main/kotlin/snyk/common/lsp/LanguageServerWrapper.kt @@ -19,7 +19,6 @@ import io.snyk.plugin.isSnykIaCLSEnabled import io.snyk.plugin.isSnykOSSLSEnabled import io.snyk.plugin.pluginSettings import io.snyk.plugin.toLanguageServerURL -import io.snyk.plugin.toVirtualFile import io.snyk.plugin.ui.toolwindow.SnykPluginDisposable import kotlinx.coroutines.DelicateCoroutinesApi import kotlinx.coroutines.GlobalScope @@ -132,7 +131,7 @@ class LanguageServerWrapper( val cmd = listOf(lsPath, "language-server", "-l", logLevel) val processBuilder = ProcessBuilder(cmd) - pluginSettings().token?.let { EnvironmentHelper.updateEnvironment(processBuilder.environment(), it) } + EnvironmentHelper.updateEnvironment(processBuilder.environment(), pluginSettings().token ?: "") process = processBuilder.start() launcher = LSPLauncher.createClientLauncher(languageClient, process.inputStream, process.outputStream)