Add customizable buttons to the status bar to execute actions or tasks in VS Code.
VsCode Action Buttons
extension in your VS Code instance.Ctrl + ,
). Navigate to the VsCode Action Buttons
section.[x] Reload the VS Code window to see the new buttons. Alternatively, you can run the Refresh Action Buttons
command to refresh without reloading the window.
"actionButtons": {
"defaultColor": "#ff0034", // Can also use string color names.
"loadNpmCommands":false, // Disables automatic generation of actions for npm commands.
"reloadButton":"♻️", // Custom reload button text or icon (default ↻). null value enables automatic reload on configuration change
"commands": [
{
"cwd": "/home/custom_folder", // Terminal initial folder ${workspaceFolder} and os user home as defaults
"name": "$(triangle-right) Run Cargo",
"color": "green",
"singleInstance": true,
"command": "cargo run ${file}", // This is executed in the terminal.
},
{
"name": "$(tools) Build Cargo",
"color": "green",
"command": "cargo build ${file}",
},
{
"name": "$(split-horizontal) Split editor",
"color": "orange",
"useVsCodeApi": true,
"command": "workbench.action.splitEditor"
}
]
}
↻
. If null, the reload button is disabled.white
. To set default theme color type none
.package.json
. Defaults to false
.[]
. See below for a list of valid options for each command$(icon-name)
. Look here for icons. (Note: If you will misspell no icons will show)useVsCodeApi
is true
, this is the VS Code command to execute. Otherwise, this specifies the command to execute in the terminaldefaultColor
.command
.${workspaceFolder}
. Only valid when useVsCodeApi
is false
false
. Only valid when useVsCodeApi
is false
false
. Only valid when useVsCodeApi
is false
false
.useVsCodeApi
is true
. "actionButtons": {
"reloadButton": null,
"loadNpmCommands": false,
"commands": [
{
"name": "Run Cargo",
"singleInstance": true,
"color": "#af565c",
"command": "cargo run ${file}",
},
]
}
As seen in the previous example, vars such as ${file}
can be used. Below is a list of each of them and what they do.
workspaceFolder
- the path of the folder opened in VS CodeworkspaceFolderBasename
- the name of the folder opened in VS Code without any slashes (/)file
- the current opened filerelativeFile
- the current opened file relative to workspaceFolderfileBasename
- the current opened file's basenamefileBasenameNoExtension
- the current opened file's basename with no file extensionfileDirname
- the current opened file's dirnamefileExtname
- the current opened file's extensioncwd
- the task runner's current working directory on startuplineNumber
- the current selected line number in the active fileselectedText
- the current selected text in the active fileexecPath
- the path to the running VS Code executableFix clear terminal command on windows #85
Added support for VSCode API calls
Added api
option.
Added support for VSCode predefined variables as ${file}
Added cwd
option.
Added reloadButton
option.
Added loadNpmCommands
option.
Added Refresh Action Buttons
action button
Changed configuration name from run
to actionButton
Better support for js projects
Added singleInstance
option.
Added support for default Colors
Added support for reading actions from the scripts segment of package.json.
Better documentation.
Initial Release