force reload config.kiss when kicked as command
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
(var &mut commandsDir "")
|
||||
(var &mut :KissConfig config null)
|
||||
|
||||
(function :Void tryLoadConfig [&opt :Bool fallbackToDefault :String _]
|
||||
(function :Void tryLoadConfig [&opt :Bool force :Bool fallbackToDefault :String _]
|
||||
(let [handleConfigFailure
|
||||
->errorMessage {
|
||||
(FileSystem.deleteDirectory activeConfigDir)
|
||||
@@ -50,21 +50,22 @@
|
||||
// If there is an active config folder from a previous session, that is still up-to-date,
|
||||
// skip re-compilation and just use it
|
||||
(#unless test
|
||||
(let [oldConfigFile (joinPath activeConfigDir "config.js")]
|
||||
(when (let [mTime
|
||||
->file (.getTime .mtime (FileSystem.stat file))
|
||||
oldFileMTime
|
||||
(mTime oldConfigFile)
|
||||
userConfigMTime
|
||||
(let [foldersToCheck [(userConfigDir) builtinConfigDir]]
|
||||
(when commandsDir
|
||||
(foldersToCheck.push commandsDir))
|
||||
(apply max
|
||||
(map (apply concat (map foldersToCheck readDirectory)) mTime)))]
|
||||
(> oldFileMTime userConfigMTime))
|
||||
(requireConfigJs oldConfigFile)
|
||||
(Vscode.window.showInformationMessage "Config loaded successfully!")
|
||||
(return))))
|
||||
(unless force
|
||||
(let [oldConfigFile (joinPath activeConfigDir "config.js")]
|
||||
(when (let [mTime
|
||||
->file (.getTime .mtime (FileSystem.stat file))
|
||||
oldFileMTime
|
||||
(mTime oldConfigFile)
|
||||
userConfigMTime
|
||||
(let [foldersToCheck [(userConfigDir) builtinConfigDir]]
|
||||
(when commandsDir
|
||||
(foldersToCheck.push commandsDir))
|
||||
(apply max
|
||||
(map (apply concat (map foldersToCheck readDirectory)) mTime)))]
|
||||
(> oldFileMTime userConfigMTime))
|
||||
(requireConfigJs oldConfigFile)
|
||||
(Vscode.window.showInformationMessage "Config loaded successfully!")
|
||||
(return)))))
|
||||
// Backup currently active config
|
||||
(FileSystem.rename activeConfigDir lastConfigDir))
|
||||
|
||||
@@ -111,7 +112,7 @@
|
||||
(File.copy file uniqueConfigFile)
|
||||
(set config (the KissConfig .KissConfig (Node.require uniqueConfigFile)))
|
||||
(set Prelude.printStr ->:Void s (Vscode.window.showInformationMessage s))
|
||||
(set config.tryLoadConfig ->[&opt _] (tryLoadConfig false))
|
||||
(set config.tryLoadConfig ->[&opt _] (tryLoadConfig true false))
|
||||
(config.prepareInterp)
|
||||
// User-defined init:
|
||||
(config.init)))
|
||||
@@ -121,8 +122,7 @@
|
||||
(context.subscriptions.push
|
||||
(Vscode.commands.registerCommand
|
||||
"kiss.reloadConfig"
|
||||
tryLoadConfig))
|
||||
|
||||
->(tryLoadConfig true)))
|
||||
(context.subscriptions.push
|
||||
(Vscode.commands.registerCommand
|
||||
"kiss.runCommand"
|
||||
|
Reference in New Issue
Block a user