eclipse-theia / theia

Eclipse Theia is a cloud & desktop IDE framework implemented in TypeScript.
http://theia-ide.org
Eclipse Public License 2.0
19.4k stars 2.45k forks source link

tasks: 'configure tasks' does not work correctly and overrides previously configured tasks #8979

Open vince-fugnitto opened 3 years ago

vince-fugnitto commented 3 years ago

Bug Description:

Given that a user attempts to configure more than two tasks, the last task is always overwritten. This behavior is not what is expected, and does not produce the same results compared to vscode.

Theia (after performing multiple configures):

{
  "tasks": [
    {
      "type": "vince",
      "task": "vince-build",
      "problemMatcher": []
    },
    {
      "type": "vince",
      "task": "vince-none",
      "problemMatcher": []
    }
  ]
}

VS Code (after performing multiple configures):

{
  "version": "2.0.0",
  "tasks": [
    {
      "type": "vince",
      "task": "vince-build",
      "group": "build",
      "problemMatcher": [],
      "label": "vince: vince-build"
    },
    {
      "type": "vince",
      "task": "vince-clean",
      "group": "clean",
      "problemMatcher": [],
      "label": "vince: vince-clean"
    },
    {
      "type": "vince",
      "task": "vince-none",
      "problemMatcher": [],
      "label": "vince: vince-none"
    },
    {
      "type": "vince",
      "task": "vince-rebuild",
      "group": "rebuild",
      "problemMatcher": [],
      "label": "vince: vince-rebuild"
    },
    {
      "type": "vince",
      "task": "vince-test",
      "group": "test",
      "problemMatcher": [],
      "label": "vince: vince-test"
    }
  ]
}

With the framework, I'm only ever able to get 2 tasks configured, while in vscode I have all of them.

Steps to Reproduce:

In order to reproduce, I created a custom TaskProvider extension which contributes multiple tasks:

  1. add the example vscode-task-provider-example extension to the framework
  2. open a workspace (ensure that no .theia or .vscode folder is present in the workspace
  3. run the command configure tasks
  4. repeat the process for all items in the list (notice that the last configuration always gets overwritten)
  5. test the extension in vscode and notice that it does not overwrite pre-existing configurations

Additional Information

msujew commented 3 years ago

@vince-fugnitto I've spent some time looking into this one. It seems like the main reasons this happens are:

When saving the tasks file in between running the configure tasks command, the intended behaviour emerges.

In vscode changes to the tasks.json file via the configure tasks command are always commited. I'd recommend implementing the same behaviour. I'll try finding a solution myself today.