Skip to content

${userHome} variable expands to path and variable name #169757

@rtillery

Description

@rtillery

Type: Bug

Below are the steps that illustrate the actual root problem. The original issue was that I could not get the CPPTools extension to recognize my cross compiler to obtain settings, so it appears that the visual indication of the issue shown below is occurring within VS Code or the extension when the path is actually used.

Running on Ubuntu 20.04.

Open Folder...
  VSCodeUserHomeBug

If Microsoft's C/C++ extension is not installed, install it (latest version appears to be 1.13.8)

Open Problems tab (View | Problems)

Ctrl-Shift-P
  C/C++ Edit Configurations (JSON)
  Default c_cpp_properties.json opens in editor (placed in .vscode sub-directory)
  My default "compilerPath" line: "compilerPath": "/usr/bin/gcc"

Note there are no problems detected.

Modify "compilerPath" line by prepending "${userHome}"
  "${userHome}/usr/bin/gcc"

Note there is a problem shown with the c_cpp_properties.json
  Cannot find "/home/username/Projects/VSCodeUserHomeBug/${userHome}/usr/bin/gcc".

Note that the path includes both the path/expanded variable and the variable name.
  Expected: Cannot find "/home/username/Projects/VSCodeUserHomeBug/usr/bin/gcc".

Modify the "compilerPath" line by replacing the "${userHome}" variable with "${workspaceFolder}"
  "${workspaceFolder}/usr/bin/gcc"

Since there is no actual compiler in that path, the problem remains, but the path has changed:
  Cannot find "/home/username/Projects/VSCodeUserHomeBug/usr/bin/gcc".

Note that the path includes only the path/expanded variable.

VS Code version: Code 1.74.0 (5235c6b, 2022-12-05T16:47:18.476Z)
OS version: Linux x64 5.15.0-56-generic
Modes:
Sandboxed: No

System Info
Item Value
CPUs AMD Ryzen 7 PRO 5850U with Radeon Graphics (6 x 1896)
GPU Status 2d_canvas: unavailable_software
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: disabled_software
multiple_raster_threads: enabled_on
opengl: disabled_off
rasterization: disabled_software
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: disabled_software
video_encode: disabled_software
vulkan: disabled_off
webgl: unavailable_software
webgl2: unavailable_software
webgpu: disabled_off
Load (avg) 0, 0, 0
Memory (System) 15.63GB (13.43GB free)
Process Argv --unity-launch --crash-reporter-id 17a18deb-93f5-49e7-8178-d7dca9ca559d
Screen Reader no
VM 100%
DESKTOP_SESSION ubuntu
XDG_CURRENT_DESKTOP Unity
XDG_SESSION_DESKTOP ubuntu
XDG_SESSION_TYPE x11
Extensions (4)
Extension Author (truncated) Version
cmake-tools ms- 1.12.27
cpptools ms- 1.13.8
cpptools-extension-pack ms- 1.3.0
cmake twx 0.0.17

(1 theme extensions excluded)

A/B Experiments
vsliv368:30146709
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
vslsvsres303:30308271
pythonvspyl392:30443607
vserr242:30382549
pythontb:30283811
vsjup518:30340749
pythonptprofiler:30281270
vsdfh931cf:30280410
vshan820:30294714
vstes263cf:30335440
vscoreces:30445986
pythondataviewer:30285071
vscod805:30301674
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
cmake_vspar411:30581797
vsaa593:30376534
pythonvs932:30410667
cppdebug:30492333
vsclangdf:30486550
c4g48928:30535728
dsvsc012cf:30540253
azure-dev_surveyone:30548225
pyindex848cf:30577861
nodejswelcome1cf:30587006
282f8724:30602487
gswce1:30612156
iaj6b796:30613358
f6dab269:30613381
fim-prod:30623723
vscup:30628656

Metadata

Metadata

Assignees

Labels

*caused-by-extensionIssue identified to be caused by an extension

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions