Skip to content
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

fix(task): Align task group validation with VS Code #13075

Merged
merged 3 commits into from
Nov 28, 2023

Conversation

planger
Copy link
Contributor

@planger planger commented Nov 13, 2023

What it does

In VS Code, the following is considered correct in a tasks.json:

"group": {"kind": "build","isDefault": false}

In Theia, however, this is considered an error as the enumeration in the JSON Schema restricts valid values to isDefault: true. This also prevents such tasks to be listed correctly when e.g. executing the command "Run Build Task".

Contributed on behalf of STMicroelectronics.

Fixes #12917

How to test

  • Create a tasks.json with the following content:
{
    "version": "2.0.0",
    "tasks": [
        {
            "label": "echo",
            "type": "shell",
            "command": "echo Hello",
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}
  • Observe how it is considered valid and automatically executes when the user executes "Run Build Task"
  • Change the task to below and observe how it is still considered valid and shows up as a suggestion when executing "Run Build Task".
        {
            "label": "echo",
            "type": "shell",
            "command": "echo Hello",
            "group": {
                "kind": "build",
                "isDefault": false
            }
        }

Follow-ups

There is another difference to the behavior of VS Code:
If there is only one task in the group, it'll be considered the default task and executed automatically. In Theia, the user is still prompted which task to execute even though there is just one. Not sure if we want to change that though.

Review checklist

Reminder for reviewers

In VS Code, the following is considered correct in a `tasks.json`:
```
"group": {"kind": "build","isDefault": false}
```

In Theia, however, this is considered an error. This also prevents such
tasks to be listed correctly when e.g. executing the command
"Run Build Task".

Contributed on behalf of STMicroelectronics.

Fixes eclipse-theia#12917

Change-Id: I1123b1a1dc5880e32780ca0b61f3bccd230b43ff
@planger planger added the tasks issues related to the task system label Nov 13, 2023
@planger planger requested a review from msujew November 28, 2023 13:34
Copy link
Member

@msujew msujew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, that works way better and makes plainly more sense 👍

@planger planger merged commit c992452 into eclipse-theia:master Nov 28, 2023
13 of 14 checks passed
@planger planger deleted the planger/issues/12917 branch November 28, 2023 17:25
@planger planger added this to the 1.44.0 milestone Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tasks issues related to the task system
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Run build task is failing to collect tasks
2 participants