Skip to content

Commit cff81f8

Browse files
committed
Merge pull request #180 from rkeithhill/rkeithill/rename-functionBreakpointDetails
Renamed FunctionBreakpointDetails to CommandBreakpointDetails
2 parents 609b2ac + 04a4190 commit cff81f8

File tree

6 files changed

+30
-31
lines changed

6 files changed

+30
-31
lines changed

src/PowerShellEditorServices.Protocol/DebugAdapter/Breakpoint.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public static Breakpoint Create(
4343
}
4444

4545
public static Breakpoint Create(
46-
FunctionBreakpointDetails breakpointDetails)
46+
CommandBreakpointDetails breakpointDetails)
4747
{
4848
return new Breakpoint {
4949
Verified = breakpointDetails.Verified,

src/PowerShellEditorServices.Protocol/Server/DebugAdapter.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -242,16 +242,16 @@ protected async Task HandleSetFunctionBreakpointsRequest(
242242
SetFunctionBreakpointsRequestArguments setBreakpointsParams,
243243
RequestContext<SetBreakpointsResponseBody> requestContext)
244244
{
245-
var breakpointDetails = new FunctionBreakpointDetails[setBreakpointsParams.Breakpoints.Length];
245+
var breakpointDetails = new CommandBreakpointDetails[setBreakpointsParams.Breakpoints.Length];
246246
for (int i = 0; i < breakpointDetails.Length; i++)
247247
{
248248
FunctionBreakpoint funcBreakpoint = setBreakpointsParams.Breakpoints[i];
249-
breakpointDetails[i] = FunctionBreakpointDetails.Create(
249+
breakpointDetails[i] = CommandBreakpointDetails.Create(
250250
funcBreakpoint.Name,
251251
funcBreakpoint.Condition);
252252
}
253253

254-
FunctionBreakpointDetails[] breakpoints =
254+
CommandBreakpointDetails[] breakpoints =
255255
await editorSession.DebugService.SetCommandBreakpoints(
256256
breakpointDetails);
257257

src/PowerShellEditorServices/Debugging/FunctionBreakpointDetails.cs renamed to src/PowerShellEditorServices/Debugging/CommandBreakpointDetails.cs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,46 +10,45 @@
1010
namespace Microsoft.PowerShell.EditorServices
1111
{
1212
/// <summary>
13-
/// Provides details about a function breakpoint that is set in the
14-
/// PowerShell debugger.
13+
/// Provides details about a command breakpoint that is set in the PowerShell debugger.
1514
/// </summary>
16-
public class FunctionBreakpointDetails : BreakpointDetailsBase
15+
public class CommandBreakpointDetails : BreakpointDetailsBase
1716
{
1817
/// <summary>
19-
/// Gets the name of the function or command name for a function breakpoint.
18+
/// Gets the name of the command on which the command breakpoint has been set.
2019
/// </summary>
2120
public string Name { get; private set; }
2221

23-
private FunctionBreakpointDetails()
22+
private CommandBreakpointDetails()
2423
{
2524
}
2625

2726
/// <summary>
28-
/// Creates an instance of the BreakpointDetails class from the individual
27+
/// Creates an instance of the <see cref="CommandBreakpointDetails"/> class from the individual
2928
/// pieces of breakpoint information provided by the client.
3029
/// </summary>
31-
/// <param name="name">The name of the function or command to break on.</param>
30+
/// <param name="name">The name of the command to break on.</param>
3231
/// <param name="condition">Condition string that would be applied to the breakpoint Action parameter.</param>
3332
/// <returns></returns>
34-
public static FunctionBreakpointDetails Create(
33+
public static CommandBreakpointDetails Create(
3534
string name,
3635
string condition = null)
3736
{
3837
Validate.IsNotNull(nameof(name), name);
3938

40-
return new FunctionBreakpointDetails {
39+
return new CommandBreakpointDetails {
4140
Name = name,
4241
Condition = condition
4342
};
4443
}
4544

4645
/// <summary>
47-
/// Creates an instance of the BreakpointDetails class from a
48-
/// PowerShell Breakpoint object.
46+
/// Creates an instance of the <see cref="CommandBreakpointDetails"/> class from a
47+
/// PowerShell CommandBreakpoint object.
4948
/// </summary>
5049
/// <param name="breakpoint">The Breakpoint instance from which details will be taken.</param>
5150
/// <returns>A new instance of the BreakpointDetails class.</returns>
52-
public static FunctionBreakpointDetails Create(Breakpoint breakpoint)
51+
public static CommandBreakpointDetails Create(Breakpoint breakpoint)
5352
{
5453
Validate.IsNotNull("breakpoint", breakpoint);
5554

@@ -60,7 +59,7 @@ public static FunctionBreakpointDetails Create(Breakpoint breakpoint)
6059
"Unexpected breakpoint type: " + breakpoint.GetType().Name);
6160
}
6261

63-
var breakpointDetails = new FunctionBreakpointDetails {
62+
var breakpointDetails = new CommandBreakpointDetails {
6463
Verified = true,
6564
Name = commandBreakpoint.Command,
6665
Condition = commandBreakpoint.Action?.ToString()

src/PowerShellEditorServices/Debugging/DebugService.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,14 @@ public async Task<BreakpointDetails[]> SetLineBreakpoints(
132132
/// <summary>
133133
/// Sets the list of command breakpoints for the current debugging session.
134134
/// </summary>
135-
/// <param name="breakpoints">BreakpointDetails for each command breakpoint that will be set.</param>
135+
/// <param name="breakpoints">CommandBreakpointDetails for each command breakpoint that will be set.</param>
136136
/// <param name="clearExisting">If true, causes all existing function breakpoints to be cleared before setting new ones.</param>
137137
/// <returns>An awaitable Task that will provide details about the breakpoints that were set.</returns>
138-
public async Task<FunctionBreakpointDetails[]> SetCommandBreakpoints(
139-
FunctionBreakpointDetails[] breakpoints,
138+
public async Task<CommandBreakpointDetails[]> SetCommandBreakpoints(
139+
CommandBreakpointDetails[] breakpoints,
140140
bool clearExisting = true)
141141
{
142-
var resultBreakpointDetails = new List<FunctionBreakpointDetails>();
142+
var resultBreakpointDetails = new List<CommandBreakpointDetails>();
143143

144144
if (clearExisting)
145145
{
@@ -148,7 +148,7 @@ public async Task<FunctionBreakpointDetails[]> SetCommandBreakpoints(
148148

149149
if (breakpoints.Length > 0)
150150
{
151-
foreach (FunctionBreakpointDetails breakpoint in breakpoints)
151+
foreach (CommandBreakpointDetails breakpoint in breakpoints)
152152
{
153153
PSCommand psCommand = new PSCommand();
154154
psCommand.AddCommand(@"Microsoft.PowerShell.Utility\Set-PSBreakpoint");
@@ -176,7 +176,7 @@ public async Task<FunctionBreakpointDetails[]> SetCommandBreakpoints(
176176
// The order in which the breakpoints are returned is significant to the
177177
// VSCode client and should match the order in which they are passed in.
178178
resultBreakpointDetails.AddRange(
179-
configuredBreakpoints.Select(FunctionBreakpointDetails.Create));
179+
configuredBreakpoints.Select(CommandBreakpointDetails.Create));
180180
}
181181
}
182182

src/PowerShellEditorServices/PowerShellEditorServices.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
<Compile Include="Debugging\BreakpointDetails.cs" />
6363
<Compile Include="Debugging\BreakpointDetailsBase.cs" />
6464
<Compile Include="Debugging\DebugService.cs" />
65-
<Compile Include="Debugging\FunctionBreakpointDetails.cs" />
65+
<Compile Include="Debugging\CommandBreakpointDetails.cs" />
6666
<Compile Include="Debugging\StackFrameDetails.cs" />
6767
<Compile Include="Debugging\VariableDetails.cs" />
6868
<Compile Include="Debugging\VariableDetailsBase.cs" />

test/PowerShellEditorServices.Test/Debugging/DebugServiceTests.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,11 @@ await this.debugService.SetLineBreakpoints(
150150
[Fact]
151151
public async Task DebuggerSetsAndClearsFunctionBreakpoints()
152152
{
153-
FunctionBreakpointDetails[] breakpoints =
153+
CommandBreakpointDetails[] breakpoints =
154154
await this.debugService.SetCommandBreakpoints(
155155
new[] {
156-
FunctionBreakpointDetails.Create("Write-Host"),
157-
FunctionBreakpointDetails.Create("Get-Date")
156+
CommandBreakpointDetails.Create("Write-Host"),
157+
CommandBreakpointDetails.Create("Get-Date")
158158
});
159159

160160
Assert.Equal(2, breakpoints.Length);
@@ -163,25 +163,25 @@ await this.debugService.SetCommandBreakpoints(
163163

164164
breakpoints =
165165
await this.debugService.SetCommandBreakpoints(
166-
new[] { FunctionBreakpointDetails.Create("Get-Host") });
166+
new[] { CommandBreakpointDetails.Create("Get-Host") });
167167

168168
Assert.Equal(1, breakpoints.Length);
169169
Assert.Equal("Get-Host", breakpoints[0].Name);
170170

171171
breakpoints =
172172
await this.debugService.SetCommandBreakpoints(
173-
new FunctionBreakpointDetails[] {});
173+
new CommandBreakpointDetails[] {});
174174

175175
Assert.Equal(0, breakpoints.Length);
176176
}
177177

178178
[Fact]
179179
public async Task DebuggerStopsOnFunctionBreakpoints()
180180
{
181-
FunctionBreakpointDetails[] breakpoints =
181+
CommandBreakpointDetails[] breakpoints =
182182
await this.debugService.SetCommandBreakpoints(
183183
new[] {
184-
FunctionBreakpointDetails.Create("Write-Host")
184+
CommandBreakpointDetails.Create("Write-Host")
185185
});
186186

187187
await this.AssertStateChange(PowerShellContextState.Ready);

0 commit comments

Comments
 (0)