Repository: vscode
Issue: Tasks interfering despite sequence order
Labels: bug,tasks

Type: <b>Bug</b>

1. Create `tasks.json`:

Note `"dependsOrder": "sequence"`.
Document formatter is [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode).

```json
{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "organize-imports",
      "command": "${command:editor.action.organizeImports}"
    },
    {
      "label": "format-document",
      "command": "${command:editor.action.formatDocument}"
    },
    {
      "label": "format",
      "dependsOrder": "sequence",
      "dependsOn": ["organize-imports", "format-document"],
      "problemMatcher": []
    }
  ]
}
```

2. Create `keybindings.json`:
```json
[
  {
    "key": "ctrl+alt+f",
    "command": "workbench.action.tasks.runTask",
    "args": "format"
  }
]
```

3. Create and save a TypeScript file:
```ts
import { unusedImport } from 'somewhere';

const x =         111;
```

4. Hit Ctrl + Alt + F

-----

**Expected result**
```ts
const x = 111;
```

**Actual result**
It will inconsistently, randomly(?) give 2 different results (either one of 2 requested tasks)
```ts
import { unusedImport } from 'somewhere';

const x = 111;
```

or

```ts

const x =         111;
```

----

**Notes**

1. The same thing happens with extensions such as https://github.com/geddski/macros (even [with the fix](https://github.com/geddski/macros/pull/11)). I was testing it a lot.
2. I'm actually trying to run 3 tasks in sequence (also `eslint.executeAutofix` in between the two from example), but 2 tasks are enough to reproduce the issue.
3. Adding a delay in between the tasks helps:
```json
{
  // See https://go.microsoft.com/fwlink/?LinkId=733558
  // for the documentation about the tasks.json format
  "version": "2.0.0",
  "tasks": [
    {
      "label": "organize-imports",
      "command": "${command:editor.action.organizeImports}"
    },
    {
      "label": "sleep-1",
      "type": "shell",
      "command": "/usr/bin/sleep",
      "args": ["0"]
    },
    {
      "label": "eslint",
      "command": "${command:eslint.executeAutofix}"
    },
    {
      "label": "sleep-2",
      "type": "shell",
      "command": "/usr/bin/sleep",
      "args": ["0"]
    },
    {
      "label": "prettier",
      "command": "${command:editor.action.formatDocument}"
    },
    {
      "label": "format",
      "dependsOrder": "sequence",
      "dependsOn": ["organize-imports", "sleep-1", "eslint", "sleep-2", "prettier"],
      "problemMatcher": []
    }
  ]
}
```

----

VS Code version: Code 1.75.1 (441438abd1ac652551dbe4d408dfcec8a499b8bf, 2023-02-08T21:35:30.018Z)
OS version: Linux x64 5.19.0-32-generic
Modes:
Sandboxed: No

<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
|CPUs|13th Gen Intel(R) Core(TM) i9-13900K (32 x 5500)|
|GPU Status|2d_canvas: enabled<br>canvas_oop_rasterization: disabled_off<br>direct_rendering_display_compositor: disabled_off_ok<br>gpu_compositing: enabled<br>multiple_raster_threads: enabled_on<br>opengl: enabled_on<br>rasterization: enabled<br>raw_draw: disabled_off_ok<br>skia_renderer: enabled_on<br>video_decode: disabled_software<br>video_encode: disabled_software<br>vulkan: disabled_off<br>webgl: enabled<br>webgl2: enabled<br>webgpu: disabled_off|
|Load (avg)|1, 0, 0|
|Memory (System)|31.09GB (24.43GB free)|
|Process Argv|--unity-launch|
|Screen Reader|no|
|VM|0%|
|DESKTOP_SESSION|ubuntu|
|XDG_CURRENT_DESKTOP|Unity|
|XDG_SESSION_DESKTOP|ubuntu|
|XDG_SESSION_TYPE|x11|
</details><details><summary>Extensions (11)</summary>

Extension|Author (truncated)|Version
---|---|---
color-info|bie|0.7.2
bojler-vscode|Kam|0.0.1
vscode-eslint|dba|2.4.0
gitlens|eam|13.2.0
prettier-vscode|esb|9.10.4
easy-icons|jam|0.3.1
macros-vscode|Kam|1.2.0
vscode-docker|ms-|1.23.3
sublime-keybindings|ms-|4.0.10
r-factor-vscode|Lim|1.0.0
multi-command|ryu|1.6.0

(1 theme extensions excluded)

</details>
<!-- generated by issue reporter -->