Skip to content

Path Mapping on Attach request #2242

@jborean93

Description

@jborean93

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all issues to ensure it has not already been requested.

Summary

When debugging a remote runspace the current logic is for PSES to retrieve back a temporary file of anything hit in a breakpoint and display it VSCode. This can be prone to some bugs and makes debugging a runspace that is not local a lot more difficult than it has to be.

Other languages work around this issue by offering an option to map local path(s) to their remote equivalent and vice versa.

For example .NET's DAP launch configuration has an option called sourceFileMap. You can do something like

{
    "sourceFileMap": {
        "C:\\remote\\path": "/home/local/path"
    }
}

Python is similar but calls the option pathMappings and uses a different structure. For example:

{
    "pathMappings": [
        {
            "localRoot": "/home/local/path",
            "remoteRoot": "C:\\remote\\path"
        }
    ]
}

I would like to extend the attach request in PSES to support a way to map these local <-> remote paths so we can avoid all the psedit and file copying problems.

Proposed Design

I'm more in favour of the pathMappings option that Python uses as the C# one is more geared around to source compilation paths than actual local/remote translations. It is slightly more verbose but it is easier to see what is the local and what is the remote.

As for the implementation there are a few locations that need to do the translation:

There may be others but I've not yet come across them. The option, if set, should also override the psedit mapping logic as well. Essentially it will treat the paths as local and just translate it to/from the remote paths when needed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-EnhancementA feature request (enhancement).Needs: TriageMaintainer attention needed!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions