Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

launch.json properties with multiple interactive variables break debugging #45493

Closed
taradinoc opened this issue Mar 11, 2018 · 4 comments
Closed
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues help wanted Issues identified as good community contribution opportunities verified Verification succeeded
Milestone

Comments

@taradinoc
Copy link

Issue Type: Bug

If one of a launch configuration's properties uses multiple interactive variables, the expansion will fail: vscode won't call the command or start a debug session.

For example, storyFile here causes the issue, but works as expected if I remove ${command:zversion}.

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "zil",
            "request": "launch",
            "name": "Launch in Z-Machine debugger",
            "storyFile": "${command:basename}.z${command:zversion}",
            "debugFile": "${command:basename}.dbg",
            "stopOnEntry": false,
            "predictableRandom": false
        }
    ]
}

Looks like these are matched with a greedy regular expression, so everything from the first ${ to the last } is merged into one variable reference: https://github.com/Microsoft/vscode/blob/1.21.0/src/vs/workbench/services/configurationResolver/electron-browser/configurationResolverService.ts#L237

VS Code version: Code 1.21.0 (9a199d7, 2018-03-07T11:04:09.969Z)
OS version: Windows_NT x64 10.0.16299

System Info
Item Value
CPUs Intel(R) Core(TM) i5-7600K CPU @ 3.80GHz (4 x 3792)
Memory (System) 31.95GB (16.67GB free)
Process Argv C:\Program Files\Microsoft VS Code\Code.exe
Screen Reader no
VM 0%
Reproduces without extensions
@kieferrm kieferrm added the debug Debug viewlet, configurations, breakpoints, adapter issues label Mar 11, 2018
@weinand weinand added the bug Issue identified by VS Code Team member as probable bug label Mar 11, 2018
@weinand weinand removed their assignment Mar 11, 2018
@isidorn
Copy link
Contributor

isidorn commented Mar 12, 2018

@taradinoc you are correct.
We accept PRs that fix this.

@isidorn isidorn added this to the Backlog milestone Mar 12, 2018
@isidorn isidorn added help wanted Issues identified as good community contribution opportunities and removed new release labels Mar 12, 2018
@weinand weinand modified the milestones: Backlog, March 2018 Mar 12, 2018
@isidorn
Copy link
Contributor

isidorn commented Mar 16, 2018

@weinand is there some special reason why this was assigned to March?
The way that delicate code is written is to not support multiple interactive variables per one field. Due to that and only 1 user complaining I am not so passionate about fixing this. Though I do accept PRs.

@weinand
Copy link
Contributor

weinand commented Mar 16, 2018

If this bug would only affect "interactive" variables, I would certainly agree.

The problem is that the term '"interactive" variables' is misleading because it really means "commands" (and the "interactive" ones are just a small subset).

So if an extension "blue" provides (non interactive) commands that surface interesting information that can be used in a launch config, it is confusing that "${command:blue.home}/${blue.version}/abc.blue" fails silently whereas "${env:blue-home}/${blue.version}/abc.blue" works fine.

I was under the impression that all variables are pattern matched by the same regular expressions and that a fix would be trivial. But it seems that different pattern matching code is used for commands.

I suggest that for March we show at least an error alert in this case before aborting the debug session. And then label this item as debt.

@isidorn
Copy link
Contributor

isidorn commented Mar 16, 2018

@weinand Thanks for the explanation.
I have pushed a fix to not so greedliy match, and to basically use the same regex pattern as in other cases.
So your @weinand example should work now. However what still will not work is evaluating multiple of different commands in the same field. If they are the same commands it should work.

@weinand weinand added the verified Verification succeeded label Mar 30, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Apr 30, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues help wanted Issues identified as good community contribution opportunities verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

4 participants