Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document all commands that support passing arguments #4298

Open
usernamehw opened this issue Feb 4, 2021 · 3 comments
Open

Document all commands that support passing arguments #4298

usernamehw opened this issue Feb 4, 2021 · 3 comments
Labels
commands doc-enhancement suggested addition or improvement

Comments

@usernamehw
Copy link
Contributor

usernamehw commented Feb 4, 2021

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
Copy link
Contributor Author

usernamehw commented Feb 4, 2021

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.

@gregvanl gregvanl added commands doc-enhancement suggested addition or improvement labels Feb 4, 2021
@KamasamaK
Copy link
Contributor

Related to #683

@ohabash
Copy link

ohabash commented Aug 8, 2022

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

moathdarwesh added a commit to moathdarwesh/vscode-docs that referenced this issue May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
commands doc-enhancement suggested addition or improvement
Projects
None yet
Development

No branches or pull requests

4 participants