[vscode] refactor some things
This commit is contained in:
@@ -259,7 +259,6 @@ class Prelude {
|
|||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO Kiss-Vscode should overload print with infoMessage()
|
|
||||||
public static dynamic function print<T>(v:T):T {
|
public static dynamic function print<T>(v:T):T {
|
||||||
#if (sys || hxnodejs)
|
#if (sys || hxnodejs)
|
||||||
Sys.println(v);
|
Sys.println(v);
|
||||||
|
|||||||
@@ -119,7 +119,6 @@
|
|||||||
|
|
||||||
(defun :Void registerShortcut [keys description &opt :Map<String,ShortcutKey> prefixMap]
|
(defun :Void registerShortcut [keys description &opt :Map<String,ShortcutKey> prefixMap]
|
||||||
(unless prefixMap (set prefixMap commandShortcuts))
|
(unless prefixMap (set prefixMap commandShortcuts))
|
||||||
(print keys)
|
|
||||||
(let [firstKey (keys.shift)]
|
(let [firstKey (keys.shift)]
|
||||||
(cond
|
(cond
|
||||||
((prefixMap.exists firstKey)
|
((prefixMap.exists firstKey)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
(.replace (.replace (.toString (Date.now)) ":" "-") " " "-"))
|
(.replace (.replace (.toString (Date.now)) ":" "-") " " "-"))
|
||||||
|
|
||||||
(defvar &mut activeConfigDir "")
|
(defvar &mut activeConfigDir "")
|
||||||
(defvar &mut :Dynamic config null)
|
(defvar &mut :KissConfig config null)
|
||||||
|
|
||||||
(defun :Void tryLoadConfig [&opt :String text]
|
(defun :Void tryLoadConfig [&opt :String text]
|
||||||
(let [activeConfigPath (Path.join [activeConfigDir "config.js"])
|
(let [activeConfigPath (Path.join [activeConfigDir "config.js"])
|
||||||
@@ -36,13 +36,13 @@
|
|||||||
(let [activeConfigFile (Path.join [activeConfigDir "config.js"])
|
(let [activeConfigFile (Path.join [activeConfigDir "config.js"])
|
||||||
uniqueConfigFile (Path.join [activeConfigDir "$(.toShort (Uuid.v4)).js"])]
|
uniqueConfigFile (Path.join [activeConfigDir "$(.toShort (Uuid.v4)).js"])]
|
||||||
(File.copy activeConfigFile uniqueConfigFile)
|
(File.copy activeConfigFile uniqueConfigFile)
|
||||||
(set config .KissConfig (Node.require uniqueConfigFile))
|
(set config (the KissConfig .KissConfig (Node.require uniqueConfigFile)))
|
||||||
// (FileSystem.deleteFile uniqueConfigFile)
|
// (FileSystem.deleteFile uniqueConfigFile)
|
||||||
(.registerBuiltins (the KissConfig config))
|
(config.registerBuiltins)
|
||||||
(.registerCommand (the KissConfig config) "Reload Kiss config" tryLoadConfig)
|
(config.registerCommand "Reload Kiss config" tryLoadConfig)
|
||||||
(.prepareInterp (the KissConfig config))
|
(config.prepareInterp)
|
||||||
// User-defined init:
|
// User-defined init:
|
||||||
(.init (the KissConfig config))
|
(config.init)
|
||||||
(Vscode.window.showInformationMessage "Config loaded successfully!"))
|
(Vscode.window.showInformationMessage "Config loaded successfully!"))
|
||||||
// If there's a build error, restore the config.js backup
|
// If there's a build error, restore the config.js backup
|
||||||
(begin
|
(begin
|
||||||
|
|||||||
Reference in New Issue
Block a user