microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.99k stars 29.2k forks source link

tasks.json syntax wrong? #135316

Closed bugfishteam closed 3 years ago

bugfishteam commented 3 years ago

Issue Type: Bug

For some reason the arg for a custom include path (ex, a user's own .h files) does NOT work in tasks.json (for compiler preprocessor) as it does in c_cpp_properties.json (for IntelliSense).

Namely, has to be something like "/I", "${workspaceFolder}/lib/" ; Because "/I", "${workspaceFolder}/**/" does NOT WORK !

Very confusing since the Microsoft docs on variable substitution give you the 2nd example!

VS Code version: Code 1.61.1 (c13f1abb110fc756f9b3a6f16670df9cd9d4cf63, 2021-10-14T01:19:42.089Z) OS version: Windows_NT x64 10.0.19043 Restricted Mode: No

System Info |Item|Value| |---|---| |CPUs|Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz (12 x 2592)| |GPU Status|2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled| |Load (avg)|undefined| |Memory (System)|15.76GB (8.09GB free)| |Process Argv|--crash-reporter-id 78254efb-024c-4795-a476-83ad39a8787d| |Screen Reader|no| |VM|0%|
A/B Experiments ``` vsliv368:30146709 vsreu685:30147344 python383:30185418 pythonvspyt602:30300191 vspor879:30202332 vspor708:30202333 vspor363:30204092 vswsl492cf:30256860 pythonvspyt639:30300192 pythontb:30283811 pythonptprofiler:30281270 vsdfh931cf:30280410 vshan820:30294714 vstes263cf:30335440 pythondataviewer:30285071 pythonvsuse255:30340121 vscod805:30301674 pythonvspyt200:30340761 binariesv615:30325510 vsccppwt:30382697 pythonvssor306:30344512 bridge0708:30335490 pygetstartedt2:30371810 dockerwalkthru:30377721 bridge0723:30353136 pythonrunftest32:30373476 pythonf5test824:30373475 javagetstartedt:30364666 pythonvspyt187:30373474 vsqsis200cf:30381675 vsaa593:30376534 vssld246cf:30379912 ```
bugfishteam commented 3 years ago

Additionally I Googled this for days, saw almost no guidance for VSCode, rather a bunch for Visual Studio.

The 'getting started' docs for VSC were ok but no mention of tasks.json or its preprocessor args. So had to manually Google preprocessor args, that too kind of vague and not geared for any particular Microsoft IDE. Actually more geared toward command line.

Wouldn't it be nice to just follow good documentation, unless I'm missing something. Please and thank you.

alexr00 commented 3 years ago

Can you share your whole task?

bugfishteam commented 2 years ago

Sorry for delay, whole build task below.

Basically completely default for a 'new' project, noting I ONLY added the "/I" ... flag. Again I could have missed but have repeatedly browsed the docs but (1) they're just for Visual Studio command line, and (2) I can't find further mention of VSC compiler flag variations.

Specifically below, why doesn't "${workspaceFolder}/**" work like the other .json files (ex, c_cpp_properties.json); in other words why do we have to put "${workspaceFolder}/lib", which is more limited (and requires more specific entries)?

{
  "version": "2.0.0",
  "windows": {
    "options": {
      "shell": {
        "executable": "cmd.exe",
        "args": [
          "/C",
          // The path to VsDevCmd.bat depends on the version of Visual Studio you have installed.
          "\"C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/Tools/VsDevCmd.bat\"",
          "&&"
        ]
      }
    }
  },
  "tasks": [
    {
      "type": "shell",
      "label": "cl.exe build active file",
      "command": "cl.exe",
      "args": [
        "/Zi",
        "/EHsc",
        "/I",
        "${workspaceFolder}/lib",
        "/Fe:",
        "${fileDirname}\\${fileBasenameNoExtension}.exe",
        "${file}"
      ],
      "problemMatcher": ["$msCompile"],
      "group": {
        "kind": "build",
        "isDefault": true
      }
    }
  ]
}
bugfishteam commented 2 years ago

Hey replied, are you going to open back up?

On Wed, Nov 3, 2021 at 7:26 AM VS Code Issue Triage Bot < @.***> wrote:

Closed #135316 https://github.com/microsoft/vscode/issues/135316.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/microsoft/vscode/issues/135316#event-5561218889, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADGWJ3XS2UWNAPT72OKW4A3UKES6RANCNFSM5GHKC57Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

--

-Eric

Principal @ Optimus Quality Consulting, LLC

ASQ Certified Six Sigma Black Belt, Quality Auditor optimusqualityconsulting.com

@.*** | P: +1.650.260.3496 <(650)%20260-3496>

LinkedIn https://www.linkedin.com/company/optimus-quality-consulting-llc?trk=top_nav_home | Facebook https://www.facebook.com/optimusqc/?ref=aymt_homepage_panel | Twitter http://twitter.com/optimusqc

alexr00 commented 2 years ago

This looks like a question about cl.exe. I would suggest asking on Stack Overflow.