Skip to content
This repository has been archived by the owner on Jan 3, 2025. It is now read-only.

Commandline arguments for --run set in comment #135

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/nimMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,23 @@ function startBuildOnSaveWatcher(subscriptions: vscode.Disposable[]) {
function runFile() {
let editor = vscode.window.activeTextEditor;
if (editor) {
var additionalArguments = '';
for (var i = 0; i < editor.document.lineCount; i++) {
var line = editor.document.lineAt(i);
var match = /#\s*vscode-nim\s+arguments:\s+(.*)/i.exec(line.text);
if (match) {
additionalArguments = match[1];
break;
}
}

if (!terminal) {
terminal = vscode.window.createTerminal('Nim');
}
terminal.show(true);
if (editor.document.isUntitled) {
terminal.sendText('nim ' + vscode.workspace.getConfiguration('nim')['buildCommand'] +
' -r "' + getDirtyFile(editor.document) + '"', true);
' -r "' + getDirtyFile(editor.document) + '" ' + additionalArguments, true);
} else {
let outputDirConfig = vscode.workspace.getConfiguration('nim')['runOutputDirectory'];
var outputParams = '';
Expand Down Expand Up @@ -226,7 +236,7 @@ function runFile() {
});
} else {
terminal.sendText('nim ' + vscode.workspace.getConfiguration('nim')['buildCommand'] +
outputParams + ' -r "' + editor.document.fileName + '"', true);
outputParams + ' -r "' + editor.document.fileName + '" ' + additionalArguments, true);
}
}
}
Expand Down