Skip to content

Commit

Permalink
Merge pull request #1494 from tgodzik/add-no-workspace
Browse files Browse the repository at this point in the history
feat: allow for no workspace
  • Loading branch information
tgodzik authored May 16, 2024
2 parents d1e9163 + c273ea4 commit da02de7
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions packages/metals-vscode/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,6 @@ async function fetchAndLaunchMetals(
serverVersion: string,
javaVersion: JavaVersion
) {
if (!workspace.workspaceFolders) {
const message = `Metals will not start because you've opened a single file and not a project directory.`;
window.showErrorMessage(message);
outputChannel.appendLine(message);
return;
}

outputChannel.appendLine(`Metals version: ${serverVersion}`);

/* eslint-disable @typescript-eslint/no-non-null-assertion */
Expand All @@ -223,7 +216,9 @@ async function fetchAndLaunchMetals(
);

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

0 comments on commit da02de7

Please sign in to comment.