Skip to content

Commit

Permalink
feat: allow for no workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
kasiaMarek committed Apr 24, 2024
1 parent f157d59 commit af86755
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions packages/metals-vscode/src/extension.ts
Expand Up @@ -192,13 +192,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 @@ -221,7 +214,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 af86755

Please sign in to comment.