Skip to content

Provide a way in the VM Service to resolve package: URIs to file paths #46631

@DanTup

Description

@DanTup

This has come up a few times and in VS Code I've somewhat worked around it by making assumptions about the package_config.json file being used (that is, assuming the never overrides it and it's always in the "obvious" location for a given script).

For the DAP implementation in the SDK it seems less reasonable to potentially get this wrong so it would be better to have a supported way to resolve a package: URI. Without this, whenever DAP hits a breakpoint/exception and gets a call stack, it is unable to resolve the package: URIs to a file paths to provide to the editor, which means the editor is unable to show the user the code where the debugger is paused (or step through it). In theory we could download the source from the VM, but that's a confusing experience for the user because they have two copies of the same file, and the editor maintains breakpoints within them separately.

There might be a few ways to support this:

  • An API that can resolve a URI (or a set of URIs)
  • An API that returns the whole lookup table and allows the client (or in DAP's case, the debug adapter) to then perform the mapping

The first may involve more round trips, though may work better if the mapping is potentially huge (or can change, or if the mapping may differ per-isolate - something I couldn't find an obvious answer to).

@bkonyi @devoncarew

Metadata

Metadata

Assignees

Labels

area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.pkg-ddsFor issues related to the Dart Development Service

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions