Skip to content

Commit

Permalink
Merge branch 'main' into code-actions-for-dsls
Browse files Browse the repository at this point in the history
  • Loading branch information
DavyLandman authored Sep 27, 2024
2 parents d0a4d08 + 6f712be commit f80d525
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions rascal-vscode-extension/src/RascalExtension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,9 @@ export class RascalExtension implements vscode.Disposable {
if (uri) {
const [error, detail] = await this.verifyProjectSetup(uri);
if (error !== '') {
await this.reportTerminalStartError(error, detail, {showOutput : false});
return;
if (!await this.reportTerminalStartError(error, detail, {showOutput : false, canContinue: true})) {
return;
}
}
}
progress.report({increment: 20, message: "Requesting IDE configuration"});
Expand All @@ -143,23 +144,28 @@ export class RascalExtension implements vscode.Disposable {
progress.report({increment: 25, message: "Finished creating terminal"});
});
} catch (err) {
await this.reportTerminalStartError("Failed to start the Rascal REPL, check Rascal Output Window", "" + err, { showOutput: true});
await this.reportTerminalStartError("Failed to start the Rascal REPL, check Rascal Output Window", "" + err, { showOutput: true, canContinue: false});
}
}

private async reportTerminalStartError(msg: string, detail: string = "", config : {modal?: boolean, showOutput?: boolean}) {
private async reportTerminalStartError(msg: string, detail: string = "", config : {modal?: boolean, showOutput?: boolean, canContinue?: boolean}) : Promise<boolean> {
const options = ["View Documentation"];
if (config.showOutput) {
options.push("Show Rascal Output Window");
}
options.push("Ok");
if (config.canContinue === true) {
options.push("Still start the REPL");
}
const selected = await vscode.window.showErrorMessage(msg, {detail : detail, modal: config.modal ?? true}, ...options);
if (selected === "View Documentation") {
await vscode.env.openExternal(vscode.Uri.parse("https://www.rascal-mpl.org/docs/GettingStarted/CreateNewProject/"));
return false;
}
if (selected === "Show Rascal Output Window") {
await vscode.commands.executeCommand("workbench.action.output.show.extension-output-usethesource.rascalmpl-#1-Rascal MPL Language Server");
return false;
}
return config.canContinue === true;
}

async fileExists(f: vscode.Uri) {
Expand Down

0 comments on commit f80d525

Please sign in to comment.