vscode: pipeTransport.pipeArgs command variable replacement not working

Attempting to figure out why input and command replacements do not work for launch.json pipeTransport.pipeArgs (used in omnisharp-csharp extension). My use case requires omnisharp-vscode extension. However, this involves the vscode variable replacement logic, so I am posting it here.

  • VSCode Version: 1.41.1 (also tried insider 1.42.0-insider)
  • OS Version: Darwin x64 18.7.0

Steps to Reproduce:

  1. Create a launch.json for remote debugging a csharp docker container. (e.g. vsdbg)

My Use Case Example (requires vscode-docker extension)

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": ".NET Core Docker Attach",
            "type": "coreclr",
            "request": "attach",
            "pipeTransport": {
                "pipeProgram": "docker",
                "pipeArgs": [
                    "exec", "-i", "${command:vscode-docker.containers.select}"
                ],
                "debuggerPath": "/root/vsdbg/vsdbg",
                "pipeCwd": "${workspaceRoot}",
                "quoteArgs": false
            },
            "processId": "${command:pickRemoteProcess}",
            "sourceFileMap": {
                "/app": "${workspaceRoot}"
            },
            "justMyCode": true
        }
    ]
}

vscode-docker.containers.select reference: https://github.com/microsoft/vscode-docker/pull/1240

Another Example

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": ".NET Core Docker Attach",
            "type": "coreclr",
            "request": "attach",
            "pipeTransport": {
                "pipeProgram": "docker",
                "pipeArgs": [
                    "exec", "-i", "${input:sampleInput}"
                ],
                "debuggerPath": "/root/vsdbg/vsdbg",
                "pipeCwd": "${workspaceRoot}",
                "quoteArgs": false
            },
            "processId": "${command:pickRemoteProcess}",
            "sourceFileMap": {
                "/app": "${workspaceRoot}"
            },
            "justMyCode": true
        }
    ],
    "inputs": [
        {
            "id": "sampleInput",
            "type": "promptString",
            "description": "issue example"
        }
    ]
}
  1. It will display the vscode prompts and dialogs, but not actually replace the entered/command value into the string for either example.

Output

Executing: docker exec -i ${input:sampleInput} sh -s < /Users/user/.vscode/extensions/ms-vscode.csharp-1.21.9/scripts/remoteProcessPickerScript
stderr: "docker exec" requires at least 2 arguments.
...

Does this issue occur when all extensions are disabled?: Not Sure.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 27 (12 by maintainers)

Most upvoted comments

As explained above (see comment and comment) variable substitution is a two phase process for good reasons. It is in place for some time and we are no longer in a position to change variable substitution in order to accommodate the use of launch configurations as “sequential programs”.

A launch.json is a configuration mechanism and variable substitution is just a string based macro mechanism. We are aware of the limitations imposed by this, but we have no plans to address them on the VS Code side.

If these limitations mean that dependent variables can not be used in launch config, then I suggest to move the “dependent variable logic” into real code (i.e. move it into code, e.g. the extension). See my comment above.

@willemodendaal You might want to file a feature request against the C# extension.

I’d rather complete the discussion on which solution to use before adding more time into a solution that would not be good enough to be considered. I also have time to implement a solution. Let’s see what @weinand thinks about this. My issue was “forgotten”/put on hold for months even though there was an associated PR (I understant the number of issues/prs opened on this repo, I’m not frustrated by it). I’d like to get a solution validated before code is done.