Skip to content

TypeScript task detection is not cross-platform #68812

@TimMensch

Description

@TimMensch

Issue Type: Bug

If your tsconfig.json is in a subfolder, the folder path has to match the system file separator (\ on Windows, / on Mac/Linux) in order for it to work.

Steps to Reproduce:

  1. Create a project with a folder in it.
  2. Put tsconfig.json in the subfolder along with a test TypeScript file.
  3. Create a build task for that tsconfig.json. On Windows it will get a backslash, on Mac/Linux a forward slash.
  4. Switch the slash to that of the opposite platform.
  5. Note that now you can't build that task, and that instead you get an error similar to the following:
Error: The typescript task detection didn't contribute a task for the following configuration:
{
    "label": "tsc-api",
    "type": "typescript",
    "tsconfig": "api/tsconfig.json",
    "option": "watch",
    "options": {
        "cwd": "${workspaceFolder}/api"
    },
    "promptOnClose": true,
    "problemMatcher": [
        "$tsc-watch"
    ],
    "group": "build"
}
The task will be ignored.

The only workaround I've found is to create TWO tasks for each desired task, where one has forward slashes and the other backslashes. But a recent VS Code update made a warning box appear for those configurations every time I build or debug, which is annoying. Please address the underlying issue.

Honestly, this would be yet another situation where simply using forward slashes all the time would fix everything. This would also fix, for instance:

#35593

...a bug that's been around for a year and a half now. :(

VS Code version: Code - Insiders 1.32.0-insider (003521e, 2019-02-15T06:16:29.903Z)
OS version: Windows_NT x64 10.0.17134

System Info
Item Value
CPUs Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz (8 x 2808)
GPU Status 2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
rasterization: enabled
surface_synchronization: enabled_on
video_decode: enabled
webgl: enabled
webgl2: enabled
Memory (System) 15.89GB (2.72GB free)
Process Argv
Screen Reader no
VM 0%
Extensions: none

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable buggood first issueIssues identified as good for first-time contributorstasksTask system issuesverifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions