-
Notifications
You must be signed in to change notification settings - Fork 33.8k
Fix accidently starting all onTaskType extensions when running any task; fixes #175821 #178679
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix accidently starting all onTaskType extensions when running any task; fixes #175821 #178679
Conversation
Does this also fix the issue where launch configs with prelaunchTask will enable everything as well? That one seems to be going through a different code path. |
It should; when testing with following configuration, no additional extensions are activated:
|
I tried your above steps and am not seeing the extension get activated when I run an npm task (no status bar item). When I run a command from that extension, I do see it. Screen.Recording.2023-03-30.at.11.57.10.AM.mov |
Whoops, I forgot my own repro steps :D. It needs to be a preLaunchTask set to "group": {
"kind": "build",
"isDefault": true
} Even if it doesn't fix that case, this is still a good improvement! (Also, I suppose for clarity: I do not work on VS Code despite the "Member" tag) |
Looked into it and it's not the task that is the problem; it's the variable: when launching, it first tries to resolve all variables present inside the config:
When i replace the line above with following code, it works: let resolvedConfig = configByProviders;
resolvedConfig.preLaunchTask = 'run \'npm: test\'';
|
Digged depper into this and it seems that the current behaviour regarding vscode/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts Lines 305 to 306 in b9202b6
When resolving I think it's best to discuss this behaviour and any possible change in this in a new issue. |
Yes @Mai-Lapyst you are correct in your understanding and that is why I said in the original issue that the behavior was expected. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't test it out, but the change looks reasonable!
This fixes issue #175821 by only starting extensions of the task's type when trying to reload task after a workspace save.
The original issue falsly is marked as closed, the bug itself isn't resolved; this PR fixes it for good.
To test them:
onTaskType
activation event such as rust-lang.rust-analyzer.package.json
with following content:Tasks: Run Task
, selectnpm
(to discover npm tasks) and runnpm: test
rust-analyzer
item in the statusbar which only gets added once the extension is loaded