Revise KissConfig
This commit is contained in:
@@ -5,13 +5,16 @@ import kiss.Prelude;
|
||||
import kiss.Stream;
|
||||
import vscode.*;
|
||||
import js.lib.Promise;
|
||||
import js.node.ChildProcess;
|
||||
import hscript.Parser;
|
||||
import hscript.Interp;
|
||||
import hscript.Expr;
|
||||
import haxe.io.Path;
|
||||
import sys.io.File;
|
||||
import sys.FileSystem;
|
||||
|
||||
using haxe.io.Path;
|
||||
using StringTools;
|
||||
|
||||
typedef Command = (String) -> Void;
|
||||
|
||||
|
@@ -1,3 +1,5 @@
|
||||
(load "Util.kiss")
|
||||
|
||||
(function userHome [] (or (Sys.getEnv "MSYSHOME") (Sys.getEnv "HOME") (Sys.getEnv "UserProfile")))
|
||||
(function userConfigDir []
|
||||
(joinPath
|
||||
@@ -9,19 +11,6 @@
|
||||
(var &mut builtinConfigDir "")
|
||||
(var &mut :KissConfig config null)
|
||||
|
||||
// This has to be a macro so it can return from tryLoadConfig
|
||||
(defMacro trySpawnSync [command args options onError]
|
||||
`(let [command ,command
|
||||
args ,args
|
||||
result (ChildProcess.spawnSync command args ,options)]
|
||||
(if result.error
|
||||
(throw "Error $result.error from $command $args: $result.stdout $result.stderr")
|
||||
(case result.status
|
||||
(0 null)
|
||||
(errCode
|
||||
(,onError "Error code $errCode from $command $args: $result.stdout $result.stderr")
|
||||
(return))))))
|
||||
|
||||
(function :Void tryLoadConfig [&opt :String text]
|
||||
// TODO if a config object is active and a shortcut panel is open, dispose the panel before we lose the handle in the current config object
|
||||
(let [handleConfigFailure
|
||||
|
13
projects/kiss-vscode/src/Util.kiss
Normal file
13
projects/kiss-vscode/src/Util.kiss
Normal file
@@ -0,0 +1,13 @@
|
||||
// This has to be a macro so it can return from tryLoadConfig
|
||||
(defMacro trySpawnSync [command args options onError]
|
||||
`(let [command ,command
|
||||
args ,args
|
||||
options ,options
|
||||
result (ChildProcess.spawnSync command args options)]
|
||||
(if result.error
|
||||
(throw "Error $result.error from $command ${args}: $result.stdout $result.stderr")
|
||||
(case result.status
|
||||
(0 null)
|
||||
(errCode
|
||||
(,onError "Error code $errCode from $command ${args}: $result.stdout $result.stderr")
|
||||
(return))))))
|
Reference in New Issue
Block a user