https://code.visualstudio.com/docs/extensionAPI/vscode-api-commands lists a couple of commands.
The keyboard shortcut file has another list of available commands. This one is just a list, no docs, no description.
Can we have a page in our docs with the whole list + description?
Closing as the new keyboard shortcut editor lists all commands, both Command Palette name and command id. It allows search and filtering for easy discovery.
OK, but for example, what's the difference between acceptSelectedSuggestion and accepSelectedSuggestionOnEnter? It would just be really nice to have some kind of description, esp in metadata like methods, for the commands so that we can figure out the answer to that kind of question.
@gregvanl these aren't documentation, it is a mere list of commands. For example, it is impossible to find out the available args for any of these.
Because the keyboard shortcut editor is where I always look for API documentation
what about commands that don't have keyboard shortcuts? ie: "Show next window tab"
Re-opening to get thoughts from the @Microsoft/vscode team
I think we should find a way to auto-generate the docs for commands (same for API doc, but both need better presentations on website).
Static analysis of the codebase to find all command registration can be tricky to implement, but we might introduce a way to let command registry dump all data into a JSON and we generate HTML for the website from it.
It might be a while till we have a way to automatically generate a list of commands so in the meantime I just added some directions for finding simple commands.
Static analysis of the codebase to find all command registration can be tricky to implement, but we might introduce [...]
That's only half of the problem, the real problem is that 99% of the commands are registered without any metadata. So first you need to hunt down all the possible places that end up registering a command and then add docs for them.
FWIW, I went looking for a command with "command" in its title using Ctrl+Shift+P.
(I may also have looked for one with "contributions" in the name, because the contributions tab for an extension lists commands, among other things, but I wanted to see all of the things in one big pile.)
It seems to me that there are some very important and fundamental commands that are not described in the documentation. For example, in the "Command arguments" section of docs/getstarted/keybindings.md, it shows this example:
{ "key": "enter", "command": "type",
"args": { "text": "Hello World" },
"when": "editorTextFocus" }
But I don't see anywhere that this type command is documented, or even listed. There is a link below that example to "Builtin Commands" (api/references/commands.md). But that document does not list the type command. Where is it described? I imagine that several other very basic commands like this exist, but I don't know where to find them. (Aside from the simple commands in the default keybindings json and the vscode.executeXYZProvider functions described in commands.md.)
BTW, What I am really looking for at the moment is a command that I can run to do a pre-defined search and replace in the current editor, specifying the find text, replacement text, and options... something like below:
{ "key": "ctrl+shift+8", "command": "findReplace",
"args": {
"findText": "(\\w+)Controller",
"replaceText": "$1Service"
"options": { "ignoreCase": false, "wholeWord": true, "regex": true }
},
"when": "editorTextFocus" }
But I haven't been able to find any such command in the documentation.
@drwatsoncode Did you get an answer to this question?
As you wrote below, I'm also looking for a comprehensive list and documentation of all the commands available.
It seems to me that there are some very important and fundamental commands that are not described in the documentation.
How can I know command arguments when I need to use the command from extension API. Keyboard shortcut editor lists only commands but not arguments. For example, how can I close a specific text editor window? workbench.action.closeActiveEditor closes the active one, does it close inactive ones when I give it arguments? What arguments does it accept anyway?
@lieene pls see https://code.visualstudio.com/api/references/commands.
@lieene pls see https://code.visualstudio.com/api/references/commands.
setContext, type, default:type, default:replacePreviousChar... there are too many commands used in https://github.com/microsoft/vscode-extension-samples or other extensions that are undocumented, or mentioned but not in a systemic way. https://code.visualstudio.com/api/references/commands only have a few commands. Could there be a vscode.d.ts for commends?
I would really appreciate if there was some way in the vscode ui to query the currently registered commands: builtin, extension, whatever. Even if there's no description, I could at least get a list of names available and maybe signature for what args it accepts and what it returns.
Most helpful comment
I think we should find a way to auto-generate the docs for commands (same for API doc, but both need better presentations on website).
Static analysis of the codebase to find all command registration can be tricky to implement, but we might introduce a way to let command registry dump all data into a JSON and we generate HTML for the website from it.