Vscode-cpptools: Symbols not refreshed when file changed cross folder for a multi-root workspace

Created on 14 Nov 2018  ยท  4Comments  ยท  Source: microsoft/vscode-cpptools

Type: LanguageService

Describe the bug

  • OS and Version: Windows 10
  • VS Code Version: 1.29.0
  • C/C++ Extension Version: 0.20.1
  • Other extensions you installed (and if the issue persists after disabling them):
  • A clear and concise description of what the bug is.

To Reproduce

  • Consider if you have a multi-root workspace like this:
Workspace
โ”œโ”€โ”€ ProjectA
โ”‚   โ””โ”€โ”€ HeaderA.h
โ””โ”€โ”€ ProjectB
    โ””โ”€โ”€ SouceB.cpp
  • Add c_cpp_properties.json config for ProjectB:
{
    "configurations": [{
        "name": "Win32",
        "browse": {
            "path": [
                "${workspaceFolder}",
                "${workspaceFolder}/../ProjectA"
            ],
            "limitSymbolsToIncludedHeaders": true
        },
        "includePath": [
            "${workspaceFolder}",
            "${workspaceFolder}/../ProjectA"
        ],
        "intelliSenseMode": "msvc-x64"
    }],
    "version": 4
}
  • Edit and save HeaderA.h in ProjectA.

  • Edit SouceB.cpp, then you will find that the symbols changed in HeaderA.h is not refreshed.

Expected behavior

Refresh the symbols when related header has changed in a multi-root workspace.

Screenshots

Additional context

Multiroot Language Service bug fixed (release pending)

All 4 comments

This is an unfortunate side effect of the current implementation of multiroot. Our multiroot implementation spawns an extension instance for each folder in the workspace and the file watcher events are only sent to the instance representing the folder where the file changed.

At some point we would like merge all the instances into a single one, but it hasn't made it to the top of the backlog yet. I'll start tagging related multiroot issues so we can get a sense of the relative importance of this refactoring work.

@bobbrow is there a way for outside contribution for this?

@roiche The multi-root code is implemented in the open source TypeScript code, so it's possible you could contribute a fix for this...but we might also need to make additional changes to the closed source part too (not sure yet). It seems like we should the TypeScript to send the messages to all the clients and let the clients determine if they should handle it or not, but I'm not too familiar with the multi-root stuff.

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thndrwrks picture thndrwrks  ยท  3Comments

jheinzel picture jheinzel  ยท  3Comments

DemoCrazer picture DemoCrazer  ยท  3Comments

jyavenard picture jyavenard  ยท  3Comments

peterwoods1 picture peterwoods1  ยท  3Comments