4

I have an url in a test.txt file, and i want to use it in launch.json. I try many things without success, like setting a var in a task but it is impossible to use it in launch.json according what I've read (is it exact ?).

Exemple of code in launch.json I've tested, doesn't work (I am on macOS), I get the error "command shell not found" in VSCode when I launch the debugger (F5):

 {

"inputs": [
    {
        "id": "DEBUG_URI",
        "type": "command",
        "command": "shell",
        ///"command": "cat test.txt",
        "args": {
            "command": "cat test.txt"
        }
    }
],

"version": "0.2.0",
"configurations": [
    {

        "name": "attach",
        "request": "attach",
        "type": "dart",
        "preLaunchTask": "test.txt generator",           
        "observatoryUri": "${input:DEBUG_URI}" 
    }

]}

I've also tested "shellCommand.execute" (exemple here) instead of "shell" but it doesn't work...

thanks,

rach
  • 129
  • 1
  • 5

1 Answers1

2

the "shellCommand.execute" comes from Tasks Shell Input extension, with this it works !! :

 "inputs": [
        {
            "id": "DEBUG_URI",
            "type": "command",
            "command": "shellCommand.execute",
                "args": {
                "command": "cat test.txt",
                "useFirstResult": "true",
            }
        }
    ],
"version": "0.2.0",
"configurations": [
    {

        "name": "attach",
        "request": "attach",
        "type": "dart",
        "preLaunchTask": "test.txt generator",           
        "observatoryUri": "${input:DEBUG_URI}" 
    }

]}

with "useFirstResult": "true" you can avoid VSCode prompt

rach
  • 129
  • 1
  • 5
  • This extension is necessary to make this work i think https://marketplace.visualstudio.com/items?itemName=augustocdias.tasks-shell-input (Tried on WSL2 ) – Parth Sindhu Feb 03 '22 at 02:56