microsoft / microsoft/vscode-cpptools

Wildcard support for includePath doesn't seem to work

Open
#13,284 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Feature: Configuration Language Service
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Environment
  • OS and Version: Mac OS, latest
  • VS Code Version: Version: 1.97.2
  • C/C++ Extension Version: 1.23.6
Bug Summary and Steps to Reproduce

I've created a new toy Bazel project and added Absel as an external dependency. Bazel can build the project OK.

However, when I open my main.cc file in VSCode, the editor says it doesn't recognize the abseil-specific includes.

My .vscode/c_cpp_properties.json contains the following record (possibly added by the Bazel plugin):

      "includePath": [
        "${workspaceFolder}/**"  // This doesn't work.
      ],

So it's supposed to find bazel-downloaded libs, but doesn't.

When I enter the correct path to the Abseil dependency manually, VSCode handles the includes correctly:

      "includePath": [
        "${workspaceFolder}/bazel-LU/external/abseil-cpp~"  // This works.
      ],

Could this be due to ${workspaceFolder}/bazel-LU being a symlink to a under under /tmp? Probably not because this has been the case since at least 2021: https://discuss.elastic.co/t/bazel-build-artifacts-stored-in-tmp-by-default/281814.

Configuration and Logs
Here is my `c_cpp_properties.json`. 


{
  "version": 4,
  "configurations": [
    {
      "name": "Mac",
      "includePath": [
        "${workspaceFolder}/bazel-LU/external/abseil-cpp~",
        "${workspaceFolder}/bazel-LU/external/googletest~/googletest/include"
      ],
      "defines": [],
      "macFrameworkPath": [
        "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks"
      ],
      "compilerPath": "/usr/bin/clang",
      "cppStandard": "c++23",
      "intelliSenseMode": "macos-clang-arm64"
    }
  ]
}
Other Extensions

No response

Additional context

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the report with the supplied .vscode/c_cpp_properties.json and main.cc, comparing the ${workspaceFolder}/** entry with the explicit Abseil path. Check whether the wildcard resolves the Bazel-generated symlinked dependency; done means the wildcard configuration recognizes the Abseil includes as the explicit path does.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, vscode
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.