kiss-vscode add extensionPath variable to KissConfig

This commit is contained in:
2022-02-01 13:01:38 -07:00
parent 8c6ff83f5c
commit 83a0e23c32
3 changed files with 8 additions and 0 deletions

View File

@@ -34,6 +34,7 @@
(var &mut :String lastCommand null) (var &mut :String lastCommand null)
(var parser (new Parser)) (var parser (new Parser))
(var interp (new Interp)) (var interp (new Interp))
(var &mut :String extensionPath "")
/** /**
* Functionality * Functionality
@@ -269,6 +270,9 @@
random Std.random random Std.random
int Std.int))) int Std.int)))
// Way to more forgivingly get long text inputs
// (function :Promise<String> inputEditor [:String filename :String prompt] )
(#unless test (#unless test
(var :Array<KTxt2Conversion> conversions []) (var :Array<KTxt2Conversion> conversions [])

View File

@@ -26,6 +26,7 @@ typedef KissConfig = {
runLastCommand:Command, runLastCommand:Command,
runKeyboardShortcut:Command, runKeyboardShortcut:Command,
tryLoadConfig:Command, tryLoadConfig:Command,
extensionPath:String,
#if !test #if !test
conversions:Array<KTxt2Conversion>, conversions:Array<KTxt2Conversion>,
#end #end

View File

@@ -107,18 +107,21 @@
(requireConfigJs activeConfigFile) (requireConfigJs activeConfigFile)
(Vscode.window.showInformationMessage "Config loaded successfully!")))))) (Vscode.window.showInformationMessage "Config loaded successfully!"))))))
(var &mut extensionPath "")
(function requireConfigJs [file] (function requireConfigJs [file]
(let [uniqueConfigFile (joinPath activeConfigDir "$(.toShort (Uuid.v4)).js")] (let [uniqueConfigFile (joinPath activeConfigDir "$(.toShort (Uuid.v4)).js")]
(File.copy file uniqueConfigFile) (File.copy file uniqueConfigFile)
(set config (the KissConfig .KissConfig (Node.require uniqueConfigFile))) (set config (the KissConfig .KissConfig (Node.require uniqueConfigFile)))
(set Prelude.printStr ->:Void s (Vscode.window.showInformationMessage s)) (set Prelude.printStr ->:Void s (Vscode.window.showInformationMessage s))
(set config.tryLoadConfig ->[&opt _] (tryLoadConfig true false)) (set config.tryLoadConfig ->[&opt _] (tryLoadConfig true false))
(set config.extensionPath extensionPath)
(config.prepareInterp) (config.prepareInterp)
// User-defined init: // User-defined init:
(config.init))) (config.init)))
(#unless test (#unless test
(function _activate [:ExtensionContext context] (function _activate [:ExtensionContext context]
(set extensionPath context.extensionPath)
(context.subscriptions.push (context.subscriptions.push
(Vscode.commands.registerCommand (Vscode.commands.registerCommand
"kiss.reloadConfig" "kiss.reloadConfig"