diff --git a/projects/kiss-vscode-api/src/Util.kiss b/projects/kiss-vscode-api/src/Util.kiss index b570784f..1c8d59ad 100644 --- a/projects/kiss-vscode-api/src/Util.kiss +++ b/projects/kiss-vscode-api/src/Util.kiss @@ -171,8 +171,10 @@ */ (defMacro defCommand [context id description shortcut argList &body body] (let [functionName id + id (symbolNameValue id) description (eval description) shortcut (eval shortcut) + _ (assert (>= 2 .length (shortcut.split " ")) "VSCode only allows 2 keys in sequence") shortcutWithHyphensProcessed (StringTools.replace (StringTools.replace diff --git a/projects/kiss-vscode/package.json b/projects/kiss-vscode/package.json index 71c12e7b..7cbbba3c 100644 --- a/projects/kiss-vscode/package.json +++ b/projects/kiss-vscode/package.json @@ -39,11 +39,6 @@ "mac": "Cmd+; Cmd+u", "key": "Ctrl+; Ctrl+u" }, - { - "command": "kiss-vscode.testAndUpdateExtension", - "mac": "Cmd+; Cmd+t Cmd+u", - "key": "Ctrl+; Ctrl+t Ctrl+u" - }, { "command": "kiss-vscode.evalAndPrint", "mac": "Cmd+; Cmd+e", @@ -51,8 +46,8 @@ }, { "command": "kiss-vscode.newKissClass", - "mac": "Cmd+; Cmd+c", - "key": "Ctrl+; Ctrl+c" + "mac": "Cmd+; Cmd+n", + "key": "Ctrl+; Ctrl+n" }, { "command": "kiss-vscode.showCorrespondingFile", @@ -61,58 +56,18 @@ }, { "command": "kiss-vscode.insertUTestCase", - "mac": "Cmd+; Cmd+t Cmd+c", - "key": "Ctrl+; Ctrl+t Ctrl+c" - }, - { - "command": "kiss-vscode.mapLinesSync", - "mac": "Cmd+; Cmd+l Cmd+m", - "key": "Ctrl+; Ctrl+l Ctrl+m" - }, - { - "command": "kiss-vscode.sortLinesSync", - "mac": "Cmd+; Cmd+l Cmd+s", - "key": "Ctrl+; Ctrl+l Ctrl+s" - }, - { - "command": "kiss-vscode.{pos: {column: 21, line: 17, absoluteChar: 470, file: src/commands/ExtensionTools.kiss}, def: Symbol(updateExtension)}", - "mac": "Cmd+; Cmd+u", - "key": "Ctrl+; Ctrl+u" - }, - { - "command": "kiss-vscode.{pos: {column: 21, line: 31, absoluteChar: 1216, file: src/commands/ExtensionTools.kiss}, def: Symbol(testAndUpdateExtension)}", - "mac": "Cmd+; Cmd+t Cmd+u", - "key": "Ctrl+; Ctrl+t Ctrl+u" - }, - { - "command": "kiss-vscode.{pos: {column: 21, line: 1, absoluteChar: 20, file: src/commands/KissTools.kiss}, def: Symbol(evalAndPrint)}", - "mac": "Cmd+; Cmd+e", - "key": "Ctrl+; Ctrl+e" - }, - { - "command": "kiss-vscode.{pos: {column: 21, line: 6, absoluteChar: 288, file: src/commands/KissTools.kiss}, def: Symbol(newKissClass)}", "mac": "Cmd+; Cmd+c", "key": "Ctrl+; Ctrl+c" }, { - "command": "kiss-vscode.{pos: {column: 21, line: 55, absoluteChar: 2420, file: src/commands/KissTools.kiss}, def: Symbol(showCorrespondingFile)}", - "mac": "Cmd+; Cmd+f", - "key": "Ctrl+; Ctrl+f" + "command": "kiss-vscode.mapLinesSync", + "mac": "Cmd+; Cmd+m", + "key": "Ctrl+; Ctrl+m" }, { - "command": "kiss-vscode.{pos: {column: 21, line: 58, absoluteChar: 2620, file: src/commands/KissTools.kiss}, def: Symbol(insertUTestCase)}", - "mac": "Cmd+; Cmd+t Cmd+c", - "key": "Ctrl+; Ctrl+t Ctrl+c" - }, - { - "command": "kiss-vscode.{pos: {column: 21, line: 18, absoluteChar: 786, file: src/commands/Lines.kiss}, def: Symbol(mapLinesSync)}", - "mac": "Cmd+; Cmd+l Cmd+m", - "key": "Ctrl+; Ctrl+l Ctrl+m" - }, - { - "command": "kiss-vscode.{pos: {column: 21, line: 33, absoluteChar: 1609, file: src/commands/Lines.kiss}, def: Symbol(sortLinesSync)}", - "mac": "Cmd+; Cmd+l Cmd+s", - "key": "Ctrl+; Ctrl+l Ctrl+s" + "command": "kiss-vscode.sortLinesSync", + "mac": "Cmd+; Cmd+s", + "key": "Ctrl+; Ctrl+s" } ], "commands": [ @@ -147,38 +102,6 @@ { "title": "kiss-vscode: Sort the selected text lines using a (String,String)->Int comparator function", "command": "kiss-vscode.sortLinesSync" - }, - { - "title": "kiss-vscode: Update and reinstall the Kiss-Vscode extension you are editing", - "command": "kiss-vscode.{pos: {column: 21, line: 17, absoluteChar: 470, file: src/commands/ExtensionTools.kiss}, def: Symbol(updateExtension)}" - }, - { - "title": "kiss-vscode: Check test.sh, then update and reinstall the kiss-vscode extension you are editing", - "command": "kiss-vscode.{pos: {column: 21, line: 31, absoluteChar: 1216, file: src/commands/ExtensionTools.kiss}, def: Symbol(testAndUpdateExtension)}" - }, - { - "title": "kiss-vscode: Evaluate and print a kiss expression's value", - "command": "kiss-vscode.{pos: {column: 21, line: 1, absoluteChar: 20, file: src/commands/KissTools.kiss}, def: Symbol(evalAndPrint)}" - }, - { - "title": "kiss-vscode: Create a new kiss class", - "command": "kiss-vscode.{pos: {column: 21, line: 6, absoluteChar: 288, file: src/commands/KissTools.kiss}, def: Symbol(newKissClass)}" - }, - { - "title": "kiss-vscode: Open the corresponding .kiss/.hx file to this one", - "command": "kiss-vscode.{pos: {column: 21, line: 55, absoluteChar: 2420, file: src/commands/KissTools.kiss}, def: Symbol(showCorrespondingFile)}" - }, - { - "title": "kiss-vscode: Generate a UTest test case in this .hx/.kiss file", - "command": "kiss-vscode.{pos: {column: 21, line: 58, absoluteChar: 2620, file: src/commands/KissTools.kiss}, def: Symbol(insertUTestCase)}" - }, - { - "title": "kiss-vscode: Transform the selected text lines using a String->String kiss function", - "command": "kiss-vscode.{pos: {column: 21, line: 18, absoluteChar: 786, file: src/commands/Lines.kiss}, def: Symbol(mapLinesSync)}" - }, - { - "title": "kiss-vscode: Sort the selected text lines using a (String,String)->Int comparator function", - "command": "kiss-vscode.{pos: {column: 21, line: 33, absoluteChar: 1609, file: src/commands/Lines.kiss}, def: Symbol(sortLinesSync)}" } ], "languages": [ diff --git a/projects/kiss-vscode/src/commands/ExtensionTools.kiss b/projects/kiss-vscode/src/commands/ExtensionTools.kiss index b55e17fd..d2f5c44a 100644 --- a/projects/kiss-vscode/src/commands/ExtensionTools.kiss +++ b/projects/kiss-vscode/src/commands/ExtensionTools.kiss @@ -28,6 +28,6 @@ {} null) -(defCommand context testAndUpdateExtension "Check test.sh, then update and reinstall the kiss-vscode extension you are editing" "C-; C-t C-u" [] +(defCommand context testAndUpdateExtension "Check test.sh, then update and reinstall the kiss-vscode extension you are editing" "" [] (trySpawnSync "test.sh" [] (options) handleUpdateFailure) (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 1f06adef..7da6a5dd 100644 --- a/projects/kiss-vscode/src/commands/KissTools.kiss +++ b/projects/kiss-vscode/src/commands/KissTools.kiss @@ -3,7 +3,7 @@ (withValueOrInputEditor st "kiss.evalAndPrint" "A kiss expression to evaluate" (infoMessage (Std.string (evalString st)))))) -(defCommand context newKissClass "Create a new kiss class" "C-; C-c" [] +(defCommand context newKissClass "Create a new kiss class" "C-; C-n" [] (awaitLet [className (inputBox)] (when className (let [currentFile @@ -55,7 +55,7 @@ class ${className} {} (defCommand context showCorrespondingFile "Open the corresponding .kiss/.hx file to this one" "C-; C-f" [] (showTextDocument (Uri.file (correspondingFile .fileName .document activeTextEditor)))) -(defCommand context insertUTestCase "Generate a UTest test case in this .hx/.kiss file" "C-; C-t C-c" [] +(defCommand context insertUTestCase "Generate a UTest test case in this .hx/.kiss file" "C-; C-c" [] (awaitLet [testName (inputBox) &sync testName "$(.toUpperCase (testName.substr 0 1))$(testName.substr 1)" diff --git a/projects/kiss-vscode/src/commands/Lines.kiss b/projects/kiss-vscode/src/commands/Lines.kiss index b7558ecf..4c42870b 100644 --- a/projects/kiss-vscode/src/commands/Lines.kiss +++ b/projects/kiss-vscode/src/commands/Lines.kiss @@ -15,7 +15,7 @@ (e.delete editor.selection) (e.insert editor.selection.active mappedText)))))) -(defCommand context mapLinesSync "Transform the selected text lines using a String->String kiss function" "C-; C-l C-m" [] +(defCommand context mapLinesSync "Transform the selected text lines using a String->String kiss function" "C-; C-m" [] (awaitLet [mapFuncStr (inputEditor "mapLinesFunc.kiss" "a String->String function through which to map the selected lines")] (let [:String->String mapFunc (evalString mapFuncStr)] (_mapLinesSync (selectedText) mapFunc)))) @@ -30,6 +30,6 @@ (e.delete editor.selection) (e.insert editor.selection.active (lines.join "\n"))))))) -(defCommand context sortLinesSync "Sort the selected text lines using a (String,String)->Int comparator function" "C-; C-l C-s" [] +(defCommand context sortLinesSync "Sort the selected text lines using a (String,String)->Int comparator function" "C-; C-s" [] (awaitLet [compareFuncStr (inputEditor "sortLinesFunc.kiss" "a (String,String) -> Int function with which to sort the selected lines")] (_sortLinesSync (selectedText) (if (< 0 compareFuncStr.length) (evalString compareFuncStr) Reflect.compare)))) \ No newline at end of file