microsoft / vscode-python-debugger

Python debugger (debugpy) extension for VS Code.
https://marketplace.visualstudio.com/items?itemName=ms-python.debugpy
MIT License
40 stars 17 forks source link

launch.json for python does not work for args with double and single quotes #353

Open JulieLeeMSFT opened 1 month ago

JulieLeeMSFT commented 1 month ago

Expected command: It should show one double quote and one single quote for the first arg as shown below:

myscript.py --gin_bindings=clang_path="'~/llvm-install/bin/clang'" --sampling_rate=0.2

What vs code terminal outputs:

myscript.py --gin_bindings=clang_path=\\\"\'~/llvm-install/bin/clang\\\"\' --sampling_rate=0.2 

Steps to Reproduce:

  1. Connect to WSL Ubuntu
  2. Create a launch.json with an arg (gin_binings) with both a double qutoe and a single quote. Escape the double quote with three backslashes as in https://github.com/microsoft/vscode-cpptools/pull/1794.
    "configurations": [
        {
            "name": "Python Debugger: Current File with Arguments",
            "type": "debugpy",
            "request": "launch",
            "program": "${file}",
            "args": [
                "--gin_bindings=clang_path=\\\"'~/llvm-install/bin/clang\\\"'",
                "--sampling_rate=0.002"
            ]
        }
    ]
  3. Start "Python Debugger: Current File with Arguments"
  4. Check the command printed in Vs code Terminal

Using three backslash does not work. Terminal prints three backslashes before the double quote and add one backslash before the single quote.

What is the correct way to put arg with double quote and signle quote in launch.json?