vscode-docs icon indicating copy to clipboard operation
vscode-docs copied to clipboard

Document all commands that support passing arguments

Open usernamehw opened this issue 4 years ago • 3 comments

This page has a list of commands: https://code.visualstudio.com/api/references/commands

All of them can be executed from extension with vscode.commands.executeCommand, but some of them can be used from keybindings.json file with "args", like vscode.setEditorLayout or editorScroll. The list is not complete, though.

I think this page should contain all commands that accept arguments.

2 notes:

  1. keybindings.json: not possible to run some commands like vscode.openFolder
  2. extension api: For specific commands api would be a preferable choice

For instance, there is a command that supports accepting args

{
	"key": "ctrl+enter",
	"command": "workbench.action.terminal.sendSequence",
	"args": {
		"text": "npm run build\r"
	},
	"when": "terminalFocus"
},

And it's pretty useful for users, but if you are an extension author - then the api Terminal.sendText() is most likely what you need.

usernamehw avatar Feb 04 '21 06:02 usernamehw

Commands to add:

  • workbench.action.tasks.runTask
  • workbench.action.terminal.sendSequence
  • workbench.action.terminal.newWithCwd
  • workbench.action.openGlobalKeybindings
  • workbench.action.openSettings
  • workbench.action.quickOpen
  • editor.action.codeAction
  • editor.action.refactor
  • editor.action.sourceAction
  • editor.action.insertSnippet
  • type
  • workbench.action.findInFiles
  • search.action.openNewEditor
  • vscode.commands.executeCommand('workbench.action.openWalkthrough', 'jakearl.md-to-html#exampleProject', true)
  • revealFileInOS <= maybe only extension api
  • workbench.extensions.command.installFromVSIX <= (only extension api)

This is not a complete list, only those known to me.

usernamehw avatar Feb 04 '21 06:02 usernamehw

Related to #683

KamasamaK avatar Jun 24 '21 11:06 KamasamaK

My terminal is suddenly not opening to the current project (zsh / mac). I keep reading about newWithCwd . But there is no keybinding with the when equal to workbench.action.terminal.newWithCwd and i dont know how to add one. any help is appriciated.

https://stackoverflow.com/questions/55668151/how-to-change-the-terminal-to-the-current-directory-in-visual-studio-code-hot

ohabash avatar Aug 08 '22 19:08 ohabash