microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
162.45k stars 28.62k forks source link

Args with double and single quotes do not work inside an array #223804

Open JulieLeeMSFT opened 3 months ago

JulieLeeMSFT commented 3 months 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?

VSCodeTriageBot commented 1 month ago

Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.91.1. Please try upgrading to the latest version and checking whether this issue remains.

Happy Coding!