From af8deb4ee17e36d3cf84cad544d79bcb5d2bc5b3 Mon Sep 17 00:00:00 2001 From: Keith Hill Date: Fri, 4 Mar 2016 18:09:20 -0700 Subject: [PATCH 1/2] Renamed FunctionBreakpointDetails to CommandBreakpointDetails The services API should be oriented more towards PowerShell (and not VSCode) terminology. --- .../DebugAdapter/Breakpoint.cs | 2 +- .../Server/DebugAdapter.cs | 6 ++--- ...Details.cs => CommandBreakpointDetails.cs} | 24 +++++++++---------- .../Debugging/DebugService.cs | 12 +++++----- .../PowerShellEditorServices.csproj | 2 +- .../Debugging/DebugServiceTests.cs | 14 +++++------ 6 files changed, 30 insertions(+), 30 deletions(-) rename src/PowerShellEditorServices/Debugging/{FunctionBreakpointDetails.cs => CommandBreakpointDetails.cs} (68%) 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 68% rename from src/PowerShellEditorServices/Debugging/FunctionBreakpointDetails.cs rename to src/PowerShellEditorServices/Debugging/CommandBreakpointDetails.cs index e08545c72..f641ec2d4 100644 --- a/src/PowerShellEditorServices/Debugging/FunctionBreakpointDetails.cs +++ b/src/PowerShellEditorServices/Debugging/CommandBreakpointDetails.cs @@ -10,46 +10,46 @@ namespace Microsoft.PowerShell.EditorServices { /// - /// Provides details about a function breakpoint that is set in the + /// 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 +60,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); From 04a41908bd990228686dab67543f49931d8bb7a1 Mon Sep 17 00:00:00 2001 From: Keith Hill Date: Fri, 4 Mar 2016 18:52:21 -0700 Subject: [PATCH 2/2] Comment tweak to kick the CI build again. --- .../Debugging/CommandBreakpointDetails.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/PowerShellEditorServices/Debugging/CommandBreakpointDetails.cs b/src/PowerShellEditorServices/Debugging/CommandBreakpointDetails.cs index f641ec2d4..1d9468df4 100644 --- a/src/PowerShellEditorServices/Debugging/CommandBreakpointDetails.cs +++ b/src/PowerShellEditorServices/Debugging/CommandBreakpointDetails.cs @@ -10,8 +10,7 @@ namespace Microsoft.PowerShell.EditorServices { /// - /// Provides details about a command breakpoint that is set in the - /// PowerShell debugger. + /// Provides details about a command breakpoint that is set in the PowerShell debugger. /// public class CommandBreakpointDetails : BreakpointDetailsBase {