Skip to content

Commit 6fee60b

Browse files
committed
Fixes #164 - add capabilities response to InitializeRequest.
This commit is in preparation for adding conditional breakpoint and function breakpoint support. Also cleaned up some doc comments. The two primary files that were changed functionally are InitializeRequest.cs and DebugAdapaterBase.cs.
1 parent 5eb8ede commit 6fee60b

File tree

6 files changed

+78
-24
lines changed

6 files changed

+78
-24
lines changed

src/PowerShellEditorServices.Protocol/DebugAdapter/InitializeRequest.cs

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ namespace Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter
1010
public class InitializeRequest
1111
{
1212
public static readonly
13-
RequestType<InitializeRequestArguments, object> Type =
14-
RequestType<InitializeRequestArguments, object>.Create("initialize");
13+
RequestType<InitializeRequestArguments, InitializeResponseBody> Type =
14+
RequestType<InitializeRequestArguments, InitializeResponseBody>.Create("initialize");
1515
}
1616

1717
public class InitializeRequestArguments
@@ -26,4 +26,36 @@ public class InitializeRequestArguments
2626

2727
public string GeneratedCodeDirectory { get; set; }
2828
}
29+
30+
public class InitializeResponseBody
31+
{
32+
/// <summary>
33+
/// Gets or sets a boolean value that determines whether the debug adapter
34+
/// supports the configurationDoneRequest.
35+
/// </summary>
36+
public bool SupportsConfigurationDoneRequest { get; set; }
37+
38+
/// <summary>
39+
/// Gets or sets a boolean value that determines whether the debug adapter
40+
/// supports functionBreakpoints.
41+
/// </summary>
42+
public bool SupportsFunctionBreakpoints { get; set; }
43+
44+
/// <summary>
45+
/// Gets or sets a boolean value that determines whether the debug adapter
46+
/// supports conditionalBreakpoints.
47+
/// </summary>
48+
public bool SupportsConditionalBreakpoints { get; set; }
49+
50+
/// <summary>
51+
/// Gets or sets a boolean value that determines whether the debug adapter
52+
/// supports a (side effect free) evaluate request for data hovers.
53+
/// </summary>
54+
public bool SupportsEvaluateForHovers { get; set; }
55+
56+
/// <summary>
57+
/// Gets or sets the available filters for the setExceptionBreakpoints request.
58+
/// </summary>
59+
public object ExceptionBreakpointFilters { get; set; }
60+
}
2961
}

src/PowerShellEditorServices.Protocol/DebugAdapter/LaunchRequest.cs

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
44
//
55

6-
using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
76
using System.Collections.Generic;
7+
using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
88

99
namespace Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter
1010
{
@@ -17,25 +17,43 @@ public static readonly
1717

1818
public class LaunchRequestArguments
1919
{
20-
// /** An absolute path to the program to debug. */
20+
/// <summary>
21+
/// Gets or sets the absolute path to the program to debug.
22+
/// </summary>
2123
public string Program { get; set; }
2224

23-
// /** Automatically stop target after launch. If not specified, target does not stop. */
25+
/// <summary>
26+
/// Gets or sets a boolean value that determines whether to automatically stop
27+
/// target after launch. If not specified, target does not stop.
28+
/// </summary>
2429
public bool StopOnEntry { get; set; }
2530

26-
// /** Optional arguments passed to the debuggee. */
31+
/// <summary>
32+
/// Gets or sets optional arguments passed to the debuggee.
33+
/// </summary>
2734
public string[] Args { get; set; }
2835

29-
// /** Launch the debuggee in this working directory (specified as an absolute path). If omitted the debuggee is lauched in its own directory. */
36+
/// <summary>
37+
/// Gets or sets the working directory of the launched debuggee (specified as an absolute path).
38+
/// If omitted the debuggee is lauched in its own directory.
39+
/// </summary>
3040
public string Cwd { get; set; }
3141

32-
// /** Absolute path to the runtime executable to be used. Default is the runtime executable on the PATH. */
42+
/// <summary>
43+
/// Gets or sets the absolute path to the runtime executable to be used.
44+
/// Default is the runtime executable on the PATH.
45+
/// </summary>
3346
public string RuntimeExecutable { get; set; }
3447

35-
// /** Optional arguments passed to the runtime executable. */
48+
/// <summary>
49+
/// Gets or sets the optional arguments passed to the runtime executable.
50+
/// </summary>
3651
public string[] RuntimeArgs { get; set; }
3752

38-
// /** Optional environment variables to pass to the debuggee. The string valued properties of the 'environmentVariables' are used as key/value pairs. */
53+
/// <summary>
54+
/// Gets or sets optional environment variables to pass to the debuggee. The string valued
55+
/// properties of the 'environmentVariables' are used as key/value pairs.
56+
/// </summary>
3957
public Dictionary<string, string> Env { get; set; }
4058
}
4159
}

