microsoft / microsoft/vscode-cpptools
Request: Allow merge of `forcedInclude` setting from base config when using `compile_commands.json`
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 61
Description
Bug type: General
Describe the bug
- OS and Version: Latest Linux Mint
- VS Code Version: 1.61
- C/C++ Extension Version: v1.7.0
This bug should be pretty easy to reproduce, for example:
Create a header file suppress-warnings.h with contents:
#ifdef __INTELLISENSE__
// 20 - identifier is undefined
#pragma diag_suppress 20
#endif
Create main.cc with contents:
int main(int argc, char** argv) { fdsfsdsfd; }
Edit c_cpp_properties.json:
{
"configurations": [
{
"name": "Linux",
"includePath": ["${default}"],
"defines": [],
"compilerPath": "/usr/local/bin/clang++",
"compileCommands": "${workspaceFolder}/compile_commands.json",
"cStandard": "c17",
"cppStandard": "gnu++20",
"intelliSenseMode": "linux-clang-x64",
"forcedInclude": [
"${workspaceFolder}/suppress-warnings.h"
]
}
],
"version": 4
}
Example compile_commands.json (empty list won't break it):
[
{
"directory": "/path-to-workspace/build/src",
"command": "true",
"file": "/path-to-workspace/main.cc"
}
]
Includes from forcedInclude are not included and do not suppress a warning.
If you comment compileCommands in c_cpp_properties.json - the forced include is included.
Expected behaviour:
forcedInclude is included when using compileCommands
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the behavior using c_cpp_properties.json with compileCommands enabled, the sample compile_commands.json, and suppress-warnings.h included through forcedInclude. Compare the result with compileCommands commented out; done means the forced include is honored and the warning is suppressed in both configurations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, vscode
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100