Skip to content

Commit

Permalink
Closes #23
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaprieto committed Jan 3, 2023
1 parent 8a70b7d commit 7cc660f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "juvix-mode",
"version": "0.1.11",
"version": "0.1.12",
"license": "GPL-3.0",
"description": "Juvix IDE support for VSCode",
"displayName": "Juvix",
Expand Down Expand Up @@ -307,6 +307,11 @@
"when": "editorLangId == Juvix && editorTextFocus",
"icon" : "$(run)"
},
{
"command": "juvix-mode.openRepl",
"title": "Open REPL",
"category": "Juvix"
},
{
"command": "juvix-mode.loadFileRepl",
"title": "Load file in REPL",
Expand Down
28 changes: 28 additions & 0 deletions src/repl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,34 @@ export class JuvixRepl {
}

export async function activate(context: vscode.ExtensionContext) {

const justOpenREPL = vscode.commands.registerCommand(
'juvix-mode.openRepl',
() => {
const document = vscode.window.activeTextEditor?.document;
if (document) { let repl = juvixTerminals.get(document.fileName);
if (!repl || repl.notAvailable()) {
repl?.dispose();
repl = new JuvixRepl(document);
}
} else {
const tempTerminal = vscode.window.createTerminal(
{
name: terminalName,
isTransient: false,
shellPath: '/usr/bin/bash',
location: {
viewColumn: vscode.ViewColumn.Beside,
preserveFocus: true,
}
})
tempTerminal.show();
tempTerminal.sendText('juvix repl');
context.subscriptions.push(
tempTerminal
);
}
});
/* Create a new terminal and send the command to load the current file */
const loadFile = vscode.commands.registerCommand(
'juvix-mode.loadFileRepl',
Expand Down

0 comments on commit 7cc660f

Please sign in to comment.