Skip to content
Snippets Groups Projects
Commit a8c97700 authored by Smit, P.J.M. (Peter, Student M-CS)'s avatar Smit, P.J.M. (Peter, Student M-CS)
Browse files

added Modest executable location in configuration

parent c25f5ddb
No related branches found
No related tags found
No related merge requests found
......@@ -16,14 +16,12 @@
"title": "Simulate Model"
}
],
"commandPalette": [
{
"command": "extension.simulate",
"when": "editorLangId == modest"
}
],
"languages": [
{
"id": "modest",
......@@ -41,9 +39,20 @@
{
"language": "modest",
"scopeName": "source.modest",
"path": "./syntaxes/modest.tmLanguage.json"
}
],
"configuration": [
{
"title": "Modest",
"properties": {
"modest.executableLocation": {
"type": "string",
"default": "C:\\Program Files\\modest\\modest.exe",
"description": "Location of the Modest executable"
}
}
}
]
},
"activationEvents": [
......
import { pathToFileURL } from 'url';
import * as vscode from 'vscode';
import * as path from "path";
export namespace ModestCommands {
const paramHistory: Map<string, string> = new Map();
function modestExecutable(): string | undefined {
let executable: string | undefined =
vscode.workspace.getConfiguration("modest").get("executableLocation");
if (executable === undefined) {
vscode.window.showInformationMessage(
"It looks like you don't have the modest configurable located yet.", "Go to settings")
.then(result => {
//TODO: Figure out how to link to settings.
});
return;
}
// Surround any directory with whitespace in quotes
return executable.split(path.sep).map(value => value.match(/\s/) ? `"${value}"` : value).join(path.sep);
}
export let simCommand = vscode.commands.registerCommand('extension.simulate', async () => {
//activeTextEditor should never be undefined
if (vscode.window.activeTextEditor === undefined) {
return;
}
let executable: string | undefined = modestExecutable();
if (executable === undefined) {
return;
}
var currentFile = vscode.window.activeTextEditor.document.fileName;
// Show parameter input box
let parms = await vscode.window.showInputBox({
......@@ -25,7 +50,7 @@ export namespace ModestCommands {
// Create a terminal and run the simulation
let term = vscode.window.createTerminal("Modest simulation");
term.sendText(`modest simulate ${currentFile} ${parms}\n`);
term.sendText(`${executable} simulate ${currentFile} ${parms}\n`);
term.show(true);
});
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment