Skip to content

Build task template use absolute path for building but relative path for problemMatcher #5209

@escape0707

Description

@escape0707

Type: General

Environments

  • OS and Version: Windows_NT x64 10.0.18363
  • VS Code Version: 1.44.0-insider
  • C/C++ Extension Version: 0.26.3

Describe the bug

The build task templates on windows, e.g. g++.exe build active file, contains:

{
    "version": "2.0.0",
    "tasks": [
        {
            "type": "shell",
            "label": "g++.exe build active file",
            "command": "C:\\Users\\someone\\scoop\\apps\\gcc\\current\\bin\\g++.exe",
            "args": [
                "-g",
                "${file}",
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd": "C:\\Users\\someone\\scoop\\apps\\gcc\\current\\bin"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}

But the problemMatcher $gcc use relative path by default. And if there is warnings or errors emitted during the build process, we can't use the problem panel to track it down. Clicking on a problem entity will cause an error notification:

Unable to open 'test.cpp': Unable to read file 'd:\Workspaces\test\d:\Workspaces\test\test.cpp' (Error: Unable to resolve non-existing file 'd:\Workspaces\test\d:\Workspaces\test\test.cpp').

Potential fixes

Use relative path for build by default, or use absolute path for problemMatcher $gcc by default.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions