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

Not possible to use ${} macros in launch.json #48

Closed
cprieto opened this issue Sep 21, 2018 · 6 comments
Closed

Not possible to use ${} macros in launch.json #48

cprieto opened this issue Sep 21, 2018 · 6 comments
Labels
bug

Comments

@cprieto
Copy link

@cprieto cprieto commented Sep 21, 2018

Currently, with input and grammar entries in launch.json you cannot use ${} variables, for example, the following sample:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "antlr4",
      "input": "${workspaceFolder}/${command:AskForTestInput}",
      "type": "antlr-debug",
      "request": "launch",
      "grammar": "Data.g4",
      "startRule": "${command:AskForTestInput}",
      "printParseTree": true,
      "visualParseTree": true
    }
  ]
}

will fail with:

Cannot read test input file:
[some directory]/${workspaceFolder}/${command:AskForTestInput}

The same is for grammar while startRule works perfectly, for example, this launch configuration will work:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "antlr4",
      "input": "test.data",
      "type": "antlr-debug",
      "request": "launch",
      "grammar": "Data.g4",
      "startRule": "${command:AskForTestInput}",
      "printParseTree": true,
      "visualParseTree": true
    }
  ]
}

I tried with ${file} and similar, but it looks like grammar and input are not preprocessing macros.

Tested in version v2.0.4

@cprieto cprieto changed the title Not possible to use ${} variables in some properties Not possible to use ${} macros in launch.json Sep 21, 2018
@mike-lischke mike-lischke added the bug label Sep 21, 2018
@mike-lischke

This comment has been minimized.

Copy link
Owner

@mike-lischke mike-lischke commented Oct 14, 2018

Variable substitution in launch.json has been removed. It was never meant to work and caused trouble. I'll update the readme and default values to no longer allow using the input dialog.

@ronnieoverby

This comment has been minimized.

Copy link

@ronnieoverby ronnieoverby commented Aug 4, 2019

The link you provided when you stated that variable substitution in launch.json has been removed doesn't say that.

It says:

Variable substitution in package.json will no longer be supported

So, why doesn't variable substitution in launch.json work for input file?

@mike-lischke

This comment has been minimized.

Copy link
Owner

@mike-lischke mike-lischke commented Aug 5, 2019

Variable substitution stopped working suddenly without any changes from my side in this area. So I concluded the mentioned change does not only apply to package.json but all json files. I also read somewhere that it was never meant to work and to my knowledge this feature had no documentation. I only used it because I saw it in one of the debugger examples.

@ronnieoverby

This comment has been minimized.

Copy link

@ronnieoverby ronnieoverby commented Aug 5, 2019

That's unexpected because it's documented well here: https://code.visualstudio.com/docs/editor/debugging#_variable-substitution

@mike-lischke

This comment has been minimized.

Copy link
Owner

@mike-lischke mike-lischke commented Aug 7, 2019

Interesting, seems that documentation has been added meanwhile. But then I wonder why macro substitution stopped working at that time. I'll take another look.

@mike-lischke mike-lischke reopened this Aug 7, 2019
@ronnieoverby

This comment has been minimized.

Copy link

@ronnieoverby ronnieoverby commented Aug 7, 2019

I wonder if the configuration property needs to opt in to variable substitution somehow. 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.