-
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
Clean up handling of 'taskType' field #9377
Clean up handling of 'taskType' field #9377
Conversation
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.
@tsmaeder
thank you for the provided fix, I tested the changes and found that they don't fix #9207 (review).
It looks like we still have some problem with provided
tasks:
The use case works well with these changes #9373:
Also, there is still a problem from #9365.
So, I have configured a task, changed the configuration, but task system runs the corresponding |
@RomanNikitenko there is https://github.com/eclipse-theia/theia/pull/9207/files for the problem matchers. |
What do you mean? |
Yes, there is an open PR for that issue. |
I don't understand what you mean.
Maybe someone could check it as well - to confirm that behavior... |
@RomanNikitenko so you're doing this:
You expectation would be that there is no output or that there is a new terminal being opened and that the command line being executed is not shown in the terminal? |
My expectation is: the configured task (not detected) is running when I run In the use case above:
as such changes I provided for the |
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'll need a bit of time to get a better understanding of all of the contingencies in play, but here are a couple of very minor comments from my first read-through of the changes.
this.providedCustomExecutions = new Map<number, CustomExecution>(); | ||
this.notProvidedCustomExecutions = new Set<number>(); | ||
this.activeCustomExecutions = new Map<number, CustomExecution>(); | ||
this.customExecutionIds = new Map(); |
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.
[Minor]: some map fields are initialized as properties above (adaptersMap
, executions
); others are initialized here. I'd vote for moving these three, which don't need information from the constructor arguments, up with the rest and initializing with the property syntax.
@@ -234,6 +234,7 @@ export class TasksMainImpl implements TasksMain, Disposable { | |||
return { | |||
...common, | |||
...partialDto, | |||
taskType: taskType, |
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.
[Minor]: Could be just taskType
.
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.
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.
so, it looks like we don't need the change here
We are running the configured task. However, we pass the configured task to I suspect this "worked" before because we were using the "taskType" based on the task execution (which is Not sure what the right thing is here: I suspect that |
Turns out that VSCode overrides the configured properties after calling the task resolver: https://github.com/microsoft/vscode/blob/10c56b598de01119b80a5c53871003f868fd41fb/src/vs/workbench/parts/tasks/node/taskConfiguration.ts#L1473 |
I found the following issue when testing with; The output from custom task e.g. task 'custombuildscript: 32 -incremental' does not show the extensions output in the terminal, |
I have tried @RomanNikitenko case but using "gradle: clean", I updated the presentation options under the configured task (tasks.json) and confirmed that the presentation options don't take effect. |
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.
Nice improvement !
it would be great to rename all taskType instances that mean execution type, so taskType names that refer to actual TaskDefintion.type would not be confused with execution type.
@@ -219,7 +219,7 @@ export class TasksMainImpl implements TasksMain, Disposable { | |||
} | |||
|
|||
protected fromTaskConfiguration(task: TaskConfiguration): TaskDto { | |||
const { group, presentation, _scope, _source, ...common } = task; | |||
const { group, presentation, _scope, _source, taskType, ...common } = task; |
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.
taskType does not seem to be converted, so we can leave it as part of ...comon, right ?
|
I checked that in master, the presentation options of the configured |
@alvsan09 Sorry, but I don't understand what issue you're describing here: could you give steps to reproduce? |
I believe all of those are fixed, except #9207 (review) (for which there is a separate PR already open). As for the presentation options not being used, IMO that only ever worked because see #9377 (comment) |
|
@tsmaeder, could you please clarify what you mean with it was broken in a different way ? |
Well, if you cared about configuring the presentation options, it was a regression, but if you cared about |
I can confirm that the presentation options work for me taken the latest branch of this PR |
I've added two commits that do the following:
To test the latest change, try configuring the I'm re-requesting reviews, since the latest two changes are non-trivial and should be looked at. |
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 tested the changes and can confirm that they fix the following issues for me:
- Task type is not displayed for detected tasks #9341
- Configuring tasks are broken #9365
- task: unable to run provided tasks #9366
But I still not able to run a task according to #9207 (review)
The error is: task ERROR Error resolving task 'test': TypeError: Cannot read property 'group' of undefined
Any news on this issue ? |
IMO, the PR as it stands now is closer to a correct implementation than reverting the change. |
The problem here is that we're not registering custom execution callbacks for custom executions added during the |
I can confirm that the fix is for this issue works !!, Thanks Thomas ! |
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 see only a pending issue for #9207 which is still under review
I know my vote does not count for the merge, but I would like to reflect my opinion
as this fixes many outstanding issues present in master.
As workaround for the use case #9377 (review) You can use my branch for testing - it contains all commits from the current PR + my workaround. Update:
I created a separate issue for that problem: #9411 So, maybe more clear solution is: 5d1efe3 |
Just by the way...the doc for
So the implementation in the task provider sample from the vscode-examples project is actually bogus: it returns new task objects. The fix still applies, though: customized tasks may have their execution replaced. |
Do you mean that there is no problem for the use case if it it returns:
? Sorry, I didn't have a lot of time for a deep investigation, but for me it looks like it's a separate problem. It's true that there is a note in the VS Code documentation
But for me it looks like it's not related to |
@RomanNikitenko it's a completely unrelated problem. I just wanted to point out that we should not take the vscode samples as our bible: we should stick to what the documentation says, not what the samples do. |
I see, thank you! |
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 tested the changes and can confirm that they fix the following issues for me:
- Task type is not displayed for detected tasks #9341
- Configuring tasks are broken #9365
- task: unable to run provided tasks #9366
I'm able to run a task according to #9207 (review) using current PR changes + my changes: 5d1efe3, please see #9377 (comment)
@colin-grant-work @RomanNikitenko @alvsan09 if no-one has any last minute objections, I would go ahead and clean up and merge this one then. Thanks for the reviews & testing. |
I think that sounds good to me, as long as @RomanNikitenko code suggestions are taken into account. |
Do you mean these changes 5d1efe3 ? I can not open a separate PR for them as the changes depend on the current PR.
If you mean something else or have a better way - please let me know |
@RomanNikitenko @tsmaeder I propose we go forward with that approach, let's squash the current pull-request and merge (for today's release) and continue with 5d1efe3 in a separate pull-request. |
Signed-off-by: Thomas Mäder <tmader@redhat.com>
7047f57
to
b502bb6
Compare
Signed-off-by: Thomas Mäder tmader@redhat.com
What it does
This PR cleans up a couple of the issues introduced by Implement CustomExecution extension API #9189 while retaining the custom execution API.
The approach is to strictly use the "taskType" field in a task configuration to mean the "task execution type". The magic in types-impl.ts (
Task#updateTypeBasedOnExecution
) has been removed and the translation ofTask.execution
intoTaskDTO.taskType
and vice-versa has been moved to the type converter.I have removed a couple of instances where
taskType
was used erroneously when the declared type was meant and not the execution type.I have removed some filtering of dependent tasks based on "source". It did not work (configured tasks have the folder they are in as "source") and I don't think the
source
field should be considered part of the task identity.I have also removed the "garbage collection" of callback functions for custom executions. There is no explicit lifecycle for those callback functions that I could find in the VS Code API. I believe there are supposed to be only a fixed, small number of callback functions. So I'm retaining these functions based on identity. We could clean up the callbacks whenever we call
provideTasks
and after call to theexecuteTask
API, but I don't think it is necessary. Convince me otherwise :-)How to test
Make sure non-contributed tasks still work, aka
process
andshell
tasks.Make sure we can run and configure both custom execution tasks (see gradle tasks: #8767) and the shell tasks contributed by @vince-fugnitto's test plugin (see #9366)
Make sure we can run dependent tasks based on label as well as based on structured task identifier.
Review checklist
Reminder for reviewers