PowerShell / PowerShell/PowerShellEditorServices

Support Set-PSBreakpoint showing breakpoints in the editor

Open
#1,091 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Area-Debugging Issue-Enhancement
Dominant language
C#
Stars
767
Forks
266
Avg merge
3d 16h
Merged PRs (30d)
1

Description

By creating a Proxy function of Set-PSBreakpoint, we can fire the breakpoint event as seen in the DAP spec to notify the client that a breakpoint has been added.

This is the really the final feature needed to provide the "console debugging in PSES experience" that feels totally integrated.

Creating a Proxy cmdlet is easy with:

$Metadata = [System.Management.Automation.CommandMetaData]::new((Get-Command Set-PSBreakpoint))
[System.Management.Automation.ProxyCommand]::Create($Metadata)

Then we'll need a way to give the EditorObject the state of the debugger... but mainly the JsonRpcServer object so that we can use it to send the SendNotification( method to send the breakpoint information to the client.

Then we take that proxy function and add something like:

$psEditor.Components
    .GetService([OmniSharp.Extensions.LanguageServer.Protocol.Server.ILanguageServer])
    .SendNotification("breakpoint", [OmniSharp.Extensions.DebugAdapter.Protocol.Events.BreakpointEvent]::new(<#...#>))

with some error handling and we should be good to go.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading EditorObject.cs and the Set-PSBreakpoint proxy approach described in the issue. Trace how the JsonRpcServer or ILanguageServer is accessed, then review BreakpointEvent in the DAP specification and the referenced protocol type. Done means adding a breakpoint through Set-PSBreakpoint notifies the editor with the breakpoint information, with error handling.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.