vscode-cpptools
vscode-cpptools copied to clipboard
Support ${relativeFileDirname} in c_cpp_properties.json
Type: LanguageService
Describe the bug
- OS and Version: Windows 10
- VS Code Version: 1.45.1
- C/C++ Extension Version: 0.28.2
- Other extensions you installed (and if the issue persists after disabling them): N/A
- Does this issue involve using SSH remote to run the extension on a remote machine?: No
VSCode supports ${relativeFileDirname} in launch.json and tasks.json. See here. I would like to have support for this variable in c_cpp_properties.json. I have a module testing framework that generates mocked functions and places them in mock_defaults.h. Each test has its own version of this header. When the test is open in the editor cpp_tools should grab ${relativeFileDirname} and use it for that translation units include paths.
Ex c_cpp_properties.json:
{
"configurations": [
{
"defines": [
"${default}"
],
"includePath": [
"${default}",
"${workspaceFolder:System Code}/bin/mod/${relativeFileDirname}"
],
"intelliSenseMode": "msvc-x64",
"name": "Win32"
}
],
"version": 4
}
Expected behavior The above config should allow each translation unit (i.e. module test in my case) to use a path unique to itself.
For expample, ${workspaceFolder} = c/code/dev ${fileDirname} = c/code/dev/tests/path/to/test ${relativeFileDirname} = tests/path/to/test final include path = c/code/dev/bin/mod/tests/path/to/test
This feature request is being closed due to insufficient upvotes. When at least 2 upvotes are received, this issue will be eligible for our backlog.
This feature request has received enough votes to be added to our backlog.