diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/Breakpoint.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/Breakpoint.cs index b34899a56..206d2176e 100644 --- a/src/PowerShellEditorServices.Protocol/DebugAdapter/Breakpoint.cs +++ b/src/PowerShellEditorServices.Protocol/DebugAdapter/Breakpoint.cs @@ -43,7 +43,7 @@ public static Breakpoint Create( } public static Breakpoint Create( - FunctionBreakpointDetails breakpointDetails) + CommandBreakpointDetails breakpointDetails) { return new Breakpoint { Verified = breakpointDetails.Verified, diff --git a/src/PowerShellEditorServices.Protocol/Server/DebugAdapter.cs b/src/PowerShellEditorServices.Protocol/Server/DebugAdapter.cs index 2f639dc62..656319470 100644 --- a/src/PowerShellEditorServices.Protocol/Server/DebugAdapter.cs +++ b/src/PowerShellEditorServices.Protocol/Server/DebugAdapter.cs @@ -242,16 +242,16 @@ protected async Task HandleSetFunctionBreakpointsRequest( SetFunctionBreakpointsRequestArguments setBreakpointsParams, RequestContext requestContext) { - var breakpointDetails = new FunctionBreakpointDetails[setBreakpointsParams.Breakpoints.Length]; + var breakpointDetails = new CommandBreakpointDetails[setBreakpointsParams.Breakpoints.Length]; for (int i = 0; i < breakpointDetails.Length; i++) { FunctionBreakpoint funcBreakpoint = setBreakpointsParams.Breakpoints[i]; - breakpointDetails[i] = FunctionBreakpointDetails.Create( + breakpointDetails[i] = CommandBreakpointDetails.Create( funcBreakpoint.Name, funcBreakpoint.Condition); } - FunctionBreakpointDetails[] breakpoints = + CommandBreakpointDetails[] breakpoints = await editorSession.DebugService.SetCommandBreakpoints( breakpointDetails); diff --git a/src/PowerShellEditorServices/Debugging/FunctionBreakpointDetails.cs b/src/PowerShellEditorServices/Debugging/CommandBreakpointDetails.cs similarity index 67% rename from src/PowerShellEditorServices/Debugging/FunctionBreakpointDetails.cs rename to src/PowerShellEditorServices/Debugging/CommandBreakpointDetails.cs index e08545c72..1d9468df4 100644 --- a/src/PowerShellEditorServices/Debugging/FunctionBreakpointDetails.cs +++ b/src/PowerShellEditorServices/Debugging/CommandBreakpointDetails.cs @@ -10,46 +10,45 @@ namespace Microsoft.PowerShell.EditorServices { /// - /// Provides details about a function breakpoint that is set in the - /// PowerShell debugger. + /// Provides details about a command breakpoint that is set in the PowerShell debugger. /// - public class FunctionBreakpointDetails : BreakpointDetailsBase + public class CommandBreakpointDetails : BreakpointDetailsBase { /// - /// Gets the name of the function or command name for a function breakpoint. + /// Gets the name of the command on which the command breakpoint has been set. /// public string Name { get; private set; } - private FunctionBreakpointDetails() + private CommandBreakpointDetails() { } /// - /// Creates an instance of the BreakpointDetails class from the individual + /// Creates an instance of the class from the individual /// pieces of breakpoint information provided by the client. /// - /// The name of the function or command to break on. + /// The name of the command to break on. /// Condition string that would be applied to the breakpoint Action parameter. /// - public static FunctionBreakpointDetails Create( + public static CommandBreakpointDetails Create( string name, string condition = null) { Validate.IsNotNull(nameof(name), name); - return new FunctionBreakpointDetails { + return new CommandBreakpointDetails { Name = name, Condition = condition }; } /// - /// Creates an instance of the BreakpointDetails class from a - /// PowerShell Breakpoint object. + /// Creates an instance of the class from a + /// PowerShell CommandBreakpoint object. /// /// The Breakpoint instance from which details will be taken. /// A new instance of the BreakpointDetails class. - public static FunctionBreakpointDetails Create(Breakpoint breakpoint) + public static CommandBreakpointDetails Create(Breakpoint breakpoint) { Validate.IsNotNull("breakpoint", breakpoint); @@ -60,7 +59,7 @@ public static FunctionBreakpointDetails Create(Breakpoint breakpoint) "Unexpected breakpoint type: " + breakpoint.GetType().Name); } - var breakpointDetails = new FunctionBreakpointDetails { + var breakpointDetails = new CommandBreakpointDetails { Verified = true, Name = commandBreakpoint.Command, Condition = commandBreakpoint.Action?.ToString() diff --git a/src/PowerShellEditorServices/Debugging/DebugService.cs b/src/PowerShellEditorServices/Debugging/DebugService.cs index bb63894ea..e80f1705a 100644 --- a/src/PowerShellEditorServices/Debugging/DebugService.cs +++ b/src/PowerShellEditorServices/Debugging/DebugService.cs @@ -132,14 +132,14 @@ public async Task SetLineBreakpoints( /// /// Sets the list of command breakpoints for the current debugging session. /// - /// BreakpointDetails for each command breakpoint that will be set. + /// CommandBreakpointDetails for each command breakpoint that will be set. /// If true, causes all existing function breakpoints to be cleared before setting new ones. /// An awaitable Task that will provide details about the breakpoints that were set. - public async Task SetCommandBreakpoints( - FunctionBreakpointDetails[] breakpoints, + public async Task SetCommandBreakpoints( + CommandBreakpointDetails[] breakpoints, bool clearExisting = true) { - var resultBreakpointDetails = new List(); + var resultBreakpointDetails = new List(); if (clearExisting) { @@ -148,7 +148,7 @@ public async Task SetCommandBreakpoints( if (breakpoints.Length > 0) { - foreach (FunctionBreakpointDetails breakpoint in breakpoints) + foreach (CommandBreakpointDetails breakpoint in breakpoints) { PSCommand psCommand = new PSCommand(); psCommand.AddCommand(@"Microsoft.PowerShell.Utility\Set-PSBreakpoint"); @@ -176,7 +176,7 @@ public async Task SetCommandBreakpoints( // The order in which the breakpoints are returned is significant to the // VSCode client and should match the order in which they are passed in. resultBreakpointDetails.AddRange( - configuredBreakpoints.Select(FunctionBreakpointDetails.Create)); + configuredBreakpoints.Select(CommandBreakpointDetails.Create)); } } diff --git a/src/PowerShellEditorServices/PowerShellEditorServices.csproj b/src/PowerShellEditorServices/PowerShellEditorServices.csproj index 9608cb57f..6fa634a43 100644 --- a/src/PowerShellEditorServices/PowerShellEditorServices.csproj +++ b/src/PowerShellEditorServices/PowerShellEditorServices.csproj @@ -62,7 +62,7 @@ - + diff --git a/test/PowerShellEditorServices.Test/Debugging/DebugServiceTests.cs b/test/PowerShellEditorServices.Test/Debugging/DebugServiceTests.cs index 14df8404f..1c9f66f5d 100644 --- a/test/PowerShellEditorServices.Test/Debugging/DebugServiceTests.cs +++ b/test/PowerShellEditorServices.Test/Debugging/DebugServiceTests.cs @@ -150,11 +150,11 @@ await this.debugService.SetLineBreakpoints( [Fact] public async Task DebuggerSetsAndClearsFunctionBreakpoints() { - FunctionBreakpointDetails[] breakpoints = + CommandBreakpointDetails[] breakpoints = await this.debugService.SetCommandBreakpoints( new[] { - FunctionBreakpointDetails.Create("Write-Host"), - FunctionBreakpointDetails.Create("Get-Date") + CommandBreakpointDetails.Create("Write-Host"), + CommandBreakpointDetails.Create("Get-Date") }); Assert.Equal(2, breakpoints.Length); @@ -163,14 +163,14 @@ await this.debugService.SetCommandBreakpoints( breakpoints = await this.debugService.SetCommandBreakpoints( - new[] { FunctionBreakpointDetails.Create("Get-Host") }); + new[] { CommandBreakpointDetails.Create("Get-Host") }); Assert.Equal(1, breakpoints.Length); Assert.Equal("Get-Host", breakpoints[0].Name); breakpoints = await this.debugService.SetCommandBreakpoints( - new FunctionBreakpointDetails[] {}); + new CommandBreakpointDetails[] {}); Assert.Equal(0, breakpoints.Length); } @@ -178,10 +178,10 @@ await this.debugService.SetCommandBreakpoints( [Fact] public async Task DebuggerStopsOnFunctionBreakpoints() { - FunctionBreakpointDetails[] breakpoints = + CommandBreakpointDetails[] breakpoints = await this.debugService.SetCommandBreakpoints( new[] { - FunctionBreakpointDetails.Create("Write-Host") + CommandBreakpointDetails.Create("Write-Host") }); await this.AssertStateChange(PowerShellContextState.Ready);