microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.45k stars 1.53k forks source link

Task json "Operating system specific properties" is broken #11601

Open Dru01 opened 10 months ago

Dru01 commented 10 months ago

Environment

Bug Summary and Steps to Reproduce

Bug Summary:

The windows and linux properties for cppbuild task are not recognized by itellisense and when trying to run program nothing happens.

Steps to reproduce:

  1. Configure task.json as:
{
    "tasks": [
        {
            "type": "cppbuild",
            "label": "C/C++: g++.exe build active file",
            "command": "g++",
            "options": {
                "cwd": "${fileDirname}"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            },
            "detail": "Task generated by Debugger.",
            "windows": {
                "args": [
                    "-fdiagnostics-color=always",
                    "-g",
                    "--std=c++20",
                    "-Wall",
                    "-Wextra",
                    "-DDEBUG",
                    "${file}",
                    "-o",
                    "${fileDirname}/${fileBasenameNoExtension}.exe"
                ],
            },
            "linux": {
                "args": [
                    "-fdiagnostics-color=always",
                    "-g",
                    "--std=c++20",
                    "-Wall",
                    "-Wextra",
                    "-DDEBUG",
                    "${file}",
                    "-o",
                    "${fileDirname}/${fileBasenameNoExtension}.out"
                ],
            },
        }
    ],
    "version": "2.0.0"
}
  1. Click Run C/C++ File

Debugger Configurations

None

Debugger Logs

None

Other Extensions

No response

Additional Information

https://github.com/microsoft/vscode-cpptools/assets/37126509/b30fedee-6101-4b3f-b2c0-e708325c32d2

sean-mcmanus commented 10 months ago

The cppbuild task doesn't check those OS-specific properties (https://github.com/microsoft/vscode-cpptools/blob/main/Extension/src/LanguageServer/cppBuildTaskProvider.ts#L51).