Skip to content

Extend customToolReplacesArgs to allow replacing all tool args #3749

@point-source

Description

@point-source

This is not working as I expect based on the prior information in this issue. I have created a brand new dart project, a simple cli app. For my launch config, I first tried this:

        {
            "name": "toolTest",
            "request": "launch",
            "type": "dart",
            "program": "bin/main.dart",
            "customTool": "echo",
        }

Output:
--enable-asserts --enable-vm-service=0 --pause_isolates_on_start=true --no-serve-devtools --write-service-info=file:///var/folders/h0/y0mhxm317slfr5k149cfxvfr0000gn/T/dart-vm-service-7630.json -DSILENT_OBSERVATORY=true bin/main.dart

So far so good. I then tried to see if I could remove args:

        {
            "name": "toolTest",
            "request": "launch",
            "type": "dart",
            "program": "bin/main.dart",
            "customTool": "echo",
            "customToolReplacesArgs": 2,
        }

Output:
--enable-asserts --enable-vm-service=0 --pause_isolates_on_start=true --no-serve-devtools --write-service-info=file:///var/folders/h0/y0mhxm317slfr5k149cfxvfr0000gn/T/dart-vm-service-6a28.json -DSILENT_OBSERVATORY=true bin/main.dart

Hmm, that's odd. Nothing got removed. Maybe it need tool args to replace them?

        {
            "name": "toolTest",
            "request": "launch",
            "type": "dart",
            "program": "bin/main.dart",
            "customTool": "echo",
            "customToolReplacesArgs": 2,
            "toolArgs": [
                "test",
                "arg"
            ]
        }

Output:
test arg --enable-asserts --enable-vm-service=0 --pause_isolates_on_start=true --no-serve-devtools --write-service-info=file:///var/folders/h0/y0mhxm317slfr5k149cfxvfr0000gn/T/dart-vm-service-6280.json -DSILENT_OBSERVATORY=true bin/main.dart

So it appears that "echo" replaces "dart" as the tool but customToolReplacesArgs maybe does nothing?

        {
            "name": "toolTest",
            "request": "launch",
            "type": "dart",
            "program": "bin/main.dart",
            "customTool": "echo",
            "toolArgs": [
                "test",
                "arg"
            ]
        }

Output:
test arg --enable-asserts --enable-vm-service=0 --pause_isolates_on_start=true --no-serve-devtools --write-service-info=file:///var/folders/h0/y0mhxm317slfr5k149cfxvfr0000gn/T/dart-vm-service-19d2.json -DSILENT_OBSERVATORY=true bin/main.dart

Same thing. How do I get the arg replacement to work?

Additionally, if I try this with a flutter project, it completely ignores "customTool" and continues running as normal even though I'm using the exact same launch config. How does the extension determine whether it's a flutter project or not and why does it ignore the customTool arg?

Originally posted by @point-source in #3656 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    in debuggingRelates to the debug adapter or process of running debug sessionsis enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions