Skip to content

Visual Studio Code actions

Visual Studio Code actions are used to perform actions related to Visual Studio Code in the editor. You can use these actions to execute commands, show information messages, and more.

Execute a Visual Studio Code command

Execute a Visual Studio Code command using the executeVSCodeCommand action.

{
"action": "executeVSCodeCommand",
"command": "<command to execute>",
"args": "<arguments to pass to the command (optional)>",
"path": "<relative path to the file (optional, when defined, the args property is ignored.)>"
}

How to find the command to execute

You can find the command to execute by opening the command palette in Visual Studio Code (Ctrl+Shift+P or Cmd+Shift+P) and typing the command you want to execute. The command palette will show you the available commands that match your search query.

Gear icon on the command in the command palette

Next to the command, you can see the “gear” icon. When you click on this icon, you get redirected to the keyboard shortcuts page where you can right-click on the command and select “Copy Command ID” to copy the command ID.

Copy the command ID

Show an information message

Show an information message in Visual Studio Code using the showInfoMessage action.

{
"action": "showInfoMessage",
"message": "<message>"
}