Skip to content

Commit

Permalink
Merge pull request #1493 from tgodzik/revert-no-workspce
Browse files Browse the repository at this point in the history
Revert "feat: allow for no workspace"
  • Loading branch information
tgodzik committed May 5, 2024
2 parents 701516e + d6f15d6 commit f441cfa
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/metals-vscode/src/extension.ts
Expand Up @@ -192,6 +192,13 @@ 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 @@ -214,9 +221,7 @@ async function fetchAndLaunchMetals(
);

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

0 comments on commit f441cfa

Please sign in to comment.