You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Today I was doing some debugging, changing arguments in the debugger configuration between runs which was a bit of a hassle and I started wondering whether perhaps this is an already solved problem. When doing so, I first found the ${command:SpecifyProgramArgs} option of the VS Code Java extension and opened feature requests for different vs code extensions but since the language I was interested in was not Java and the feature requests weren't pursued, that wasn't really useful.
Pursuing this a bit more, I encountered a feature of VS Code's debugging and task configuration files that solves this problem nicely - input variables. Input variables are substitutions that you can define under "inputs" key in launch.json and later use in e.g. debugger configuration with ${input:variableID}. Then when you launch the debugger with the configuration that requires some inputs, VS Code will prompt you for those variables (either through free text or through a list of options to choose from, depending on input definition), as well as allow you to use its defined default value (if any is provided).
I think that this would be a useful addition to this plugin as well and one of the use cases would be the previously mentioned args argument. Here's how an example launch.json with this options looks ("inputs" key would probably map to "debugger_inputs" in sublime project file):
{
"version": "0.2.0",
"inputs": [
{
"id": "fileArguments",
"description": "The arguments to send to the debugger",
"type": "promptString",
"default": "",
}
],
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"console": "integratedTerminal",
"request": "launch",
"program": "${file}",
"args": "${input:fileArguments}",
"justMyCode": true
}
]
}
Note that "args" key specifically can be a string in VS Code since July 2022 (for participating extensions, whatever that means): microsoft/vscode#83678 (comment) This isn't the only use case of course (being able to choose the component to run with inputs could be quite useful too) but I would appreciate if this case could be supported as well if you choose to pursue this.
The text was updated successfully, but these errors were encountered:
Today I was doing some debugging, changing arguments in the debugger configuration between runs which was a bit of a hassle and I started wondering whether perhaps this is an already solved problem. When doing so, I first found the
${command:SpecifyProgramArgs}
option of the VS Code Java extension and opened feature requests for different vs code extensions but since the language I was interested in was not Java and the feature requests weren't pursued, that wasn't really useful.Pursuing this a bit more, I encountered a feature of VS Code's debugging and task configuration files that solves this problem nicely - input variables. Input variables are substitutions that you can define under
"inputs"
key inlaunch.json
and later use in e.g. debugger configuration with${input:variableID}
. Then when you launch the debugger with the configuration that requires some inputs, VS Code will prompt you for those variables (either through free text or through a list of options to choose from, depending on input definition), as well as allow you to use its defined default value (if any is provided).I think that this would be a useful addition to this plugin as well and one of the use cases would be the previously mentioned
args
argument. Here's how an examplelaunch.json
with this options looks ("inputs"
key would probably map to"debugger_inputs"
in sublime project file):Note that
"args"
key specifically can be a string in VS Code since July 2022 (for participating extensions, whatever that means): microsoft/vscode#83678 (comment) This isn't the only use case of course (being able to choose the component to run with inputs could be quite useful too) but I would appreciate if this case could be supported as well if you choose to pursue this.The text was updated successfully, but these errors were encountered: