Skip to content

Commit

Permalink
allow to run main objects of different files in parallel
Browse files Browse the repository at this point in the history
  • Loading branch information
kaplan-shaked committed Apr 7, 2024
1 parent ec5db6d commit 52bedc8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/metals-vscode/src/debugger/scalaDebugger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
} from "metals-languageclient";
import { ExtendedScalaRunMain, ScalaCodeLensesParams } from "./types";
import { platform } from "os";
import { currentWorkspaceFolder } from "../util";
import { currentFile, currentWorkspaceFolder } from "../util";

const configurationType = "scala";

Expand Down Expand Up @@ -76,10 +76,10 @@ async function runMain(main: ExtendedScalaRunMain): Promise<boolean> {
},
{}
);

const file = currentFile();
const shellOptions = { ...platformSpecificOptions(), env };
const task = new Task(
{ type: "scala", task: "run" },
{ type: "scala" + (file ? `: ${file.fileName}` : ""), task: "run" },
workspaceFolder,
"Scala run",
"Metals",
Expand Down
5 changes: 5 additions & 0 deletions packages/metals-vscode/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
window,
workspace,
WorkspaceFolder,
TextDocument,
} from "vscode";
import {
ExecuteCommandRequest,
Expand Down Expand Up @@ -70,6 +71,10 @@ export function currentWorkspaceFolder(): WorkspaceFolder | undefined {
return workspace.workspaceFolders?.[0];
}

export function currentFile(): TextDocument | undefined {
return window.activeTextEditor?.document;
}

export function getTextDocumentPositionParams(
editor: TextEditor
): TextDocumentPositionParams {
Expand Down

0 comments on commit 52bedc8

Please sign in to comment.