actboy168 / vscode-tasks

MIT License
37 stars 14 forks source link

Add option to manually specify task order #14

Closed kiontupper closed 4 years ago

kiontupper commented 4 years ago

I found that sometimes the order of the tasks shown can be inconsistent (at least in newer versions of VSCode), breaking the logical order of large, multi-step workflows.

image

I wanted this to be Build, Prebuild, Deploy

This change is quite simple: it adds a position field to the status bar options. When the extension loads the tasks, it sorts them according to the position value, which defaults to 0.

This allowed me to fix the mess

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Build",
      // ...
      "options": {
        "statusbar": {
          "label": "$(tools) Build",
          "position": 0
        }
      }
    },
    {
      "label": "Rebuild",
      // ...
      "options": {
        "statusbar": {
          "label": "$(sync) Rebuild",
          "position": 1
        }
      }
    },
    {
      "label": "Deploy",
      // ...
      "options": {
        "statusbar": {
          "label": "$(rocket) Deploy",
          "position": 2
        }
      }
    }
  ]
}

Which yields the following result:

image

Much better! 🎉


PS: I also bumped the version number to 0.3.7.

actboy168 commented 4 years ago

I cannot reproduce this bug. Can you provide your tasks.json?

If VSCode does interrupt the order of tasks for some reason, I think it can use the order of tasks.json instead of the order provided by vscode.tasks.fetchTasks. No need for a new parameter.

kiontupper commented 4 years ago

It happened to me with the same tasks.json above, just without the position fields and the tasks just run NPM scripts.

actboy168 commented 4 years ago

I pushed a commit 178f4b1f16b237555744e141ee27945552d857ed. Now it should use the order in tasks.json exactly, I think this should solve your problem.