microsoft / microsoft/vscode-cpptools

Add squiggles in c_cpp_properties.json for browse.databaseFilename if it is not the first folder in the multi-root workspace

Open
#6,838 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Version info

  • OS and Version: MacOS 11.1
  • VS Code Version: 1.52.1
  • C/C++ Extension Version: 1.2.0-insiders2
  • Other extensions you installed (and if the issue persists after disabling them): Tried without every other extension

Bug description

I have set browse.databaseFilename in my c_cpp_properties.json, unfortunately it looks like that property isn't used/applied. But i already found out why it isn't working.

Content of my c_cpp_properties.json:

{
    "configurations": [
        {
            "name": "Configuration 1",
            "defines": [],
            "cStandard": "c11",
            "cppStandard": "c++17",
            "intelliSenseMode": "clang-x64",
            "browse": {
                "databaseFilename": "/tmp/vscode/browse_config10.db"
            }
        }
    ],
    "version": 4
}

Now here comes the thing: I noticed that the order of workspace folders is affecting this behavior. Here is the content of my workspace json file:

{
	"folders": [
		{
			"path": "build"
		},
		{
			"path": "src"
		},
	],
	"settings": {
		"C_Cpp.loggingLevel": "Debug",
	}
}

This is my folder/file structue:

├── build
│   └── .vscode
│       └── settings.json
├── src
│   ├── .vscode
│   │   └── c_cpp_properties.json
│   └── main.cpp
└── workspace.code-workspace

As soon as i put the src folder to the top (where c_cpp_properties.json is located in), it works as expected!

"folders": [
	{
		"path": "src"
	},
	{
		"path": "build"
	}
],

Maybe this is intended and I'm not aware of, but i don't think so.
I attached a zipfile with my minimal example, so this should be easy to reproduce: code_workspace.zip

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

Reproduce the issue with the attached code_workspace.zip, using the workspace JSON with build before src and then reversing the folder order. Start with src/.vscode/c_cpp_properties.json and the browse.databaseFilename handling; done means the configured database path is applied regardless of folder order and the reported invalid configuration receives the requested squiggles.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, typescript, vscode
Domain
devtools, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.