Vscode-cpptools: IntelliSense complains about missing header if workspace contains several projects

Created on 17 Feb 2020  路  9Comments  路  Source: microsoft/vscode-cpptools

VSCode mistakenly reports that a header file is missing even though I can open this file using Go to definition and all symbols from this file are perfectly visible in the main file. This only occurs when there are several project folders in the workspace:

vscode-workspace

Originally reported in a PlatformIO Community topic, so I put together a more straightforward example. Steps to reproduce the issue:

  1. Clone this repository https://github.com/valeros/vscode-workspaces.git
  2. Open folder vscode-prj1
  3. Add folder vscode-prj2 to the workspace
  4. Add folder vscode-prj3 to the workspace
  5. Make sure that there are no problems with the file test3.h.
  6. Close VSCode
  7. Open VSCode
  8. See error squiggles under #include test3.h line.

OS and Version: Windows 8.1
VS Code Version: 1.14.1
C/C++ Extension Version: 0.26.3

cc @ivankravets

Multiroot Language Service bug fixed (release pending)

Most helpful comment

@ivankravets Yeah, sorry about that. We're looking into releasing 0.27.0-insiders as soon as possible: https://github.com/microsoft/vscode-cpptools/blob/master/Extension/CHANGELOG.md#cc-for-visual-studio-code-change-log . There were a huge amount of changes so we want to make sure there are no major regressions before shipping the release 0.27.0 (and we also have a couple Mac-only bugs we want to fix).

All 9 comments

This is fixed in our pending 1.0 release with our new multi-root implementation, but only when the includePath is changed to be like "${workspaceFolder}/inc" instead of just "inc". I'll look into why the implicit "${workspaceFolder} appears to work in single root.

@valeros "inc" without "${workspaceFolder}" is probably not going to be supported for multi-root in our next release (we could change this to a feature request to add support for that) -- it happens to work "unintentionally" in the single root case (as a byproduct of path canonicalization), but that mechanism gives the wrong workspace folder in the multiroot case. Can you add the ${workspaceFolder} later? It won't fix it now, because it's hitting a different issue.

I filed issue https://github.com/microsoft/vscode-cpptools/issues/4983 to track the relative path issue.

"inc" without "${workspaceFolder}" is probably not going to be supported for multi-root in our next release (we could change this to a feature request to add support for that)

I used relative paths just for that synthetic example, so relative paths actually not a problem because we use absolute paths when rendering our template for c_cpp_properties.json file. So in our case it's all right as long as it works properly with absolute paths.

Thanks!

@bobbrow @sean-mcmanus Is it possible to publish 0.26.x bugfix release and close this issue? We have a ton of reports and developers write bad feedback about our extension due to this issue:

We ask them to use 1 project per 1 workspace. However, this is not the right solution and most people think that the problem is with PlatformIO.

@ivankravets Yeah, sorry about that. We're looking into releasing 0.27.0-insiders as soon as possible: https://github.com/microsoft/vscode-cpptools/blob/master/Extension/CHANGELOG.md#cc-for-visual-studio-code-change-log . There were a huge amount of changes so we want to make sure there are no major regressions before shipping the release 0.27.0 (and we also have a couple Mac-only bugs we want to fix).

Thanks! We will wait for 0.27..0.

Our latest Insiders release has a new multi-root implementation (which fixes this bug): https://github.com/microsoft/vscode-cpptools/releases/tag/0.27.0-insiders. Please let us know if you find any multi-root-related bugs or regressions so we can prioritize fixing those for 0.27.0.

I cannot reproduce this issue with 0.27.0, so many thanks @sean-mcmanus

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SkyRiderMike picture SkyRiderMike  路  3Comments

jheinzel picture jheinzel  路  3Comments

jyavenard picture jyavenard  路  3Comments

peterwoods1 picture peterwoods1  路  3Comments

arl picture arl  路  3Comments