kiss-vscode evalString
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
-lib hxnodejs
|
-lib hxnodejs
|
||||||
-lib kiss
|
-lib kiss
|
||||||
-lib uuid
|
-lib uuid
|
||||||
|
-lib hscript
|
||||||
-cp src
|
-cp src
|
||||||
-js bin/extension.js
|
-js bin/extension.js
|
||||||
-D analyzer-optimize
|
-D analyzer-optimize
|
||||||
|
@@ -4,6 +4,10 @@ import kiss.Kiss;
|
|||||||
import kiss.Prelude;
|
import kiss.Prelude;
|
||||||
import vscode.*;
|
import vscode.*;
|
||||||
import js.lib.Promise;
|
import js.lib.Promise;
|
||||||
|
import js.node.ChildProcess;
|
||||||
|
import js.node.buffer.Buffer;
|
||||||
|
import hscript.Parser;
|
||||||
|
import hscript.Interp;
|
||||||
|
|
||||||
typedef Command = (String) -> Void;
|
typedef Command = (String) -> Void;
|
||||||
|
|
||||||
|
@@ -46,11 +46,21 @@
|
|||||||
|
|
||||||
(defvar :Map<String,Command> commands (new Map))
|
(defvar :Map<String,Command> commands (new Map))
|
||||||
(defvar &mut :String lastCommand null)
|
(defvar &mut :String lastCommand null)
|
||||||
|
(defvar parser (new Parser))
|
||||||
|
(defvar interp (new Interp))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Functionality
|
* Functionality
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
(defun convertToHScript [kiss]
|
||||||
|
(.toString (the Buffer .stdout (ChildProcess.spawnSync "haxelib" ["run" "kiss" "--all"] (object input kiss)))))
|
||||||
|
|
||||||
|
(defun evalString [kiss]
|
||||||
|
(interp.execute
|
||||||
|
(parser.parseString
|
||||||
|
(convertToHScript kiss))))
|
||||||
|
|
||||||
(defun runCommand [&opt command]
|
(defun runCommand [&opt command]
|
||||||
(if command
|
(if command
|
||||||
{(set lastCommand command) ((dictGet commands command) (selectedText))}
|
{(set lastCommand command) ((dictGet commands command) (selectedText))}
|
||||||
|
Reference in New Issue
Block a user