-
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
Add task#runOptions
to API.
#11759
Add task#runOptions
to API.
#11759
Conversation
a627f16
to
03fd853
Compare
return; | ||
} | ||
const { source, taskLabel, scope } = this.lastTask; | ||
return this.run(token, source, taskLabel, scope); | ||
if (!this.lastTask.resolvedTask.runOptions?.reevaluateOnRerun) { |
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.
If this flag is set to false no variables will be resolved again. Therefore lastTask can now be re-triggered without resolving all variables.
It appears that reevaluateOnRerun = false
is being treated as the default. That's a change in the expectations for internal tasks, which in the past would always have been resolved when rerun. Is there any value in treating internal and external tasks differently in this respect?
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.
Yes i was wondering this as well. I would find it odd, if the default behavior is reevaluateOnRerun = true
as this would mean, that we need to interpret missing options as true
. I am not sure, how internal tasks are handled, but would it be a option to add this runOption to all internal tasks? This would keep the current behavior and explicitly explain for each task how it should be handled. WDYT?
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.
@colin-grant-work by "internal", do you mean tasks defined in tasks.json
or contributed by non-plugin API? If we need to treat tasks different, I would much prefer putting the difference where we create the tasks (for example by setting a flag in the contructor) and not where we process the tasks. Locality of reference for teh win!
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.
Re: tasks.json
, we should likely follow what VSCode does, though there's scope for making our own choice there. Mostly I mean other tasks created internally, but I'm not very familiar with the behavior or UI of 'rerun' tasks (as opposed to running the same task again, but not as a rerun), so I'm not sure how disruptive it would be to change from resolving to not resolving variables in the task description.
One solution might be to modify the plugin system to supply false
by default for tasks originating from plugins, and then have a flag in the task service for whether to use false
or true
as the default value there so that application implementers can easily toggle it if they have a use case where true
is appropriate. On the other hand, it sounds like @tsmaeder favors something on the task description itself (in which case maybe setting false
in the plugin system and using true
as a default otherwise would be the best course?). In any case, I don't know if it really warrants too much concern.
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 thought about this some more: what I really would like to avoid is a "if tasksource = plugin, do x, else do y". I'm also not a fan of setting variables that are client API in order to simulate the "right" default behaviour: if anything, we should set a flag : task.defaultRerunOnReevaluate= false
that is not part of the API in the plugin task provider implementation and default to true in clients to preserve the current behaviour.
But t.b.h, I would just make the change to the VS Code behavior: it's a breaking change, and while we try not to frivolously break API, we also should not unduly complicate the system to keep the API stable.
My vote is: put the code in as it is and make a note of it in the "breaking changes". Clients can trivially update their code if they rely on the behaviour. @colin-grant-work can you live with that?
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'm fine with this approach.
return; | ||
} | ||
const { source, taskLabel, scope } = this.lastTask; | ||
return this.run(token, source, taskLabel, scope); | ||
if (!this.lastTask.resolvedTask.runOptions?.reevaluateOnRerun) { |
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.
@colin-grant-work by "internal", do you mean tasks defined in tasks.json
or contributed by non-plugin API? If we need to treat tasks different, I would much prefer putting the difference where we create the tasks (for example by setting a flag in the contructor) and not where we process the tasks. Locality of reference for teh win!
03fd853
to
8c57959
Compare
@@ -8,6 +8,8 @@ | |||
|
|||
- [plugin] added support for the `InlineValues` feature [#11729](https://github.com/eclipse-theia/theia/pull/11729) - Contributed on behalf of STMicroelectronics | |||
- [plugin] Added support for `resolveTreeItem` of `TreeDataProvider` [#11708](https://github.com/eclipse-theia/theia/pull/11708) - Contributed on behalf of STMicroelectronics | |||
- [plugin] added `Task#runOptions` field and `RunOptions` interface [#11759](https://github.com/eclipse-theia/theia/pull/11759) - Contributed on behalf of STMicroelectronics | |||
- [tasks] added support for `reevaluateOnRerun` run option [#11759](https://github.com/eclipse-theia/theia/pull/11759) - Contributed on behalf of STMicroelectronics |
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.
As suggested by @tsmaeder, please add a note about the change in behavior for tasks in the breaking changes area.
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.
Done. Could you recheck?
Additionally added functionality to support `reevaluateOnRerun`. If this flag is set to false no variables will be resolved again. Therefore lastTask can now be re-triggered without resolving all variables. For this the lastTask object was updated to contain all resolved information. Contributed on behalf of STMicroelectronics Resolves eclipse-theia#11132
8c57959
to
fd36854
Compare
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.
The behavior looks good, and adopters should be adequately warned re: any effect on their current setup.
What it does
Additionally added functionality to support
reevaluateOnRerun
. If this flag is set to false no variables will be resolved again. Therefore lastTask can now be re-triggered without resolving all variables. For this the lastTask object was updated to contain all resolved information.Contributed on behalf of STMicroelectronics
Resolves #11132
How to test
To test you can use the follwing
tasks.json
:When you run the node command you will be asked, which command you want to run. If you enter
--version
for example and then rerun the last task. You will not be asked andnode --version
is automatically executed.When you change
reevaluateOnRerun
to true, run and rerun the task, you will need to reenter the command every time.To test the API you can use this extension. It provides a task (custombuildscript: 32) with
reevaluateOnRerun: true
. When you run this task and debug, for example attask-service.ts#808
thetask
object should have the correctrunOptions
set.Review checklist
Reminder for reviewers