microsoft / vscode-cpptools

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

CppToolsAPI incorrectly adding includes and defines #2015

Closed ThadHouse closed 6 years ago

ThadHouse commented 6 years ago

I'm trying to test out the new extension API to be able to provide my own configurations, and am running into issues.

Below is the SourceFileConfigurationItem I am providing for my file. The provided include paths are correct (Well I have another issue I'm posted separately with them) however MSVC includes are being added, and not my includes provided by the provided compiler.

Here is the debug log

sending compilation args for C:\USERS\THADH\DOCUMENTS\GRADLEJAVA\SRC\CPP\MYTHING.CPP
  include: C:\Users\thadh\Documents\GradleJava\build\tmp\expandedArchives\hal-2018.3.2-headers.zip_c2e0b10dbe01f5bb317559e19f923b7b
  include: C:\Users\thadh\Documents\GradleJava\build\tmp\expandedArchives\hal-2018.3.2-headers.zip_c2e0b10dbe01f5bb317559e19f923b7b\HAL
  include: C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Tools\MSVC\14.13.26128\include
  include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.16299.0\ucrt
  include: C:\Program Files (x86)\Windows Kits\10\Include\10.0.16299.0\shared
  define: _DEBUG
  define: UNICODE
  define: _UNICODE
  stdver: --ms_c++latest

Here is the SourceFileConfigurationItem

[
    {
        "uri": "c:\\Users\\thadh\\Documents\\GradleJava\\src\\cpp\\MyThing.cpp",
        "configuration": {
            "standard": "c++14",
            "intelliSenseMode": "clang-x64",
            "includePath": [
                "C:\\Users\\thadh\\Documents\\GradleJava\\build\\tmp\\expandedArchives\\hal-2018.3.2-headers.zip_c2e0b10dbe01f5bb317559e19f923b7b",
                "C:\\Users\\thadh\\Documents\\GradleJava\\build\\tmp\\expandedArchives\\cscore-cpp-1.2.0-headers.zip_d74028ab3c80a2c64e1d3f5057fd0f19",
                "C:\\Users\\thadh\\Documents\\GradleJava\\build\\tmp\\expandedArchives\\opencv-cpp-3.2.0-headers.zip_1b8591564854592a4aff6bd224b2b0a3",
                "C:\\Users\\thadh\\Documents\\GradleJava\\build\\tmp\\expandedArchives\\wpilibc-2018.3.2-headers.zip_4790c768d89540161556bab2475dfed0",
                "C:\\Users\\thadh\\Documents\\GradleJava\\build\\tmp\\expandedArchives\\ntcore-cpp-4.0.0-headers.zip_517391151665b6a51f10f788c06ee62d",
                "C:\\Users\\thadh\\Documents\\GradleJava\\build\\tmp\\expandedArchives\\ni-libraries-2018.3.2-headers.zip_55705e66b0e6e7d3459ef1e0f179830e",
                "C:\\Users\\thadh\\Documents\\GradleJava\\build\\tmp\\expandedArchives\\wpiutil-cpp-3.1.0-headers.zip_8913f4f6489a6d0e0336260f474dc3a0",
                "C:\\Users\\thadh\\Documents\\GradleJava\\build\\tmp\\expandedArchives\\CTRE-phoenix-cpp-5.2.1.1-headers.zip_ed51ae3396f2e2d306a9f6a233af2bce",
                "C:\\Users\\thadh\\Documents\\GradleJava\\build\\tmp\\expandedArchives\\navx-cpp-3.0.346-headers.zip_bdc8378de58d7490d517245a513e81b3",
                "C:\\Users\\thadh\\Documents\\GradleJava\\src\\include",
                "C:\\Users\\thadh\\Documents\\GradleJava\\src\\cpp"
            ],
            "defines": [],
            "compilerPath": "C:\\frc\\bin\\arm-frc-linux-gnueabi-g++.exe"
        }
    }
]
bobbrow commented 6 years ago

@ThadHouse, I forgot to mention that 0.17.5-insiders should have the API enabled with the language service backend support if you want to try it out.

The current implementation is alpha quality, but I'm in the process of making some additional UI changes in the TypeScript code to polish the experience. There will be additional updates to the API, but I published an npm package for it so you should be able to get the updates as they are published. The package name is vscode-cpptools.

ThadHouse commented 6 years ago

Cool. Just downloaded the API, and I'll take a look at using insiders soon. Not super worried about changes, will happily make changes required to make the final release better.

bobbrow commented 6 years ago

The bare-bones support for this was released in 0.17.5. Improved support is available in the pending 0.17.6 release.