Skip to content

Tasks interfering despite sequence order #174791

@kamilmielnik

Description

@kamilmielnik

Type: Bug

  1. Create tasks.json:

Note "dependsOrder": "sequence".
Document formatter is Prettier.

{
  "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": []
    }
  ]
}
  1. Create keybindings.json:
[
  {
    "key": "ctrl+alt+f",
    "command": "workbench.action.tasks.runTask",
    "args": "format"
  }
]
  1. Create and save a TypeScript file:
import { unusedImport } from 'somewhere';

const x =         111;
  1. Hit Ctrl + Alt + F

Expected result

const x = 111;

Actual result
It will inconsistently, randomly(?) give 2 different results (either one of 2 requested tasks)

import { unusedImport } from 'somewhere';

const x = 111;

or

const x =         111;

Notes

  1. The same thing happens with extensions such as https://github.com/geddski/macros (even with the fix). 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:
{
  // 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 (441438a, 2023-02-08T21:35:30.018Z)
OS version: Linux x64 5.19.0-32-generic
Modes:
Sandboxed: No

System Info
Item Value
CPUs 13th Gen Intel(R) Core(TM) i9-13900K (32 x 5500)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: disabled_software
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
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
Extensions (11)
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)

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugtasksTask system issues

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions