raix / vscode-perl-debug

LOOKING FOR MAINTAINERS. Perl debugger extension for visual studio code
MIT License
63 stars 36 forks source link

Add 'commandLine' Option to Debug Configuration #143

Closed Kenobi-the-2nd closed 4 years ago

Kenobi-the-2nd commented 4 years ago

Good morning,

I have found VS Code's input variable feature very useful in the context of debugging. However, there are many cases when it would be useful to type in an entire list of args without quoting the whole list. I do much of my development in Perl, and the ability to pass multiple arguments to a script is essential. The current functionality using string substitution will not work in Perl when passing more than one argument since it treats the entire string as a single argument. Being able to type in the args and have them passed directly to the script (without the quotes) would be very helpful. A parameter called commandLine, for example, that would allow passing a single string--instead of an array--would be sufficient. Then, I could use the input variable to simply enter in my arguments for the script.

Below is an example configuration:

{
    "type": "perl",
    "request": "launch",
    "name": "Debug INPUT",
    "console": "integratedTerminal",
    "program": "${workspaceFolder}/${relativeFile}",
    "commandLine": "${input:argsPrompt}"
}
...
"inputs": [
        {
          "id": "argsPrompt",
          "description": "Enter list of args...",
          "default": "",
          "type": "promptString",
        }
    ]

If you could add this feature, it would be much appreciated. Thank-you for your time.

GitMensch commented 4 years ago

I'd say it is better to be added as a general feature request of a special inputs->type (maybe something like promptStringAsArray) and does not applies to perl but to any launch configuration.

Please close it and move it to https://github.com/Microsoft/vscode/issues instead.

Until vscode possibly adds a new type this is what does work:


{
  "version": "0.2.0",
  "inputs": [
        {
          "id": "arg1",
          "description": "Enter argument 1...",
          "default": "",
          "type": "promptString",
        },
        {
          "id": "arg2",
          "description": "Enter argument 2...",
          "default": "",
          "type": "promptString",
        },
        {
          "id": "arg3",
          "description": "Enter argument 3...",
          "default": "",
          "type": "promptString",
        }
    ],
    "configurations": [
        {
            "type": "perl",
            "request": "launch",
...
            "args": ["${input:arg1}", "${input:arg2}", "${input:arg3}"],
...
        }
    ]
}
Kenobi-the-2nd commented 4 years ago

@GitMensch I agree, it would be much better as a general feature, and that is where I went first. However, the developers' initial response was that there is no way to do that with the current JSON launch configuration format. Since then, there have been more ideas towards adoption of a general feature that would support a single string of args on the command line. These are covered in this issue. If you're interested in this feature, please show your support by upvoting it.

Also, thank-you for the configuration suggestion above. It is much appreciated!

GitMensch commented 4 years ago

@Kenobi-the-2nd so what do you think of closing this? If it is added here it should be done by a property argsString as done in https://github.com/rogalmic/vscode-bash-debug/pull/139.

Kenobi-the-2nd commented 4 years ago

Yes, I think that we can close this. I feel that it will be added as a general debug option by the vs code team, given the number of people that want to see this feature added.

felipecrs commented 4 years ago

@GitMensch The promptStringAsArray input is interesting, but then you could not define the arguments in JSON (without inputs at all) using plain string. This is useful in some cases since it's easier than write string arrays.