0

The problem:

If you don't have a launch.json in VSCode and is starting to debug/run flutter/dart program, it assign a dynamic name, for example, if you run for android emulator, then it will use emulator's name.

But, when you set up a new launch.json it requires a name (for example "Sample"). But if name will be provided the debugger will use incerement names like "Sample 1", "Sample 2".

The question:

Is it possible to setup launch configuration with the name, which will supports a dynamic naming?

My current config for example looks like:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "front",
      "request": "launch",
      "type": "dart",
      "args": ["--web-port=3000"]
    }
  ]
}

Thank you for any help!

Arenukvern
  • 438
  • 6
  • 11

1 Answers1

1

The dynamic name is assigned when a launch config has no name:

https://github.com/Dart-Code/Dart-Code/blob/2ff8cb91f6c5785069a33a36e0d33ef430809cf0/src/extension/providers/debug_config_provider.ts#L495-L505

This is the case when you don't have a launch configuration because VS Code just provides the extension an empty one. However if you create one in launch.json it needs a name so that it can be shown in the debug side bar drop-down (it cannot be dynamic here, because VS Code shows whatever is literally in the file).

It's possible we could support a substitution (eg. ${deviceName} becomes the device name we're launching on), however it would show literally as ${deviceName} in places like the debug side bar.

If that may still be useful, please file an issue requesting this at https://github.com/Dart-Code/Dart-Code.

Danny Tuppeny
  • 40,147
  • 24
  • 151
  • 275