vscode-taskexplorer
vscode-taskexplorer copied to clipboard
Gulp task displayName is not recognized / supported
Display names for gulp tasks does not seem to be supported by the Task Explorer.
If you set a display name to a Gulp task in the gulpfile:
const buildZip = series(build, zip);
buildZip.displayName = "build-zip";
Using gulp -T shows tasks with the defined display name and they can be run with that name (only):
gulp -T
[14:55:20] Tasks for E:\Project\gulpfile.js
[14:55:20] ├─┬ default
[14:55:20] │ └─┬ <series>
[14:55:20] │ ├─┬ <series>
[14:55:20] │ │ ├─┬ <series>
[14:55:20] │ │ │ ├─┬ <series>
[14:55:20] │ │ │ │ ├── clean
[14:55:20] │ │ │ │ └─┬ <parallel>
[14:55:20] │ │ │ │ ├─┬ <parallel>
[14:55:20] │ │ │ │ │ ├── copy-files
[14:55:20] │ │ │ │ │ └── copy-redist
[14:55:20] │ │ │ │ └── webpack
[14:55:20] │ │ │ └── zip
[14:55:20] │ │ └── install
[14:55:20] │ └── watch
[14:55:20] ├─┬ build-install
[14:55:20] │ └─┬ <series>
[14:55:20] │ ├─┬ <series>
[14:55:20] │ │ ├─┬ <series>
[14:55:20] │ │ │ ├── clean
[14:55:20] │ │ │ └─┬ <parallel>
[14:55:20] │ │ │ ├─┬ <parallel>
[14:55:20] │ │ │ │ ├── copy-files
[14:55:20] │ │ │ │ └── copy-redist
[14:55:20] │ │ │ └── webpack
[14:55:20] │ │ └── zip
[14:55:20] │ └── install
[14:55:20] ├── watch
[14:55:20] ├─┬ build-zip
[14:55:20] │ └─┬ <series>
[14:55:20] │ ├─┬ <series>
[14:55:20] │ │ ├── clean
[14:55:20] │ │ └─┬ <parallel>
[14:55:20] │ │ ├─┬ <parallel>
[14:55:20] │ │ │ ├── copy-files
[14:55:20] │ │ │ └── copy-redist
[14:55:20] │ │ └── webpack
[14:55:20] │ └── zip
[14:55:20] ├── clean
[14:55:20] ├─┬ build
[14:55:20] │ └─┬ <series>
[14:55:20] │ ├── clean
[14:55:20] │ └─┬ <parallel>
[14:55:20] │ ├─┬ <parallel>
[14:55:20] │ │ ├── copy-files
[14:55:20] │ │ └── copy-redist
[14:55:20] │ └── webpack
[14:55:20] ├─┬ zip-install
[14:55:20] │ └─┬ <series>
[14:55:20] │ ├── zip
[14:55:20] │ └── install
[14:55:20] ├── webpack
[14:55:20] ├── lint
[14:55:20] └── lint-fix
But task explorer still shows the tasks under gulp with the function names, not with the display names:
And it also runs the task with the function name, not the display name, so gulp complains it does not find the task:
* Executing task: npx gulp buildZip
[15:05:20] Using gulpfile E:\Project\gulpfile.js
[15:05:20] Task never defined: buildZip
[15:05:20] To list available tasks, try running: gulp --tasks
* The terminal process "C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command npx gulp buildZip" terminated with exit code: 1.
* Terminal will be reused by tasks, press any key to close it.
Would it be possible to get the displayName attribute supported for gulp tasks?
Okay, I found out that I can solve this for now by modifying how the exports are done.
So instead of this:
exports.buildZip = buildZip;
Do this if you have changed the display name of the task:
exports['build-zip'] = buildZip;
But I guess Task Explorer could still look up the display name for the export and use that if configured (Gulp Tasks extension works with the display names without changing the export).