-
Couldn't load subscription status.
- Fork 240
Add pathMappings option to debugger
#2251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a pathMappings option to the PowerShell debugger that enables mapping between local and remote file paths during debugging sessions. This is particularly useful when debugging remote PowerShell instances where the local development environment has the same files but at different paths.
Key changes:
- Adds
PathMappingrecord to define local-to-remote path mappings - Integrates path mapping logic into breakpoint setting, stack trace handling, and script launching
- Adds comprehensive end-to-end test for attach scenarios with path mappings
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| PathMapping.cs | New record defining the structure for local/remote path mappings |
| DebugService.cs | Core path mapping logic with methods to translate between local and remote paths |
| LaunchAndAttachHandler.cs | Integration of path mappings into launch and attach request handling |
| StackTraceHandler.cs | Updates stack trace paths using path mappings for remote debugging |
| BreakpointService.cs | Modified to use mapped paths when setting breakpoints |
| BreakpointApiUtils.cs | Added script path override parameter for breakpoint setting |
| DisconnectHandler.cs | Cleanup of path mappings on disconnect |
| DscBreakpointCapability.cs | Minor refactor to extract module name instead of full module info |
| DebugAdapterProtocolMessageTests.cs | Comprehensive E2E test for path mapping functionality |
Comments suppressed due to low confidence (1)
test/PowerShellEditorServices.Test.E2E/DebugAdapterProtocolMessageTests.cs:580
- Spelling error: 'cotinue' should be 'continue'.
// background and requesting the st is the only wait to ensure
src/PowerShellEditorServices/Services/DebugAdapter/PathMapping.cs
Outdated
Show resolved
Hide resolved
test/PowerShellEditorServices.Test.E2E/DebugAdapterProtocolMessageTests.cs
Outdated
Show resolved
Hide resolved
test/PowerShellEditorServices.Test.E2E/DebugAdapterProtocolMessageTests.cs
Outdated
Show resolved
Hide resolved
src/PowerShellEditorServices/Services/DebugAdapter/DebugService.cs
Outdated
Show resolved
Hide resolved
src/PowerShellEditorServices/Services/DebugAdapter/DebugService.cs
Outdated
Show resolved
Hide resolved
a182fe6 to
23ef91b
Compare
src/PowerShellEditorServices/Services/DebugAdapter/DebugService.cs
Outdated
Show resolved
Hide resolved
src/PowerShellEditorServices/Services/DebugAdapter/DebugService.cs
Outdated
Show resolved
Hide resolved
src/PowerShellEditorServices/Services/DebugAdapter/DebugService.cs
Outdated
Show resolved
Hide resolved
src/PowerShellEditorServices/Services/DebugAdapter/Handlers/LaunchAndAttachHandler.cs
Show resolved
Hide resolved
src/PowerShellEditorServices/Services/DebugAdapter/Handlers/LaunchAndAttachHandler.cs
Outdated
Show resolved
Hide resolved
src/PowerShellEditorServices/Services/DebugAdapter/Handlers/LaunchAndAttachHandler.cs
Show resolved
Hide resolved
src/PowerShellEditorServices/Services/DebugAdapter/Handlers/LaunchAndAttachHandler.cs
Outdated
Show resolved
Hide resolved
src/PowerShellEditorServices/Services/DebugAdapter/Handlers/StackTraceHandler.cs
Show resolved
Hide resolved
src/PowerShellEditorServices/Services/PowerShell/Debugging/DscBreakpointCapability.cs
Show resolved
Hide resolved
test/PowerShellEditorServices.Test.E2E/DebugAdapterProtocolMessageTests.cs
Show resolved
Hide resolved
649a4c1 to
163cd74
Compare
Adds the `pathMappings` option to the debugger that can be used to map a local to remote path and vice versa. This is useful if the local environment has a checkout of the files being run on a remote target but at a different path. The mappings are used to translate the paths that will the breakpoint will be set to in the target PowerShell instance. It is also used to update the stack trace paths received from the remote. For a launch scenario, the path mappings are also used when launching a script if the integrated terminal has entered a remote runspace.
163cd74 to
6dda2c6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this!
pathMappings option to debugger
|
Thanks for the review and merge! |

PR Summary
Adds the
pathMappingsoption to the debugger that can be used to map a local to remote path and vice versa. This is useful if the local environment has a checkout of the files being run on a remote target but at a different path. The mappings are used to translate the paths that will the breakpoint will be set to in the target PowerShell instance. It is also used to update the stack trace paths received from the remote.For a launch scenario, the path mappings are also used when launching a script if the integrated terminal has entered a remote runspace.
PR Context
Fixes: #2242