Skip to content

Make "args": "${command:pickArgs}" as default debug configuration #225834

@PRO-2684

Description

@PRO-2684

With the new feature from July participating debug extensions can now support an args property that takes a single string that is passed unmodified to the underlying shell (this solves your problem "... a single string that appears as multiple space-separated arguments on the command line").

This makes it possible to use a command line like the following in a launch.json:

"args": "`echo hello world` > outfile",

Instead of having this command line literal in the launch.json you can use an ${input:commandline}variable that lets the user type the command line in an input box:

"args": "${input:commandline}",

Originally posted by @weinand in #83678 (comment)

I was really frustrated when I "debug Python files with arguments", input my space-separated argument list, and see my script treating it like a single argument. So I think it is more sensible to make "args": "${command:pickArgs}" as default, instead of "args": ["${command:pickArgs}"]. More specifically, taking Python for example, I suggest changing the default debug configuration:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python 调试程序: 包含参数的当前文件",
            "type": "debugpy",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "args": [
                "${command:pickArgs}"
            ]
        }
    ]
}

to:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python Debugger: Python File",
            "type": "debugpy",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "args": "${command:pickArgs}"
        }
    ]
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions