From 023648b90e46da9e95c2fb8f60526e3cbc65288e Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Wed, 17 Mar 2021 11:21:52 -0600 Subject: [PATCH] use :Void lambdas in kiss-vscode --- projects/kiss-vscode/config/KissConfig.kiss | 20 ++++++++------------ projects/kiss-vscode/src/Main.kiss | 15 ++++++--------- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/projects/kiss-vscode/config/KissConfig.kiss b/projects/kiss-vscode/config/KissConfig.kiss index 9235ecb6..a2337306 100644 --- a/projects/kiss-vscode/config/KissConfig.kiss +++ b/projects/kiss-vscode/config/KissConfig.kiss @@ -61,7 +61,7 @@ (parser.parseString (convertToHScript kiss)))) -(defun runCommand [&opt command] +(defun :Void runCommand [&opt command] (if command {(set lastCommand command) ((dictGet commands command) (selectedText))} (let [commandList @@ -74,24 +74,20 @@ alwaysShow null))] (awaitLet [chosenCommand (quickPick commandList)] (set lastCommand chosenCommand.label) - ((dictGet commands chosenCommand.label) (selectedText))))) - (return)) + ((dictGet commands chosenCommand.label) (selectedText)))))) -(defun runLastCommand [&opt _] +(defun :Void runLastCommand [&opt _] (if lastCommand (runCommand lastCommand) - (errorMessage "No Kiss command was run previously.")) - (return)) + (errorMessage "No Kiss command was run previously."))) -(defun runKeyboardShortcut [&opt _] +(defun :Void runKeyboardShortcut [&opt _] // TODO - (errorMessage "Keyboard shortcut commands are not yet implemented") - (return)) + (errorMessage "Keyboard shortcut commands are not yet implemented")) (defun registerCommand [description command] (dictSet commands description command)) -(defun registerBuiltins [] +(defun :Void registerBuiltins [] (registerCommand "Rerun last command" runLastCommand) - (registerCommand "Run a keyboard shortcut command" runKeyboardShortcut) - (return)) + (registerCommand "Run a keyboard shortcut command" runKeyboardShortcut)) diff --git a/projects/kiss-vscode/src/Main.kiss b/projects/kiss-vscode/src/Main.kiss index 2d242294..69833546 100644 --- a/projects/kiss-vscode/src/Main.kiss +++ b/projects/kiss-vscode/src/Main.kiss @@ -62,29 +62,26 @@ (context.subscriptions.push (Vscode.commands.registerCommand "kiss.runCommand" - (lambda [] + (lambda :Void [] (if config (.runCommand (the KissConfig config)) - (Vscode.window.showErrorMessage "Can't run commands! No config is loaded.")) - (return)))) + (Vscode.window.showErrorMessage "Can't run commands! No config is loaded."))))) (context.subscriptions.push (Vscode.commands.registerCommand "kiss.runLastCommand" - (lambda [] + (lambda :Void [] (if config (.runLastCommand (the KissConfig config)) - (Vscode.window.showErrorMessage "Can't run commands! No config is loaded.")) - (return)))) + (Vscode.window.showErrorMessage "Can't run commands! No config is loaded."))))) (context.subscriptions.push (Vscode.commands.registerCommand "kiss.runKeyboardShortcut" - (lambda [] + (lambda :Void [] (if config (.runKeyboardShortcut (the KissConfig config)) - (Vscode.window.showErrorMessage "Can't run commands! No config is loaded.")) - (return)))) + (Vscode.window.showErrorMessage "Can't run commands! No config is loaded."))))) // TODO overload Prelude.print to use showInformationMessage