diff --git a/projects/kiss-vscode-api/src/Util.kiss b/projects/kiss-vscode-api/src/Util.kiss index b5fca90b..31b47fa8 100644 --- a/projects/kiss-vscode-api/src/Util.kiss +++ b/projects/kiss-vscode-api/src/Util.kiss @@ -298,4 +298,7 @@ (otherwise (throw "Unsupported operating system"))))) (function :Void osOpenFileInDir [&opt :String dir] - (chooseFileInDir osOpenFile false dir)) \ No newline at end of file + (chooseFileInDir osOpenFile false dir)) + +(function :Void printThroughInfoMessage [] + (set Prelude.printStr ->s (infoMessage s))) \ No newline at end of file diff --git a/projects/kiss-vscode/kiss-vscode-0.0.18.vsix b/projects/kiss-vscode/kiss-vscode-0.0.18.vsix index 04bd2ba4..c255ec49 100644 Binary files a/projects/kiss-vscode/kiss-vscode-0.0.18.vsix and b/projects/kiss-vscode/kiss-vscode-0.0.18.vsix differ diff --git a/projects/kiss-vscode/package.json b/projects/kiss-vscode/package.json index e1995b0d..abf67c92 100644 --- a/projects/kiss-vscode/package.json +++ b/projects/kiss-vscode/package.json @@ -51,8 +51,8 @@ }, { "command": "kiss.insertUTestCase", - "mac": "Cmd+; Cmd+u", - "key": "Ctrl+; Ctrl+u" + "mac": "Cmd+; Cmd+t Cmd+c", + "key": "Ctrl+; Ctrl+t Ctrl+c" }, { "command": "kiss.mapLinesSync", @@ -63,6 +63,16 @@ "command": "kiss.sortLinesSync", "mac": "Cmd+; Cmd+l Cmd+s", "key": "Ctrl+; Ctrl+l Ctrl+s" + }, + { + "command": "kiss.updateExtension", + "mac": "Cmd+; Cmd+u", + "key": "Ctrl+; Ctrl+u" + }, + { + "command": "kiss.testAndUpdateExtension", + "mac": "Cmd+; Cmd+t Cmd+u", + "key": "Ctrl+; Ctrl+t Ctrl+u" } ], "commands": [ @@ -89,6 +99,14 @@ { "title": "Kiss-Vscode: Sort the selected text lines using a (String,String)->Int comparator function", "command": "kiss.sortLinesSync" + }, + { + "title": "Kiss-Vscode: Update and reinstall the Kiss-Vscode extension you are editing", + "command": "kiss.updateExtension" + }, + { + "title": "Kiss-Vscode: Check test.sh, then update and reinstall the kiss-vscode extension you are editing", + "command": "kiss.testAndUpdateExtension" } ], "languages": [ diff --git a/projects/kiss-vscode/src/Main.kiss b/projects/kiss-vscode/src/Main.kiss index 62fabc6e..bdc4aabf 100644 --- a/projects/kiss-vscode/src/Main.kiss +++ b/projects/kiss-vscode/src/Main.kiss @@ -2,6 +2,7 @@ (loadFrom "kiss-vscode-api" "src/KissUtil.kiss") (function _activate [:ExtensionContext context] + (printThroughInfoMessage) (load "commands/ExtensionTools.kiss") (load "commands/KissTools.kiss") (load "commands/Lines.kiss")) \ No newline at end of file diff --git a/projects/kiss-vscode/src/commands/ExtensionTools.kiss b/projects/kiss-vscode/src/commands/ExtensionTools.kiss index 2b3b5a03..2915f62d 100644 --- a/projects/kiss-vscode/src/commands/ExtensionTools.kiss +++ b/projects/kiss-vscode/src/commands/ExtensionTools.kiss @@ -1,7 +1,7 @@ (loadFrom "kiss-vscode-api" "src/Util.kiss") -(function kvLibpath [] (.trim (assertProcess "haxelib" ["libpath" "kiss-vscode"]))) -(function :ChildProcessSpawnSyncOptions options [] (object cwd (let [path (kvLibpath)] (path.substr 0 (- path.length 1))))) +(function extensionPath [] .fsPath .uri (first Vscode.workspace.workspaceFolders)) +(function :ChildProcessSpawnSyncOptions options [] (object cwd (extensionPath))) (function handleUpdateFailure [error] (showCompileError "Error updating Kiss-VSCode: $error") @@ -14,25 +14,20 @@ (return) }) -(function :Void updateKissVscode [&opt _] - (trySpawnSync "haxe" ["build.hxml"] (options) forceUpdateFailure) +(defCommand context kiss.updateExtension "Update and reinstall the Kiss-Vscode extension you are editing" "C-; C-u" [] (if (= "Windows" (Sys.systemName)) - { - (trySpawnSync "cmd.exe" ["/c" "npm" "install"] (options) forceUpdateFailure) - (trySpawnSync "cmd.exe" ["/c" "vsce" "package"] (options) forceUpdateFailure) - } - { - (trySpawnSync "npm" ["install"] (options) forceUpdateFailure) - (trySpawnSync "vsce" ["package"] (options) forceUpdateFailure) - }) + (trySpawnSync "cmd.exe" ["/c" "npm" "install"] (options) forceUpdateFailure) + (trySpawnSync "npm" ["install"] (options) forceUpdateFailure)) + (trySpawnSync "haxe" ["build.hxml"] (options) forceUpdateFailure) (awaitLet [_ (executeCommand "workbench.extensions.command.installFromVSIX" - (Uri.file (joinPath (kvLibpath) (last (filter (FileSystem.readDirectory (kvLibpath)) ->file (file.endsWith ".vsix"))))))] + (Uri.file (joinPath (extensionPath) (last (filter (FileSystem.readDirectory (extensionPath)) ->file (file.endsWith ".vsix"))))))] (catch [error] (handleUpdateFailure error))) - {}) + {} + null) -(function testAndUpdateKissVscode [&opt _] +(defCommand context kiss.testAndUpdateExtension "Check test.sh, then update and reinstall the kiss-vscode extension you are editing" "C-; C-t C-u" [] (trySpawnSync "test.sh" [] (options) handleUpdateFailure) - (updateKissVscode)) \ No newline at end of file + (kiss_updateExtension)) \ No newline at end of file diff --git a/projects/kiss-vscode/src/commands/KissTools.kiss b/projects/kiss-vscode/src/commands/KissTools.kiss index 109348a9..108152ef 100644 --- a/projects/kiss-vscode/src/commands/KissTools.kiss +++ b/projects/kiss-vscode/src/commands/KissTools.kiss @@ -55,7 +55,7 @@ class ${className} {} (defCommand context kiss.showCorrespondingFile "Open the corresponding .kiss/.hx file to this one" "C-; C-f" [] (showTextDocument (Uri.file (correspondingFile .fileName .document activeTextEditor)))) -(defCommand context kiss.insertUTestCase "Generate a UTest test case in this .hx/.kiss file" "C-; C-u" [] +(defCommand context kiss.insertUTestCase "Generate a UTest test case in this .hx/.kiss file" "C-; C-t C-c" [] (awaitLet [testName (inputBox) &sync testName "$(.toUpperCase (testName.substr 0 1))$(testName.substr 1)" diff --git a/projects/kiss-vscode/test.sh b/projects/kiss-vscode/test.sh index 3a272d6f..0ee8ae95 100755 --- a/projects/kiss-vscode/test.sh +++ b/projects/kiss-vscode/test.sh @@ -1,4 +1,3 @@ #! /bin/bash -# Run the build without -D test first, to make sure it works that way too: -echo "!test" && haxe build.hxml && echo "test" && haxe -D test build.hxml -cmd "node bin/extension.js" \ No newline at end of file +haxe build.hxml \ No newline at end of file