From c5b3f9822a5022cf3e33cee8dcf6ed97e7b47996 Mon Sep 17 00:00:00 2001 From: tgodzik Date: Thu, 16 May 2024 20:01:51 +0200 Subject: [PATCH] bugfix: Revert changes to env and properties for now --- .../metals-languageclient/src/fetchMetals.ts | 25 +++++-------------- .../src/setupCoursier.ts | 2 +- 2 files changed, 7 insertions(+), 20 deletions(-) diff --git a/packages/metals-languageclient/src/fetchMetals.ts b/packages/metals-languageclient/src/fetchMetals.ts index 092553eb..3af58932 100644 --- a/packages/metals-languageclient/src/fetchMetals.ts +++ b/packages/metals-languageclient/src/fetchMetals.ts @@ -21,7 +21,7 @@ interface PackedChildPromise { export async function fetchMetals({ serverVersion, serverProperties, - javaConfig: { javaOptions, coursier, extraEnv, javaPath }, + javaConfig: { coursier, javaPath }, outputChannel, }: FetchMetalsOptions): Promise { const serverDependency = calcServerDependency(serverVersion); @@ -53,27 +53,14 @@ export async function fetchMetals({ "-p", ]; - const environment = { - env: { - ...process.env, - ...extraEnv, - }, - }; - if (coursier.endsWith(".jar")) { - const jarArgs = [ - ...javaOptions, - ...fetchProperties, - "-Dfile.encoding=UTF-8", - "-jar", - coursier, - ].concat(coursierArgs); - return { promise: spawn(javaPath, jarArgs, environment) }; + const jarArgs = ["-Dfile.encoding=UTF-8", "-jar", coursier].concat( + coursierArgs + ); + return { promise: spawn(javaPath, jarArgs) }; } else { - // Convert Java properties to the "-J" argument form used by Coursier - const javaArgs = javaOptions.concat(fetchProperties).map((p) => `-J${p}`); return { - promise: spawn(coursier, javaArgs.concat(coursierArgs), environment), + promise: spawn(coursier, coursierArgs), }; } } diff --git a/packages/metals-languageclient/src/setupCoursier.ts b/packages/metals-languageclient/src/setupCoursier.ts index af4b4de1..60a04982 100644 --- a/packages/metals-languageclient/src/setupCoursier.ts +++ b/packages/metals-languageclient/src/setupCoursier.ts @@ -93,7 +93,7 @@ export async function setupCoursier( * we can still fall back to jar based launcher. */ if (!coursier && javaHome) { - coursier = path.join(extensionPath, "./coursier-fallback.jar"); + coursier = path.join(extensionPath, "coursier-fallback.jar"); } if (javaHome && coursier) return { coursier, javaHome };