microsoft / microsoft/vscode-cpptools

Unsupported variable expansion for user variables

Open
#5,223 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

debugger Feature Request
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Type: Debugger

Describe the bug

  • OS and Version:
    Linux - Fedora 31 Linux 5.5.11-200.fc31.x86_64 #1 SMP Mon Mar 23 17:32:43 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

  • VS Code Version:
    Version: 1.43.2
    Commit: 0ba0ca52957102ca3527cf479571617f0de6ed50
    Date: 2020-03-24T07:52:11.516Z
    Electron: 7.1.11
    Chrome: 78.0.3904.130
    Node.js: 12.8.1
    V8: 7.8.279.23-electron.0
    OS: Linux x64 5.5.11-200.fc31.x86_64

  • C/C++ Extension Version:
    C/C++ for Visual Studio Code Change Log
    Version 0.27.0-insiders5: March 26, 2019

  • Other extensions you installed (and if the issue persists after disabling them):
    N/A

  • A clear and concise description of what the bug is.

If I set an environment variable that depends upon another variable, it is not dereferenced correctly

Example:

"environment": [
{"name":"VAR1",
"value": "${workspaceFolder}"},
{"name":"VAR2",
"value": "${VAR1}"},]

The result is: ],
VAR1=/home/jack/dev/
VAR2=${VAR1}

Expected result is:
VAR1=/home/jack/dev/
VAR2=/home/jack/dev/

Built-in variables such ${workspaceFolder} are dereferenced (and any other number of built-ins too) there's no reason the same parser can't look for all other extant environment variables too.

Beware infinite loop -
Should also support:
"environment": [
{"name":"VAR", "value": "SOME_VALUE"},
{"name":"VAR", "value": "${VAR} OTHER_VALUE"},
]
To produce VAR="SOME_VALUE OTHER_VALUE"

Since the variable (e.g. ${workspaceFolder}) syntax is already defined as "${VARIABLE}" this should be trivial.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how the debugger processes the configuration's environment entries and expands ${...} variables. Reproduce the VAR1/VAR2 example and the self-referential VAR example from the issue. Done means user-defined variables expand to their resolved values, including references to earlier values, without an infinite loop.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.