fix quickPick functions + add withValueOrQuickPick macros
This commit is contained in:
@@ -22,11 +22,11 @@
|
|||||||
|
|
||||||
(function quickPick [:Array<String> strings]
|
(function quickPick [:Array<String> strings]
|
||||||
(awaitLet [chosenItem (_quickPick (for string strings (quickPickItem string)))]
|
(awaitLet [chosenItem (_quickPick (for string strings (quickPickItem string)))]
|
||||||
chosenItem.label))
|
(when chosenItem chosenItem.label)))
|
||||||
|
|
||||||
(function quickPickMap [:Map<String,Dynamic> stringMap]
|
(function quickPickMap [:Map<String,Dynamic> stringMap]
|
||||||
(awaitLet [chosenItem (_quickPick (for =>key value stringMap (quickPickItem key (Std.string value))))]
|
(awaitLet [chosenItem (_quickPick (for =>key value stringMap (quickPickItem key (Std.string value))))]
|
||||||
(dictGet stringMap chosenItem.label)))
|
(when chosenItem (dictGet stringMap chosenItem.label))))
|
||||||
|
|
||||||
// commands
|
// commands
|
||||||
(defAlias &call executeCommand Vscode.commands.executeCommand)
|
(defAlias &call executeCommand Vscode.commands.executeCommand)
|
||||||
@@ -45,6 +45,18 @@
|
|||||||
(awaitLet [,v (inputBox)]
|
(awaitLet [,v (inputBox)]
|
||||||
,@body)))
|
,@body)))
|
||||||
|
|
||||||
|
(defMacro withValueOrQuickPick [v options &body body]
|
||||||
|
`(if ,v
|
||||||
|
{,@body}
|
||||||
|
(awaitLet [,v (quickPick ,options)]
|
||||||
|
,@body)))
|
||||||
|
|
||||||
|
(defMacro withValueOrQuickPickMap [v options &body body]
|
||||||
|
`(if ,v
|
||||||
|
{,@body}
|
||||||
|
(awaitLet [,v (quickPickMap ,options)]
|
||||||
|
,@body)))
|
||||||
|
|
||||||
// This has to be a macro so it can return from tryLoadConfig
|
// This has to be a macro so it can return from tryLoadConfig
|
||||||
(defMacro trySpawnSync [command args options onError]
|
(defMacro trySpawnSync [command args options onError]
|
||||||
`(let [command ,command
|
`(let [command ,command
|
||||||
|
Reference in New Issue
Block a user