src/PowerShellEditorServices.Protocol/DebugAdapter/SetExceptionBreakpointsRequest.cs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,25 @@
77

88
namespace Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter
99
{
10-
// /** SetExceptionBreakpoints request; value of command field is "setExceptionBreakpoints".
11-
// Enable that the debuggee stops on exceptions with a StoppedEvent (event type 'exception').
12-
// */
10+
/// <summary>
11+
/// SetExceptionBreakpoints request; value of command field is "setExceptionBreakpoints".
12+
/// Enable that the debuggee stops on exceptions with a StoppedEvent (event type 'exception').
13+
/// </summary>
1314
public class SetExceptionBreakpointsRequest
1415
{
1516
public static readonly
1617
RequestType<SetExceptionBreakpointsRequestArguments, object> Type =
1718
RequestType<SetExceptionBreakpointsRequestArguments, object>.Create("setExceptionBreakpoints");
1819
}
1920

21+
/// <summary>
22+
/// Arguments for "setExceptionBreakpoints" request.
23+
/// </summary>
2024
public class SetExceptionBreakpointsRequestArguments
2125
{
22-
// /** Arguments for "setExceptionBreakpoints" request. */
23-
// export interface SetExceptionBreakpointsArguments {
24-
// /** Names of enabled exception breakpoints. */
25-
// filters: string[];
26-
// }
26+
/// <summary>
27+
/// Gets or sets the names of enabled exception breakpoints.
28+
/// </summary>
2729
public string[] Filters { get; set; }
2830
}
2931
}
30-

src/PowerShellEditorServices.Protocol/DebugAdapter/SourceRequest.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ public static readonly
1616

1717
public class SourceRequestArguments
1818
{
19-
// /** The reference to the source. This is the value received in Source.reference. */
19+
/// <summary>
20+
/// Gets or sets the reference to the source. This is the value received in Source.reference.
21+
/// </summary>
2022
public int SourceReference { get; set; }
2123
}
2224

@@ -25,4 +27,3 @@ public class SourceResponseBody
2527
public string Content { get; set; }
2628
}
2729
}
28-

src/PowerShellEditorServices.Protocol/DebugAdapter/StackTraceRequest.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ public class StackTraceRequestArguments
2020
{
2121
public int ThreadId { get; private set; }
2222

23-
// /** The maximum number of frames to return. If levels is not specified or 0, all frames are returned. */
23+
/// <summary>
24+
/// Gets the maximum number of frames to return. If levels is not specified or 0, all frames are returned.
25+
/// </summary>
2426
public int Levels { get; private set; }
2527
}
2628

src/PowerShellEditorServices.Protocol/Server/DebugAdapterBase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@ protected override Task OnStop()
5252

5353
private async Task HandleInitializeRequest(
5454
object shutdownParams,
55-
RequestContext<object> requestContext)
55+
RequestContext<InitializeResponseBody> requestContext)
5656
{
5757
// Send the Initialized event first so that we get breakpoints
5858
await requestContext.SendEvent(
5959
InitializedEvent.Type,
6060
null);
6161

6262
// Now send the Initialize response to continue setup
63-
await requestContext.SendResult(new object());
63+
await requestContext.SendResult(new InitializeResponseBody());
6464
}
6565
}
6666
}

0 commit comments

Comments
 (0)