-
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
[tasks] Fix execution of Configured tasks #5313
Conversation
@elaihau @akosyakov is it fine for you ? |
@vince-fugnitto this one is related to your work in #5472 |
Sorry for my misleading comments (which has been removed). I am playing with this change in my local env. |
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.
} | ||
|
||
private findConfig(label: string, configs: TaskConfiguration[]): TaskConfiguration | undefined { | ||
return configs.find(task => label === task.label); |
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.
Not sure if the label comparison is enough. What if we have tasks
- from different sources
- and with the same label
?
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.
fixed, please review
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 am testing right now
Maybe it's related to known issue #4919 and it never worked in a multi-root use case. |
Hello,
Looks like the tasks are different for the cases and maybe it's quickly on gif... I'm trying to reproduce it and catch the difference, could you help me? Thanks in advance! |
i did more testing and looks like the problem i found is different from what i initially thought: let me use As you see, only the names of the folders (instead of full paths) are displayed as the source. ============== Things started going wrong when i added "detected tasks": Full paths show up as the source, which is inconsistent. So this is not a bug introduced by this pull request. |
I fixed it in #5550 |
@elaihau thank you very much for your investigation, this was very helpful! |
@RomanNikitenko do you want to resolve this comment and merge this PR in near future? I see other PRs dependent on this one. Thanks ! |
Signed-off-by: Roman Nikitenko <rnikiten@redhat.com>
774f02e
to
e08f734
Compare
I fixed the comment here. Also I separated changes related to fix task converting, please review. It should be noted that ‘run task’ items for ‘configured’ tasks don’t look the same as for VS Code, so maybe it makes sense to create the issue and align this behavior. |
if (exist) { | ||
filteredRecentTasks.push(recent); | ||
for (const recent of recentTasks) { | ||
const taskConfig = configuredTasks.find(task => recent.label === task.label) || detectedTasks.find(task => TaskConfiguration.equals(task, recent)); |
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.
like i mentioned in the other comment, using label comparison would cause issues that tasks from different sources are indentified as the same task.
This is what happened with your change:
What i did was running test task
from test-resources_A
and test-resources_B
respectively.
We ended up having only one test task
in recently used tasks
============================
For your reference, this is what happened on master branch
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.
We used to use TaskConfiguration.equals()
which compares the label
and _source
- I guess you might have a good reason to use the label comparison instead. Could you please explain ?
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.
thank you, I'll check mentioned case
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 tried to fix the case like:
- User runs detected task (the task moves to 'recently used' section)
- User configures the task, edits it (adds some args for command, for example) and tries to run the task.
- It's expected for me that modified task will be running, not detected task.
So at first I try to find configured task by label for ‘recently used’ section. Why by label? Because
according to the doc for configured task source is the root folder, while for a detected task, it is the name of the provider - after configuring the task has another source - so I can not use equals method for this case. Is it correct?
Then I use equals method to find task among detected tasks.
But you are right, for a multi-root use case it's not working, so we need to improve filtering tasks for 'recently used' section.
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. You are right: When the detected task
is written into the tasks.json
, it becomes a configured task
. We need a machanism to differentiate the configured detected task
from the configured task
. And to be honest, I am not sure what is the best way to do.
The behavior for master branch was changed: after configuring of |
tasks.json
Related issues: #5064 and #5067
Signed-off-by: Roman Nikitenko rnikiten@redhat.com