Fix kiss-vscode allowing >2 keys in shortcut
This commit is contained in:
@@ -171,8 +171,10 @@
|
|||||||
*/
|
*/
|
||||||
(defMacro defCommand [context id description shortcut argList &body body]
|
(defMacro defCommand [context id description shortcut argList &body body]
|
||||||
(let [functionName id
|
(let [functionName id
|
||||||
|
id (symbolNameValue id)
|
||||||
description (eval description)
|
description (eval description)
|
||||||
shortcut (eval shortcut)
|
shortcut (eval shortcut)
|
||||||
|
_ (assert (>= 2 .length (shortcut.split " ")) "VSCode only allows 2 keys in sequence")
|
||||||
shortcutWithHyphensProcessed
|
shortcutWithHyphensProcessed
|
||||||
(StringTools.replace
|
(StringTools.replace
|
||||||
(StringTools.replace
|
(StringTools.replace
|
||||||
|
@@ -39,11 +39,6 @@
|
|||||||
"mac": "Cmd+; Cmd+u",
|
"mac": "Cmd+; Cmd+u",
|
||||||
"key": "Ctrl+; Ctrl+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",
|
"command": "kiss-vscode.evalAndPrint",
|
||||||
"mac": "Cmd+; Cmd+e",
|
"mac": "Cmd+; Cmd+e",
|
||||||
@@ -51,8 +46,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "kiss-vscode.newKissClass",
|
"command": "kiss-vscode.newKissClass",
|
||||||
"mac": "Cmd+; Cmd+c",
|
"mac": "Cmd+; Cmd+n",
|
||||||
"key": "Ctrl+; Ctrl+c"
|
"key": "Ctrl+; Ctrl+n"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "kiss-vscode.showCorrespondingFile",
|
"command": "kiss-vscode.showCorrespondingFile",
|
||||||
@@ -61,58 +56,18 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "kiss-vscode.insertUTestCase",
|
"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",
|
"mac": "Cmd+; Cmd+c",
|
||||||
"key": "Ctrl+; Ctrl+c"
|
"key": "Ctrl+; Ctrl+c"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "kiss-vscode.{pos: {column: 21, line: 55, absoluteChar: 2420, file: src/commands/KissTools.kiss}, def: Symbol(showCorrespondingFile)}",
|
"command": "kiss-vscode.mapLinesSync",
|
||||||
"mac": "Cmd+; Cmd+f",
|
"mac": "Cmd+; Cmd+m",
|
||||||
"key": "Ctrl+; Ctrl+f"
|
"key": "Ctrl+; Ctrl+m"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "kiss-vscode.{pos: {column: 21, line: 58, absoluteChar: 2620, file: src/commands/KissTools.kiss}, def: Symbol(insertUTestCase)}",
|
"command": "kiss-vscode.sortLinesSync",
|
||||||
"mac": "Cmd+; Cmd+t Cmd+c",
|
"mac": "Cmd+; Cmd+s",
|
||||||
"key": "Ctrl+; Ctrl+t Ctrl+c"
|
"key": "Ctrl+; Ctrl+s"
|
||||||
},
|
|
||||||
{
|
|
||||||
"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"
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"commands": [
|
"commands": [
|
||||||
@@ -147,38 +102,6 @@
|
|||||||
{
|
{
|
||||||
"title": "kiss-vscode: Sort the selected text lines using a (String,String)->Int comparator function",
|
"title": "kiss-vscode: Sort the selected text lines using a (String,String)->Int comparator function",
|
||||||
"command": "kiss-vscode.sortLinesSync"
|
"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": [
|
"languages": [
|
||||||
|
@@ -28,6 +28,6 @@
|
|||||||
{}
|
{}
|
||||||
null)
|
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)
|
(trySpawnSync "test.sh" [] (options) handleUpdateFailure)
|
||||||
(updateExtension))
|
(updateExtension))
|
@@ -3,7 +3,7 @@
|
|||||||
(withValueOrInputEditor st "kiss.evalAndPrint" "A kiss expression to evaluate"
|
(withValueOrInputEditor st "kiss.evalAndPrint" "A kiss expression to evaluate"
|
||||||
(infoMessage (Std.string (evalString st))))))
|
(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)]
|
(awaitLet [className (inputBox)]
|
||||||
(when className
|
(when className
|
||||||
(let [currentFile
|
(let [currentFile
|
||||||
@@ -55,7 +55,7 @@ class ${className} {}
|
|||||||
(defCommand context showCorrespondingFile "Open the corresponding .kiss/.hx file to this one" "C-; C-f" []
|
(defCommand context showCorrespondingFile "Open the corresponding .kiss/.hx file to this one" "C-; C-f" []
|
||||||
(showTextDocument (Uri.file (correspondingFile .fileName .document activeTextEditor))))
|
(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)
|
(awaitLet [testName (inputBox)
|
||||||
&sync testName
|
&sync testName
|
||||||
"$(.toUpperCase (testName.substr 0 1))$(testName.substr 1)"
|
"$(.toUpperCase (testName.substr 0 1))$(testName.substr 1)"
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
(e.delete editor.selection)
|
(e.delete editor.selection)
|
||||||
(e.insert editor.selection.active mappedText))))))
|
(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")]
|
(awaitLet [mapFuncStr (inputEditor "mapLinesFunc.kiss" "a String->String function through which to map the selected lines")]
|
||||||
(let [:String->String mapFunc (evalString mapFuncStr)]
|
(let [:String->String mapFunc (evalString mapFuncStr)]
|
||||||
(_mapLinesSync (selectedText) mapFunc))))
|
(_mapLinesSync (selectedText) mapFunc))))
|
||||||
@@ -30,6 +30,6 @@
|
|||||||
(e.delete editor.selection)
|
(e.delete editor.selection)
|
||||||
(e.insert editor.selection.active (lines.join "\n")))))))
|
(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")]
|
(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))))
|
(_sortLinesSync (selectedText) (if (< 0 compareFuncStr.length) (evalString compareFuncStr) Reflect.compare))))
|
Reference in New Issue
Block a user