Closed canadaduane closed 4 years ago
@canadaduane Thank you for great feature request!!
I didn't know there are some commands which be given arguments.
Do you know any commands which can be given more than one argument?
Would you like to pass multiple arguments to the command?
I'll do a quick look to see if I can find any examples of multiple arguments.
FWIW, here is how the macros
extension handles multiple arguments: https://github.com/geddski/macros/blob/master/extension.js#L34
It looks like many commands accept multiple (usually optional) arguments:
cursorLeft, cursorRight, etc.
insertSnippet has snippet
, name
, and langId
There are many more examples here: https://github.com/Microsoft/vscode/blob/master/src/vs/workbench/api/node/extHostApiCommands.ts
@canadaduane Thank you for investigation.
I implemented your feature request on v1.2.0 and released it.
Many commands accept multiple arguments but I'm not sure they are useful to be passed multiple arguments. So I implemented with passing 'args' value object simply, as you said first.
Please try the new version, and report if you have any problem.
Awesome! I'll give it a swing soon.
On Wed, Mar 21, 2018, 4:26 PM ryuta46 notifications@github.com wrote:
@canadaduane https://github.com/canadaduane Thank you for investigation.
I implemented your feature request on v1.2.0 and released it.
Many commands accept multiple arguments but I'm not sure they are useful to be passed multiple arguments. So I implemented with passing 'args' value object simply, as you said first.
Please try the new version, and report if you have any problem.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ryuta46/vscode-multi-command/issues/3#issuecomment-375116315, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAAgdC8pDVHZUbqOEO3Har_1D4ybaVpks5tgtOlgaJpZM4Syl9w .
hello, can I use argument on the command git.commitAll
? Thanks!
{
"command": "git.commitAll",
"args": {
"???": "123"
}
}
I verified sending commands with arguments works with the example in the readme!
Now, would it be possible to add the ability to execute a command conditional on the context? For example, I have the following:
"command": "multiCommand.newPostgreSQLQuery",
"sequence": [
"vscode-postgres.newQuery",
"workbench.action.editor.changeLanguageMode",
{"command": "type", "args": {"text": "sql"}, "when":"inputFocus"}
]
This executes the first two commands successfully, which opens vscode's language switcher. The context of the language switcher in vscode is "inputFocus". What I would like to have happen is for the last command above to execute as soon as the language switcher has focus. I suppose this would have to be implemented via a promise - wait until the context is "inputFocus", then execute the command, and have a timeout of 3 seconds or something like that, showing an error if the requested "when" condition is never met. This would truly take the plugin to a new level of usefulness. Thanks for considering!
@mmcintyre123 Seems interesting feature. I'll investigate if it can be implmented.
I investigated but I couldn't find the way to get the context like "inputFocus" from an extension.
getContext
is discussed in vscode issue and it seems not to be implemented in current version.
https://github.com/microsoft/vscode/issues/10471
Passing argument, which is main feature discussed in this issue, is implemented in current version.
Close this issue and I will create an issue when getContext
is implemented in vscode.
Some commands are only useful when arguments are supplied. For example, the "type" command can be used to enter text into the current editor, but the text to type must be supplied as a "text" argument.
Would it be possible to change the type signature of the commands list from String only, to either (String OR Object), where Object would allow for "command" and "args" keys? For example: