-
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
[vscode] fix fetchTasks to no longer filter modified configured tasks #8399
Conversation
@akosyakov Whom please I can contact to start reviewing this PR? 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 reviewed the changes superficially for the moment, please address the test since we should not be disabling the rules (it leaves us with incorrect formatting, suppressed potential warnings and errors). Also, please squash your commits (into a single commit) when you are ready for another round of review.
@@ -139,9 +139,19 @@ export class TaskConfigurations implements Disposable { | |||
if (detected) { | |||
// there might be a provided task that has a different scope from the task we're inspecting | |||
detectedTasksAsConfigured.push({ ...detected, ...cus }); | |||
} else { | |||
if (configuredTasksMap.has(rootFolder)) { | |||
configuredTasksMap.get(rootFolder)!.set(cus['label'], cus as TaskConfiguration); |
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.
How can we be sure that the label
field is not undefined
here?
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 agree with your concern and maybe I have to add a check here.
The reason of such usage of label
field is caused by the following:
PR modifies method getTasks
.
This method processes 2 groups of tasks:
- taskCustomizationMap
- tasksMap
These groups are created in the method reorganizeTasks
. As you can see, the existing code:
addConfiguredTask(scopeKey, transformedTask['label'] as string, transformedTask); |
uses the field
label
without additional check.If task is not detected it's assigned to tasksMap group assuming it has field
label
.Don't we miss the check already here?
CHANGELOG.md
Outdated
@@ -2,6 +2,7 @@ | |||
|
|||
## v1.5.0 | |||
|
|||
- [tasks] fix vscode.tasks.fetchTasks to no longer filter modified configured tasks aligning to VS Code. |
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.
When fixing a bug, please add a link to the issue for easy reference.
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
} | ||
} | ||
} | ||
const configuredTasks = Array.from(configuredTasksMap.values()).reduce((acc, labelConfigMap) => acc.concat(Array.from(labelConfigMap.values())), [] as TaskConfiguration[]); |
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 I understand the code, this will still remove any tasks of type "shell", etc (which don't have a task definition) that have the same label (since we're using a map by label). Is the behaviour after this change aligned with VS Code as described in #7672 (comment) ? If I add the following to a tasks.json file:
{
"label": "My Task",
"type": "shell",
"command": "echo Hello",
"problemMatcher": []
},
{
"label": "My Task",
"type": "shell",
"command": "echo Hello",
"problemMatcher": []
}
}
and then do "run tasks", I see two tasks, as I read the code here, we would only get one 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.
You are right, the purpose of this PR is not to cover all delta of the fetchTasks between Theia and VSCode.
It covers only specific case that we run into, implementing VSCode extension with task provider.
8602d14
to
ef6dabc
Compare
related to: eclipse-theia#7681 Signed-off-by: Alla Volkov <[email protected]>
ef6dabc
to
1ca6e79
Compare
Any update on this PR? |
I'm not sure this PR does the right thing: according to https://code.visualstudio.com/docs/editor/tasks#_customizing-autodetected-tasks, an entry in a tasks.json file must be either of type I've opened #10850 exactly because we don't really have a good handle on questions like this. I would vote for keeping this PR open unmerged. When we attack the tasks once more, we can decide for/against it. |
@tsmaeder the pull-request is over a year old and based on your last comment you don't believe it is going in the right direction. Is it safe to close the issue to keep the list of open pull-requests more manageable? |
As much as I hate doing this, I think the likelihood of this one getting merged any time soon is low. |
related to: #7681
Signed-off-by: Alla Volkov [email protected]
What it does
fetchTasks
filters out some configured tasks from thetasks.json
file.It happens when an auto detected task is configured and some of its properties are then changed in the
tasks.json
file.Management of the tasks from the
tasks.json
file separates them into two groups:When
fetchTasks
is executed, the heuristic looks for matched original auto detected task for each customized task. The search is strict and compares each property from the task definition. In the case of a modified task, the match fails, and the task is filtered out. The PR resolves this problem by assigning these tasks to the group of configured tasks instead.How to test
echo
task provider.npm install
npm run compile
vsce package
RunTasks…
from the command paletteObserve 2 auto detected tasks:
echo: task 1
echo: task 2
task 1
tasks.json
file:label
totask 3
text
toConfigured text
RunTasks…
from the command palettetask 3
echo: task 1
echo: task 2
Prior to this PR
task 3
was missing in the list of tasks. In VS Code it was listed.Review checklist
Reminder for reviewers