From 6fee60b5e9dd997630eb797c090f4024eb8b9dc5 Mon Sep 17 00:00:00 2001 From: Keith Hill Date: Wed, 24 Feb 2016 19:55:53 -0700 Subject: [PATCH 1/2] 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. --- .../DebugAdapter/InitializeRequest.cs | 36 +++++++++++++++++-- .../DebugAdapter/LaunchRequest.cs | 34 +++++++++++++----- .../SetExceptionBreakpointsRequest.cs | 19 +++++----- .../DebugAdapter/SourceRequest.cs | 5 +-- .../DebugAdapter/StackTraceRequest.cs | 4 ++- .../Server/DebugAdapterBase.cs | 4 +-- 6 files changed, 78 insertions(+), 24 deletions(-) diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/InitializeRequest.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/InitializeRequest.cs index 81dc7426d..6e27962ac 100644 --- a/src/PowerShellEditorServices.Protocol/DebugAdapter/InitializeRequest.cs +++ b/src/PowerShellEditorServices.Protocol/DebugAdapter/InitializeRequest.cs @@ -10,8 +10,8 @@ namespace Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter public class InitializeRequest { public static readonly - RequestType Type = - RequestType.Create("initialize"); + RequestType Type = + RequestType.Create("initialize"); } public class InitializeRequestArguments @@ -26,4 +26,36 @@ public class InitializeRequestArguments public string GeneratedCodeDirectory { get; set; } } + + public class InitializeResponseBody + { + /// + /// Gets or sets a boolean value that determines whether the debug adapter + /// supports the configurationDoneRequest. + /// + public bool SupportsConfigurationDoneRequest { get; set; } + + /// + /// Gets or sets a boolean value that determines whether the debug adapter + /// supports functionBreakpoints. + /// + public bool SupportsFunctionBreakpoints { get; set; } + + /// + /// Gets or sets a boolean value that determines whether the debug adapter + /// supports conditionalBreakpoints. + /// + public bool SupportsConditionalBreakpoints { get; set; } + + /// + /// Gets or sets a boolean value that determines whether the debug adapter + /// supports a (side effect free) evaluate request for data hovers. + /// + public bool SupportsEvaluateForHovers { get; set; } + + /// + /// Gets or sets the available filters for the setExceptionBreakpoints request. + /// + public object ExceptionBreakpointFilters { get; set; } + } } diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/LaunchRequest.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/LaunchRequest.cs index e32e9e5da..6d6d971e8 100644 --- a/src/PowerShellEditorServices.Protocol/DebugAdapter/LaunchRequest.cs +++ b/src/PowerShellEditorServices.Protocol/DebugAdapter/LaunchRequest.cs @@ -3,8 +3,8 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. // -using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol; using System.Collections.Generic; +using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol; namespace Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter { @@ -17,25 +17,43 @@ public static readonly public class LaunchRequestArguments { - // /** An absolute path to the program to debug. */ + /// + /// Gets or sets the absolute path to the program to debug. + /// public string Program { get; set; } - // /** Automatically stop target after launch. If not specified, target does not stop. */ + /// + /// Gets or sets a boolean value that determines whether to automatically stop + /// target after launch. If not specified, target does not stop. + /// public bool StopOnEntry { get; set; } - // /** Optional arguments passed to the debuggee. */ + /// + /// Gets or sets optional arguments passed to the debuggee. + /// public string[] Args { get; set; } - // /** Launch the debuggee in this working directory (specified as an absolute path). If omitted the debuggee is lauched in its own directory. */ + /// + /// Gets or sets the working directory of the launched debuggee (specified as an absolute path). + /// If omitted the debuggee is lauched in its own directory. + /// public string Cwd { get; set; } - // /** Absolute path to the runtime executable to be used. Default is the runtime executable on the PATH. */ + /// + /// Gets or sets the absolute path to the runtime executable to be used. + /// Default is the runtime executable on the PATH. + /// public string RuntimeExecutable { get; set; } - // /** Optional arguments passed to the runtime executable. */ + /// + /// Gets or sets the optional arguments passed to the runtime executable. + /// public string[] RuntimeArgs { get; set; } - // /** Optional environment variables to pass to the debuggee. The string valued properties of the 'environmentVariables' are used as key/value pairs. */ + /// + /// Gets or sets optional environment variables to pass to the debuggee. The string valued + /// properties of the 'environmentVariables' are used as key/value pairs. + /// public Dictionary Env { get; set; } } } diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/SetExceptionBreakpointsRequest.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/SetExceptionBreakpointsRequest.cs index 3e6109fe5..a586f27bf 100644 --- a/src/PowerShellEditorServices.Protocol/DebugAdapter/SetExceptionBreakpointsRequest.cs +++ b/src/PowerShellEditorServices.Protocol/DebugAdapter/SetExceptionBreakpointsRequest.cs @@ -7,9 +7,10 @@ namespace Microsoft.PowerShell.EditorServices.Protocol.DebugAdapter { - // /** SetExceptionBreakpoints request; value of command field is "setExceptionBreakpoints". - // Enable that the debuggee stops on exceptions with a StoppedEvent (event type 'exception'). - // */ + /// + /// SetExceptionBreakpoints request; value of command field is "setExceptionBreakpoints". + /// Enable that the debuggee stops on exceptions with a StoppedEvent (event type 'exception'). + /// public class SetExceptionBreakpointsRequest { public static readonly @@ -17,14 +18,14 @@ public static readonly RequestType.Create("setExceptionBreakpoints"); } + /// + /// Arguments for "setExceptionBreakpoints" request. + /// public class SetExceptionBreakpointsRequestArguments { - // /** Arguments for "setExceptionBreakpoints" request. */ - // export interface SetExceptionBreakpointsArguments { - // /** Names of enabled exception breakpoints. */ - // filters: string[]; - // } + /// + /// Gets or sets the names of enabled exception breakpoints. + /// public string[] Filters { get; set; } } } - diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/SourceRequest.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/SourceRequest.cs index fbb7285a8..9d185af23 100644 --- a/src/PowerShellEditorServices.Protocol/DebugAdapter/SourceRequest.cs +++ b/src/PowerShellEditorServices.Protocol/DebugAdapter/SourceRequest.cs @@ -16,7 +16,9 @@ public static readonly public class SourceRequestArguments { - // /** The reference to the source. This is the value received in Source.reference. */ + /// + /// Gets or sets the reference to the source. This is the value received in Source.reference. + /// public int SourceReference { get; set; } } @@ -25,4 +27,3 @@ public class SourceResponseBody public string Content { get; set; } } } - diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/StackTraceRequest.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/StackTraceRequest.cs index 9a11086bd..06929ba45 100644 --- a/src/PowerShellEditorServices.Protocol/DebugAdapter/StackTraceRequest.cs +++ b/src/PowerShellEditorServices.Protocol/DebugAdapter/StackTraceRequest.cs @@ -20,7 +20,9 @@ public class StackTraceRequestArguments { public int ThreadId { get; private set; } - // /** The maximum number of frames to return. If levels is not specified or 0, all frames are returned. */ + /// + /// Gets the maximum number of frames to return. If levels is not specified or 0, all frames are returned. + /// public int Levels { get; private set; } } diff --git a/src/PowerShellEditorServices.Protocol/Server/DebugAdapterBase.cs b/src/PowerShellEditorServices.Protocol/Server/DebugAdapterBase.cs index 550f9b24d..eed67a92b 100644 --- a/src/PowerShellEditorServices.Protocol/Server/DebugAdapterBase.cs +++ b/src/PowerShellEditorServices.Protocol/Server/DebugAdapterBase.cs @@ -52,7 +52,7 @@ protected override Task OnStop() private async Task HandleInitializeRequest( object shutdownParams, - RequestContext requestContext) + RequestContext requestContext) { // Send the Initialized event first so that we get breakpoints await requestContext.SendEvent( @@ -60,7 +60,7 @@ await requestContext.SendEvent( null); // Now send the Initialize response to continue setup - await requestContext.SendResult(new object()); + await requestContext.SendResult(new InitializeResponseBody()); } } } From a9b5441e45fe18d7d40fb6fc4e2a37bcd9ed6fae Mon Sep 17 00:00:00 2001 From: Keith Hill Date: Wed, 24 Feb 2016 20:03:20 -0700 Subject: [PATCH 2/2] Removed exceptionBreakpointFilters capabilities field for now. The type (object) wasn't right and I don't think we would ever support this unless the PowerShell debug engine started to support this. --- .../DebugAdapter/InitializeRequest.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/PowerShellEditorServices.Protocol/DebugAdapter/InitializeRequest.cs b/src/PowerShellEditorServices.Protocol/DebugAdapter/InitializeRequest.cs index 6e27962ac..16c99544e 100644 --- a/src/PowerShellEditorServices.Protocol/DebugAdapter/InitializeRequest.cs +++ b/src/PowerShellEditorServices.Protocol/DebugAdapter/InitializeRequest.cs @@ -52,10 +52,5 @@ public class InitializeResponseBody /// supports a (side effect free) evaluate request for data hovers. /// public bool SupportsEvaluateForHovers { get; set; } - - /// - /// Gets or sets the available filters for the setExceptionBreakpoints request. - /// - public object ExceptionBreakpointFilters { get; set; } } }