${userHome} variable expands to path and variable name
Environment
- OS and Version: Ubuntu 20.04
- VS Code Version: 1.74.2
- C/C++ Extension Version: 1.13.8
- If using SSH remote, specify OS of remote machine: n/a
Bug Summary and Steps to Reproduce
Bug Summary: ${userHome} variable expands to path and variable name
Steps to reproduce:
- Install Code (
sudo apt-get install code*.deb) - Run Code (
codefrom command line or from the Applications list on the desktop) - Install C/C++ extension from Microsoft (extension icon along left; search for C/C++; install C/C++ extension--not ~~C/C++ Extension Pack~~)
- Open a test folder (File | Open Folder... or Ctrl-K Ctrl-O)
- Create a new folder (folder icon with a + on it)
- Enable C/C++ extension (extension icon along left; choose C/C++; click Enable (Workspace) button; click Trust button in dialog box)
- Open the Command Palette (either with the Gear icon | Command Palette... or using Ctrl-Shift-P)
- Start typing or scroll down to choose C/C++ Edit Configurations (JSON)
- Note that the default
c_cpp_properties.jsonfile is populated, opened in a new editor tab, and stored in the.vscodesub-directory under the open folder - Open the Problems window/tab (View | Problems or Ctrl-Shift-M)
- Note that there are no problems shown in the Problems window/tab
- In the
c_cpp_properties.jsonfile tab, modify the "compilerPath" line to be:"compilerPath": "/user/bin/gcc"(if it is not already showing this or something like it) - Note there are no problems detected in the Problems window/tab.
- In the
c_cpp_properties.jsonfile tab, modify the "compilerPath" line to be:"compilerPath": "${userHome}/usr/bin/gcc"(or similar, where ${userHome} is part of the path) - Note there is a problem shown in the Problems window/tab for the
c_cpp_properties.jsonfile: Cannot find "/home/username/Projects/VSCodeUserHomeBug/${userHome}/usr/bin/gcc" - In the
c_cpp_properties.jsonfile tab, modify the "compilerPath" line to be:"compilerPath": "${workspaceFolder}/usr/bin/gcc"(or similar, where ${workspaceFolder} is part of the path) - Note there is still a problem shown in the Problems window/tab for the
c_cpp_properties.jsonbecause the path is still invalid, but this time the error shows: Cannot find "/home/username/Projects/VSCodeUserHomeBug/usr/bin/gcc"
Expected behavior:
In step 15, expected:
Cannot find "/home/username/Projects/VSCodeUserHomeBug/usr/bin/gcc"
In other words, with the path expansion as with ${workspaceFolder}, but without the literal "${userHome}" portion.
Expands to: Cannot find "/home/username/Projects/VSCodeUserHomeBug/${userHome}/usr/bin/gcc"
Expected: Cannot find "/home/username/Projects/VSCodeUserHomeBug/usr/bin/gcc"
Configuration and Logs
Configuration is as described above (default plus changes).
Logs available on request, but I don't think they are needed or will show anything helpful, since this bug occurs on a new, fresh installation.
Other Extensions
No response
Additional context
Note that a ticket was filed for VS Code itself (since this is a variable expansion, it is possible that the issue could be in either VS Code or the extension), but that was closed and it was kicked to the extension. If this needs to go back to VS Code, maybe that ticket could be reopened.