Title: Path Mapping on Attach request · Issue #2242 · PowerShell/PowerShellEditorServices · GitHub
Open Graph Title: Path Mapping on Attach request · Issue #2242 · PowerShell/PowerShellEditorServices
X Title: Path Mapping on Attach request · Issue #2242 · PowerShell/PowerShellEditorServices
Description: 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 a...
Open Graph Description: 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 PSE...
X Description: 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 PSE...
Opengraph URL: https://github.com/PowerShell/PowerShellEditorServices/issues/2242
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Path Mapping on Attach request","articleBody":"### Prerequisites\n\n- [x] I have written a descriptive issue title.\n- [x] I have searched all [issues](https://github.com/PowerShell/PowerShellEditorServices/issues?q=is%3Aissue) to ensure it has not already been requested.\n\n### Summary\n\nWhen 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.\n\nOther languages work around this issue by offering an option to map local path(s) to their remote equivalent and vice versa.\n\nFor example .NET's DAP launch configuration has an option called [sourceFileMap](https://code.visualstudio.com/docs/csharp/debugger-settings#_source-file-map). You can do something like\n\n```json\n{\n \"sourceFileMap\": {\n \"C:\\\\remote\\\\path\": \"/home/local/path\"\n }\n}\n```\n\nPython is similar but calls the option [pathMappings](https://code.visualstudio.com/docs/python/debugging#_remote-script-debugging-with-ssh) and uses a different structure. For example:\n\n```json\n{\n \"pathMappings\": [\n {\n \"localRoot\": \"/home/local/path\",\n \"remoteRoot\": \"C:\\\\remote\\\\path\"\n }\n ]\n}\n```\n\nI would like to extend the attach request in PSES to support a way to map these local \u003c-\u003e remote paths so we can avoid all the psedit and file copying problems.\n\n### Proposed Design\n\nI'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.\n\nAs for the implementation there are a few locations that need to do the translation:\n\n+ [SetLineBreakpointsAsync](https://github.com/PowerShell/PowerShellEditorServices/blob/6bb322ec2150ed341991ffc7db7180db7a49539d/src/PowerShellEditorServices/Services/DebugAdapter/DebugService.cs#L129-L173) when translating the local to remote breakpoint path\n+ [FetchStackFramesAsync](https://github.com/PowerShell/PowerShellEditorServices/blob/6bb322ec2150ed341991ffc7db7180db7a49539d/src/PowerShellEditorServices/Services/DebugAdapter/DebugService.cs#L779-L892) when translating the remote stack frame file path to local\n+ [StackTraceHandler.Handle](https://github.com/PowerShell/PowerShellEditorServices/blob/6bb322ec2150ed341991ffc7db7180db7a49539d/src/PowerShellEditorServices/Services/DebugAdapter/Handlers/StackTraceHandler.cs#L38-L41) needs to update the breakpoint label\n\nThere 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.","author":{"url":"https://github.com/jborean93","@type":"Person","name":"jborean93"},"datePublished":"2025-07-23T03:42:34.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/2242/PowerShellEditorServices/issues/2242"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:89dd71f1-e6f5-a78e-135e-17af889c2d30 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | AE6C:12F67D:11E2C0F:181839E:6A59B844 |
| html-safe-nonce | dc641d552c26eb62543f8431c0f1224c8918010c3e22c8807720dabd941cfc2c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRTZDOjEyRjY3RDoxMUUyQzBGOjE4MTgzOUU6NkE1OUI4NDQiLCJ2aXNpdG9yX2lkIjoiNzI4Nzg1NDU0ODYzOTEzNTgxMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 25027172b0f95c792c1ec73dffc43ae30c4678ec0eeea75de91690bc6f5279f5 |
| hovercard-subject-tag | issue:3254729208 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShellEditorServices/2242/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ce25784b2c41310761899936ce448d7999dbba51f5d172eb543bd24369cb4a00/PowerShell/PowerShellEditorServices/issues/2242 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ce25784b2c41310761899936ce448d7999dbba51f5d172eb543bd24369cb4a00/PowerShell/PowerShellEditorServices/issues/2242 |
| og:image:alt | 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 PSE... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jborean93 |
| hostname | github.com |
| expected-hostname | github.com |
| None | ba3976babb66479b1c943a8edc0777d96157da48fadc0161f9ddb219deee8353 |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShellEditorServices git https://github.com/PowerShell/PowerShellEditorServices.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 36031537 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShellEditorServices |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 36031537 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShellEditorServices |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | ab680789ae4a316cdaf0d5a292a1760140931cc4 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width