use :Void lambdas in kiss-vscode
This commit is contained in:
@@ -61,7 +61,7 @@
|
|||||||
(parser.parseString
|
(parser.parseString
|
||||||
(convertToHScript kiss))))
|
(convertToHScript kiss))))
|
||||||
|
|
||||||
(defun runCommand [&opt command]
|
(defun :Void runCommand [&opt command]
|
||||||
(if command
|
(if command
|
||||||
{(set lastCommand command) ((dictGet commands command) (selectedText))}
|
{(set lastCommand command) ((dictGet commands command) (selectedText))}
|
||||||
(let [commandList
|
(let [commandList
|
||||||
@@ -74,24 +74,20 @@
|
|||||||
alwaysShow null))]
|
alwaysShow null))]
|
||||||
(awaitLet [chosenCommand (quickPick commandList)]
|
(awaitLet [chosenCommand (quickPick commandList)]
|
||||||
(set lastCommand chosenCommand.label)
|
(set lastCommand chosenCommand.label)
|
||||||
((dictGet commands chosenCommand.label) (selectedText)))))
|
((dictGet commands chosenCommand.label) (selectedText))))))
|
||||||
(return))
|
|
||||||
|
|
||||||
(defun runLastCommand [&opt _]
|
(defun :Void runLastCommand [&opt _]
|
||||||
(if lastCommand
|
(if lastCommand
|
||||||
(runCommand lastCommand)
|
(runCommand lastCommand)
|
||||||
(errorMessage "No Kiss command was run previously."))
|
(errorMessage "No Kiss command was run previously.")))
|
||||||
(return))
|
|
||||||
|
|
||||||
(defun runKeyboardShortcut [&opt _]
|
(defun :Void runKeyboardShortcut [&opt _]
|
||||||
// TODO
|
// TODO
|
||||||
(errorMessage "Keyboard shortcut commands are not yet implemented")
|
(errorMessage "Keyboard shortcut commands are not yet implemented"))
|
||||||
(return))
|
|
||||||
|
|
||||||
(defun registerCommand [description command]
|
(defun registerCommand [description command]
|
||||||
(dictSet commands description command))
|
(dictSet commands description command))
|
||||||
|
|
||||||
(defun registerBuiltins []
|
(defun :Void registerBuiltins []
|
||||||
(registerCommand "Rerun last command" runLastCommand)
|
(registerCommand "Rerun last command" runLastCommand)
|
||||||
(registerCommand "Run a keyboard shortcut command" runKeyboardShortcut)
|
(registerCommand "Run a keyboard shortcut command" runKeyboardShortcut))
|
||||||
(return))
|
|
||||||
|
@@ -62,29 +62,26 @@
|
|||||||
(context.subscriptions.push
|
(context.subscriptions.push
|
||||||
(Vscode.commands.registerCommand
|
(Vscode.commands.registerCommand
|
||||||
"kiss.runCommand"
|
"kiss.runCommand"
|
||||||
(lambda []
|
(lambda :Void []
|
||||||
(if config
|
(if config
|
||||||
(.runCommand (the KissConfig config))
|
(.runCommand (the KissConfig config))
|
||||||
(Vscode.window.showErrorMessage "Can't run commands! No config is loaded."))
|
(Vscode.window.showErrorMessage "Can't run commands! No config is loaded.")))))
|
||||||
(return))))
|
|
||||||
|
|
||||||
(context.subscriptions.push
|
(context.subscriptions.push
|
||||||
(Vscode.commands.registerCommand
|
(Vscode.commands.registerCommand
|
||||||
"kiss.runLastCommand"
|
"kiss.runLastCommand"
|
||||||
(lambda []
|
(lambda :Void []
|
||||||
(if config
|
(if config
|
||||||
(.runLastCommand (the KissConfig config))
|
(.runLastCommand (the KissConfig config))
|
||||||
(Vscode.window.showErrorMessage "Can't run commands! No config is loaded."))
|
(Vscode.window.showErrorMessage "Can't run commands! No config is loaded.")))))
|
||||||
(return))))
|
|
||||||
|
|
||||||
(context.subscriptions.push
|
(context.subscriptions.push
|
||||||
(Vscode.commands.registerCommand
|
(Vscode.commands.registerCommand
|
||||||
"kiss.runKeyboardShortcut"
|
"kiss.runKeyboardShortcut"
|
||||||
(lambda []
|
(lambda :Void []
|
||||||
(if config
|
(if config
|
||||||
(.runKeyboardShortcut (the KissConfig config))
|
(.runKeyboardShortcut (the KissConfig config))
|
||||||
(Vscode.window.showErrorMessage "Can't run commands! No config is loaded."))
|
(Vscode.window.showErrorMessage "Can't run commands! No config is loaded.")))))
|
||||||
(return))))
|
|
||||||
|
|
||||||
// TODO overload Prelude.print to use showInformationMessage
|
// TODO overload Prelude.print to use showInformationMessage
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user