defCommand don't require prefix on id
This commit is contained in:
@@ -167,11 +167,10 @@
|
|||||||
|
|
||||||
// Example:
|
// Example:
|
||||||
/*
|
/*
|
||||||
(defCommand myExt.customCommand "Custom command that does something" "C-; C-c" [<args...>] <body...>)
|
(defCommand customCommand "Custom command that does something" "C-; C-c" [<args...>] <body...>)
|
||||||
*/
|
*/
|
||||||
(defMacroVar extensionName "Kiss-Vscode")
|
|
||||||
(defMacro defCommand [context id description shortcut argList &body body]
|
(defMacro defCommand [context id description shortcut argList &body body]
|
||||||
(let [id (symbolNameValue id)
|
(let [functionName id
|
||||||
description (eval description)
|
description (eval description)
|
||||||
shortcut (eval shortcut)
|
shortcut (eval shortcut)
|
||||||
shortcutWithHyphensProcessed
|
shortcutWithHyphensProcessed
|
||||||
@@ -188,12 +187,14 @@
|
|||||||
"++" "-+")
|
"++" "-+")
|
||||||
packageJson
|
packageJson
|
||||||
(Json.parse (File.getContent "package.json"))
|
(Json.parse (File.getContent "package.json"))
|
||||||
|
extensionName
|
||||||
|
packageJson.name
|
||||||
keybindings
|
keybindings
|
||||||
packageJson.contributes.keybindings
|
packageJson.contributes.keybindings
|
||||||
commands
|
commands
|
||||||
packageJson.contributes.commands
|
packageJson.contributes.commands
|
||||||
functionName
|
id
|
||||||
(symbol (StringTools.replace id "." "_"))
|
"${extensionName}.${id}"
|
||||||
&mut keyBindingIndex null
|
&mut keyBindingIndex null
|
||||||
&mut commandIndex null]
|
&mut commandIndex null]
|
||||||
(doFor [idx binding] (enumerate keybindings)
|
(doFor [idx binding] (enumerate keybindings)
|
||||||
|
@@ -35,78 +35,150 @@
|
|||||||
],
|
],
|
||||||
"keybindings": [
|
"keybindings": [
|
||||||
{
|
{
|
||||||
"command": "kiss.evalAndPrint",
|
"command": "kiss-vscode.updateExtension",
|
||||||
"mac": "Cmd+; Cmd+e",
|
|
||||||
"key": "Ctrl+; Ctrl+e"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command": "kiss.newKissClass",
|
|
||||||
"mac": "Cmd+; Cmd+c",
|
|
||||||
"key": "Ctrl+; Ctrl+c"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command": "kiss.showCorrespondingFile",
|
|
||||||
"mac": "Cmd+; Cmd+f",
|
|
||||||
"key": "Ctrl+; Ctrl+f"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command": "kiss.insertUTestCase",
|
|
||||||
"mac": "Cmd+; Cmd+t Cmd+c",
|
|
||||||
"key": "Ctrl+; Ctrl+t Ctrl+c"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command": "kiss.mapLinesSync",
|
|
||||||
"mac": "Cmd+; Cmd+l Cmd+m",
|
|
||||||
"key": "Ctrl+; Ctrl+l Ctrl+m"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command": "kiss.sortLinesSync",
|
|
||||||
"mac": "Cmd+; Cmd+l Cmd+s",
|
|
||||||
"key": "Ctrl+; Ctrl+l Ctrl+s"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"command": "kiss.updateExtension",
|
|
||||||
"mac": "Cmd+; Cmd+u",
|
"mac": "Cmd+; Cmd+u",
|
||||||
"key": "Ctrl+; Ctrl+u"
|
"key": "Ctrl+; Ctrl+u"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"command": "kiss.testAndUpdateExtension",
|
"command": "kiss-vscode.testAndUpdateExtension",
|
||||||
"mac": "Cmd+; Cmd+t Cmd+u",
|
"mac": "Cmd+; Cmd+t Cmd+u",
|
||||||
"key": "Ctrl+; Ctrl+t Ctrl+u"
|
"key": "Ctrl+; Ctrl+t Ctrl+u"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "kiss-vscode.evalAndPrint",
|
||||||
|
"mac": "Cmd+; Cmd+e",
|
||||||
|
"key": "Ctrl+; Ctrl+e"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "kiss-vscode.newKissClass",
|
||||||
|
"mac": "Cmd+; Cmd+c",
|
||||||
|
"key": "Ctrl+; Ctrl+c"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"command": "kiss-vscode.showCorrespondingFile",
|
||||||
|
"mac": "Cmd+; Cmd+f",
|
||||||
|
"key": "Ctrl+; Ctrl+f"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"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.{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"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"commands": [
|
"commands": [
|
||||||
{
|
{
|
||||||
"title": "Kiss-Vscode: Evaluate and print a kiss expression's value",
|
"title": "kiss-vscode: Update and reinstall the Kiss-Vscode extension you are editing",
|
||||||
"command": "kiss.evalAndPrint"
|
"command": "kiss-vscode.updateExtension"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": "Kiss-Vscode: Create a new kiss class",
|
"title": "kiss-vscode: Check test.sh, then update and reinstall the kiss-vscode extension you are editing",
|
||||||
"command": "kiss.newKissClass"
|
"command": "kiss-vscode.testAndUpdateExtension"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": "Kiss-Vscode: Open the corresponding .kiss/.hx file to this one",
|
"title": "kiss-vscode: Evaluate and print a kiss expression's value",
|
||||||
"command": "kiss.showCorrespondingFile"
|
"command": "kiss-vscode.evalAndPrint"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": "Kiss-Vscode: Generate a UTest test case in this .hx/.kiss file",
|
"title": "kiss-vscode: Create a new kiss class",
|
||||||
"command": "kiss.insertUTestCase"
|
"command": "kiss-vscode.newKissClass"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": "Kiss-Vscode: Transform the selected text lines using a String->String kiss function",
|
"title": "kiss-vscode: Open the corresponding .kiss/.hx file to this one",
|
||||||
"command": "kiss.mapLinesSync"
|
"command": "kiss-vscode.showCorrespondingFile"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": "Kiss-Vscode: Sort the selected text lines using a (String,String)->Int comparator function",
|
"title": "kiss-vscode: Generate a UTest test case in this .hx/.kiss file",
|
||||||
"command": "kiss.sortLinesSync"
|
"command": "kiss-vscode.insertUTestCase"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": "Kiss-Vscode: Update and reinstall the Kiss-Vscode extension you are editing",
|
"title": "kiss-vscode: Transform the selected text lines using a String->String kiss function",
|
||||||
"command": "kiss.updateExtension"
|
"command": "kiss-vscode.mapLinesSync"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"title": "Kiss-Vscode: Check test.sh, then update and reinstall the kiss-vscode extension you are editing",
|
"title": "kiss-vscode: Sort the selected text lines using a (String,String)->Int comparator function",
|
||||||
"command": "kiss.testAndUpdateExtension"
|
"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": [
|
||||||
|
@@ -14,7 +14,7 @@
|
|||||||
(return)
|
(return)
|
||||||
})
|
})
|
||||||
|
|
||||||
(defCommand context kiss.updateExtension "Update and reinstall the Kiss-Vscode extension you are editing" "C-; C-u" []
|
(defCommand context updateExtension "Update and reinstall the Kiss-Vscode extension you are editing" "C-; C-u" []
|
||||||
(if (= "Windows" (Sys.systemName))
|
(if (= "Windows" (Sys.systemName))
|
||||||
(trySpawnSync "cmd.exe" ["/c" "npm" "install"] (options) forceUpdateFailure)
|
(trySpawnSync "cmd.exe" ["/c" "npm" "install"] (options) forceUpdateFailure)
|
||||||
(trySpawnSync "npm" ["install"] (options) forceUpdateFailure))
|
(trySpawnSync "npm" ["install"] (options) forceUpdateFailure))
|
||||||
@@ -28,6 +28,6 @@
|
|||||||
{}
|
{}
|
||||||
null)
|
null)
|
||||||
|
|
||||||
(defCommand context kiss.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" "C-; C-t C-u" []
|
||||||
(trySpawnSync "test.sh" [] (options) handleUpdateFailure)
|
(trySpawnSync "test.sh" [] (options) handleUpdateFailure)
|
||||||
(kiss_updateExtension))
|
(updateExtension))
|
@@ -1,9 +1,9 @@
|
|||||||
(defCommand context kiss.evalAndPrint "Evaluate and print a kiss expression's value" "C-; C-e" []
|
(defCommand context evalAndPrint "Evaluate and print a kiss expression's value" "C-; C-e" []
|
||||||
(let [st (selectedText)]
|
(let [st (selectedText)]
|
||||||
(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 kiss.newKissClass "Create a new kiss class" "C-; C-c" []
|
(defCommand context newKissClass "Create a new kiss class" "C-; C-c" []
|
||||||
(awaitLet [className (inputBox)]
|
(awaitLet [className (inputBox)]
|
||||||
(when className
|
(when className
|
||||||
(let [currentFile
|
(let [currentFile
|
||||||
@@ -52,10 +52,10 @@ class ${className} {}
|
|||||||
(otherwise (throw "No corresponding file for ${kissOrHxFile}")))]
|
(otherwise (throw "No corresponding file for ${kissOrHxFile}")))]
|
||||||
"${base}.${correspondingExt}"))
|
"${base}.${correspondingExt}"))
|
||||||
|
|
||||||
(defCommand context kiss.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 kiss.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-t 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 kiss.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-l 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 kiss.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-l 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