Skip to content

Commit af8deb4

Browse files
committed
Renamed FunctionBreakpointDetails to CommandBreakpointDetails
The services API should be oriented more towards PowerShell (and not VSCode) terminology.
1 parent 609b2ac commit af8deb4

File tree

6 files changed

+30
-30
lines changed

6 files changed

+30
-30
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 & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,46 +10,46 @@
1010
namespace Microsoft.PowerShell.EditorServices
1111
{
1212
/// <summary>
13-
/// Provides details about a function breakpoint that is set in the
13+
/// Provides details about a command breakpoint that is set in the
1414
/// PowerShell debugger.
1515
/// </summary>
16-
public class FunctionBreakpointDetails : BreakpointDetailsBase
16+
public class CommandBreakpointDetails : BreakpointDetailsBase
1717
{
1818
/// <summary>
19-
/// Gets the name of the function or command name for a function breakpoint.
19+
/// Gets the name of the command on which the command breakpoint has been set.
2020
/// </summary>
2121
public string Name { get; private set; }
2222

23-
private FunctionBreakpointDetails()
23+
private CommandBreakpointDetails()
2424
{
2525
}
2626

2727
/// <summary>
28-
/// Creates an instance of the BreakpointDetails class from the individual
28+
/// Creates an instance of the <see cref="CommandBreakpointDetails"/> class from the individual
2929
/// pieces of breakpoint information provided by the client.
3030
/// </summary>
31-
/// <param name="name">The name of the function or command to break on.</param>
31+
/// <param name="name">The name of the command to break on.</param>
3232
/// <param name="condition">Condition string that would be applied to the breakpoint Action parameter.</param>
3333
/// <returns></returns>
34-
public static FunctionBreakpointDetails Create(
34+
public static CommandBreakpointDetails Create(
3535
string name,
3636
string condition = null)
3737
{
3838
Validate.IsNotNull(nameof(name), name);
3939

40-
return new FunctionBreakpointDetails {
40+
return new CommandBreakpointDetails {
4141
Name = name,
4242
Condition = condition
4343
};
4444
}
4545

4646
/// <summary>
47-
/// Creates an instance of the BreakpointDetails class from a
48-
/// PowerShell Breakpoint object.
47+
/// Creates an instance of the <see cref="CommandBreakpointDetails"/> class from a
48+
/// PowerShell CommandBreakpoint object.
4949
/// </summary>
5050
/// <param name="breakpoint">The Breakpoint instance from which details will be taken.</param>
5151
/// <returns>A new instance of the BreakpointDetails class.</returns>
52-
public static FunctionBreakpointDetails Create(Breakpoint breakpoint)
52+
public static CommandBreakpointDetails Create(Breakpoint breakpoint)
5353
{
5454
Validate.IsNotNull("breakpoint", breakpoint);
5555

@@ -60,7 +60,7 @@ public static FunctionBreakpointDetails Create(Breakpoint breakpoint)
6060
"Unexpected breakpoint type: " + breakpoint.GetType().Name);
6161
}
6262

63-
var breakpointDetails = new FunctionBreakpointDetails {
63+
var breakpointDetails = new CommandBreakpointDetails {
6464
Verified = true,
6565
Name = commandBreakpoint.Command,
6666
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)