Adding support for TaskProvider.resolveTask#71027
Adding support for TaskProvider.resolveTask#71027alexr00 merged 6 commits intomicrosoft:masterfrom joelday:task-provider-resolve-task
Conversation
|
Wasn't able to repro the macOS integration test failure. |
|
It looks like you are going in a good direction! I only took a quick look today. I will give a more thorough reveiw later in the week. |
src/vs/workbench/contrib/tasks/electron-browser/task.contribution.ts
Outdated
Show resolved
Hide resolved
|
@alexr00 Do you have any suggestions on which tests/test areas I should add coverage for this with? Thanks! |
|
@alexr00 Just an assurance: I'm totally happy to rework this if the acceptance criteria needs to change. Also happy to do some general refactoring if this currently contributes to any debt. |
|
@joelday, I'm sorry it took me so long to take a look at your PR! Most of it looks good. However, I think you are calling provider.resolveTask in the wrong place. resolveTask is intended to be used to increase task performance. |
|
@alexr00 I had a feeling that these requirements may have not been 100% right: #33523 (comment) This should be an easy change and I don't think it'll conflict. I'll need to do some refactoring, largely along how things are asynchronously enumerated/transformed/joined. That function has a lot of complexity. Thank you! |
|
@alexr00 For the specific task run scenario: As I dig into the implications for the various current callers of As for the Quick Pick scenario, I'm unsure of the performance benefit if |
|
I agree that this is not a trivial change. There's no rush to get it done though. For cases like the VS Code repo the quick pick scenario could provide a significant improvement. 9.9 times out of 10 I want to run one of the tasks in the tasks.json. However, I have to wait up to a minute for all of our gulp and typescript tasks to enumerate (gulp in particular is slow to enumerate). |
|
@alexr00 absolutely agreed on the impact of the performance for quick pick. Is it possible to present items in a quick pick incrementally? Otherwise I'm not sure how to reconcile presenting both the quickly resolved tasks without still having to wait for the slow contributed ones to finish first. |
|
@alexr00 @dbaeumer Just pinging on this. My impression is that this was really a disconnect on the intended design of the Tasks feature entirely, so I'm happy to just decline this PR. I do have some (hopefully useful) feedback on my experience contributing here, especially in contrast to having worked with @jrieken after I proposed and implemented the
Should Thanks! |
|
@joelday I'm sorry I've let this PR lapse. Looking at it again with a fresh set of eyes, I think that it As you say, what #33523 (comment) asks for isn't what Having an API that doesn't do anything ( |
| resolveTask: (task: ConfiguringTask) => { | ||
| const dto = TaskDTO.from(task); | ||
|
|
||
| // Only named tasks can be resolved. (That should be the case, right?) |
There was a problem hiding this comment.
As far as I can see, not having a name is fine. The important thing is that the task has a definition so that the task provider knows what to do with it.
| try { | ||
| const resolvedTask = await provider.resolveTask(configuringTask); | ||
| if (resolvedTask) { | ||
| result.add(key, resolvedTask); |
There was a problem hiding this comment.
This adds the task as a contributed task in the quick pick. We need to add it as a configuring task.
|
@joelday this works very nicely! I made two very small changes in the areas I left comments while I was testing it. I also selfishly updated our builtin gulp extension to use |
|
Thanks! Regarding what #58836 asks for, this does allow an extension developer to "abuse" the API for that purpose, so that would be my only concern at this point. |
|
Also, please don't take my follow-up to imply impatience. Having a PR to review doesn't change prioritization! |
|
I am working on debt items this week, and an unimplemented API looked like debt to me. You had good timing :) Yes, "abuse" is possible. It might be worth adding a check on the task after we get it back from |
|
@alexr00 Thanks again! |
| } | ||
|
|
||
| if (CustomExecutionDTO.is(resolvedTaskDTO.execution)) { | ||
| await this.addCustomExecution(taskDTO, <vscode.Task2>task); |
There was a problem hiding this comment.
If we allow the provider to change the DTO properties, then we have a different task since those properties are the fingerprint of the task.
First pass on #33523 for early review. Will be working on tests, possibly updating the example extension. Let me know if you have any suggestions for that.
Thanks @dbaeumer @alexr00!