Add custom action buttons to your VS Code status bar that execute shell commands with a single click.
- Open Command Palette (
Ctrl+Shift+PorCmd+Shift+P) - Run
Project Actions: Edit Project Actions - Configure your actions in the generated
.project-actions.jsonfile
Example:
{
"actions": [
{
"text": "$(play) Run",
"command": "npm start",
"tooltip": "Start development server"
},
{
"text": "$(beaker) Test",
"command": "npm test",
"tooltip": "Run tests"
}
]
}Buttons appear automatically on the status bar and update on file save.
Each action requires:
text: Button label (supports Codicons like$(play))command: Shell command to executetooltip(optional): Hover textcolor(optional): Text color (CSS format)
Use VS Code variables for dynamic commands:
${file}- Current file path${fileBasename}- Current filename${fileDirname}- Current file's directory${workspaceFolder}- Workspace root path${relativeFile}- File path relative to workspace
Example:
{
"text": "$(play) Run File",
"command": "python ${file}",
"tooltip": "Run current Python file"
}Define actions in VS Code settings that appear based on file patterns:
- Open Command Palette (
Ctrl+Shift+PorCmd+Shift+P) - Run
Project Actions: Edit Global Actions - Add global actions as follows:
{
"project-actions.globalActions": [
{
"text": "$(repo-pull) Pull",
"command": "git pull",
"glob": "**/.git",
"tooltip": "Pull latest changes"
}
]
}Global actions appear when the glob pattern matches files in your workspace (e.g., **/.git shows the action in Git repositories).
Define actions in VS Code settings that appear based on the currently active file:
- Open Command Palette (
Ctrl+Shift+PorCmd+Shift+P) - Run
Project Actions: Edit Active File Actions - Add active file actions as follows:
{
"project-actions.activeFileActions": [
{
"text": "$(python) Run Python",
"command": "python ${file}",
"glob": "*.py",
"tooltip": "Run current Python file"
}
]
}Active file actions appear when the glob pattern matches the currently open file (e.g., *.py shows the action only when editing Python files).
project-actions.configFileName: Config file name (default:.project-actions.json)project-actions.globalActions: Global actions with glob patternsproject-actions.activeFileActions: Active file actions with glob patterns
MIT License - see LICENSE file for details
Contributions are welcome! Please feel free to submit a Pull Request to the GitHub repository.
Found a bug or have a feature request? Please open an issue on the GitHub issue tracker.
