The most downloaded task related extension on the Marketplace
IMPORTANT NOTE: This extension has surpassed where I was ever going to take it, and the time that ended up going into it were more than I ever intended. Considering a pay scheme (cheap, e.g. $10 - $20), with free usage up to the # of to-be-determined number of parsed tasks. Note the license, this codebase is NOT permitted to be copied or distributed without my permission.
Provides a view in either (or both) the SideBar and/or Explorer that displays all supported tasks organized into a treeview, with parent task file nodes, grouped nodes, and project folders (convenient for large multi-root workspaces). Tasks can be opened for view/edit, executed, and stopped, among other things for specific task types, for example NPM file nodes support common npm command(s) (i.e. 'install') via context menu.
Original Explorer Tray | Sidebar View (v1.7) | Task Type Groups (v1.13) |
---|---|---|
Grunt/Gulp in Subfolders (v1.14) | Npm Commands (v1.16) | Task Groupings (v1.23) |
---|---|---|
Multi-Level Task Groupings (v1.29) | Run with Args, No Terminal (1.30) | Last Tasks (1.25) Favorites (2.0) |
---|---|---|
"Should" work with VSCode versions 1.30 and above, but am no longer running tests against VSCode versions below 1.50 as of 2/5/2021 (v1.28.0).
Version 2 highlights 2 major performance enhancements along with several features and bug fixes, notably:
Integrates with the app-publisher tool.
App-Publisher is a multi-purpose versioning/release tool that can be used for, but not limited to, the following:
The setting exclude defines a file/directory pattern or an array of file/directory patterns to ignore using Glob Patterns or a valid File URI. The setting applies to all script types. For example:
taskExplorer.exclude: [ "**/.vscode-test/**", "**/vendor/**", "**/out/**", "**/output/**", "/c:/projects/project1/src/theme/test/package.json" ]
Note that the glob pattern "**/node_modules/**" is applied by default to the excludes list in all cases. Using the exclude configuration can greatly improve performance in large workspaces if configured correctly.
Task files that are found by Task Explorer can also be added to the excludes list via the tree node context menu, by right clicking the task file or task group node, and selecting Add to Excludes.
Apache Ant uses an .xml file extension, the setting globPatternsAnt can be used to specify other file names other than [Bb]uild.xml to include as ant files so that all xml files do not need to be searched (slowing down tree refreshes in large workspaces or project with a large number of various xml files). The setting defines a file pattern or an array of file patterns to include using Glob Patterns or a valid File URI, for example:
taskExplorer.globPatternsAnt: [ "**/extraTasks.xml", "**/scripts/ant/*.xml", "/c:/projects/project1/scripts/test/antetests.xml" ]
Note that the glob pattern "**/[Bb]uild.xml" is applied by default to the Ant includes list in all cases. If you don't include the asterisked glob pattern **/
first in the string, files in sub-folders will not be found.
In the same way as for Ant tasks, Bash scripts without extensions can be configured to be found by the Bash Task Provider by using glob patterns in the same way, with the globPatternsBash setting:
taskExplorer.globPatternsBash: [ "**/bash_scripts/**", "**/sh/scripts/**", "/usr/local/bin/start_task" ]
By default, a custom parser is used to locate Ant and Gulp tasks in respective files. This may be fine in most cases, but in cases where the script and/or build files become complex, or there is something in the file that was not coded into the parser, you can use the ant and gulp programs themselves to find their own tasks. Note however that turning this on has a negative performance impact when refreshing and providing tasks to the VSCode Task Host.
EXPERIMENTAL The Groups With Separator option is simply an extra level of task groupings that can be made based on a configured separation character in the script name. This option can be turned on/off with the Group With Seperator option in Settings, the default is OFF. The default separator is a dash ("-").
For example, consider 10 npm tasks, 5 of which all start with the string dev-, 5 of which start with the string prod-. Prior to Version 1.23, this would create 10 individual task nodes within the main npm task node in the task tree:
npm
dev-build
dev-build-server
dev-build-themes
dev-cp-from-bin
dev-clean
prod-build
prod-build-server
prod-build-themes
prod-cp-from-bin
prod-clean
By enabling the Group With Separator option in Settings and setting the Group Separator to a dash ("-") two new grouped nodes would be created underneath the main npm node, one called dev and the other called prod. Each of these two sub-nodes of course would contain the respective dev- and prod- scripts/tasks, minus the prepended group name:
npm
dev
build
build-server
build-themes
cp-from-bin
clean
prod
build
build-server
build-themes
cp-from-bin
clean
The following tasks are provided by VSCode:
All other tasks are internally provided. Workspace tasks are detected by VSCode in all cases. However, NPM tasks are detected only if the setting 'Npm -> Auto Detect'
is turned on in VSCode Settings. By default this is turned on, but if NPM tasks are not displaying, please check this setting, also check the setting that turns npm package management off in favor of Yarn 'Npm -> Package manager'
. A future release will contain internally provided NPM and Yarn tasks. Note these tasks are still displayed in the Task Tree, just not "provided" by this extension.
Detection of all internally provided task types can be turned on/off in Settings - 'Task Explorer -> Enable [Tasktype]'
.
Bash/sh scripts in Windows will have the shell executable automatically set to a bash shell (if the default shell set in VSCode is not bash). The shell executable used can be set in Settings using the pathToBash
setting. If there is no value set in Settings, and Git Bash exists at the default installation installation, Git Bash will be used (MinGW). If Git Bash does not exist at the default install location, it is assumed the the path to bash.exe is part of the system PATH variable. If you experience errors running Bash scripts in Windows, please check these items.
FOr whatever reason, on some systems the animated running task icon eats a lot of CPU. If this is your case, the animated icon can be turned off in settings (on by default).
For debugging or curiosity, a report can be generated listing all parsed components and the properties found. You can generate a report in the explorer context menus using the Task Explorer: View Parsing Report
menu item.
Any extension that implements TaskProvider
(specifically it's provideTasks
method) can add it's tasks to the Task Explorer tree. To register an external provider with Task Explorer, follow these steps:
Get the TaskExplorer API object:
const teApi = await vscode.commands.executeCommand("taskExplorer.getApi");
Alternatively, using the Task Explorer type definitions:
let teApi;
const taskExplorer = extensions.getExtension("spmeesseman.vscode-taskexplorer");
if (taskExplorer && taskExplorer.isActive)
{
teApi = taskExplorer.exports as TaskExplorerApi;
}
Note: Before using any of the API functions, check busy status using the teApi.isBusy
API function first, to ensure the indexer is not running.
Register the instance of TaskProvider
or ExternalExplorerProvider
using the register
method of the Task Explorer API object:
await teApi.register("taskTypeName", myProvider as TaskProvider);
Where taskTypeName is the name of the task type, i.e. "npm", "ant", "gulp", etc, and myProvider
is the instance of TaskProvider that implements the provideTasks
method.
Any provider(s) should be unregistered in the deactivate method of an extension, to remove a provider:
await teApi.unregister("taskTypeName");
Where taskTypeName is the name of the task type, i.e. "npm", "ant", "gulp".
You can optionally install the Task Explorer API types:
npm install @spmeesseman/vscode-taskexplorer-types
The provided tasks must implement the taskExplorer.external task interface:
{
script: "the task name",
target: "command to run",
path: "file path",
fileName: "file name",
uri: file `Uri`,
taskItemId: (internal use, ignore),
icon: {
light: "/path/to/light.svg",
dark: "/path/to/dark.svg"
}
}
The task definition must also define most of the interface properties in the package.json, for completeness, the entire definition is:
"taskDefinitions": [
{
"type": "extjs",
"required": [],
"properties": {
"script": {
"type": "string",
"description": "taskdef.task.script"
},
"target": {
"type": "string",
"description": "taskdef.task.target"
},
"cmdLine": {
"type": "string",
"description": "taskdef.task.cmdLine"
},
"fileName": {
"type": "string",
"description": "taskdef.task.fileName"
},
"icon": {
"type": "string",
"description": "taskdef.task.icon"
},
"iconDark": {
"type": "string",
"description": "taskdef.task.icon.dark"
},
"isDefault": {
"type": "boolean",
"description": "taskdef.task.isDefault"
},
"path": {
"type": "string",
"description": "taskdef.task.path"
},
"taskItemId": {
"type": "string",
"description": "taskdef.task.taskItemId"
},
"uri": {
"type": "object",
"description": "taskdef.task.fileUri"
}
}
}]
The definition will be reduced in the future. This definition is remnant of Task Explorer's early days and is in need of a cleanup.
For reference, the entire Task Explorer API object is:
interface TaskExplorerApi
{
log: any;
utilities: any;
fileCache: any;
explorerProvider: TaskTreeDataProvider | undefined;
sidebarProvider: TaskTreeDataProvider | undefined;
taskProviders: Map<string, TaskExplorerProvider>;
registerProvider(providerName: string, provider: TaskProvider): void;
unregisterProvider(providerName: string): void;
}
Putting it all together:
async function activate()
{
... other code ...
const taskProvider = new ExtJsTaskProvider();
context.subscriptions.push(tasks.registerTaskProvider("extjs", taskProvider));
registerWithTaskExplorer(taskProvider);
... other code ...
}
async function deactivate()
{
... other code ...
const taskExplorer = extensions.getExtension("spmeesseman.vscode-taskexplorer");
if (taskExplorer && taskExplorer.isActive && taskExplorerRegistered)
{
const teApi = taskExplorer.exports as TaskExplorerApi;
await teApi.unregister("extjs");
}
... other code ...
return Promise.resolve();
}
function registerWithTaskExplorer(taskProvider: ExternalExplorerProvider)
{
const taskExplorer = extensions.getExtension("spmeesseman.vscode-taskexplorer");
if (taskExplorer && taskExplorer.isActive)
{
const teApi = taskExplorer.exports as TaskExplorerApi;
if (!teApi.isBusy())
{
await teApi.register("taskTypeName", taskProvider);
taskExplorerRegistered = true;
}
else {
setTimeout(() => registerWithTaskExplorer(taskProvider), 1000);
}
}
else
{
setTimeout(() => registerWithTaskExplorer(taskProvider), 5000);
}
}
res/sources
or res/dark
/ res/light
of the TaskExplorer installation folder, named using the same task type name in the registerProvider
call mentioned above, and will be used by the Task Explorer tree.Please rate your experience with stars... like five of them ;)
Icon Contributors:
Other Contributors:
Package | Use Case | Repository | Marketplace |
---|---|---|---|
app-publisher | Release Automation / CI | GitHub | Npmjs.org Registry |
arg-parser | Node Argument Parser | GitHub | Npmjs.org Registry |
code-package | Code Dev Environment | GitHub | GitHub Releases |
env-ci | CI ENvironment Detection | GitHub | Npmjs.org Registry |
extjs-pkg-filterbar | ExtJS Grid Filter Bar | GitHub | Npmjs.org Registry |
extjs-pkg-fontawesome | ExtJS FontAwesome Integration | GitHub | Npmjs.org Registry |
extjs-pkg-fontawesome-pro | ExtJS FontAwesome Pro Integration | GitHub | Npmjs.org Private Registry |
extjs-pkg-intltelinput | ExtJS IntlTelInput Wrapper | GitHub | Npmjs.org Registry |
extjs-pkg-mantis | ExtJS MantisBT Integration | GitHub | Npmjs.org Registry |
extjs-pkg-plyr | ExtJS Plyr Wrapper | GitHub | Npmjs.org Registry |
extjs-pkg-tinymce | ExtJS TinyMCE Wrapper | GitHub | Npmjs.org Registry |
extjs-pkg-websocket | ExtJS WebSocket Wrapper | GitHub | Npmjs.org Registry |
extjs-pkg-webworker | ExtJS WebWorker Wrapper | GitHub | Npmjs.org Registry |
jenkins-mantisbt-plugin | Jenkins MantisBT Integration | GitHub | Npmjs.org Registry |
jenkins-utility-server | Jenkins Desktop Server | GitHub | Npmjs.org Registry |
mantisbt | MantisBT Custom Site | GitHub | GitHub Releases |
ApiExtend | MantisBT API Extensions | GitHub | GitHub Releases |
CommitReact | MantisBT Post Commit Actions | GitHub | GitHub Releases |
GanttChart | MantisBT Gantt Chart | GitHub | GitHub Releases |
IFramed | MantisBT IFramed Pages | GitHub | GitHub Releases |
ProjectPages | MantisBT Custom Nav Buttons | GitHub | GitHub Releases |
Releases | MantisBT Releases Management | GitHub | GitHub Releases |
SecurityExtend | MantisBT SPAM Filter | GitHub | GitHub Releases |
ServerFiles | MantisBT Server File Editor | GitHub | GitHub Releases |
svn-scm-ext | VSCode SVN Extension | GitHub | Visual Studio Marketplace |
vscode-extjs | VSCode ExtJS Intellisense | GitHub | Visual Studio Marketplace |
vscode-taskexplorer | VSCode Tasks Management | GitHub | Visual Studio Marketplace |
vscode-vslauncher | VSCode VS Project Launcher | GitHub | Visual Studio Marketplace |
If my work and this extension has made your life easier, consider a donation. All donations go straight to the Single Dad ATM.