Statusbar Task Groups
Run VS Code workspace tasks directly from the status bar. Tasks with a shared colon-separated prefix are automatically combined into a task menu, keeping the status bar compact.
Features
- Click a standalone task to execute it, or click a group to choose a task.
- Automatically group tasks such as
Toonflow:前端编译 and Toonflow:后端编译 under Toonflow.
- Limit the number of visible buttons and access remaining tasks or groups through an overflow menu.
- Customize task labels, icons, colors, tooltips, and running-state styles.
- Filter tasks by the active file using
filePattern.
This is an independent fork of Tasks by actboy168, distributed under the MIT license. The original copyright notice is preserved in LICENSE.
If the original Tasks extension is installed, disable it to avoid displaying two sets of task buttons.
Task groups
Tasks with the same prefix before the first : are automatically combined into one status bar button:
{
"version": "2.0.0",
"tasks": [
{
"label": "Toonflow:前端编译",
"type": "shell",
"command": "npm run build:frontend"
},
{
"label": "Toonflow:后端编译",
"type": "shell",
"command": "npm run build:backend"
}
]
}
The status bar displays Toonflow. Clicking it opens a task menu with 前端编译 and 后端编译; selecting an item runs that task.
- A group requires at least two non-hidden tasks with the same non-empty prefix and a non-empty suffix. Other tasks keep their individual buttons.
- Grouping uses the normal status bar label, including an
options.statusbar.label override. Running labels and automatically added icons do not change the group.
- Only the first ASCII colon (
:) is the separator. Surrounding whitespace is trimmed; further colons remain in the submenu label.
- Each task's
filePattern still applies. A group with no matching tasks is hidden; otherwise its menu contains only matching tasks.
- A group counts as one button for
statusbarTaskGroups.statusbar.limit. Groups beyond the limit remain accessible through the ... task menu.
Settings
Configure these options in VS Code's settings.json:
| Setting |
Default |
Description |
statusbarTaskGroups.statusbar.limit |
null |
Maximum visible task/group buttons; null means unlimited. |
statusbarTaskGroups.statusbar.default.hide |
false |
Hide tasks by default; individual tasks can override this. |
statusbarTaskGroups.statusbar.default.color |
"" |
Default task text color; empty uses the theme default. |
statusbarTaskGroups.statusbar.select.label |
"..." |
Overflow button label. |
statusbarTaskGroups.statusbar.select.color |
"" |
Overflow button text color. |
For example, to show at most five task/group buttons:
{
"statusbarTaskGroups.statusbar.limit": 5
}
If migrating from the original Tasks extension, rename your tasks.statusbar.* settings to statusbarTaskGroups.statusbar.*. Existing options.statusbar entries in tasks.json do not need to change.
Options
You can hide some tasks with the following options directly in tasks.json:
"label": "Test",
"options": {
"statusbar": {
"hide" : true
}
}
You can set the label of the statusbar:
"label": "Test",
"options": {
"statusbar": {
"label" : "ts"
}
}
You can embed icons in the text by leveraging the syntax: $(icon-name). More details in icons-in-labels and octicons
"label": "Test",
"options": {
"statusbar": {
"label" : "$(beaker) ts"
}
}
You can set the foreground color of the statusbar:
"label": "Test",
"options": {
"statusbar": {
"color" : "#22C1D6"
}
}
You can set the tooltip of the statusbar:
"label": "Test",
"options": {
"statusbar": {
"detail" : "my test"
}
}
You can enable statusbar items based on the file in the active editor using the filePattern attribute, causing the statusbar item to be hidden when the active file does not match the specified pattern. If the filePattern attribute is not provided, the statusbar item will not be hidden based on the active file. Also, if it is provided but is invalid or causes an error during validation, the statusbar item will not be displayed. (Note that filePattern only applies to statusbar items that have not been otherwise effectively set as hidden through tasks.json or settings.json).
For instance, the following would only display the "Test" button when a filename beginning with test_ is the active editor:
"label": "Test",
"options": {
"statusbar": {
"filePattern" : "test_.*"
}
}