-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Introduce a token to scope contributed tasks #7996
Conversation
ed7d9b0
to
0dce814
Compare
I wonder is there a way to restructure that it does not call expensive methods often instead of passing token. It feels somehow like a broken cache abstraction. We have |
Maybe it makes sense to investigate VS Code approach for this problem. |
@akosyakov the "restructure until we have a set of root methods" was my first approach, however, I could not make it work: the call graph has just a lot of entry points initiated by the user. |
@RomanNikitenko VS Code fetches tasks at the beginning of user actions and then passes them around. In order to do that, we would have to do quite a large refactoring. I would totally love that, but it's a major undertaking whereas this PR is s relatively limited bugfix. |
I could not find caching in VS Code. That seems to be a method which is used by all clients to get tasks: https://github.com/microsoft/vscode/blob/e683ace9e5acadba0e8bde72d793cb2cb83e58a7/src/vs/workbench/contrib/tasks/browser/abstractTaskService.ts#L1564 and it always calls
Maybe it is what actually VS Code does. If these APIs are not used often (what I don't expect). We could move with the proposed solution and later reconsider. |
Yes, VS code fetches the tasks once and then passes them around. However, our internal API (TaskService) is very much different, that's why we would have to refactor quite a bit for this to work. It would also entail a breaking change. |
true, but this PR is a breaking change as well. I do feel though that eventually we will have to rewrite it to fix task identity and caching issues properly, so breaking is fine. @RomanNikitenko could you test please? if it works fine then we merge it for now? |
I'm able to check it today. |
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.
Tested for npm
tasks:
- I was able to run a
npm
task as detected task as well as a configured one. Configure Task
action worked as well- I added some logs to check if cached tasks were used properly
The dark side of this approach - we had to add token
to multiple tasks related methods...
btw: it would be nice to add some doc to methods which describes what the token
is, why we need it and how it should be used.
That is true: documentation in PR's is kinda useless once it's merged. |
@tsmaeder btw: detailed description in a PR is very helpful for me as well:
So, I'm sorry, I'm afraid I can't agree with you 😉 |
0dce814
to
3fa67cc
Compare
@RomanNikitenko I added documention for the token parameter |
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.
Signed-off-by: Thomas Mäder <tmader@redhat.com>
0afa10f
to
689fad0
Compare
Signed-off-by: Thomas Mäder tmader@redhat.com
What it does
This PR fixes "Run tasks" calls same Task Provider repeatedly. #7496
This PR is based on the idea that each user-level operation ("Run Task...", "Run Build Task") needs to obtain a token before using contributed tasks. There is a cache of contributed tasks in "ProvidedTaskConfigurations" that is used for as long as the token passed in is the same as the one used when first fetching the tasks.
How to test
Test the various task-related operations with tasks that are contributed by extensions, like "npm" or "yarn" tasks.
Review checklist
Reminder for reviewers