microsoft / microsoft/vscode-cpptools
Support ${relativeFileDirname} in c_cpp_properties.json
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 6.2k
- Forks
- 1.7k
- Ø Merge
- 14 Std. 46 Min.
- Gemergte PRs (30 T.)
- 61
Beschreibung
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
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginnen Sie mit dem Verhalten der Variablenexpansion in c_cpp_properties.json und vergleichen Sie es mit der dokumentierten Variablenunterstützung in launch.json und tasks.json. Verwenden Sie die Beispielkonfiguration und die Pfadwerte in diesem Issue, um zu überprüfen, dass ${relativeFileDirname} pro Übersetzungseinheit aufgelöst wird und den erwarteten Include-Pfad erzeugt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- typescript
- Bereich
- tooling
- Issue-Typ
- Feature
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 35/100