Skip to content

Commit

Permalink
bugfix: Add java options while fetching java via coursier
Browse files Browse the repository at this point in the history
  • Loading branch information
tgodzik committed Oct 25, 2024
1 parent 7bf4bfc commit 3f33103
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions packages/metals-languageclient/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export * from "./checkServerVersion";
export * from "./fetchMetals";
export * from "./getServerOptions";
export * from "./getJavaConfig";
export * from "./getJavaOptions";
export * from "./getJavaHome";
export * from "./setupCoursier";

Expand Down
11 changes: 6 additions & 5 deletions packages/metals-vscode/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import * as fs from "fs";
import {
restartServer,
getJavaConfig,
getJavaOptions,
fetchMetals,
JavaConfig,
getServerOptions,
Expand Down Expand Up @@ -220,7 +221,9 @@ async function fetchAndLaunchMetals(
const coursierMirror = getCoursierMirrorPath(config);

const metalsDirPath = metalsDir(ConfigurationTarget.Global);

const workspaceRoot = workspace.workspaceFolders
? workspace.workspaceFolders[0]?.uri.fsPath
: undefined;
if (!fs.existsSync(metalsDirPath)) {
fs.mkdirSync(metalsDirPath);
}
Expand All @@ -231,7 +234,7 @@ async function fetchAndLaunchMetals(
context.extensionPath,
outputChannel,
forceCoursierJar,
serverProperties
serverProperties.concat(getJavaOptions(workspaceRoot))
);

const canRetryWithJar =
Expand All @@ -249,9 +252,7 @@ async function fetchAndLaunchMetals(
}

const javaConfig = getJavaConfig({
workspaceRoot: workspace.workspaceFolders
? workspace.workspaceFolders[0]?.uri.fsPath
: undefined,
workspaceRoot,
javaHome,
coursier,
customRepositories,
Expand Down

0 comments on commit 3f33103

Please sign in to comment.