Skip to content

Commit

Permalink
Adding custom actions and linking the documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
DavyLandman committed Oct 31, 2023
1 parent 3e42008 commit 4e20c0d
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions rascal-vscode-extension/src/RascalExtension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export class RascalExtension implements vscode.Disposable {
if (uri) {
const [error, detail] = await this.verifyProjectSetup(uri);
if (error !== '') {
await this.reportTerminalStartError(error, detail);
await this.reportTerminalStartError(error, detail, {showOutput : false});
return;
}
}
Expand All @@ -141,12 +141,23 @@ 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);
await this.reportTerminalStartError("Failed to start the Rascal REPL, check Rascal Output Window", "" + err, { showOutput: true});
}
}

private reportTerminalStartError(msg: string, detail: string = "", modal = true) {
return vscode.window.showErrorMessage(msg, {detail : detail, modal: modal});
private async reportTerminalStartError(msg: string, detail: string = "", config : {modal?: boolean, showOutput?: boolean}) {
const options = ["View Documentation"];
if (config.showOutput) {
options.push("Show Rascal Output Window");
}
options.push("Ok");
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/"));
}
if (selected === "Show Rascal Output Window") {
await vscode.commands.executeCommand("workbench.action.output.show.extension-output-usethesource.rascalmpl-#1-Rascal MPL Language Server");
}
}

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

0 comments on commit 4e20c0d

Please sign in to comment.