This extension adds a customizable button to the VS Code status bar that can be bound to any command from the command palette or to any VS Code task.
Features
- Adds a button to the VS Code status bar
- Allows binding any VS Code command to the button
- Allows binding any VS Code task to the button
- Customize button text, color, and emoji
- Quick commands to configure the button
Usage
Binding to a Command
- Install the extension
- Run the command "Command Button: Configure Button Command" from the command palette
- Select a command to bind to the button
- Click the button in the status bar to execute the command
Binding to a Task
- Install the extension
- Run the command "Command Button: Configure Button Task" from the command palette
- Select a task to bind to the button
- Click the button in the status bar to run the task
Configuration
You can customize the button through VS Code settings:
Setting |
Description |
Default |
commandButton.actionType |
Type of action ("command" or "task") |
"command" |
commandButton.command |
Command ID to execute when clicked (for command type) |
"" |
commandButton.taskName |
Task name to run when clicked (for task type) |
"" |
commandButton.text |
Text to display on the button |
"Command" |
commandButton.color |
Color of the button text (CSS color) |
"" |
commandButton.emoji |
Emoji to display before text |
"📎" |
Examples
- Open command palette and select "Command Button: Configure Button Command"
- Search for and select "Git: Push"
- Update settings:
{
"commandButton.text": "Push",
"commandButton.emoji": "⬆️"
}
- Open command palette and select "Command Button: Configure Button Command"
- Search for and select "Format Document"
- Update settings:
{
"commandButton.text": "Format",
"commandButton.emoji": "✨",
"commandButton.color": "#7cb342"
}
- Open command palette and select "Command Button: Configure Button Task"
- Select your "build" task
- Update settings:
{
"commandButton.text": "Build",
"commandButton.emoji": "🔨",
"commandButton.color": "#f44336"
}
- Open command palette and select "Command Button: Configure Button Task"
- Select your "test" task
- Update settings:
{
"commandButton.text": "Run Tests",
"commandButton.emoji": "✅",
"commandButton.color": "#4caf50"
}
Installation
From VS Code Marketplace
- Open Extensions in VS Code
- Search for "Command Button"
- Click Install
Manual Installation
- Download the
.vsix file from the releases page
- Run
code --install-extension vscode-command-button-0.1.0.vsix
Building the Extension
# Clone the repository
git clone https://github.com/yourusername/vscode-command-button.git
cd vscode-command-button
# Install dependencies
npm install
# Compile the extension
npm run compile
# Package the extension
npx vsce package
or
npm install --save-dev @types/vscode@1.60.0 typescript
npx tsc -p ./
npx @vscode/vsce package
License
MIT
| |