From 192f131916e225fd3f4c597c2524f589fdbace5f Mon Sep 17 00:00:00 2001 From: David Driscoll Date: Fri, 19 Jul 2019 19:37:13 -0400 Subject: [PATCH 01/20] Sample debug adapter reciever --- LSP.sln | 32 +++- src/Dap.Protocol/Class1.cs | 8 + src/Dap.Protocol/Dap.Protocol.csproj | 21 +++ src/Dap.Server/Class1.cs | 8 + src/Dap.Server/Dap.Server.csproj | 16 ++ src/JsonRpc/DapReciever.cs | 92 +++++++++++ src/Protocol/Protocol.csproj | 4 +- test/JsonRpc.Tests/InputHandlerTests.cs | 42 ++--- test/JsonRpc.Tests/JsonRpc.Tests.csproj | 2 +- .../DebugAdapterSpecifictionRecieverTests.cs | 152 ++++++++++++++++++ .../Server/SpecifictionRecieverTests.cs | 2 +- 11 files changed, 346 insertions(+), 33 deletions(-) create mode 100644 src/Dap.Protocol/Class1.cs create mode 100644 src/Dap.Protocol/Dap.Protocol.csproj create mode 100644 src/Dap.Server/Class1.cs create mode 100644 src/Dap.Server/Dap.Server.csproj create mode 100644 src/JsonRpc/DapReciever.cs create mode 100644 test/JsonRpc.Tests/Server/DebugAdapterSpecifictionRecieverTests.cs diff --git a/LSP.sln b/LSP.sln index 0101f00db..21996c820 100644 --- a/LSP.sln +++ b/LSP.sln @@ -1,4 +1,4 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 +Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.29025.244 MinimumVisualStudioVersion = 10.0.40219.1 @@ -50,6 +50,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution cake.config = cake.config EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dap.Protocol", "src\Dap.Protocol\Dap.Protocol.csproj", "{F2C9D555-118E-442B-A953-9A7B58A53F33}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dap.Server", "src\Dap.Server\Dap.Server.csproj", "{E1A9123B-A236-4240-8C82-A61BD85C3BF4}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -156,6 +160,30 @@ Global {E540868F-438E-4F7F-BBB7-010D6CB18A57}.Release|x64.Build.0 = Release|Any CPU {E540868F-438E-4F7F-BBB7-010D6CB18A57}.Release|x86.ActiveCfg = Release|Any CPU {E540868F-438E-4F7F-BBB7-010D6CB18A57}.Release|x86.Build.0 = Release|Any CPU + {F2C9D555-118E-442B-A953-9A7B58A53F33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F2C9D555-118E-442B-A953-9A7B58A53F33}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F2C9D555-118E-442B-A953-9A7B58A53F33}.Debug|x64.ActiveCfg = Debug|Any CPU + {F2C9D555-118E-442B-A953-9A7B58A53F33}.Debug|x64.Build.0 = Debug|Any CPU + {F2C9D555-118E-442B-A953-9A7B58A53F33}.Debug|x86.ActiveCfg = Debug|Any CPU + {F2C9D555-118E-442B-A953-9A7B58A53F33}.Debug|x86.Build.0 = Debug|Any CPU + {F2C9D555-118E-442B-A953-9A7B58A53F33}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F2C9D555-118E-442B-A953-9A7B58A53F33}.Release|Any CPU.Build.0 = Release|Any CPU + {F2C9D555-118E-442B-A953-9A7B58A53F33}.Release|x64.ActiveCfg = Release|Any CPU + {F2C9D555-118E-442B-A953-9A7B58A53F33}.Release|x64.Build.0 = Release|Any CPU + {F2C9D555-118E-442B-A953-9A7B58A53F33}.Release|x86.ActiveCfg = Release|Any CPU + {F2C9D555-118E-442B-A953-9A7B58A53F33}.Release|x86.Build.0 = Release|Any CPU + {E1A9123B-A236-4240-8C82-A61BD85C3BF4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E1A9123B-A236-4240-8C82-A61BD85C3BF4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E1A9123B-A236-4240-8C82-A61BD85C3BF4}.Debug|x64.ActiveCfg = Debug|Any CPU + {E1A9123B-A236-4240-8C82-A61BD85C3BF4}.Debug|x64.Build.0 = Debug|Any CPU + {E1A9123B-A236-4240-8C82-A61BD85C3BF4}.Debug|x86.ActiveCfg = Debug|Any CPU + {E1A9123B-A236-4240-8C82-A61BD85C3BF4}.Debug|x86.Build.0 = Debug|Any CPU + {E1A9123B-A236-4240-8C82-A61BD85C3BF4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E1A9123B-A236-4240-8C82-A61BD85C3BF4}.Release|Any CPU.Build.0 = Release|Any CPU + {E1A9123B-A236-4240-8C82-A61BD85C3BF4}.Release|x64.ActiveCfg = Release|Any CPU + {E1A9123B-A236-4240-8C82-A61BD85C3BF4}.Release|x64.Build.0 = Release|Any CPU + {E1A9123B-A236-4240-8C82-A61BD85C3BF4}.Release|x86.ActiveCfg = Release|Any CPU + {E1A9123B-A236-4240-8C82-A61BD85C3BF4}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -169,6 +197,8 @@ Global {97437BE1-2EC3-4F6B-AC75-C3E099040A07} = {2F323ED5-EBF8-45E1-B9D3-C014561B3DDA} {92B331E9-5225-428D-AE82-37F5F46156A3} = {D764E024-3D3F-4112-B932-2DB722A1BACC} {E540868F-438E-4F7F-BBB7-010D6CB18A57} = {D764E024-3D3F-4112-B932-2DB722A1BACC} + {F2C9D555-118E-442B-A953-9A7B58A53F33} = {D764E024-3D3F-4112-B932-2DB722A1BACC} + {E1A9123B-A236-4240-8C82-A61BD85C3BF4} = {D764E024-3D3F-4112-B932-2DB722A1BACC} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {D38DD0EC-D095-4BCD-B8AF-2D788AF3B9AE} diff --git a/src/Dap.Protocol/Class1.cs b/src/Dap.Protocol/Class1.cs new file mode 100644 index 000000000..cc1ec5565 --- /dev/null +++ b/src/Dap.Protocol/Class1.cs @@ -0,0 +1,8 @@ +using System; + +namespace Dap.Protocol +{ + public class Class1 + { + } +} diff --git a/src/Dap.Protocol/Dap.Protocol.csproj b/src/Dap.Protocol/Dap.Protocol.csproj new file mode 100644 index 000000000..123eda095 --- /dev/null +++ b/src/Dap.Protocol/Dap.Protocol.csproj @@ -0,0 +1,21 @@ + + + + netstandard2.0 + AnyCPU + OmniSharp.Extensions.DebugAdapter + OmniSharp.Extensions.DebugAdapter.Protocol + Debug Adapter Protocol models, classes, interfaces and helper methods + + + + + + <_Parameter1>OmniSharp.Extensions.LanguageServer, PublicKey=0024000004800000940000000602000000240000525341310004000001000100391db875e68eb4bfef49ce14313b9e13f2cd3cc89eb273bbe6c11a55044c7d4f566cf092e1c77ef9e7c75b1496ae7f95d925938f5a01793dd8d9f99ae0a7595779b71b971287d7d7b5960d052078d14f5ce1a85ea5c9fb2f59ac735ff7bc215cab469b7c3486006860bad6f4c3b5204ea2f28dd4e1d05e2cca462cfd593b9f9f + + + <_Parameter1>OmniSharp.Extensions.LanguageClient, PublicKey=0024000004800000940000000602000000240000525341310004000001000100391db875e68eb4bfef49ce14313b9e13f2cd3cc89eb273bbe6c11a55044c7d4f566cf092e1c77ef9e7c75b1496ae7f95d925938f5a01793dd8d9f99ae0a7595779b71b971287d7d7b5960d052078d14f5ce1a85ea5c9fb2f59ac735ff7bc215cab469b7c3486006860bad6f4c3b5204ea2f28dd4e1d05e2cca462cfd593b9f9f + + + + diff --git a/src/Dap.Server/Class1.cs b/src/Dap.Server/Class1.cs new file mode 100644 index 000000000..62500e673 --- /dev/null +++ b/src/Dap.Server/Class1.cs @@ -0,0 +1,8 @@ +using System; + +namespace Dap.Server +{ + public class Class1 + { + } +} diff --git a/src/Dap.Server/Dap.Server.csproj b/src/Dap.Server/Dap.Server.csproj new file mode 100644 index 000000000..7dddf388e --- /dev/null +++ b/src/Dap.Server/Dap.Server.csproj @@ -0,0 +1,16 @@ + + + + netstandard2.0 + AnyCPU + OmniSharp.Extensions.DebugAdapter.Server + OmniSharp.Extensions.DebugAdapter.Server + You can use this package to create a debug adapter, that will be consumed by many clients + + + + + + + + diff --git a/src/JsonRpc/DapReciever.cs b/src/JsonRpc/DapReciever.cs new file mode 100644 index 000000000..8c9e097f9 --- /dev/null +++ b/src/JsonRpc/DapReciever.cs @@ -0,0 +1,92 @@ +using System; +using System.Collections.Generic; +using Newtonsoft.Json.Linq; +using OmniSharp.Extensions.JsonRpc.Server; +using OmniSharp.Extensions.JsonRpc.Server.Messages; + +namespace OmniSharp.Extensions.JsonRpc +{ + public class DapReciever : IReciever + { + public (IEnumerable results, bool hasResponse) GetRequests(JToken container) + { + var result = GetRenor(container); + return (new[] { result }, result.IsResponse); + } + + public bool IsValid(JToken container) + { + if (container is JObject) + { + return true; + } + + return false; + } + + protected virtual Renor GetRenor(JToken @object) + { + if (!( @object is JObject request )) + { + return new InvalidRequest(null, "Not an object"); + } + + if (!request.TryGetValue("seq", out var id)) + { + return new InvalidRequest(null, "No sequence given"); + } + + if (!request.TryGetValue("type", out var type)) + { + return new InvalidRequest(null, "No type given"); + } + var sequence = id.Value(); + var messageType = type.Value(); + + if (messageType == "event") + { + if (!request.TryGetValue("event", out var @event)) + { + return new InvalidRequest(null, "No event given"); + } + return new Notification(@event.Value(), request.TryGetValue("body", out var body) ? body : null); + } + if (messageType == "request") + { + if (!request.TryGetValue("command", out var command)) + { + return new InvalidRequest(null, "No command given"); + } + return new Request(sequence, command.Value(), request.TryGetValue("arguments", out var body) ? body : null); + } + if (messageType == "response") + { + if (!request.TryGetValue("request_seq", out var request_seq)) + { + return new InvalidRequest(null, "No request_seq given"); + } + if (!request.TryGetValue("command", out var command)) + { + return new InvalidRequest(null, "No command given"); + } + if (!request.TryGetValue("success", out var success)) + { + return new InvalidRequest(null, "No success given"); + } + + var bodyValue = request.TryGetValue("body", out var body) ? body : null; + + var requestSequence = request_seq.Value(); + var successValue = success.Value(); + + if (successValue) + { + return new ServerResponse(requestSequence, bodyValue); + } + return new ServerError(requestSequence, bodyValue); + } + + throw new NotSupportedException($"Message type {messageType} is not supported"); + } + } +} diff --git a/src/Protocol/Protocol.csproj b/src/Protocol/Protocol.csproj index 03265db19..85b78f506 100644 --- a/src/Protocol/Protocol.csproj +++ b/src/Protocol/Protocol.csproj @@ -1,10 +1,10 @@ - + netstandard2.0 AnyCPU OmniSharp.Extensions.LanguageProtocol OmniSharp.Extensions.LanguageServer.Protocol - Language Server Protocl models, classes, interfaces and helper methods + Language Server Protocol models, classes, interfaces and helper methods diff --git a/test/JsonRpc.Tests/InputHandlerTests.cs b/test/JsonRpc.Tests/InputHandlerTests.cs index 7cf427ccf..6d94d1038 100644 --- a/test/JsonRpc.Tests/InputHandlerTests.cs +++ b/test/JsonRpc.Tests/InputHandlerTests.cs @@ -63,11 +63,9 @@ public void ShouldPassInRequests() Substitute.For(), Substitute.For>(), Substitute.For(), - cts => - { + cts => { reciever.When(x => x.IsValid(Arg.Any())) - .Do(x => - { + .Do(x => { cts.Cancel(); }); })) @@ -90,11 +88,9 @@ public void ShouldHaveAThreadName() Substitute.For(), Substitute.For>(), Substitute.For(), - cts => - { + cts => { reciever.When(x => x.IsValid(Arg.Any())) - .Do(x => - { + .Do(x => { threadName = System.Threading.Thread.CurrentThread.Name; cts.Cancel(); }); @@ -121,11 +117,9 @@ public void ShouldPassInUtf8EncodedRequests() Substitute.For(), Substitute.For>(), Substitute.For(), - cts => - { + cts => { reciever.When(x => x.IsValid(Arg.Any())) - .Do(x => - { + .Do(x => { cts.Cancel(); }); })) @@ -159,11 +153,9 @@ public void ShouldHandleRequest() Substitute.For(), incomingRequestRouter, Substitute.For(), - cts => - { + cts => { outputHandler.When(x => x.Send(Arg.Any())) - .Do(x => - { + .Do(x => { cts.Cancel(); }); })) @@ -193,11 +185,9 @@ public void ShouldHandleError() Substitute.For(), incomingRequestRouter, Substitute.For(), - cts => - { + cts => { outputHandler.When(x => x.Send(Arg.Any())) - .Do(x => - { + .Do(x => { cts.Cancel(); }); })) @@ -226,11 +216,9 @@ public async Task ShouldHandleNotification() Substitute.For(), incomingRequestRouter, Substitute.For(), - cts => - { + cts => { incomingRequestRouter.When(x => x.RouteNotification(Arg.Any(), Arg.Any(), CancellationToken.None)) - .Do(x => - { + .Do(x => { cts.Cancel(); }); })) @@ -262,11 +250,9 @@ public void ShouldHandleResponse() Substitute.For(), Substitute.For>(), responseRouter, - cts => - { + cts => { responseRouter.When(x => x.GetRequest(Arg.Any())) - .Do(x => - { + .Do(x => { cts.CancelAfter(1); }); })) diff --git a/test/JsonRpc.Tests/JsonRpc.Tests.csproj b/test/JsonRpc.Tests/JsonRpc.Tests.csproj index 0c4601010..a28df7f7a 100644 --- a/test/JsonRpc.Tests/JsonRpc.Tests.csproj +++ b/test/JsonRpc.Tests/JsonRpc.Tests.csproj @@ -1,4 +1,4 @@ - + netcoreapp2.1 true diff --git a/test/JsonRpc.Tests/Server/DebugAdapterSpecifictionRecieverTests.cs b/test/JsonRpc.Tests/Server/DebugAdapterSpecifictionRecieverTests.cs new file mode 100644 index 000000000..07fc3c1cf --- /dev/null +++ b/test/JsonRpc.Tests/Server/DebugAdapterSpecifictionRecieverTests.cs @@ -0,0 +1,152 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using FluentAssertions; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using OmniSharp.Extensions.JsonRpc; +using OmniSharp.Extensions.JsonRpc.Server; +using OmniSharp.Extensions.JsonRpc.Server.Messages; +using Xunit; + +namespace JsonRpc.Tests.Server +{ + public class DebugAdapterSpecifictionRecieverTests + { + [Theory] + [ClassData(typeof(SpecificationMessages))] + public void ShouldRespond_AsExpected(string json, Renor[] request) + { + var reciever = new DapReciever(); + var (requests, _) = reciever.GetRequests(JToken.Parse(json)); + var result = requests.ToArray(); + request.Length.Should().Be(result.Length); + + for (var i = 0; i < request.Length; i++) + { + var r = request[i]; + var response = result[i]; + + JsonConvert.SerializeObject(response) + .Should().Be(JsonConvert.SerializeObject(r)); + } + } + + class SpecificationMessages : TheoryData + { + public override IEnumerable> GetValues() + { + yield return ( + @"{""seq"": ""0"", ""type"": ""request"", ""command"": ""attach"", ""arguments"": { ""__restart"": 3 }}", + new Renor[] + { + new Request(0, "attach", new JObject() { { "__restart", 3 } }) + } + ); + + yield return ( + @"{""seq"": ""1"", ""type"": ""request"", ""command"": ""attach""}", + new Renor[] + { + new Request(1, "attach", null) + } + ); + + yield return ( + @"{""seq"": ""0"", ""type"": ""event"", ""event"": ""breakpoint"", ""body"": { ""reason"": ""new"" }}", + new Renor[] + { + new Notification("breakpoint", new JObject() { { "reason", "new" } }), + } + ); + + yield return ( + @"{""seq"": ""1"", ""type"": ""event"", ""event"": ""breakpoint""}", + new Renor[] + { + new Notification("breakpoint", null) + } + ); + + yield return ( + @"{""seq"": ""1"", ""type"": ""response"", ""request_seq"": 3, ""success"": true, ""command"": ""attach"", ""body"": { }}", + new Renor[] + { + new ServerResponse(3, new JObject()), + } + ); + + yield return ( + @"{""seq"": ""1"", ""type"": ""response"", ""request_seq"": 3, ""success"": true, ""command"": ""attach"", ""body"": null}", + new Renor[] + { + new ServerResponse(3, null), + } + ); + + yield return ( + @"{""seq"": ""1"", ""type"": ""response"", ""request_seq"": 3, ""success"": false, ""command"": ""attach"", ""body"": { }}", + new Renor[] + { + new ServerError(3, new JObject()), + } + ); + + yield return ( + @"{""seq"": ""1"", ""type"": ""response"", ""request_seq"": 3, ""success"": false, ""command"": ""attach"", ""body"": null}", + new Renor[] + { + new ServerError(3, null), + } + ); + + yield return ( + @"[1]", + new Renor[] + { + new InvalidRequest("Not an object") + }); + + //yield return ( + // @"[ + // {""jsonrpc"": ""2.0"", ""method"": ""sum"", ""params"": [1,2,4], ""id"": ""1""}, + // {""jsonrpc"": ""2.0"", ""method"": ""notify_hello"", ""params"": [7]}, + // {""jsonrpc"": ""2.0"", ""method"": ""subtract"", ""params"": [42,23], ""id"": ""2""}, + // {""foo"": ""boo""}, + // {""jsonrpc"": ""2.0"", ""method"": ""foo.get"", ""params"": {""name"": ""myself""}, ""id"": ""5""}, + // {""jsonrpc"": ""2.0"", ""method"": ""get_data"", ""id"": ""9""} + // ]", + // new Renor[] + // { + // new Request("1", "sum", new JArray(new [] {1,2,4})), + // new Notification("notify_hello", new JArray(new [] {7})), + // new Request("2", "subtract", new JArray(new [] {42,23})), + // new InvalidRequest("Unexpected protocol"), + // new Request("5", "foo.get", JObject.FromObject(new {name = "myself"})), + // new Request("9", "get_data", null), + // }); + } + } + + [Theory] + [ClassData(typeof(InvalidMessages))] + public void Should_ValidateInvalidMessages(string json, bool expected) + { + var reciever = new DapReciever(); + var result = reciever.IsValid(JToken.Parse(json)); + result.Should().Be(expected); + } + + class InvalidMessages : TheoryData + { + public override IEnumerable> GetValues() + { + yield return (@"[]", false); + yield return (@"""""", false); + yield return (@"1", false); + yield return (@"true", false); + yield return (@"{}", true); + } + } + } +} diff --git a/test/JsonRpc.Tests/Server/SpecifictionRecieverTests.cs b/test/JsonRpc.Tests/Server/SpecifictionRecieverTests.cs index a1e91cfff..c46b9611b 100644 --- a/test/JsonRpc.Tests/Server/SpecifictionRecieverTests.cs +++ b/test/JsonRpc.Tests/Server/SpecifictionRecieverTests.cs @@ -104,7 +104,7 @@ public override IEnumerable> GetValues() yield return ( @"{""jsonrpc"":""2.0"",""method"":""initialized"",""params"":{}}", new Renor[] { - new Notification("initialized", new JObject()), + new Notification("initialized", new JObject()), } ); From a0dcf0356dff7d70aaf3a8e591a2c21f6072c40f Mon Sep 17 00:00:00 2001 From: David Driscoll Date: Fri, 19 Jul 2019 23:47:58 -0400 Subject: [PATCH 02/20] Added output handling of Debug Adapter Protocol serialization --- src/JsonRpc/Client/Notification.cs | 4 - src/JsonRpc/Client/Request.cs | 4 - src/JsonRpc/Client/Response.cs | 12 +- src/JsonRpc/ISerializer.cs | 1 + src/JsonRpc/JsonRpcServerOptions.cs | 3 +- src/JsonRpc/RequestRouterBase.cs | 2 +- src/JsonRpc/RpcError.cs | 30 +- src/JsonRpc/RpcErrorConverter.cs | 51 ---- .../Converters/ClientNotificationConverter.cs | 32 +++ .../Converters/ClientRequestConverter.cs | 32 +++ .../Converters/ClientResponseConverter.cs | 32 +++ .../Converters/ErrorMessageConverter.cs | 25 ++ .../Converters/RpcErrorConverter.cs | 50 ++++ src/JsonRpc/Serialization/DapSerializer.cs | 17 ++ .../DapClientNotificationConverter.cs | 42 +++ .../DapClientRequestConverter.cs | 34 +++ .../DapClientResponseConverter.cs | 43 +++ .../DapRpcErrorConverter.cs | 57 ++++ .../Serialization/JsonRpcSerializer.cs | 20 ++ src/JsonRpc/Serialization/SerializerBase.cs | 71 +++++ src/JsonRpc/Serializer.cs | 45 --- src/JsonRpc/Server/JsonRpcException.cs | 4 +- src/JsonRpc/Server/Messages/ErrorMessage.cs | 20 +- src/JsonRpc/Server/Messages/InternalError.cs | 2 +- src/JsonRpc/Server/Messages/InvalidParams.cs | 2 +- src/JsonRpc/Server/Messages/InvalidRequest.cs | 2 +- src/JsonRpc/Server/Notification.cs | 11 +- src/JsonRpc/Server/Request.cs | 11 +- src/JsonRpc/Server/ResponseBase.cs | 3 - src/Protocol/Serialization/Serializer.cs | 16 ++ test/JsonRpc.Tests/DapInputHandlerTests.cs | 265 ++++++++++++++++++ test/JsonRpc.Tests/DapOutputHandlerTests.cs | 156 +++++++++++ test/JsonRpc.Tests/InputHandlerTests.cs | 5 +- .../MediatorTestsNotificationHandler.cs | 3 +- .../MediatorTestsNotificationHandlerOfT.cs | 3 +- .../MediatorTestsRequestHandlerOfTRequest.cs | 3 +- ...rTestsRequestHandlerOfTRequestTResponse.cs | 3 +- test/JsonRpc.Tests/OutputHandlerTests.cs | 110 +++++++- test/JsonRpc.Tests/RequestRouterTests.cs | 3 +- 39 files changed, 1036 insertions(+), 193 deletions(-) delete mode 100644 src/JsonRpc/RpcErrorConverter.cs create mode 100644 src/JsonRpc/Serialization/Converters/ClientNotificationConverter.cs create mode 100644 src/JsonRpc/Serialization/Converters/ClientRequestConverter.cs create mode 100644 src/JsonRpc/Serialization/Converters/ClientResponseConverter.cs create mode 100644 src/JsonRpc/Serialization/Converters/ErrorMessageConverter.cs create mode 100644 src/JsonRpc/Serialization/Converters/RpcErrorConverter.cs create mode 100644 src/JsonRpc/Serialization/DapSerializer.cs create mode 100644 src/JsonRpc/Serialization/DebugAdapterConverters/DapClientNotificationConverter.cs create mode 100644 src/JsonRpc/Serialization/DebugAdapterConverters/DapClientRequestConverter.cs create mode 100644 src/JsonRpc/Serialization/DebugAdapterConverters/DapClientResponseConverter.cs create mode 100644 src/JsonRpc/Serialization/DebugAdapterConverters/DapRpcErrorConverter.cs create mode 100644 src/JsonRpc/Serialization/JsonRpcSerializer.cs create mode 100644 src/JsonRpc/Serialization/SerializerBase.cs delete mode 100644 src/JsonRpc/Serializer.cs create mode 100644 test/JsonRpc.Tests/DapInputHandlerTests.cs create mode 100644 test/JsonRpc.Tests/DapOutputHandlerTests.cs diff --git a/src/JsonRpc/Client/Notification.cs b/src/JsonRpc/Client/Notification.cs index f4604675a..c7016ff14 100644 --- a/src/JsonRpc/Client/Notification.cs +++ b/src/JsonRpc/Client/Notification.cs @@ -3,12 +3,8 @@ namespace OmniSharp.Extensions.JsonRpc.Client { - [JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))] public class Notification { - [JsonProperty("jsonrpc")] - public string ProtocolVersion { get; } = "2.0"; - public string Method { get; set; } public object Params { get; set; } diff --git a/src/JsonRpc/Client/Request.cs b/src/JsonRpc/Client/Request.cs index bee1822b0..15b810b38 100644 --- a/src/JsonRpc/Client/Request.cs +++ b/src/JsonRpc/Client/Request.cs @@ -3,14 +3,10 @@ namespace OmniSharp.Extensions.JsonRpc.Client { - [JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))] public class Request { public object Id { get; set; } - [JsonProperty("jsonrpc")] - public string ProtocolVersion { get; } = "2.0"; - public string Method { get; set; } [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] diff --git a/src/JsonRpc/Client/Response.cs b/src/JsonRpc/Client/Response.cs index 77047477d..e879d2930 100644 --- a/src/JsonRpc/Client/Response.cs +++ b/src/JsonRpc/Client/Response.cs @@ -1,27 +1,27 @@ using Newtonsoft.Json; using Newtonsoft.Json.Serialization; +using ServerRequest = OmniSharp.Extensions.JsonRpc.Server.Request; namespace OmniSharp.Extensions.JsonRpc.Client { - [JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))] public class Response { - public Response(object id) + public Response(object id, ServerRequest request) { Id = id; + Request = request; } - public Response(object id, object result) + public Response(object id, object result, ServerRequest request) { Id = id; Result = result; + Request = request; } - [JsonProperty("jsonrpc")] - public string ProtocolVersion { get; set; } = "2.0"; - public object Id { get; set; } public object Result { get; set; } + public ServerRequest Request { get; } } } diff --git a/src/JsonRpc/ISerializer.cs b/src/JsonRpc/ISerializer.cs index d8aba6aa8..83f686d77 100644 --- a/src/JsonRpc/ISerializer.cs +++ b/src/JsonRpc/ISerializer.cs @@ -10,5 +10,6 @@ public interface ISerializer string SerializeObject(object value); object DeserializeObject(string json, Type type); T DeserializeObject(string json); + long GetNextId(); } } diff --git a/src/JsonRpc/JsonRpcServerOptions.cs b/src/JsonRpc/JsonRpcServerOptions.cs index 31238195d..a203cea0b 100644 --- a/src/JsonRpc/JsonRpcServerOptions.cs +++ b/src/JsonRpc/JsonRpcServerOptions.cs @@ -5,6 +5,7 @@ using System.Reflection; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; +using OmniSharp.Extensions.JsonRpc.Serialization; namespace OmniSharp.Extensions.JsonRpc { @@ -17,7 +18,7 @@ public JsonRpcServerOptions() public Stream Input { get; set; } public Stream Output { get; set; } public ILoggerFactory LoggerFactory { get; set; } = new LoggerFactory(); - public ISerializer Serializer { get; set; } = new Serializer(); + public ISerializer Serializer { get; set; } = new JsonRpcSerializer(); public IRequestProcessIdentifier RequestProcessIdentifier { get; set; } = new ParallelRequestProcessIdentifier(); public IReciever Reciever { get; set; } = new Reciever(); public IServiceCollection Services { get; set; } = new ServiceCollection(); diff --git a/src/JsonRpc/RequestRouterBase.cs b/src/JsonRpc/RequestRouterBase.cs index c599654b0..24e279cdf 100644 --- a/src/JsonRpc/RequestRouterBase.cs +++ b/src/JsonRpc/RequestRouterBase.cs @@ -146,7 +146,7 @@ public virtual async Task RouteRequest(TDescriptor descriptor, Re _logger.LogDebug("Response value was {Type}", responseValue?.GetType().FullName); } - return new JsonRpc.Client.Response(request.Id, responseValue); + return new JsonRpc.Client.Response(request.Id, responseValue, request); } catch (TaskCanceledException e) { diff --git a/src/JsonRpc/RpcError.cs b/src/JsonRpc/RpcError.cs index e99987f11..9376c8bc8 100644 --- a/src/JsonRpc/RpcError.cs +++ b/src/JsonRpc/RpcError.cs @@ -4,40 +4,16 @@ namespace OmniSharp.Extensions.JsonRpc { - - [JsonConverter(typeof(RpcErrorConverter))] - public class RpcError + public class RpcError { - public RpcError(object id, ErrorMessage message) : this(id, message, "2.0") - { - } - [JsonConstructor] - public RpcError(object id, ErrorMessage message, string protocolVersion) + public RpcError(object id, ErrorMessage message) { Id = id; Error = message; - ProtocolVersion = protocolVersion; } - [JsonProperty("jsonrpc")] - public string ProtocolVersion { get; set; } - - [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public object Id { get; } - - public ErrorMessage Error { get; } - } - - public class RpcError : RpcError - { - public RpcError(object id, ErrorMessage message) : this(id, message, "2.0") - { - } - - [JsonConstructor] - public RpcError(object id, ErrorMessage message, string protocolVersion) : base(id, message, protocolVersion) - { - } + public ErrorMessage Error { get; } } } diff --git a/src/JsonRpc/RpcErrorConverter.cs b/src/JsonRpc/RpcErrorConverter.cs deleted file mode 100644 index 15c3c5ced..000000000 --- a/src/JsonRpc/RpcErrorConverter.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using System.Reflection; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using OmniSharp.Extensions.JsonRpc.Server.Messages; - -namespace OmniSharp.Extensions.JsonRpc -{ - public class RpcErrorConverter : JsonConverter - { - public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) - { - throw new NotImplementedException(); - } - - public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) - { - var obj = JObject.Load(reader); - - var messageDataType = objectType.GetTypeInfo().IsGenericType - ? objectType.GetTypeInfo().GetGenericArguments()[0] - : typeof(object); - - object requestId = null; - if (obj.TryGetValue("id", out var id)) - { - var idString = id.Type == JTokenType.String ? (string)id : null; - var idLong = id.Type == JTokenType.Integer ? (long?)id : null; - requestId = idString ?? (idLong.HasValue ? (object)idLong.Value : null); - } - - object data = null; - if (obj.TryGetValue("error", out var dataToken)) - { - var errorMessageType = typeof(ErrorMessage<>).MakeGenericType(messageDataType); - data = dataToken.ToObject(errorMessageType, serializer); - } - - return Activator.CreateInstance(objectType, requestId, data, obj["jsonrpc"].ToString()); - } - - public override bool CanConvert(Type objectType) - { - return objectType == typeof(RpcError) || - (objectType.GetTypeInfo().IsGenericType && objectType.GetTypeInfo().GetGenericTypeDefinition() == typeof(RpcError<>)); - } - - public override bool CanWrite { get; } = false; - public override bool CanRead { get; } = true; - } -} diff --git a/src/JsonRpc/Serialization/Converters/ClientNotificationConverter.cs b/src/JsonRpc/Serialization/Converters/ClientNotificationConverter.cs new file mode 100644 index 000000000..88218f01b --- /dev/null +++ b/src/JsonRpc/Serialization/Converters/ClientNotificationConverter.cs @@ -0,0 +1,32 @@ +using System; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using OmniSharp.Extensions.JsonRpc.Client; + +namespace OmniSharp.Extensions.JsonRpc.Serialization.Converters +{ + public class ClientNotificationConverter : JsonConverter + { + public override bool CanRead => false; + public override Notification ReadJson(JsonReader reader, Type objectType, Notification existingValue, + bool hasExistingValue, JsonSerializer serializer) + { + throw new NotImplementedException(); + } + + public override void WriteJson(JsonWriter writer, Notification value, JsonSerializer serializer) + { + writer.WriteStartObject(); + writer.WritePropertyName("jsonrpc"); + writer.WriteValue("2.0"); + writer.WritePropertyName("method"); + writer.WriteValue(value.Method); + if (value.Params != null) + { + writer.WritePropertyName("params"); + serializer.Serialize(writer, value.Params); + } + writer.WriteEndObject(); + } + } +} diff --git a/src/JsonRpc/Serialization/Converters/ClientRequestConverter.cs b/src/JsonRpc/Serialization/Converters/ClientRequestConverter.cs new file mode 100644 index 000000000..5e602e2bd --- /dev/null +++ b/src/JsonRpc/Serialization/Converters/ClientRequestConverter.cs @@ -0,0 +1,32 @@ +using System; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using OmniSharp.Extensions.JsonRpc.Client; + +namespace OmniSharp.Extensions.JsonRpc.Serialization.Converters +{ + public class ClientRequestConverter : JsonConverter + { + public override bool CanRead => false; + public override Request ReadJson(JsonReader reader, Type objectType, Request existingValue, + bool hasExistingValue, JsonSerializer serializer) + { + throw new NotImplementedException(); + } + + public override void WriteJson(JsonWriter writer, Request value, JsonSerializer serializer) + { + writer.WriteStartObject(); + writer.WritePropertyName("jsonrpc"); + writer.WriteValue("2.0"); + writer.WritePropertyName("method"); + writer.WriteValue(value.Method); + if (value.Params != null) + { + writer.WritePropertyName("params"); + serializer.Serialize(writer, value.Params); + } + writer.WriteEndObject(); + } + } +} diff --git a/src/JsonRpc/Serialization/Converters/ClientResponseConverter.cs b/src/JsonRpc/Serialization/Converters/ClientResponseConverter.cs new file mode 100644 index 000000000..3ede1c03d --- /dev/null +++ b/src/JsonRpc/Serialization/Converters/ClientResponseConverter.cs @@ -0,0 +1,32 @@ +using System; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using OmniSharp.Extensions.JsonRpc.Client; + +namespace OmniSharp.Extensions.JsonRpc.Serialization.Converters +{ + public class ClientResponseConverter : JsonConverter + { + public override bool CanRead => false; + public override Response ReadJson(JsonReader reader, Type objectType, Response existingValue, + bool hasExistingValue, JsonSerializer serializer) + { + throw new NotImplementedException(); + } + + public override void WriteJson(JsonWriter writer, Response value, JsonSerializer serializer) + { + writer.WriteStartObject(); + writer.WritePropertyName("jsonrpc"); + writer.WriteValue("2.0"); + writer.WritePropertyName("id"); + writer.WriteValue(value.Id); + if (value.Result != null) + { + writer.WritePropertyName("result"); + serializer.Serialize(writer, value.Result); + } + writer.WriteEndObject(); + } + } +} diff --git a/src/JsonRpc/Serialization/Converters/ErrorMessageConverter.cs b/src/JsonRpc/Serialization/Converters/ErrorMessageConverter.cs new file mode 100644 index 000000000..14d0cd374 --- /dev/null +++ b/src/JsonRpc/Serialization/Converters/ErrorMessageConverter.cs @@ -0,0 +1,25 @@ +using System; +using Newtonsoft.Json; +using OmniSharp.Extensions.JsonRpc.Server.Messages; + +namespace OmniSharp.Extensions.JsonRpc.Serialization.Converters +{ + public class ErrorMessageConverter : JsonConverter + { + public override void WriteJson(JsonWriter writer, ErrorMessage value, JsonSerializer serializer) + { + writer.WriteStartObject(); + writer.WritePropertyName("code"); + writer.WriteValue(value.Code); + writer.WritePropertyName("data"); + writer.WriteValue(value.Data); + writer.WritePropertyName("message"); + writer.WriteValue(value.Message); + writer.WriteEndObject(); + } + + public override ErrorMessage ReadJson(JsonReader reader, Type objectType, ErrorMessage existingValue, bool hasExistingValue, JsonSerializer serializer) => throw new NotImplementedException(); + + public override bool CanRead => false; + } +} diff --git a/src/JsonRpc/Serialization/Converters/RpcErrorConverter.cs b/src/JsonRpc/Serialization/Converters/RpcErrorConverter.cs new file mode 100644 index 000000000..73717f2de --- /dev/null +++ b/src/JsonRpc/Serialization/Converters/RpcErrorConverter.cs @@ -0,0 +1,50 @@ +using System; +using System.Reflection; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using OmniSharp.Extensions.JsonRpc.Server.Messages; + +namespace OmniSharp.Extensions.JsonRpc.Serialization.Converters +{ + public class RpcErrorConverter : JsonConverter + { + public override void WriteJson(JsonWriter writer, RpcError value, JsonSerializer serializer) + { + writer.WriteStartObject(); + writer.WritePropertyName("jsonrpc"); + writer.WriteValue("2.0"); + if (value.Id != null) + { + writer.WritePropertyName("id"); + writer.WriteValue(value.Id); + } + writer.WritePropertyName("error"); + serializer.Serialize(writer, value.Error); + writer.WriteEndObject(); + } + + public override RpcError ReadJson(JsonReader reader, Type objectType, RpcError existingValue, + bool hasExistingValue, JsonSerializer serializer) + { + + var obj = JObject.Load(reader); + + object requestId = null; + if (obj.TryGetValue("id", out var id)) + { + var idString = id.Type == JTokenType.String ? (string) id : null; + var idLong = id.Type == JTokenType.Integer ? (long?) id : null; + requestId = idString ?? ( idLong.HasValue ? (object) idLong.Value : null ); + } + + ErrorMessage data = null; + if (obj.TryGetValue("error", out var dataToken)) + { + var errorMessageType = typeof(ErrorMessage); + data = dataToken.ToObject< ErrorMessage>(serializer); + } + + return new RpcError(id, data); + } + } +} diff --git a/src/JsonRpc/Serialization/DapSerializer.cs b/src/JsonRpc/Serialization/DapSerializer.cs new file mode 100644 index 000000000..e67149623 --- /dev/null +++ b/src/JsonRpc/Serialization/DapSerializer.cs @@ -0,0 +1,17 @@ +using System.Collections.Generic; +using Newtonsoft.Json; +using OmniSharp.Extensions.JsonRpc.Serialization.DebugAdapterConverters; + +namespace OmniSharp.Extensions.JsonRpc.Serialization +{ + public class DapSerializer : SerializerBase + { + protected override void AddOrReplaceConverters(ICollection converters) + { + ReplaceConverter(converters, new DapClientNotificationConverter(this)); + ReplaceConverter(converters, new DapClientResponseConverter(this)); + ReplaceConverter(converters, new DapClientRequestConverter()); + ReplaceConverter(converters, new DapRpcErrorConverter(this)); + } + } +} diff --git a/src/JsonRpc/Serialization/DebugAdapterConverters/DapClientNotificationConverter.cs b/src/JsonRpc/Serialization/DebugAdapterConverters/DapClientNotificationConverter.cs new file mode 100644 index 000000000..179690e0e --- /dev/null +++ b/src/JsonRpc/Serialization/DebugAdapterConverters/DapClientNotificationConverter.cs @@ -0,0 +1,42 @@ +using System; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using OmniSharp.Extensions.JsonRpc.Client; + +namespace OmniSharp.Extensions.JsonRpc.Serialization.DebugAdapterConverters +{ + class DapClientNotificationConverter : JsonConverter + { + private readonly ISerializer _serializer; + + public DapClientNotificationConverter(ISerializer serializer) + { + _serializer = serializer; + } + + public override bool CanRead => false; + + public override Notification ReadJson(JsonReader reader, Type objectType, Notification existingValue, + bool hasExistingValue, JsonSerializer serializer) + { + throw new NotImplementedException(); + } + + public override void WriteJson(JsonWriter writer, Notification value, JsonSerializer serializer) + { + writer.WriteStartObject(); + writer.WritePropertyName("seq"); + writer.WriteValue(_serializer.GetNextId()); + writer.WritePropertyName("type"); + writer.WriteValue("event"); + writer.WritePropertyName("event"); + writer.WriteValue(value.Method); + if (value.Params != null) + { + writer.WritePropertyName("body"); + serializer.Serialize(writer, value.Params); + } + writer.WriteEndObject(); + } + } +} diff --git a/src/JsonRpc/Serialization/DebugAdapterConverters/DapClientRequestConverter.cs b/src/JsonRpc/Serialization/DebugAdapterConverters/DapClientRequestConverter.cs new file mode 100644 index 000000000..09fd83161 --- /dev/null +++ b/src/JsonRpc/Serialization/DebugAdapterConverters/DapClientRequestConverter.cs @@ -0,0 +1,34 @@ +using System; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using OmniSharp.Extensions.JsonRpc.Client; + +namespace OmniSharp.Extensions.JsonRpc.Serialization.DebugAdapterConverters +{ + class DapClientRequestConverter : JsonConverter + { + public override bool CanRead => false; + public override Request ReadJson(JsonReader reader, Type objectType, Request existingValue, + bool hasExistingValue, JsonSerializer serializer) + { + throw new NotImplementedException(); + } + + public override void WriteJson(JsonWriter writer, Request value, JsonSerializer serializer) + { + writer.WriteStartObject(); + writer.WritePropertyName("seq"); + writer.WriteValue(value.Id); + writer.WritePropertyName("type"); + writer.WriteValue("request"); + writer.WritePropertyName("command"); + writer.WriteValue(value.Method); + if (value.Params != null) + { + writer.WritePropertyName("arguments"); + serializer.Serialize(writer, value.Params); + } + writer.WriteEndObject(); + } + } +} diff --git a/src/JsonRpc/Serialization/DebugAdapterConverters/DapClientResponseConverter.cs b/src/JsonRpc/Serialization/DebugAdapterConverters/DapClientResponseConverter.cs new file mode 100644 index 000000000..12d1d834b --- /dev/null +++ b/src/JsonRpc/Serialization/DebugAdapterConverters/DapClientResponseConverter.cs @@ -0,0 +1,43 @@ +using System; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using OmniSharp.Extensions.JsonRpc.Client; + +namespace OmniSharp.Extensions.JsonRpc.Serialization.DebugAdapterConverters +{ + class DapClientResponseConverter : JsonConverter + { + private readonly ISerializer _serializer; + + public DapClientResponseConverter(ISerializer serializer) + { + _serializer = serializer; + } + + public override bool CanRead => false; + public override Response ReadJson(JsonReader reader, Type objectType, Response existingValue, + bool hasExistingValue, JsonSerializer serializer) + { + throw new NotImplementedException(); + } + + public override void WriteJson(JsonWriter writer, Response value, JsonSerializer serializer) + { + writer.WriteStartObject(); + writer.WritePropertyName("seq"); + writer.WriteValue(_serializer.GetNextId()); + writer.WritePropertyName("type"); + writer.WriteValue("response"); + writer.WritePropertyName("request_seq"); + writer.WriteValue(value.Id); + writer.WritePropertyName("command"); + writer.WriteValue(value.Request?.Method); + if (value.Result != null) + { + writer.WritePropertyName("body"); + serializer.Serialize(writer, value.Result); + } + writer.WriteEndObject(); + } + } +} diff --git a/src/JsonRpc/Serialization/DebugAdapterConverters/DapRpcErrorConverter.cs b/src/JsonRpc/Serialization/DebugAdapterConverters/DapRpcErrorConverter.cs new file mode 100644 index 000000000..a7d23c975 --- /dev/null +++ b/src/JsonRpc/Serialization/DebugAdapterConverters/DapRpcErrorConverter.cs @@ -0,0 +1,57 @@ +using System; +using System.Reflection; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using OmniSharp.Extensions.JsonRpc.Server.Messages; + +namespace OmniSharp.Extensions.JsonRpc.Serialization.DebugAdapterConverters +{ + public class DapRpcErrorConverter : JsonConverter + { + private readonly ISerializer _serializer; + + public DapRpcErrorConverter(ISerializer serializer) + { + _serializer = serializer; + } + + public override void WriteJson(JsonWriter writer, RpcError value, JsonSerializer serializer) + { + writer.WriteStartObject(); + writer.WritePropertyName("seq"); + writer.WriteValue(_serializer.GetNextId()); + if (value.Id != null) + { + writer.WritePropertyName("request_seq"); + writer.WriteValue(value.Id); + } + writer.WritePropertyName("message"); + writer.WriteValue(value.Error.Message); + writer.WriteEndObject(); + } + + public override RpcError ReadJson(JsonReader reader, Type objectType, RpcError existingValue, + bool hasExistingValue, JsonSerializer serializer) + { + + var obj = JObject.Load(reader); + + object requestId = null; + if (obj.TryGetValue("id", out var id)) + { + var idString = id.Type == JTokenType.String ? (string) id : null; + var idLong = id.Type == JTokenType.Integer ? (long?) id : null; + requestId = idString ?? ( idLong.HasValue ? (object) idLong.Value : null ); + } + + ErrorMessage data = null; + if (obj.TryGetValue("message", out var dataToken)) + { + var errorMessageType = typeof(ErrorMessage); + data = dataToken.ToObject(serializer); + } + + return new RpcError(id, data); + } + } +} diff --git a/src/JsonRpc/Serialization/JsonRpcSerializer.cs b/src/JsonRpc/Serialization/JsonRpcSerializer.cs new file mode 100644 index 000000000..e9a95a7d8 --- /dev/null +++ b/src/JsonRpc/Serialization/JsonRpcSerializer.cs @@ -0,0 +1,20 @@ +using System.Collections.Generic; +using System.Text; +using Newtonsoft.Json; +using OmniSharp.Extensions.JsonRpc.Serialization.Converters; +using OmniSharp.Extensions.JsonRpc.Serialization.DebugAdapterConverters; + +namespace OmniSharp.Extensions.JsonRpc.Serialization +{ + public class JsonRpcSerializer : SerializerBase + { + protected override void AddOrReplaceConverters(ICollection converters) + { + ReplaceConverter(converters, new ClientNotificationConverter()); + ReplaceConverter(converters, new ClientResponseConverter()); + ReplaceConverter(converters, new ClientRequestConverter()); + ReplaceConverter(converters, new ErrorMessageConverter()); + ReplaceConverter(converters, new RpcErrorConverter()); + } + } +} diff --git a/src/JsonRpc/Serialization/SerializerBase.cs b/src/JsonRpc/Serialization/SerializerBase.cs new file mode 100644 index 000000000..a4fd820dd --- /dev/null +++ b/src/JsonRpc/Serialization/SerializerBase.cs @@ -0,0 +1,71 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Newtonsoft.Json; + +namespace OmniSharp.Extensions.JsonRpc.Serialization +{ + public abstract class SerializerBase : ISerializer + { + private readonly object _lock = new object(); + private long _id = 0; + public SerializerBase() + { + JsonSerializer = CreateSerializer(); + Settings = CreateSerializerSettings(); + } + + protected JsonSerializer CreateSerializer() + { + var serializer = JsonSerializer.CreateDefault(); + AddOrReplaceConverters(serializer.Converters); + return serializer; + } + + protected JsonSerializerSettings CreateSerializerSettings() + { + var settings = JsonConvert.DefaultSettings != null ? JsonConvert.DefaultSettings() : new JsonSerializerSettings(); + AddOrReplaceConverters(settings.Converters); + return settings; + } + + protected internal static void ReplaceConverter(ICollection converters, T item) + where T : JsonConverter + { + var existingConverters = converters.OfType().ToArray(); + if (existingConverters.Any()) + { + foreach (var converter in existingConverters) + converters.Remove(converter); + } + converters.Add(item); + } + + public JsonSerializer JsonSerializer { get; } + + public JsonSerializerSettings Settings { get; } + + public string SerializeObject(object value) + { + return JsonConvert.SerializeObject(value, Settings); + } + + public object DeserializeObject(string json, Type type) + { + return JsonConvert.DeserializeObject(json, type, Settings); + } + + public T DeserializeObject(string json) + { + return JsonConvert.DeserializeObject(json, Settings); + } + public long GetNextId() + { + lock (_lock) + { + return _id++; + } + } + protected abstract void AddOrReplaceConverters(ICollection converters); + } +} \ No newline at end of file diff --git a/src/JsonRpc/Serializer.cs b/src/JsonRpc/Serializer.cs deleted file mode 100644 index 84ddb51c9..000000000 --- a/src/JsonRpc/Serializer.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using Newtonsoft.Json; - -namespace OmniSharp.Extensions.JsonRpc -{ - public class Serializer : ISerializer - { - public Serializer() - { - JsonSerializer = CreateSerializer(); - Settings = CreateSerializerSettings(); - } - - private static JsonSerializer CreateSerializer() - { - var serializer = JsonSerializer.CreateDefault(); - return serializer; - } - - private static JsonSerializerSettings CreateSerializerSettings() - { - var settings = JsonConvert.DefaultSettings != null ? JsonConvert.DefaultSettings() : new JsonSerializerSettings(); - return settings; - } - - public JsonSerializer JsonSerializer { get; } - - public JsonSerializerSettings Settings { get; } - - public string SerializeObject(object value) - { - return JsonConvert.SerializeObject(value, Settings); - } - - public object DeserializeObject(string json, Type type) - { - return JsonConvert.DeserializeObject(json, type, Settings); - } - - public T DeserializeObject(string json) - { - return JsonConvert.DeserializeObject(json, Settings); - } - } -} diff --git a/src/JsonRpc/Server/JsonRpcException.cs b/src/JsonRpc/Server/JsonRpcException.cs index 091673acb..f85ac3c5b 100644 --- a/src/JsonRpc/Server/JsonRpcException.cs +++ b/src/JsonRpc/Server/JsonRpcException.cs @@ -1,4 +1,4 @@ -using System; +using System; using Newtonsoft.Json.Linq; namespace OmniSharp.Extensions.JsonRpc.Server @@ -9,11 +9,9 @@ public JsonRpcException(ServerError error) { Error = error.Error; Id = error.Id; - ProtocolVersion = error.ProtocolVersion; } public JToken Error { get; } public object Id { get; } - public string ProtocolVersion { get; } } } diff --git a/src/JsonRpc/Server/Messages/ErrorMessage.cs b/src/JsonRpc/Server/Messages/ErrorMessage.cs index f351f430d..b86ad78d0 100644 --- a/src/JsonRpc/Server/Messages/ErrorMessage.cs +++ b/src/JsonRpc/Server/Messages/ErrorMessage.cs @@ -3,22 +3,17 @@ namespace OmniSharp.Extensions.JsonRpc.Server.Messages { - public class ErrorMessage: ErrorMessage + [JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))] + public class ErrorMessage : IErrorMessage { - public ErrorMessage(int code, string message) : base(code, message, null) - { - } - - [JsonConstructor] - public ErrorMessage(int code, string message, object data) : base(code, message, data) + public ErrorMessage(int code, string message) { + Code = code; + Message = message; } - } - public class ErrorMessage : IErrorMessage - { [JsonConstructor] - public ErrorMessage(int code, string message, T data) + public ErrorMessage(int code, string message, object data) { Code = code; Message = message; @@ -29,8 +24,7 @@ public ErrorMessage(int code, string message, T data) public string Message { get; } - [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] - public T Data { get; } + public object Data { get; } object IErrorMessage.Data => Data; } diff --git a/src/JsonRpc/Server/Messages/InternalError.cs b/src/JsonRpc/Server/Messages/InternalError.cs index cd4814e1c..889543278 100644 --- a/src/JsonRpc/Server/Messages/InternalError.cs +++ b/src/JsonRpc/Server/Messages/InternalError.cs @@ -1,4 +1,4 @@ -namespace OmniSharp.Extensions.JsonRpc.Server.Messages +namespace OmniSharp.Extensions.JsonRpc.Server.Messages { public class InternalError : RpcError { diff --git a/src/JsonRpc/Server/Messages/InvalidParams.cs b/src/JsonRpc/Server/Messages/InvalidParams.cs index be3f74427..79f9d1e3d 100644 --- a/src/JsonRpc/Server/Messages/InvalidParams.cs +++ b/src/JsonRpc/Server/Messages/InvalidParams.cs @@ -1,4 +1,4 @@ -namespace OmniSharp.Extensions.JsonRpc.Server.Messages +namespace OmniSharp.Extensions.JsonRpc.Server.Messages { public class InvalidParams : RpcError { diff --git a/src/JsonRpc/Server/Messages/InvalidRequest.cs b/src/JsonRpc/Server/Messages/InvalidRequest.cs index 58977436e..ac54cdd8a 100644 --- a/src/JsonRpc/Server/Messages/InvalidRequest.cs +++ b/src/JsonRpc/Server/Messages/InvalidRequest.cs @@ -1,4 +1,4 @@ -namespace OmniSharp.Extensions.JsonRpc.Server.Messages +namespace OmniSharp.Extensions.JsonRpc.Server.Messages { public class InvalidRequest : RpcError { diff --git a/src/JsonRpc/Server/Notification.cs b/src/JsonRpc/Server/Notification.cs index 1cb33333d..8b8fdcb60 100644 --- a/src/JsonRpc/Server/Notification.cs +++ b/src/JsonRpc/Server/Notification.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Newtonsoft.Json.Serialization; @@ -8,19 +8,12 @@ public class Notification : IMethodWithParams { internal Notification( string method, - JToken @params, - string protocolVersion) + JToken @params) { - ProtocolVersion = protocolVersion; Method = method; Params = @params; } - internal Notification(string method, JToken @params) : this(method, @params, "2.0") { } - - [JsonProperty("jsonrpc")] - public string ProtocolVersion { get; } - public string Method { get; } public JToken Params { get; } diff --git a/src/JsonRpc/Server/Request.cs b/src/JsonRpc/Server/Request.cs index 3fc93f4f2..67359a10f 100644 --- a/src/JsonRpc/Server/Request.cs +++ b/src/JsonRpc/Server/Request.cs @@ -1,4 +1,4 @@ -using Newtonsoft.Json; +using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Newtonsoft.Json.Serialization; @@ -6,25 +6,18 @@ namespace OmniSharp.Extensions.JsonRpc.Server { public class Request : IMethodWithParams { - internal Request(object id, string method, JToken @params) : this(id, method, @params, "2.0") { } - internal Request( object id, string method, - JToken @params, - string protocolVersion) + JToken @params) { Id = id; - ProtocolVersion = protocolVersion; Method = method; Params = @params; } public object Id { get; } - [JsonProperty("jsonrpc")] - public string ProtocolVersion { get; } - public string Method { get; } public JToken Params { get; } diff --git a/src/JsonRpc/Server/ResponseBase.cs b/src/JsonRpc/Server/ResponseBase.cs index 00425d163..134fe338c 100644 --- a/src/JsonRpc/Server/ResponseBase.cs +++ b/src/JsonRpc/Server/ResponseBase.cs @@ -11,9 +11,6 @@ public ResponseBase(object id) Id = id; } - [JsonProperty("jsonrpc")] - public string ProtocolVersion { get; set; } = "2.0"; - public object Id { get; set; } } } diff --git a/src/Protocol/Serialization/Serializer.cs b/src/Protocol/Serialization/Serializer.cs index c1550bf01..49ae9a707 100644 --- a/src/Protocol/Serialization/Serializer.cs +++ b/src/Protocol/Serialization/Serializer.cs @@ -3,6 +3,7 @@ using System.Linq; using Newtonsoft.Json; using OmniSharp.Extensions.JsonRpc; +using OmniSharp.Extensions.JsonRpc.Serialization.Converters; using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities; using OmniSharp.Extensions.LanguageServer.Protocol.Models; using OmniSharp.Extensions.LanguageServer.Protocol.Serialization.Converters; @@ -11,6 +12,8 @@ namespace OmniSharp.Extensions.LanguageServer.Protocol.Serialization { public class Serializer : ISerializer { + private readonly object _lock = new object(); + private long _id = 0; private static readonly CompletionItemKind[] DefaultCompletionItemKinds = Enum.GetValues(typeof(CompletionItemKind)) .Cast() .Where(x => x < CompletionItemKind.Folder) @@ -75,6 +78,12 @@ private static void AddOrReplaceConverters(ICollection converters ReplaceConverter(converters, new WorkspaceEditDocumentChangeConverter()); ReplaceConverter(converters, new ParameterInformationLabelConverter()); ReplaceConverter(converters, new ValueTupleContractResolver()); + + + ReplaceConverter(converters, new ClientNotificationConverter()); + ReplaceConverter(converters, new ClientResponseConverter()); + ReplaceConverter(converters, new ClientRequestConverter()); + ReplaceConverter(converters, new RpcErrorConverter()); } private static void ReplaceConverter(ICollection converters, T item) @@ -159,5 +168,12 @@ public void SetClientCapabilities(ClientVersion clientVersion, ClientCapabilitie workspaceSymbolKinds ); } + public long GetNextId() + { + lock (_lock) + { + return _id++; + } + } } } diff --git a/test/JsonRpc.Tests/DapInputHandlerTests.cs b/test/JsonRpc.Tests/DapInputHandlerTests.cs new file mode 100644 index 000000000..1cdb5ce66 --- /dev/null +++ b/test/JsonRpc.Tests/DapInputHandlerTests.cs @@ -0,0 +1,265 @@ +using System; +using System.IO; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using FluentAssertions; +using Microsoft.Extensions.Logging; +using Newtonsoft.Json.Linq; +using NSubstitute; +using OmniSharp.Extensions.JsonRpc; +using OmniSharp.Extensions.JsonRpc.Client; +using OmniSharp.Extensions.JsonRpc.Serialization; +using OmniSharp.Extensions.JsonRpc.Server; +using OmniSharp.Extensions.JsonRpc.Server.Messages; +using Xunit; +using Notification = OmniSharp.Extensions.JsonRpc.Server.Notification; +using Request = OmniSharp.Extensions.JsonRpc.Server.Request; + +namespace JsonRpc.Tests +{ + public class DapInputHandlerTests + { + private static InputHandler NewHandler( + Stream inputStream, + IOutputHandler outputHandler, + IReciever reciever, + IRequestProcessIdentifier requestProcessIdentifier, + IRequestRouter requestRouter, + IResponseRouter responseRouter, + Action action) + { + var cts = new CancellationTokenSource(); + if (!System.Diagnostics.Debugger.IsAttached) + cts.CancelAfter(TimeSpan.FromSeconds(5)); + action(cts); + + var handler = new InputHandler( + inputStream, + outputHandler, + reciever, + requestProcessIdentifier, + requestRouter, + responseRouter, + Substitute.For(), + new DapSerializer()); + handler.Start(); + cts.Wait(); + Task.Delay(10).Wait(); + return handler; + } + + [Fact] + public void ShouldPassInRequests() + { + var inputStream = new MemoryStream(Encoding.ASCII.GetBytes("Content-Length: 2\r\n\r\n{}")); + var outputHandler = Substitute.For(); + var reciever = Substitute.For(); + + using (NewHandler( + inputStream, + outputHandler, + reciever, + Substitute.For(), + Substitute.For>(), + Substitute.For(), + cts => { + reciever.When(x => x.IsValid(Arg.Any())) + .Do(x => { + cts.Cancel(); + }); + })) + { + reciever.Received().IsValid(Arg.Is(x => x.ToString() == "{}")); + } + } + + [Fact] + public void ShouldHaveAThreadName() + { + var threadName = "(untouched)"; + var inputStream = new MemoryStream(Encoding.ASCII.GetBytes("Content-Length: 2\r\n\r\n{}")); + var reciever = Substitute.For(); + + using (NewHandler( + inputStream, + Substitute.For(), + reciever, + Substitute.For(), + Substitute.For>(), + Substitute.For(), + cts => { + reciever.When(x => x.IsValid(Arg.Any())) + .Do(x => { + threadName = System.Threading.Thread.CurrentThread.Name; + cts.Cancel(); + }); + })) + { + reciever.Received(); + threadName.Should().Be("ProcessInputStream", because: "it is easier to find it in the Threads pane by it's name"); + } + + } + + [Fact] + public void ShouldPassInUtf8EncodedRequests() + { + // Note: an ä (ä) is encoded by two bytes, so string-length is 13 and byte-length is 14 + var inputStream = new MemoryStream(Encoding.UTF8.GetBytes("Content-Length: 14\r\n\r\n{\"utf8\": \"ä\"}")); + var outputHandler = Substitute.For(); + var reciever = Substitute.For(); + + using (NewHandler( + inputStream, + outputHandler, + reciever, + Substitute.For(), + Substitute.For>(), + Substitute.For(), + cts => { + reciever.When(x => x.IsValid(Arg.Any())) + .Do(x => { + cts.Cancel(); + }); + })) + { + reciever.Received().IsValid(Arg.Is(x => x["utf8"].ToString() == "ä")); + } + } + + [Fact] + public void ShouldHandleRequest() + { + var inputStream = new MemoryStream(Encoding.ASCII.GetBytes("Content-Length: 2\r\n\r\n{}")); + var outputHandler = Substitute.For(); + var reciever = Substitute.For(); + var incomingRequestRouter = Substitute.For>(); + + var req = new Request(1, "abc", null); + reciever.IsValid(Arg.Any()).Returns(true); + reciever.GetRequests(Arg.Any()) + .Returns(c => (new Renor[] { req }, false)); + + var response = new Response(1, req); + + incomingRequestRouter.RouteRequest(Arg.Any(), req, CancellationToken.None) + .Returns(response); + + using (NewHandler( + inputStream, + outputHandler, + reciever, + Substitute.For(), + incomingRequestRouter, + Substitute.For(), + cts => { + outputHandler.When(x => x.Send(Arg.Any())) + .Do(x => { + cts.Cancel(); + }); + })) + { + outputHandler.Received().Send(Arg.Is(x => x == response)); + } + } + + [Fact] + public void ShouldHandleError() + { + var inputStream = new MemoryStream(Encoding.ASCII.GetBytes("Content-Length: 2\r\n\r\n{}")); + var outputHandler = Substitute.For(); + var reciever = Substitute.For(); + var incomingRequestRouter = Substitute.For>(); + + var error = new RpcError(1, new ErrorMessage(1, "abc")); + reciever.IsValid(Arg.Any()).Returns(true); + reciever.GetRequests(Arg.Any()) + .Returns(c => (new Renor[] { error }, false)); + + + using (NewHandler( + inputStream, + outputHandler, + reciever, + Substitute.For(), + incomingRequestRouter, + Substitute.For(), + cts => { + outputHandler.When(x => x.Send(Arg.Any())) + .Do(x => { + cts.Cancel(); + }); + })) + { + outputHandler.Received().Send(Arg.Is(x => x == error)); + } + } + + [Fact] + public async Task ShouldHandleNotification() + { + var inputStream = new MemoryStream(Encoding.ASCII.GetBytes("Content-Length: 2\r\n\r\n{}")); + var outputHandler = Substitute.For(); + var reciever = Substitute.For(); + var incomingRequestRouter = Substitute.For>(); + + var notification = new Notification("abc", null); + reciever.IsValid(Arg.Any()).Returns(true); + reciever.GetRequests(Arg.Any()) + .Returns(c => (new Renor[] { notification }, false)); + + using (NewHandler( + inputStream, + outputHandler, + reciever, + Substitute.For(), + incomingRequestRouter, + Substitute.For(), + cts => { + incomingRequestRouter.When(x => x.RouteNotification(Arg.Any(), Arg.Any(), CancellationToken.None)) + .Do(x => { + cts.Cancel(); + }); + })) + { + await incomingRequestRouter.Received().RouteNotification(Arg.Any(), notification, CancellationToken.None); + } + } + + [Fact] + public void ShouldHandleResponse() + { + var inputStream = new MemoryStream(Encoding.ASCII.GetBytes("Content-Length: 2\r\n\r\n{}")); + var outputHandler = Substitute.For(); + var reciever = Substitute.For(); + var responseRouter = Substitute.For(); + + var response = new OmniSharp.Extensions.JsonRpc.Server.ServerResponse(1L, JToken.Parse("{}")); + reciever.IsValid(Arg.Any()).Returns(true); + reciever.GetRequests(Arg.Any()) + .Returns(c => (new Renor[] { response }, true)); + + var tcs = new TaskCompletionSource(); + responseRouter.GetRequest(1L).Returns(tcs); + + using (NewHandler( + inputStream, + outputHandler, + reciever, + Substitute.For(), + Substitute.For>(), + responseRouter, + cts => { + responseRouter.When(x => x.GetRequest(Arg.Any())) + .Do(x => { + cts.CancelAfter(1); + }); + })) + { + responseRouter.Received().GetRequest(1L); + tcs.Task.Result.ToString().Should().Be("{}"); + } + } + } +} diff --git a/test/JsonRpc.Tests/DapOutputHandlerTests.cs b/test/JsonRpc.Tests/DapOutputHandlerTests.cs new file mode 100644 index 000000000..c584bca0b --- /dev/null +++ b/test/JsonRpc.Tests/DapOutputHandlerTests.cs @@ -0,0 +1,156 @@ +using System; +using System.IO; +using System.Threading; +using System.Threading.Tasks; +using FluentAssertions; +using Newtonsoft.Json.Linq; +using NSubstitute; +using OmniSharp.Extensions.JsonRpc; +using OmniSharp.Extensions.JsonRpc.Client; +using OmniSharp.Extensions.JsonRpc.Serialization; +using OmniSharp.Extensions.JsonRpc.Server; +using OmniSharp.Extensions.JsonRpc.Server.Messages; +using Xunit; + +namespace JsonRpc.Tests +{ + public class DapOutputHandlerTests + { + private static (OutputHandler handler, Func wait) NewHandler(Stream Writer, Action action) + { + var cts = new CancellationTokenSource(); + if (!System.Diagnostics.Debugger.IsAttached) + cts.CancelAfter(TimeSpan.FromSeconds(120)); + action(cts); + + var handler = new OutputHandler( + Writer, + new DapSerializer()); + handler.Start(); + return (handler, () => { + cts.Wait(); + return Task.Delay(50); + } + ); + } + + [Fact] + public async Task ShouldSerializeResponses() + { + var w = Substitute.For(); + var received = ""; + w.CanWrite.Returns(true); + + var (handler, wait) = NewHandler(w, cts => { + w.When(x => x.Write(Arg.Any(), Arg.Any(), Arg.Any())) + .Do(c => { + received = System.Text.Encoding.UTF8.GetString(c.ArgAt(0), 0, c.ArgAt(2)); + cts.Cancel(); + }); + }); + var value = new Response(1, new object(), new OmniSharp.Extensions.JsonRpc.Server.Request(1, "command", new JObject())); + + using (handler) + { + + handler.Send(value); + await wait(); + const string send = "Content-Length: 73\r\n\r\n{\"seq\":0,\"type\":\"response\",\"request_seq\":1,\"command\":\"command\",\"body\":{}}"; + received.Should().Be(send); + var b = System.Text.Encoding.UTF8.GetBytes(send); + w.Received().Write(Arg.Any(), 0, b.Length); // can't compare b here, because it is only value-equal and this test tests reference equality + } + } + + [Fact] + public async Task ShouldSerializeNotifications() + { + var w = Substitute.For(); + var received = ""; + w.CanWrite.Returns(true); + + var (handler, wait) = NewHandler(w, cts => { + w.When(x => x.Write(Arg.Any(), Arg.Any(), Arg.Any())) + .Do(c => { + received = System.Text.Encoding.UTF8.GetString(c.ArgAt(0), 0, c.ArgAt(2)); + cts.Cancel(); + }); + }); + var value = new OmniSharp.Extensions.JsonRpc.Client.Notification() { + Method = "method", + Params = new object() + }; + + using (handler) + { + + handler.Send(value); + await wait(); + const string send = "Content-Length: 51\r\n\r\n{\"seq\":0,\"type\":\"event\",\"event\":\"method\",\"body\":{}}"; + received.Should().Be(send); + var b = System.Text.Encoding.UTF8.GetBytes(send); + w.Received().Write(Arg.Any(), 0, b.Length); // can't compare b here, because it is only value-equal and this test tests reference equality + } + } + + [Fact] + public async Task ShouldSerializeRequests() + { + var w = Substitute.For(); + var received = ""; + w.CanWrite.Returns(true); + + var (handler, wait) = NewHandler(w, cts => { + w.When(x => x.Write(Arg.Any(), Arg.Any(), Arg.Any())) + .Do(c => { + received = System.Text.Encoding.UTF8.GetString(c.ArgAt(0), 0, c.ArgAt(2)); + cts.Cancel(); + }); + }); + var value = new OmniSharp.Extensions.JsonRpc.Client.Request() { + Method = "method", + Id = 1, + Params = new object(), + }; + + using (handler) + { + + handler.Send(value); + await wait(); + const string send = "Content-Length: 60\r\n\r\n{\"seq\":1,\"type\":\"request\",\"command\":\"method\",\"arguments\":{}}"; + received.Should().Be(send); + var b = System.Text.Encoding.UTF8.GetBytes(send); + w.Received().Write(Arg.Any(), 0, b.Length); // can't compare b here, because it is only value-equal and this test tests reference equality + } + } + + [Fact] + public async Task ShouldSerializeErrors() + { + var w = Substitute.For(); + var received = ""; + w.CanWrite.Returns(true); + + var (handler, wait) = NewHandler(w, cts => { + w.When(x => x.Write(Arg.Any(), Arg.Any(), Arg.Any())) + .Do(c => { + received = System.Text.Encoding.UTF8.GetString(c.ArgAt(0), 0, c.ArgAt(2)); + cts.Cancel(); + }); + }); + var value = new RpcError(1, new ErrorMessage(1, "something", new object())); + + using (handler) + { + + handler.Send(value); + await wait(); + const string send = "Content-Length: 47\r\n\r\n{\"seq\":0,\"request_seq\":1,\"message\":\"something\"}"; + received.Should().Be(send); + var b = System.Text.Encoding.UTF8.GetBytes(send); + w.Received().Write(Arg.Any(), 0, b.Length); // can't compare b here, because it is only value-equal and this test tests reference equality + } + } + } +} diff --git a/test/JsonRpc.Tests/InputHandlerTests.cs b/test/JsonRpc.Tests/InputHandlerTests.cs index 6d94d1038..40faf652f 100644 --- a/test/JsonRpc.Tests/InputHandlerTests.cs +++ b/test/JsonRpc.Tests/InputHandlerTests.cs @@ -10,6 +10,7 @@ using Newtonsoft.Json.Linq; using NSubstitute; using OmniSharp.Extensions.JsonRpc; +using OmniSharp.Extensions.JsonRpc.Serialization; using OmniSharp.Extensions.JsonRpc.Server; using OmniSharp.Extensions.JsonRpc.Server.Messages; using Xunit; @@ -42,7 +43,7 @@ private static InputHandler NewHandler( requestRouter, responseRouter, Substitute.For(), - new Serializer()); + new JsonRpcSerializer()); handler.Start(); cts.Wait(); Task.Delay(10).Wait(); @@ -141,7 +142,7 @@ public void ShouldHandleRequest() reciever.GetRequests(Arg.Any()) .Returns(c => (new Renor[] { req }, false)); - var response = new Response(1); + var response = new Response(1, req); incomingRequestRouter.RouteRequest(Arg.Any(), req, CancellationToken.None) .Returns(response); diff --git a/test/JsonRpc.Tests/MediatorTestsNotificationHandler.cs b/test/JsonRpc.Tests/MediatorTestsNotificationHandler.cs index 5e9672c01..9c830fe16 100644 --- a/test/JsonRpc.Tests/MediatorTestsNotificationHandler.cs +++ b/test/JsonRpc.Tests/MediatorTestsNotificationHandler.cs @@ -7,6 +7,7 @@ using Microsoft.Extensions.DependencyInjection; using NSubstitute; using OmniSharp.Extensions.JsonRpc; +using OmniSharp.Extensions.JsonRpc.Serialization; using OmniSharp.Extensions.JsonRpc.Server; using Xunit; using Xunit.Abstractions; @@ -22,7 +23,7 @@ public MediatorTestsNotificationHandler(ITestOutputHelper testOutputHelper) : ba { Services .AddJsonRpcMediatR(new [] { typeof(MediatorTestsNotificationHandler).Assembly }) - .AddSingleton(new Serializer()); + .AddSingleton(new JsonRpcSerializer()); } [Fact] diff --git a/test/JsonRpc.Tests/MediatorTestsNotificationHandlerOfT.cs b/test/JsonRpc.Tests/MediatorTestsNotificationHandlerOfT.cs index 7bbff6ca5..f4cde5d29 100644 --- a/test/JsonRpc.Tests/MediatorTestsNotificationHandlerOfT.cs +++ b/test/JsonRpc.Tests/MediatorTestsNotificationHandlerOfT.cs @@ -9,6 +9,7 @@ using Newtonsoft.Json.Serialization; using NSubstitute; using OmniSharp.Extensions.JsonRpc; +using OmniSharp.Extensions.JsonRpc.Serialization; using OmniSharp.Extensions.JsonRpc.Server; using Xunit; using Xunit.Abstractions; @@ -29,7 +30,7 @@ public MediatorTestsNotificationHandlerOfT(ITestOutputHelper testOutputHelper) : { Services .AddJsonRpcMediatR(new[] { typeof(MediatorTestsNotificationHandler).Assembly }) - .AddSingleton(new Serializer()); + .AddSingleton(new JsonRpcSerializer()); } [Fact] diff --git a/test/JsonRpc.Tests/MediatorTestsRequestHandlerOfTRequest.cs b/test/JsonRpc.Tests/MediatorTestsRequestHandlerOfTRequest.cs index 0127b099b..0173c288e 100644 --- a/test/JsonRpc.Tests/MediatorTestsRequestHandlerOfTRequest.cs +++ b/test/JsonRpc.Tests/MediatorTestsRequestHandlerOfTRequest.cs @@ -10,6 +10,7 @@ using Newtonsoft.Json.Serialization; using NSubstitute; using OmniSharp.Extensions.JsonRpc; +using OmniSharp.Extensions.JsonRpc.Serialization; using OmniSharp.Extensions.JsonRpc.Server; using Xunit; using Xunit.Abstractions; @@ -31,7 +32,7 @@ public MediatorTestsRequestHandlerOfTRequest(ITestOutputHelper testOutputHelper) { Services .AddJsonRpcMediatR(new[] { typeof(MediatorTestsNotificationHandler).Assembly }) - .AddSingleton(new Serializer()); + .AddSingleton(new JsonRpcSerializer()); } [Fact] diff --git a/test/JsonRpc.Tests/MediatorTestsRequestHandlerOfTRequestTResponse.cs b/test/JsonRpc.Tests/MediatorTestsRequestHandlerOfTRequestTResponse.cs index e1fdbe13e..5dd5a6be9 100644 --- a/test/JsonRpc.Tests/MediatorTestsRequestHandlerOfTRequestTResponse.cs +++ b/test/JsonRpc.Tests/MediatorTestsRequestHandlerOfTRequestTResponse.cs @@ -12,6 +12,7 @@ using Newtonsoft.Json.Serialization; using NSubstitute; using OmniSharp.Extensions.JsonRpc; +using OmniSharp.Extensions.JsonRpc.Serialization; using OmniSharp.Extensions.JsonRpc.Server; using Xunit; using Xunit.Abstractions; @@ -42,7 +43,7 @@ public MediatorTestsRequestHandlerOfTRequestTResponse(ITestOutputHelper testOutp { Services .AddJsonRpcMediatR(new[] { typeof(MediatorTestsNotificationHandler).Assembly }) - .AddSingleton(new Serializer()); + .AddSingleton(new JsonRpcSerializer()); } [Fact] diff --git a/test/JsonRpc.Tests/OutputHandlerTests.cs b/test/JsonRpc.Tests/OutputHandlerTests.cs index da6f3f4ec..f430da9d5 100644 --- a/test/JsonRpc.Tests/OutputHandlerTests.cs +++ b/test/JsonRpc.Tests/OutputHandlerTests.cs @@ -6,13 +6,16 @@ using FluentAssertions; using OmniSharp.Extensions.JsonRpc; using OmniSharp.Extensions.JsonRpc.Client; +using OmniSharp.Extensions.JsonRpc.Serialization; +using OmniSharp.Extensions.JsonRpc.Server; +using OmniSharp.Extensions.JsonRpc.Server.Messages; using Xunit; namespace JsonRpc.Tests { public class OutputHandlerTests { - private static (OutputHandler handler, Func wait) NewHandler(Stream Writer,Action action) + private static (OutputHandler handler, Func wait) NewHandler(Stream Writer, Action action) { var cts = new CancellationTokenSource(); if (!System.Diagnostics.Debugger.IsAttached) @@ -21,16 +24,17 @@ private static (OutputHandler handler, Func wait) NewHandler(Stream Writer var handler = new OutputHandler( Writer, - new Serializer()); + new JsonRpcSerializer()); handler.Start(); return (handler, () => { - cts.Wait(); - return Task.Delay(50); - }); + cts.Wait(); + return Task.Delay(50); + } + ); } [Fact] - public async Task ShouldSerializeValues() + public async Task ShouldSerializeResponses() { var w = Substitute.For(); var received = ""; @@ -43,7 +47,7 @@ public async Task ShouldSerializeValues() cts.Cancel(); }); }); - var value = new Response(1, 1); + var value = new Response(1, 1, new OmniSharp.Extensions.JsonRpc.Server.Request(1, "a", null)); using (handler) { @@ -56,5 +60,97 @@ public async Task ShouldSerializeValues() w.Received().Write(Arg.Any(), 0, b.Length); // can't compare b here, because it is only value-equal and this test tests reference equality } } + + + [Fact] + public async Task ShouldSerializeNotifications() + { + var w = Substitute.For(); + var received = ""; + w.CanWrite.Returns(true); + + var (handler, wait) = NewHandler(w, cts => { + w.When(x => x.Write(Arg.Any(), Arg.Any(), Arg.Any())) + .Do(c => { + received = System.Text.Encoding.UTF8.GetString(c.ArgAt(0), 0, c.ArgAt(2)); + cts.Cancel(); + }); + }); + var value = new OmniSharp.Extensions.JsonRpc.Client.Notification() { + Method = "method", + Params = new object() + }; + + using (handler) + { + + handler.Send(value); + await wait(); + const string send = "Content-Length: 47\r\n\r\n{\"jsonrpc\":\"2.0\",\"method\":\"method\",\"params\":{}}"; + received.Should().Be(send); + var b = System.Text.Encoding.UTF8.GetBytes(send); + w.Received().Write(Arg.Any(), 0, b.Length); // can't compare b here, because it is only value-equal and this test tests reference equality + } + } + + [Fact] + public async Task ShouldSerializeRequests() + { + var w = Substitute.For(); + var received = ""; + w.CanWrite.Returns(true); + + var (handler, wait) = NewHandler(w, cts => { + w.When(x => x.Write(Arg.Any(), Arg.Any(), Arg.Any())) + .Do(c => { + received = System.Text.Encoding.UTF8.GetString(c.ArgAt(0), 0, c.ArgAt(2)); + cts.Cancel(); + }); + }); + var value = new OmniSharp.Extensions.JsonRpc.Client.Request() { + Method = "method", + Id = 1, + Params = new object(), + }; + + using (handler) + { + + handler.Send(value); + await wait(); + const string send = "Content-Length: 47\r\n\r\n{\"jsonrpc\":\"2.0\",\"method\":\"method\",\"params\":{}}"; + received.Should().Be(send); + var b = System.Text.Encoding.UTF8.GetBytes(send); + w.Received().Write(Arg.Any(), 0, b.Length); // can't compare b here, because it is only value-equal and this test tests reference equality + } + } + + [Fact] + public async Task ShouldSerializeErrors() + { + var w = Substitute.For(); + var received = ""; + w.CanWrite.Returns(true); + + var (handler, wait) = NewHandler(w, cts => { + w.When(x => x.Write(Arg.Any(), Arg.Any(), Arg.Any())) + .Do(c => { + received = System.Text.Encoding.UTF8.GetString(c.ArgAt(0), 0, c.ArgAt(2)); + cts.Cancel(); + }); + }); + var value = new RpcError(1, new ErrorMessage(1, "something", new object())); + + using (handler) + { + + handler.Send(value); + await wait(); + const string send = "Content-Length: 75\r\n\r\n{\"jsonrpc\":\"2.0\",\"id\":1,\"error\":{\"code\":1,\"message\":\"something\",\"data\":{}}}"; + received.Should().Be(send); + var b = System.Text.Encoding.UTF8.GetBytes(send); + w.Received().Write(Arg.Any(), 0, b.Length); // can't compare b here, because it is only value-equal and this test tests reference equality + } + } } } diff --git a/test/JsonRpc.Tests/RequestRouterTests.cs b/test/JsonRpc.Tests/RequestRouterTests.cs index bd0d2c082..26f0352de 100644 --- a/test/JsonRpc.Tests/RequestRouterTests.cs +++ b/test/JsonRpc.Tests/RequestRouterTests.cs @@ -16,6 +16,7 @@ using Xunit.Abstractions; using Xunit.Sdk; using System.Reactive.Disposables; +using OmniSharp.Extensions.JsonRpc.Serialization; namespace Lsp.Tests { @@ -71,7 +72,7 @@ public RequestRouterTests(ITestOutputHelper testOutputHelper) : base(testOutputH { Services .AddJsonRpcMediatR(new[] { typeof(RequestRouterTests).Assembly }) - .AddSingleton(new Serializer()); + .AddSingleton(new JsonRpcSerializer()); } [Fact] From e8801d00c4e265404cb73a57548fdd3b0cb7ff40 Mon Sep 17 00:00:00 2001 From: David Driscoll Date: Fri, 19 Jul 2019 23:52:57 -0400 Subject: [PATCH 03/20] Removed some comments --- src/Protocol/Serialization/Serializer.cs | 1 + .../DebugAdapterSpecifictionRecieverTests.cs | 19 ------------------- 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/src/Protocol/Serialization/Serializer.cs b/src/Protocol/Serialization/Serializer.cs index 49ae9a707..086ee1b62 100644 --- a/src/Protocol/Serialization/Serializer.cs +++ b/src/Protocol/Serialization/Serializer.cs @@ -84,6 +84,7 @@ private static void AddOrReplaceConverters(ICollection converters ReplaceConverter(converters, new ClientResponseConverter()); ReplaceConverter(converters, new ClientRequestConverter()); ReplaceConverter(converters, new RpcErrorConverter()); + ReplaceConverter(converters, new ErrorMessageConverter()); } private static void ReplaceConverter(ICollection converters, T item) diff --git a/test/JsonRpc.Tests/Server/DebugAdapterSpecifictionRecieverTests.cs b/test/JsonRpc.Tests/Server/DebugAdapterSpecifictionRecieverTests.cs index 07fc3c1cf..a6b7848ba 100644 --- a/test/JsonRpc.Tests/Server/DebugAdapterSpecifictionRecieverTests.cs +++ b/test/JsonRpc.Tests/Server/DebugAdapterSpecifictionRecieverTests.cs @@ -106,25 +106,6 @@ public override IEnumerable> GetValues() { new InvalidRequest("Not an object") }); - - //yield return ( - // @"[ - // {""jsonrpc"": ""2.0"", ""method"": ""sum"", ""params"": [1,2,4], ""id"": ""1""}, - // {""jsonrpc"": ""2.0"", ""method"": ""notify_hello"", ""params"": [7]}, - // {""jsonrpc"": ""2.0"", ""method"": ""subtract"", ""params"": [42,23], ""id"": ""2""}, - // {""foo"": ""boo""}, - // {""jsonrpc"": ""2.0"", ""method"": ""foo.get"", ""params"": {""name"": ""myself""}, ""id"": ""5""}, - // {""jsonrpc"": ""2.0"", ""method"": ""get_data"", ""id"": ""9""} - // ]", - // new Renor[] - // { - // new Request("1", "sum", new JArray(new [] {1,2,4})), - // new Notification("notify_hello", new JArray(new [] {7})), - // new Request("2", "subtract", new JArray(new [] {42,23})), - // new InvalidRequest("Unexpected protocol"), - // new Request("5", "foo.get", JObject.FromObject(new {name = "myself"})), - // new Request("9", "get_data", null), - // }); } } From 7ce175f8d10a541fb371f74bbe92510c701b4751 Mon Sep 17 00:00:00 2001 From: David Driscoll Date: Sat, 20 Jul 2019 00:00:05 -0400 Subject: [PATCH 04/20] fixed failing tests --- .../Serialization/Converters/ErrorMessageConverter.cs | 9 ++++++--- src/JsonRpc/Server/Messages/ErrorMessage.cs | 5 +++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/JsonRpc/Serialization/Converters/ErrorMessageConverter.cs b/src/JsonRpc/Serialization/Converters/ErrorMessageConverter.cs index 14d0cd374..8eaa81d13 100644 --- a/src/JsonRpc/Serialization/Converters/ErrorMessageConverter.cs +++ b/src/JsonRpc/Serialization/Converters/ErrorMessageConverter.cs @@ -1,4 +1,4 @@ -using System; +using System; using Newtonsoft.Json; using OmniSharp.Extensions.JsonRpc.Server.Messages; @@ -11,8 +11,11 @@ public override void WriteJson(JsonWriter writer, ErrorMessage value, JsonSerial writer.WriteStartObject(); writer.WritePropertyName("code"); writer.WriteValue(value.Code); - writer.WritePropertyName("data"); - writer.WriteValue(value.Data); + if (value.Data != null) + { + writer.WritePropertyName("data"); + writer.WriteValue(value.Data); + } writer.WritePropertyName("message"); writer.WriteValue(value.Message); writer.WriteEndObject(); diff --git a/src/JsonRpc/Server/Messages/ErrorMessage.cs b/src/JsonRpc/Server/Messages/ErrorMessage.cs index b86ad78d0..755824d5e 100644 --- a/src/JsonRpc/Server/Messages/ErrorMessage.cs +++ b/src/JsonRpc/Server/Messages/ErrorMessage.cs @@ -22,10 +22,11 @@ public ErrorMessage(int code, string message, object data) public int Code { get; } - public string Message { get; } - + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public object Data { get; } + public string Message { get; } + object IErrorMessage.Data => Data; } } From 62b7cb73c71c0618e349fe776b5548923f01b81e Mon Sep 17 00:00:00 2001 From: David Driscoll Date: Sat, 20 Jul 2019 09:14:31 -0400 Subject: [PATCH 05/20] Use interlocked increment --- src/Dap.Server/Dap.Server.csproj | 3 +-- src/JsonRpc/ResponseRouter.cs | 20 +++---------------- .../Converters/RpcErrorConverter.cs | 2 +- .../DapRpcErrorConverter.cs | 2 +- src/JsonRpc/Serialization/SerializerBase.cs | 9 +++------ src/Protocol/Serialization/Serializer.cs | 9 +++------ .../ServerErrorStartTests_$SimpleTest.json | 4 ++-- 7 files changed, 14 insertions(+), 35 deletions(-) diff --git a/src/Dap.Server/Dap.Server.csproj b/src/Dap.Server/Dap.Server.csproj index 7dddf388e..fe4c39586 100644 --- a/src/Dap.Server/Dap.Server.csproj +++ b/src/Dap.Server/Dap.Server.csproj @@ -1,4 +1,4 @@ - + netstandard2.0 @@ -10,7 +10,6 @@ - diff --git a/src/JsonRpc/ResponseRouter.cs b/src/JsonRpc/ResponseRouter.cs index 32dbd7f9e..9fb4ac69a 100644 --- a/src/JsonRpc/ResponseRouter.cs +++ b/src/JsonRpc/ResponseRouter.cs @@ -9,7 +9,6 @@ public class ResponseRouter : IResponseRouter private readonly IOutputHandler _outputHandler; private readonly ISerializer _serializer; private readonly object _lock = new object(); - private long _id = 0; private readonly ConcurrentDictionary> _requests = new ConcurrentDictionary>(); public ResponseRouter(IOutputHandler outputHandler, ISerializer serializer) @@ -35,13 +34,8 @@ public void SendNotification(string method, T @params) public async Task SendRequest(string method, T @params) { - long nextId; - lock (_lock) - { - nextId = _id++; - } - var tcs = new TaskCompletionSource(); + var nextId = _serializer.GetNextId(); _requests.TryAdd(nextId, tcs); _outputHandler.Send(new Client.Request() { @@ -63,11 +57,7 @@ public async Task SendRequest(string method, T @params) public async Task SendRequest(string method) { - long nextId; - lock (_lock) - { - nextId = _id++; - } + var nextId = _serializer.GetNextId(); var tcs = new TaskCompletionSource(); _requests.TryAdd(nextId, tcs); @@ -91,11 +81,7 @@ public async Task SendRequest(string method) public async Task SendRequest(string method, T @params) { - long nextId; - lock (_lock) - { - nextId = _id++; - } + var nextId = _serializer.GetNextId(); var tcs = new TaskCompletionSource(); _requests.TryAdd(nextId, tcs); diff --git a/src/JsonRpc/Serialization/Converters/RpcErrorConverter.cs b/src/JsonRpc/Serialization/Converters/RpcErrorConverter.cs index 73717f2de..56dce402d 100644 --- a/src/JsonRpc/Serialization/Converters/RpcErrorConverter.cs +++ b/src/JsonRpc/Serialization/Converters/RpcErrorConverter.cs @@ -44,7 +44,7 @@ public override RpcError ReadJson(JsonReader reader, Type objectType, RpcError e data = dataToken.ToObject< ErrorMessage>(serializer); } - return new RpcError(id, data); + return new RpcError(requestId, data); } } } diff --git a/src/JsonRpc/Serialization/DebugAdapterConverters/DapRpcErrorConverter.cs b/src/JsonRpc/Serialization/DebugAdapterConverters/DapRpcErrorConverter.cs index a7d23c975..63617aeae 100644 --- a/src/JsonRpc/Serialization/DebugAdapterConverters/DapRpcErrorConverter.cs +++ b/src/JsonRpc/Serialization/DebugAdapterConverters/DapRpcErrorConverter.cs @@ -51,7 +51,7 @@ public override RpcError ReadJson(JsonReader reader, Type objectType, RpcError e data = dataToken.ToObject(serializer); } - return new RpcError(id, data); + return new RpcError(requestId, data); } } } diff --git a/src/JsonRpc/Serialization/SerializerBase.cs b/src/JsonRpc/Serialization/SerializerBase.cs index a4fd820dd..29801fa43 100644 --- a/src/JsonRpc/Serialization/SerializerBase.cs +++ b/src/JsonRpc/Serialization/SerializerBase.cs @@ -1,13 +1,13 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Threading; using Newtonsoft.Json; namespace OmniSharp.Extensions.JsonRpc.Serialization { public abstract class SerializerBase : ISerializer { - private readonly object _lock = new object(); private long _id = 0; public SerializerBase() { @@ -61,11 +61,8 @@ public T DeserializeObject(string json) } public long GetNextId() { - lock (_lock) - { - return _id++; - } + return Interlocked.Increment(ref _id); } protected abstract void AddOrReplaceConverters(ICollection converters); } -} \ No newline at end of file +} diff --git a/src/Protocol/Serialization/Serializer.cs b/src/Protocol/Serialization/Serializer.cs index 086ee1b62..d048b6e4b 100644 --- a/src/Protocol/Serialization/Serializer.cs +++ b/src/Protocol/Serialization/Serializer.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Threading; using Newtonsoft.Json; using OmniSharp.Extensions.JsonRpc; using OmniSharp.Extensions.JsonRpc.Serialization.Converters; @@ -12,8 +13,7 @@ namespace OmniSharp.Extensions.LanguageServer.Protocol.Serialization { public class Serializer : ISerializer { - private readonly object _lock = new object(); - private long _id = 0; + private long _id; private static readonly CompletionItemKind[] DefaultCompletionItemKinds = Enum.GetValues(typeof(CompletionItemKind)) .Cast() .Where(x => x < CompletionItemKind.Folder) @@ -171,10 +171,7 @@ public void SetClientCapabilities(ClientVersion clientVersion, ClientCapabilitie } public long GetNextId() { - lock (_lock) - { - return _id++; - } + return Interlocked.Increment(ref _id); } } } diff --git a/test/Lsp.Tests/Messages/ServerErrorStartTests_$SimpleTest.json b/test/Lsp.Tests/Messages/ServerErrorStartTests_$SimpleTest.json index 9dc56fcbb..130acab3b 100644 --- a/test/Lsp.Tests/Messages/ServerErrorStartTests_$SimpleTest.json +++ b/test/Lsp.Tests/Messages/ServerErrorStartTests_$SimpleTest.json @@ -2,7 +2,7 @@ "jsonrpc": "2.0", "error": { "code": -32099, - "message": "Server Error Start", - "data": "abcd" + "data": "abcd", + "message": "Server Error Start" } } From d89cb20b884003cfaa6125433969d484234dffb4 Mon Sep 17 00:00:00 2001 From: David Driscoll Date: Sat, 20 Jul 2019 10:57:48 -0400 Subject: [PATCH 06/20] wip with models, requests and events --- src/Dap.Protocol/Class1.cs | 8 - src/Dap.Protocol/Dap.Protocol.csproj | 2 +- src/Dap.Protocol/Events/classs1.cs | 10 + src/Dap.Protocol/Models/Breakpoint.cs | 50 + src/Dap.Protocol/Models/Capabilities.cs | 155 ++ src/Dap.Protocol/Models/Checksum.cs | 22 + src/Dap.Protocol/Models/ChecksumAlgorithm.cs | 14 + src/Dap.Protocol/Models/ColumnDescriptor.cs | 37 + .../Models/ColumnDescriptorType.cs | 15 + src/Dap.Protocol/Models/CompletionItem.cs | 37 + src/Dap.Protocol/Models/CompletionItemType.cs | 14 + src/Dap.Protocol/Models/Container.cs | 36 + src/Dap.Protocol/Models/ContainerBase.cs | 54 + src/Dap.Protocol/Models/DataBreakpoint.cs | 30 + .../Models/DataBreakpointAccessType.cs | 16 + .../Models/DisassembledInstruction.cs | 55 + src/Dap.Protocol/Models/ExceptionBreakMode.cs | 18 + .../Models/ExceptionBreakpointsFilter.cs | 25 + src/Dap.Protocol/Models/ExceptionDetails.cs | 40 + src/Dap.Protocol/Models/ExceptionOptions.cs | 20 + .../Models/ExceptionPathSegment.cs | 20 + src/Dap.Protocol/Models/FunctionBreakpoint.cs | 25 + src/Dap.Protocol/Models/GotoTarget.cs | 46 + src/Dap.Protocol/Models/Message.cs | 47 + src/Dap.Protocol/Models/Module.cs | 69 + .../Models/ModulesViewDescriptor.cs | 11 + src/Dap.Protocol/Models/NumberString.cs | 57 + src/Dap.Protocol/Models/Scope.cs | 72 + src/Dap.Protocol/Models/Source.cs | 51 + src/Dap.Protocol/Models/SourceBreakpoint.cs | 35 + .../Models/SourcePresentationHint.cs | 13 + src/Dap.Protocol/Models/StackFrame.cs | 60 + src/Dap.Protocol/Models/StackFrameFormat.cs | 45 + .../Models/StackFramePresentationHint.cs | 13 + src/Dap.Protocol/Models/StepInTarget.cs | 18 + src/Dap.Protocol/Models/Thread.cs | 18 + src/Dap.Protocol/Models/ValueFormat.cs | 15 + src/Dap.Protocol/Models/Variable.cs | 62 + .../Models/VariablePresentationHint.cs | 48 + src/Dap.Protocol/Requests/classs1.cs | 1496 +++++++++++++++++ .../Serialization/ContractResolver.cs | 28 + src/Dap.Protocol/Serialization/ISerializer.cs | 4 + .../Serialization/OptionalAttribute.cs | 35 + src/Dap.Protocol/Serialization/Serializer.cs | 33 + src/JsonRpc/Serialization/SerializerBase.cs | 20 +- src/Protocol/Serialization/Serializer.cs | 73 +- 46 files changed, 2994 insertions(+), 78 deletions(-) delete mode 100644 src/Dap.Protocol/Class1.cs create mode 100644 src/Dap.Protocol/Events/classs1.cs create mode 100644 src/Dap.Protocol/Models/Breakpoint.cs create mode 100644 src/Dap.Protocol/Models/Capabilities.cs create mode 100644 src/Dap.Protocol/Models/Checksum.cs create mode 100644 src/Dap.Protocol/Models/ChecksumAlgorithm.cs create mode 100644 src/Dap.Protocol/Models/ColumnDescriptor.cs create mode 100644 src/Dap.Protocol/Models/ColumnDescriptorType.cs create mode 100644 src/Dap.Protocol/Models/CompletionItem.cs create mode 100644 src/Dap.Protocol/Models/CompletionItemType.cs create mode 100644 src/Dap.Protocol/Models/Container.cs create mode 100644 src/Dap.Protocol/Models/ContainerBase.cs create mode 100644 src/Dap.Protocol/Models/DataBreakpoint.cs create mode 100644 src/Dap.Protocol/Models/DataBreakpointAccessType.cs create mode 100644 src/Dap.Protocol/Models/DisassembledInstruction.cs create mode 100644 src/Dap.Protocol/Models/ExceptionBreakMode.cs create mode 100644 src/Dap.Protocol/Models/ExceptionBreakpointsFilter.cs create mode 100644 src/Dap.Protocol/Models/ExceptionDetails.cs create mode 100644 src/Dap.Protocol/Models/ExceptionOptions.cs create mode 100644 src/Dap.Protocol/Models/ExceptionPathSegment.cs create mode 100644 src/Dap.Protocol/Models/FunctionBreakpoint.cs create mode 100644 src/Dap.Protocol/Models/GotoTarget.cs create mode 100644 src/Dap.Protocol/Models/Message.cs create mode 100644 src/Dap.Protocol/Models/Module.cs create mode 100644 src/Dap.Protocol/Models/ModulesViewDescriptor.cs create mode 100644 src/Dap.Protocol/Models/NumberString.cs create mode 100644 src/Dap.Protocol/Models/Scope.cs create mode 100644 src/Dap.Protocol/Models/Source.cs create mode 100644 src/Dap.Protocol/Models/SourceBreakpoint.cs create mode 100644 src/Dap.Protocol/Models/SourcePresentationHint.cs create mode 100644 src/Dap.Protocol/Models/StackFrame.cs create mode 100644 src/Dap.Protocol/Models/StackFrameFormat.cs create mode 100644 src/Dap.Protocol/Models/StackFramePresentationHint.cs create mode 100644 src/Dap.Protocol/Models/StepInTarget.cs create mode 100644 src/Dap.Protocol/Models/Thread.cs create mode 100644 src/Dap.Protocol/Models/ValueFormat.cs create mode 100644 src/Dap.Protocol/Models/Variable.cs create mode 100644 src/Dap.Protocol/Models/VariablePresentationHint.cs create mode 100644 src/Dap.Protocol/Requests/classs1.cs create mode 100644 src/Dap.Protocol/Serialization/ContractResolver.cs create mode 100644 src/Dap.Protocol/Serialization/ISerializer.cs create mode 100644 src/Dap.Protocol/Serialization/OptionalAttribute.cs create mode 100644 src/Dap.Protocol/Serialization/Serializer.cs diff --git a/src/Dap.Protocol/Class1.cs b/src/Dap.Protocol/Class1.cs deleted file mode 100644 index cc1ec5565..000000000 --- a/src/Dap.Protocol/Class1.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System; - -namespace Dap.Protocol -{ - public class Class1 - { - } -} diff --git a/src/Dap.Protocol/Dap.Protocol.csproj b/src/Dap.Protocol/Dap.Protocol.csproj index 123eda095..77f219518 100644 --- a/src/Dap.Protocol/Dap.Protocol.csproj +++ b/src/Dap.Protocol/Dap.Protocol.csproj @@ -1,4 +1,4 @@ - + netstandard2.0 diff --git a/src/Dap.Protocol/Events/classs1.cs b/src/Dap.Protocol/Events/classs1.cs new file mode 100644 index 000000000..b893bc7e0 --- /dev/null +++ b/src/Dap.Protocol/Events/classs1.cs @@ -0,0 +1,10 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + class classs1 + { + } +} diff --git a/src/Dap.Protocol/Models/Breakpoint.cs b/src/Dap.Protocol/Models/Breakpoint.cs new file mode 100644 index 000000000..42b0738a7 --- /dev/null +++ b/src/Dap.Protocol/Models/Breakpoint.cs @@ -0,0 +1,50 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol +{ + /// + /// Information about a Breakpoint created in setBreakpoints or setFunctionBreakpoints. + /// + public class Breakpoint + { + /// + /// An optional identifier for the breakpoint. It is needed if breakpoint events are used to update or remove breakpoints. + /// + [Optional] public long? Id { get; set; } + + /// + /// If true breakpoint could be set (but not necessarily at the desired location). + /// + public bool Verified { get; set; } + + /// + /// An optional message about the state of the breakpoint. This is shown to the user and can be used to explain why a breakpoint could not be verified. + /// + [Optional] public string Message { get; set; } + + /// + /// The source where the breakpoint is located. + /// + [Optional] public Source Source { get; set; } + + /// + /// The start line of the actual range covered by the breakpoint. + /// + [Optional] public long? Line { get; set; } + + /// + /// An optional start column of the actual range covered by the breakpoint. + /// + [Optional] public long? Column { get; set; } + + /// + /// An optional end line of the actual range covered by the breakpoint. + /// + [Optional] public long? EndLine { get; set; } + + /// + /// An optional end column of the actual range covered by the breakpoint. If no end line is given, then the end column is assumed to be in the start line. + /// + [Optional] public long? EndColumn { get; set; } + } +} \ No newline at end of file diff --git a/src/Dap.Protocol/Models/Capabilities.cs b/src/Dap.Protocol/Models/Capabilities.cs new file mode 100644 index 000000000..171652de3 --- /dev/null +++ b/src/Dap.Protocol/Models/Capabilities.cs @@ -0,0 +1,155 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol +{ + /// + /// Information about the capabilities of a debug adapter. + /// + public class Capabilities + { + /// + /// The debug adapter supports the 'configurationDone' request. + /// + [Optional] public bool? SupportsConfigurationDoneRequest { get; set; } + + /// + /// The debug adapter supports function breakpoints. + /// + [Optional] public bool? SupportsFunctionBreakpoints { get; set; } + + /// + /// The debug adapter supports conditional breakpoints. + /// + [Optional] public bool? SupportsConditionalBreakpoints { get; set; } + + /// + /// The debug adapter supports breakpoints that break execution after a specified long of hits. + /// + [Optional] public bool? SupportsHitConditionalBreakpoints { get; set; } + + /// + /// The debug adapter supports a (side effect free) evaluate request for data hovers. + /// + [Optional] public bool? SupportsEvaluateForHovers { get; set; } + + /// + /// Available filters or options for the setExceptionBreakpoints request. + /// + [Optional] public Container ExceptionBreakpointFilters { get; set; } + + /// + /// The debug adapter supports stepping back via the 'stepBack' and 'reverseContinue' requests. + /// + [Optional] public bool? SupportsStepBack { get; set; } + + /// + /// The debug adapter supports setting a variable to a value. + /// + [Optional] public bool? SupportsSetVariable { get; set; } + + /// + /// The debug adapter supports restarting a frame. + /// + [Optional] public bool? SupportsRestartFrame { get; set; } + + /// + /// The debug adapter supports the 'gotoTargets' request. + /// + [Optional] public bool? SupportsGotoTargetsRequest { get; set; } + + /// + /// The debug adapter supports the 'stepInTargets' request. + /// + [Optional] public bool? SupportsStepInTargetsRequest { get; set; } + + /// + /// The debug adapter supports the 'completions' request. + /// + [Optional] public bool? SupportsCompletionsRequest { get; set; } + + /// + /// The debug adapter supports the 'modules' request. + /// + [Optional] public bool? SupportsModulesRequest { get; set; } + + /// + /// The set of additional module information exposed by the debug adapter. + /// + [Optional] public Container AdditionalModuleColumns { get; set; } + + /// + /// Checksum algorithms supported by the debug adapter. + /// + [Optional] public Container SupportedChecksumAlgorithms { get; set; } + + /// + /// The debug adapter supports the 'restart' request. In this case a client should not implement 'restart' by terminating and relaunching the adapter but by calling the RestartRequest. + /// + [Optional] public bool? SupportsRestartRequest { get; set; } + + /// + /// The debug adapter supports 'exceptionOptions' on the setExceptionBreakpoints request. + /// + [Optional] public bool? SupportsExceptionOptions { get; set; } + + /// + /// The debug adapter supports a 'format' attribute on the stackTraceRequest, variablesRequest, and evaluateRequest. + /// + [Optional] public bool? SupportsValueFormattingOptions { get; set; } + + /// + /// The debug adapter supports the 'exceptionInfo' request. + /// + [Optional] public bool? SupportsExceptionInfoRequest { get; set; } + + /// + /// The debug adapter supports the 'terminateDebuggee' attribute on the 'disconnect' request. + /// + [Optional] public bool? SupportTerminateDebuggee { get; set; } + + /// + /// The debug adapter supports the delayed loading of parts of the stack, which requires that both the 'startFrame' and 'levels' arguments and the 'totalFrames' result of the 'StackTrace' request are supported. + /// + [Optional] public bool? SupportsDelayedStackTraceLoading { get; set; } + + /// + /// The debug adapter supports the 'loadedSources' request. + /// + [Optional] public bool? SupportsLoadedSourcesRequest { get; set; } + + /// + /// The debug adapter supports logpoints by interpreting the 'logMessage' attribute of the SourceBreakpoint. + /// + [Optional] public bool? SupportsLogPoints { get; set; } + + /// + /// The debug adapter supports the 'terminateThreads' request. + /// + [Optional] public bool? SupportsTerminateThreadsRequest { get; set; } + + /// + /// The debug adapter supports the 'setExpression' request. + /// + [Optional] public bool? SupportsSetExpression { get; set; } + + /// + /// The debug adapter supports the 'terminate' request. + /// + [Optional] public bool? SupportsTerminateRequest { get; set; } + + /// + /// The debug adapter supports data breakpoints. + /// + [Optional] public bool? SupportsDataBreakpoints { get; set; } + + /// + /// The debug adapter supports the 'readMemory' request. + /// + [Optional] public bool? SupportsReadMemoryRequest { get; set; } + + /// + /// The debug adapter supports the 'disassemble' request. + /// + [Optional] public bool? SupportsDisassembleRequest { get; set; } + } +} diff --git a/src/Dap.Protocol/Models/Checksum.cs b/src/Dap.Protocol/Models/Checksum.cs new file mode 100644 index 000000000..4e80be80d --- /dev/null +++ b/src/Dap.Protocol/Models/Checksum.cs @@ -0,0 +1,22 @@ +using Newtonsoft.Json; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol +{ + /// + /// The checksum of an item calculated by the specified algorithm. + /// + + public class Checksum + { + /// + /// The algorithm used to calculate this checksum. + /// + public ChecksumAlgorithm Algorithm { get; set; } + + /// + /// Value of the checksum. + /// + [JsonProperty("checksum")] + public string Value { get; set; } + } +} \ No newline at end of file diff --git a/src/Dap.Protocol/Models/ChecksumAlgorithm.cs b/src/Dap.Protocol/Models/ChecksumAlgorithm.cs new file mode 100644 index 000000000..da34e936b --- /dev/null +++ b/src/Dap.Protocol/Models/ChecksumAlgorithm.cs @@ -0,0 +1,14 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol +{ + /// + /// Names of checksum algorithms that may be supported by a debug adapter. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ChecksumAlgorithm + { + Md5, Sha1, Sha256, Timestamp + } +} \ No newline at end of file diff --git a/src/Dap.Protocol/Models/ColumnDescriptor.cs b/src/Dap.Protocol/Models/ColumnDescriptor.cs new file mode 100644 index 000000000..150e69499 --- /dev/null +++ b/src/Dap.Protocol/Models/ColumnDescriptor.cs @@ -0,0 +1,37 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol +{ + /// + /// A ColumnDescriptor specifies what module attribute to show in a column of the ModulesView, how to format it, and what the column’s label should be. + /// It is only used if the underlying UI actually supports this level of customization. + /// + + public class ColumnDescriptor + { + /// + /// Name of the attribute rendered in this column. + /// + public string AttributeName { get; set; } + + /// + /// Header UI label of column. + /// + public string Label { get; set; } + + /// + /// Format to use for the rendered values in this column. TBD how the format strings looks like. + /// + [Optional] public string Format { get; set; } + + /// + /// Datatype of values in this column. Defaults to 'string' if not specified. + /// + [Optional] public ColumnDescriptorType Type { get; set; } + + /// + /// Width of this column in characters (hint only). + /// + [Optional] public long? Width { get; set; } + } +} \ No newline at end of file diff --git a/src/Dap.Protocol/Models/ColumnDescriptorType.cs b/src/Dap.Protocol/Models/ColumnDescriptorType.cs new file mode 100644 index 000000000..13fc080ae --- /dev/null +++ b/src/Dap.Protocol/Models/ColumnDescriptorType.cs @@ -0,0 +1,15 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol +{ + [JsonConverter(typeof(StringEnumConverter))] + public enum ColumnDescriptorType + { + String, + + Long, + Bool, + UnixTimestampUtc, + } +} \ No newline at end of file diff --git a/src/Dap.Protocol/Models/CompletionItem.cs b/src/Dap.Protocol/Models/CompletionItem.cs new file mode 100644 index 000000000..84dec98ca --- /dev/null +++ b/src/Dap.Protocol/Models/CompletionItem.cs @@ -0,0 +1,37 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol +{ + /// + /// CompletionItems are the suggestions returned from the CompletionsRequest. + /// + public class CompletionItem + { + /// + /// The label of this completion item. By default this is also the text that is inserted when selecting this completion. + /// + public string Label { get; set; } + + /// + /// If text is not falsy then it is inserted instead of the label. + /// + [Optional] public string Text { get; set; } + + /// + /// The item's type. Typically the client uses this information to render the item in the UI with an icon. + /// + [Optional] public CompletionItemType Type { get; set; } + + /// + /// This value determines the location (in the CompletionsRequest's 'text' attribute) where the completion text is added. + /// If missing the text is added at the location specified by the CompletionsRequest's 'column' attribute. + /// + [Optional] public long? Start { get; set; } + + /// + /// This value determines how many characters are overwritten by the completion text. + /// If missing the value 0 is assumed which results in the completion text being inserted. + /// + [Optional] public long? Length { get; set; } + } +} \ No newline at end of file diff --git a/src/Dap.Protocol/Models/CompletionItemType.cs b/src/Dap.Protocol/Models/CompletionItemType.cs new file mode 100644 index 000000000..af1d5985b --- /dev/null +++ b/src/Dap.Protocol/Models/CompletionItemType.cs @@ -0,0 +1,14 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol +{ + /// + /// Some predefined types for the CompletionItem.Please note that not all clients have specific icons for all of them. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum CompletionItemType + { + Method, Function, Constructor, Field, Variable, Class, Interface, Module, Property, Unit, Value, Enum, Keyword, Snippet, Text, Color, File, Reference, CustomColor + } +} \ No newline at end of file diff --git a/src/Dap.Protocol/Models/Container.cs b/src/Dap.Protocol/Models/Container.cs new file mode 100644 index 000000000..c88ecb326 --- /dev/null +++ b/src/Dap.Protocol/Models/Container.cs @@ -0,0 +1,36 @@ +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol +{ + public class Container : ContainerBase + { + public Container() : this(Enumerable.Empty()) + { + } + + public Container(IEnumerable items) : base(items) + { + } + + public Container(params T[] items) : base(items) + { + } + + public static implicit operator Container(T[] items) + { + return new Container(items); + } + + public static implicit operator Container(Collection items) + { + return new Container(items); + } + + public static implicit operator Container(List items) + { + return new Container(items); + } + } +} diff --git a/src/Dap.Protocol/Models/ContainerBase.cs b/src/Dap.Protocol/Models/ContainerBase.cs new file mode 100644 index 000000000..6ec86c66c --- /dev/null +++ b/src/Dap.Protocol/Models/ContainerBase.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol +{ + public abstract class ContainerBase : IEnumerable, IEquatable> + { + private readonly IEnumerable _items; + + public ContainerBase(IEnumerable items) + { + _items = items; + } + + public override bool Equals(object obj) + { + return Equals(obj as ContainerBase); + } + + public bool Equals(ContainerBase other) + { + return other != null && + EqualityComparer>.Default.Equals(_items, other._items); + } + + public IEnumerator GetEnumerator() + { + return _items.GetEnumerator(); + } + + public override int GetHashCode() + { + return -566117206 + EqualityComparer>.Default.GetHashCode(_items); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public static bool operator ==(ContainerBase base1, ContainerBase base2) + { + return EqualityComparer>.Default.Equals(base1, base2); + } + + public static bool operator !=(ContainerBase base1, ContainerBase base2) + { + return !( base1 == base2 ); + } + } +} diff --git a/src/Dap.Protocol/Models/DataBreakpoint.cs b/src/Dap.Protocol/Models/DataBreakpoint.cs new file mode 100644 index 000000000..9202bdcea --- /dev/null +++ b/src/Dap.Protocol/Models/DataBreakpoint.cs @@ -0,0 +1,30 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol +{ + /// + /// Properties of a data breakpoint passed to the setDataBreakpoints request. + /// + public class DataBreakpoint + { + /// + /// An id representing the data. This id is returned from the dataBreakpointInfo request. + /// + public string DataId { get; set; } + + /// + /// The access type of the data. + /// + [Optional] public DataBreakpointAccessType AccessType { get; set; } + + /// + /// An optional expression for conditional breakpoints. + /// + [Optional] public string Condition { get; set; } + + /// + /// An optional expression that controls how many hits of the breakpoint are ignored. The backend is expected to interpret the expression as needed. + /// + [Optional] public string HitCondition { get; set; } + } +} \ No newline at end of file diff --git a/src/Dap.Protocol/Models/DataBreakpointAccessType.cs b/src/Dap.Protocol/Models/DataBreakpointAccessType.cs new file mode 100644 index 000000000..cd71da3b7 --- /dev/null +++ b/src/Dap.Protocol/Models/DataBreakpointAccessType.cs @@ -0,0 +1,16 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol +{ + /// + /// This enumeration defines all possible access types for data breakpoints. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum DataBreakpointAccessType + { + Read, + Write, + ReadWrite + } +} \ No newline at end of file diff --git a/src/Dap.Protocol/Models/DisassembledInstruction.cs b/src/Dap.Protocol/Models/DisassembledInstruction.cs new file mode 100644 index 000000000..75869a47b --- /dev/null +++ b/src/Dap.Protocol/Models/DisassembledInstruction.cs @@ -0,0 +1,55 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol +{ + /// DisassembledInstruction + /// Represents a single disassembled instruction. + /// + public class DisassembledInstruction + { + /// + /// The address of the instruction. Treated as a hex value if prefixed with '0x', or as a decimal value otherwise. + /// + public string Address { get; set; } + + /// + /// Optional raw bytes representing the instruction and its operands, in an implementation-defined format. + /// + [Optional] public string InstructionBytes { get; set; } + + /// + /// Text representing the instruction and its operands, in an implementation-defined format. + /// + public string Instruction { get; set; } + + /// + /// Name of the symbol that correponds with the location of this instruction, if any. + /// + [Optional] public string Symbol { get; set; } + + /// + /// Source location that corresponds to this instruction, if any. Should always be set (if available) on the first instruction returned, but can be omitted afterwards if this instruction maps to the same source file as the previous instruction. + /// + [Optional] public Source Location { get; set; } + + /// + /// The line within the source location that corresponds to this instruction, if any. + /// + [Optional] public long? Line { get; set; } + + /// + /// The column within the line that corresponds to this instruction, if any. + /// + [Optional] public long? Column { get; set; } + + /// + /// The end line of the range that corresponds to this instruction, if any. + /// + [Optional] public long? EndLine { get; set; } + + /// + /// The end column of the range that corresponds to this instruction, if any. + /// + [Optional] public long? EndColumn { get; set; } + } +} \ No newline at end of file diff --git a/src/Dap.Protocol/Models/ExceptionBreakMode.cs b/src/Dap.Protocol/Models/ExceptionBreakMode.cs new file mode 100644 index 000000000..48ff05373 --- /dev/null +++ b/src/Dap.Protocol/Models/ExceptionBreakMode.cs @@ -0,0 +1,18 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol +{ + /// + /// This enumeration defines all possible conditions when a thrown exception should result in a break. + /// never: never breaks, + /// always: always breaks, + /// unhandled: breaks when excpetion unhandled, + /// userUnhandled: breaks if the exception is not handled by user code. + /// + [JsonConverter(typeof(StringEnumConverter))] + public enum ExceptionBreakMode + { + Never, Always, Unhandled, UserUnhandled + } +} \ No newline at end of file diff --git a/src/Dap.Protocol/Models/ExceptionBreakpointsFilter.cs b/src/Dap.Protocol/Models/ExceptionBreakpointsFilter.cs new file mode 100644 index 000000000..0a88fa124 --- /dev/null +++ b/src/Dap.Protocol/Models/ExceptionBreakpointsFilter.cs @@ -0,0 +1,25 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol +{ + /// ExceptionBreakpointsFilter + /// An ExceptionBreakpointsFilter is shown in the UI as an option for configuring how exceptions are dealt with. + /// + public class ExceptionBreakpointsFilter + { + /// + /// The internal ID of the filter. This value is passed to the setExceptionBreakpoints request. + /// + public string Filter { get; set; } + + /// + /// The name of the filter. This will be shown in the UI. + /// + public string Label { get; set; } + + /// + /// Initial value of the filter. If not specified a value 'false' is assumed. + /// + [Optional] public bool? Default { get; set; } + } +} \ No newline at end of file diff --git a/src/Dap.Protocol/Models/ExceptionDetails.cs b/src/Dap.Protocol/Models/ExceptionDetails.cs new file mode 100644 index 000000000..d755ce041 --- /dev/null +++ b/src/Dap.Protocol/Models/ExceptionDetails.cs @@ -0,0 +1,40 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol +{ + /// ExceptionDetails + /// Detailed information about an exception that has occurred. + /// + public class ExceptionDetails + { + /// + /// Message contained in the exception. + /// + [Optional] public string Message { get; set; } + + /// + /// Short type name of the exception object. + /// + [Optional] public string TypeName { get; set; } + + /// + /// Fully-qualified type name of the exception object. + /// + [Optional] public string FullTypeName { get; set; } + + /// + /// Optional expression that can be evaluated in the current scope to obtain the exception object. + /// + [Optional] public string EvaluateName { get; set; } + + /// + /// Stack trace at the time the exception was thrown. + /// + [Optional] public string StackTrace { get; set; } + + /// + /// Details of the exception contained by this exception, if any. + /// + [Optional] public Container InnerException { get; set; } + } +} diff --git a/src/Dap.Protocol/Models/ExceptionOptions.cs b/src/Dap.Protocol/Models/ExceptionOptions.cs new file mode 100644 index 000000000..6f2f71b4e --- /dev/null +++ b/src/Dap.Protocol/Models/ExceptionOptions.cs @@ -0,0 +1,20 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol +{ + /// ExceptionOptions + /// An ExceptionOptions assigns configuration options to a set of exceptions. + /// + public class ExceptionOptions + { + /// + /// A path that selects a single or multiple exceptions in a tree. If 'path' is missing, the whole tree is selected. By convention the first segment of the path is a category that is used to group exceptions in the UI. + /// + [Optional] public Container Path { get; set; } + + /// + /// Condition when a thrown exception should result in a break. + /// + public ExceptionBreakMode BreakMode { get; set; } + } +} diff --git a/src/Dap.Protocol/Models/ExceptionPathSegment.cs b/src/Dap.Protocol/Models/ExceptionPathSegment.cs new file mode 100644 index 000000000..57e703eaa --- /dev/null +++ b/src/Dap.Protocol/Models/ExceptionPathSegment.cs @@ -0,0 +1,20 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol +{ + /// + /// An ExceptionPathSegment represents a segment in a path that is used to match leafs or nodes in a tree of exceptions.If a segment consists of more than one name, it matches the names provided if ‘negate’ is false or missing or it matches anything except the names provided if ‘negate’ is true. + /// + public class ExceptionPathSegment + { + /// + /// If false or missing this segment matches the names provided, otherwise it matches anything except the names provided. + /// + [Optional] public bool? Negate { get; set; } + + /// + /// Depending on the value of 'negate' the names that should match or not match. + /// + public Container Names { get; set; } + } +} diff --git a/src/Dap.Protocol/Models/FunctionBreakpoint.cs b/src/Dap.Protocol/Models/FunctionBreakpoint.cs new file mode 100644 index 000000000..ed328903b --- /dev/null +++ b/src/Dap.Protocol/Models/FunctionBreakpoint.cs @@ -0,0 +1,25 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol +{ + /// FunctionBreakpoint + /// Properties of a breakpoint passed to the setFunctionBreakpoints request. + /// + public class FunctionBreakpoint + { + /// + /// The name of the function. + /// + public string Name { get; set; } + + /// + /// An optional expression for conditional breakpoints. + /// + [Optional] public string Condition { get; set; } + + /// + /// An optional expression that controls how many hits of the breakpoint are ignored. The backend is expected to interpret the expression as needed. + /// + [Optional] public string HitCondition { get; set; } + } +} \ No newline at end of file diff --git a/src/Dap.Protocol/Models/GotoTarget.cs b/src/Dap.Protocol/Models/GotoTarget.cs new file mode 100644 index 000000000..042e37334 --- /dev/null +++ b/src/Dap.Protocol/Models/GotoTarget.cs @@ -0,0 +1,46 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol +{ + /// + /// A GotoTarget describes a code location that can be used as a target in the ‘goto’ request. + /// The possible goto targets can be determined via the ‘gotoTargets’ request. + /// + public class GotoTarget + { + /// + /// Unique identifier for a goto target. This is used in the goto request. + /// + public long Id { get; set; } + + /// + /// The name of the goto target (shown in the UI). + /// + public string Label { get; set; } + + /// + /// The line of the goto target. + /// + public long Line { get; set; } + + /// + /// An optional column of the goto target. + /// + [Optional] public long? Column { get; set; } + + /// + /// An optional end line of the range covered by the goto target. + /// + [Optional] public long? EndLine { get; set; } + + /// + /// An optional end column of the range covered by the goto target. + /// + [Optional] public long? EndColumn { get; set; } + + /// + /// Optional memory reference for the instruction pointer value represented by this target. + /// + [Optional] public string InstructionPointerReference { get; set; } + } +} \ No newline at end of file diff --git a/src/Dap.Protocol/Models/Message.cs b/src/Dap.Protocol/Models/Message.cs new file mode 100644 index 000000000..393be6b4b --- /dev/null +++ b/src/Dap.Protocol/Models/Message.cs @@ -0,0 +1,47 @@ +using System.Collections.Generic; +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol +{ + /// + /// A structured message object. Used to return errors from requests. + /// + public class Message + { + /// + /// Unique identifier for the message. + /// + public long Id { get; set; } + + /// + /// A format string for the message. Embedded variables have the form '{name}'. + /// If variable name starts with an underscore character, the variable does not contain user data (PII) and can be safely used for telemetry purposes. + /// + public string Format { get; set; } + + /// + /// An object used as a dictionary for looking up the variables in the format string. + /// + [Optional] public IDictionary Variables { get; set; } + + /// + /// If true send to telemetry. + /// + [Optional] public bool? SendTelemetry { get; set; } + + /// + /// If true show user. + /// + [Optional] public bool? ShowUser { get; set; } + + /// + /// An optional url where additional information about this message can be found. + /// + [Optional] public string Url { get; set; } + + /// + /// An optional label that is presented to the user as the UI for opening the url. + /// + [Optional] public string UrlLabel { get; set; } + } +} \ No newline at end of file diff --git a/src/Dap.Protocol/Models/Module.cs b/src/Dap.Protocol/Models/Module.cs new file mode 100644 index 000000000..02a66ad9b --- /dev/null +++ b/src/Dap.Protocol/Models/Module.cs @@ -0,0 +1,69 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol +{ + /// + /// A Module object represents a row in the modules view. + /// Two attributes are mandatory: an id identifies a module in the modules view and is used in a ModuleEvent for identifying a module for adding, updating or deleting. + /// The name is used to minimally render the module in the UI. + /// Additional attributes can be added to the module.They will show up in the module View if they have a corresponding ColumnDescriptor. + /// To avoid an unnecessary proliferation of additional attributes with similar semantics but different names + /// we recommend to re-use attributes from the ‘recommended’ list below first, and only introduce new attributes if nothing appropriate could be found. + /// + + public class Module + { + /// + /// Unique identifier for the module. + /// + public NumberString Id { get; set; } + + /// + /// A name of the module. + /// + public string Name { get; set; } + + /// + /// optional but recommended attributes. + /// always try to use these first before introducing additional attributes. + /// + /// Logical full path to the module. The exact definition is implementation defined, but usually this would be a full path to the on-disk file for the module. + /// + [Optional] public string Path { get; set; } + + /// + /// True if the module is optimized. + /// + [Optional] public bool? IsOptimized { get; set; } + + /// + /// True if the module is considered 'user code' by a debugger that supports 'Just My Code'. + /// + [Optional] public bool? IsUserCode { get; set; } + + /// + /// Version of Module. + /// + [Optional] public string Version { get; set; } + + /// + /// User understandable description of if symbols were found for the module (ex: 'Symbols Loaded', 'Symbols not found', etc. + /// + [Optional] public string SymbolStatus { get; set; } + + /// + /// Logical full path to the symbol file. The exact definition is implementation defined. + /// + [Optional] public string SymbolFilePath { get; set; } + + /// + /// Module created or modified. + /// + [Optional] public string DateTimeStamp { get; set; } + + /// + /// Address range covered by this module. + /// + [Optional] public string AddressRange { get; set; } + } +} \ No newline at end of file diff --git a/src/Dap.Protocol/Models/ModulesViewDescriptor.cs b/src/Dap.Protocol/Models/ModulesViewDescriptor.cs new file mode 100644 index 000000000..8bfe11fb0 --- /dev/null +++ b/src/Dap.Protocol/Models/ModulesViewDescriptor.cs @@ -0,0 +1,11 @@ +namespace OmniSharp.Extensions.DebugAdapter.Protocol +{ + /// + /// The ModulesViewDescriptor is the container for all declarative configuration options of a ModuleView. + /// For now it only specifies the columns to be shown in the modules view. + /// + public class ModulesViewDescriptor + { + public Container Columns { get; set; } + } +} diff --git a/src/Dap.Protocol/Models/NumberString.cs b/src/Dap.Protocol/Models/NumberString.cs new file mode 100644 index 000000000..5dc2ae83f --- /dev/null +++ b/src/Dap.Protocol/Models/NumberString.cs @@ -0,0 +1,57 @@ +using System.Collections.Generic; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Linq; +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol +{ + public struct NumberString + { + private long? _long; + private string _string; + + public NumberString(long value) + { + _long = value; + _string = null; + } + public NumberString(string value) + { + _long = null; + _string = value; + } + + public bool IsLong => _long.HasValue; + public long Long + { + get => _long ?? 0; + set + { + String = null; + _long = value; + } + } + + public bool IsString => _string != null; + public string String + { + get => _string; + set + { + _string = value; + _long = null; + } + } + + public static implicit operator NumberString(long value) + { + return new NumberString(value); + } + + public static implicit operator NumberString(string value) + { + return new NumberString(value); + } + } +} diff --git a/src/Dap.Protocol/Models/Scope.cs b/src/Dap.Protocol/Models/Scope.cs new file mode 100644 index 000000000..548f170a3 --- /dev/null +++ b/src/Dap.Protocol/Models/Scope.cs @@ -0,0 +1,72 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol +{ + /// + /// A Scope is a named container for variables.Optionally a scope can map to a source or a range within a source. + /// + public class Scope + { + /// + /// Name of the scope such as 'Arguments', 'Locals', or 'Registers'. This string is shown in the UI as is and can be translated. + /// + public string Name { get; set; } + + /// + /// An optional hint for how to present this scope in the UI. If this attribute is missing, the scope is shown with a generic UI. + /// Values: + /// 'arguments': Scope contains method arguments. + /// 'locals': Scope contains local variables. + /// 'registers': Scope contains registers. Only a single 'registers' scope should be returned from a 'scopes' request. + /// etc. + /// + [Optional] public string PresentationHint { get; set; } + + /// + /// The variables of this scope can be retrieved by passing the value of variablesReference to the VariablesRequest. + /// + public long VariablesReference { get; set; } + + /// + /// The long of named variables in this scope. + /// The client can use this optional information to present the variables in a paged UI and fetch them in chunks. + /// + [Optional] public long? NamedVariables { get; set; } + + /// + /// The long of indexed variables in this scope. + /// The client can use this optional information to present the variables in a paged UI and fetch them in chunks. + /// + [Optional] public long? IndexedVariables { get; set; } + + /// + /// If true, the long of variables in this scope is large or expensive to retrieve. + /// + public bool Expensive { get; set; } + + /// + /// Optional source for this scope. + /// + [Optional] public Source Source { get; set; } + + /// + /// Optional start line of the range covered by this scope. + /// + [Optional] public long? Line { get; set; } + + /// + /// Optional start column of the range covered by this scope. + /// + [Optional] public long? Column { get; set; } + + /// + /// Optional end line of the range covered by this scope. + /// + [Optional] public long? EndLine { get; set; } + + /// + /// Optional end column of the range covered by this scope. + /// + [Optional] public long? EndColumn { get; set; } + } +} \ No newline at end of file diff --git a/src/Dap.Protocol/Models/Source.cs b/src/Dap.Protocol/Models/Source.cs new file mode 100644 index 000000000..0aa2122f8 --- /dev/null +++ b/src/Dap.Protocol/Models/Source.cs @@ -0,0 +1,51 @@ +using Newtonsoft.Json.Linq; +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol +{ + /// + /// A Source is a descriptor for source code.It is returned from the debug adapter as part of a StackFrame and it is used by clients when specifying breakpoints. + /// + public class Source + { + /// + /// The short name of the source. Every source returned from the debug adapter has a name. When sending a source to the debug adapter this name is optional. + /// + [Optional] public string Name { get; set; } + + /// + /// The path of the source to be shown in the UI. It is only used to locate and load the content of the source if no sourceReference is specified (or its value is 0). + /// + [Optional] public string Path { get; set; } + + /// + /// If sourceReference > 0 the contents of the source must be retrieved through the SourceRequest (even if a path is specified). A sourceReference is only valid for a session, so it must not be used to persist a source. + /// + [Optional] public long? SourceReference { get; set; } + + /// + /// An optional hint for how to present the source in the UI. A value of 'deemphasize' can be used to indicate that the source is not available or that it is skipped on stepping. + /// + [Optional] public SourcePresentationHint PresentationHint { get; set; } + + /// + /// The (optional) origin of this source: possible values 'internal module', 'inlined content from source map', etc. + /// + [Optional] public string Origin { get; set; } + + /// + /// An optional list of sources that are related to this source. These may be the source that generated this source. + /// + [Optional] public Container Sources { get; set; } + + /// + /// Optional data that a debug adapter might want to loop through the client. The client should leave the data intact and persist it across sessions. The client should not interpret the data. + /// + [Optional] public JToken AdapterData { get; set; } + + /// + /// The checksums associated with this file. + /// + [Optional] public Container Checksums { get; set; } + } +} diff --git a/src/Dap.Protocol/Models/SourceBreakpoint.cs b/src/Dap.Protocol/Models/SourceBreakpoint.cs new file mode 100644 index 000000000..fa569ed21 --- /dev/null +++ b/src/Dap.Protocol/Models/SourceBreakpoint.cs @@ -0,0 +1,35 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol +{ + /// SourceBreakpoint + /// Properties of a breakpoint or logpoint passed to the setBreakpoints request. + /// + public class SourceBreakpoint + { + /// + /// The source line of the breakpoint or logpoint. + /// + public long Line { get; set; } + + /// + /// An optional source column of the breakpoint. + /// + [Optional] public long? Column { get; set; } + + /// + /// An optional expression for conditional breakpoints. + /// + [Optional] public string Condition { get; set; } + + /// + /// An optional expression that controls how many hits of the breakpoint are ignored. The backend is expected to interpret the expression as needed. + /// + [Optional] public string HitCondition { get; set; } + + /// + /// If this attribute exists and is non-empty, the backend must not 'break' (stop) but log the message instead. Expressions within {} are interpolated. + /// + [Optional] public string LogMessage { get; set; } + } +} \ No newline at end of file diff --git a/src/Dap.Protocol/Models/SourcePresentationHint.cs b/src/Dap.Protocol/Models/SourcePresentationHint.cs new file mode 100644 index 000000000..7e4da05d7 --- /dev/null +++ b/src/Dap.Protocol/Models/SourcePresentationHint.cs @@ -0,0 +1,13 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol +{ + [JsonConverter(typeof(StringEnumConverter))] + public enum SourcePresentationHint + { + Normal, + Emphasize, + Deemphasize, + } +} \ No newline at end of file diff --git a/src/Dap.Protocol/Models/StackFrame.cs b/src/Dap.Protocol/Models/StackFrame.cs new file mode 100644 index 000000000..9c378a89b --- /dev/null +++ b/src/Dap.Protocol/Models/StackFrame.cs @@ -0,0 +1,60 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol +{ + /// + /// A Stackframe contains the source location. + /// + public class StackFrame + { + /// + /// An identifier for the stack frame. It must be unique across all threads. This id can be used to retrieve the scopes of the frame with the 'scopesRequest' or to restart the execution of a stackframe. + /// + public long Id { get; set; } + + /// + /// The name of the stack frame, typically a method name. + /// + public string Name { get; set; } + + /// + /// The optional source of the frame. + /// + [Optional] public Source Source { get; set; } + + /// + /// The line within the file of the frame. If source is null or doesn't exist, line is 0 and must be ignored. + /// + public long Line { get; set; } + + /// + /// The column within the line. If source is null or doesn't exist, column is 0 and must be ignored. + /// + public long Column { get; set; } + + /// + /// An optional end line of the range covered by the stack frame. + /// + [Optional] public long? EndLine { get; set; } + + /// + /// An optional end column of the range covered by the stack frame. + /// + [Optional] public long? EndColumn { get; set; } + + /// + /// Optional memory reference for the current instruction pointer in this frame. + /// + [Optional] public string InstructionPointerReference { get; set; } + + /// + /// The module associated with this frame, if any. + /// + [Optional] public NumberString? ModuleId { get; set; } + + /// + /// An optional hint for how to present this frame in the UI. A value of 'label' can be used to indicate that the frame is an artificial frame that is used as a visual label or separator. A value of 'subtle' can be used to change the appearance of a frame in a 'subtle' way. + /// + [Optional] public StackFramePresentationHint PresentationHint { get; set; } + } +} \ No newline at end of file diff --git a/src/Dap.Protocol/Models/StackFrameFormat.cs b/src/Dap.Protocol/Models/StackFrameFormat.cs new file mode 100644 index 000000000..ab73d1bec --- /dev/null +++ b/src/Dap.Protocol/Models/StackFrameFormat.cs @@ -0,0 +1,45 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol +{ + /// + /// Provides formatting information for a stack frame. + /// + public class StackFrameFormat : ValueFormat + { + /// + /// Displays parameters for the stack frame. + /// + [Optional] public bool? Parameters { get; set; } + + /// + /// Displays the types of parameters for the stack frame. + /// + [Optional] public bool? ParameterTypes { get; set; } + + /// + /// Displays the names of parameters for the stack frame. + /// + [Optional] public bool? ParameterNames { get; set; } + + /// + /// Displays the values of parameters for the stack frame. + /// + [Optional] public bool? ParameterValues { get; set; } + + /// + /// Displays the line long of the stack frame. + /// + [Optional] public bool? Line { get; set; } + + /// + /// Displays the module of the stack frame. + /// + [Optional] public bool? Module { get; set; } + + /// + /// Includes all stack frames, including those the debug adapter might otherwise hide. + /// + [Optional] public bool? IncludeAll { get; set; } + } +} \ No newline at end of file diff --git a/src/Dap.Protocol/Models/StackFramePresentationHint.cs b/src/Dap.Protocol/Models/StackFramePresentationHint.cs new file mode 100644 index 000000000..7e10245da --- /dev/null +++ b/src/Dap.Protocol/Models/StackFramePresentationHint.cs @@ -0,0 +1,13 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol +{ + [JsonConverter(typeof(StringEnumConverter))] + public enum StackFramePresentationHint + { + Normal, + Label, + Subtle, + } +} \ No newline at end of file diff --git a/src/Dap.Protocol/Models/StepInTarget.cs b/src/Dap.Protocol/Models/StepInTarget.cs new file mode 100644 index 000000000..2417c2ffa --- /dev/null +++ b/src/Dap.Protocol/Models/StepInTarget.cs @@ -0,0 +1,18 @@ +namespace OmniSharp.Extensions.DebugAdapter.Protocol +{ + /// + /// A StepInTarget can be used in the ‘stepIn’ request and determines into which single target the stepIn request should step. + /// + public class StepInTarget + { + /// + /// Unique identifier for a stepIn target. + /// + public long Id { get; set; } + + /// + /// The name of the stepIn target (shown in the UI). + /// + public string Label { get; set; } + } +} \ No newline at end of file diff --git a/src/Dap.Protocol/Models/Thread.cs b/src/Dap.Protocol/Models/Thread.cs new file mode 100644 index 000000000..f1653cfda --- /dev/null +++ b/src/Dap.Protocol/Models/Thread.cs @@ -0,0 +1,18 @@ +namespace OmniSharp.Extensions.DebugAdapter.Protocol +{ + /// + /// A Thread + /// + public class Thread + { + /// + /// Unique identifier for the thread. + /// + public long Id { get; set; } + + /// + /// A name of the thread. + /// + public string Name { get; set; } + } +} \ No newline at end of file diff --git a/src/Dap.Protocol/Models/ValueFormat.cs b/src/Dap.Protocol/Models/ValueFormat.cs new file mode 100644 index 000000000..44e33dd0a --- /dev/null +++ b/src/Dap.Protocol/Models/ValueFormat.cs @@ -0,0 +1,15 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol +{ + /// + /// Provides formatting information for a value. + /// + public class ValueFormat + { + /// + /// Display the value in hex. + /// + [Optional] public bool? Hex { get; set; } + } +} \ No newline at end of file diff --git a/src/Dap.Protocol/Models/Variable.cs b/src/Dap.Protocol/Models/Variable.cs new file mode 100644 index 000000000..429581e57 --- /dev/null +++ b/src/Dap.Protocol/Models/Variable.cs @@ -0,0 +1,62 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol +{ + /// + /// A Variable is a name/value pair. + /// Optionally a variable can have a ‘type’ that is shown if space permits or when hovering over the variable’s name. + /// An optional ‘kind’ is used to render additional properties of the variable, e.g.different icons can be used to indicate that a variable is public or private. + /// If the value is structured(has children), a handle is provided to retrieve the children with the VariablesRequest. + /// If the long of named or indexed children is large, the longs should be returned via the optional ‘namedVariables’ and ‘indexedVariables’ attributes. + /// The client can use this optional information to present the children in a paged UI and fetch them in chunks. + /// + public class Variable + { + /// + /// The variable's name. + /// + public string Name { get; set; } + + /// + /// The variable's value. This can be a multi-line text, e.g. for a function the body of a function. + /// + public string Value { get; set; } + + /// + /// The type of the variable's value. Typically shown in the UI when hovering over the value. + /// + [Optional] public string Type { get; set; } + + /// + /// Properties of a variable that can be used to determine how to render the variable in the UI. + /// + [Optional] public VariablePresentationHint PresentationHint { get; set; } + + /// + /// Optional evaluatable name of this variable which can be passed to the 'EvaluateRequest' to fetch the variable's value. + /// + [Optional] public string EvaluateName { get; set; } + + /// + /// If variablesReference is > 0, the variable is structured and its children can be retrieved by passing variablesReference to the VariablesRequest. + /// + public long VariablesReference { get; set; } + + /// + /// The long of named child variables. + /// The client can use this optional information to present the children in a paged UI and fetch them in chunks. + /// + [Optional] public long? NamedVariables { get; set; } + + /// + /// The long of indexed child variables. + /// The client can use this optional information to present the children in a paged UI and fetch them in chunks. + /// + [Optional] public long? IndexedVariables { get; set; } + + /// + /// Optional memory reference for the variable if the variable represents executable code, such as a function pointer. + /// + [Optional] public string MemoryReference { get; set; } + } +} \ No newline at end of file diff --git a/src/Dap.Protocol/Models/VariablePresentationHint.cs b/src/Dap.Protocol/Models/VariablePresentationHint.cs new file mode 100644 index 000000000..2ba2b7c1e --- /dev/null +++ b/src/Dap.Protocol/Models/VariablePresentationHint.cs @@ -0,0 +1,48 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol +{ + /// VariablePresentationHint + /// Optional properties of a variable that can be used to determine how to render the variable in the UI. + /// + public class VariablePresentationHint + { + /// + /// The kind of variable. Before introducing additional values, try to use the listed values. + /// Values: + /// 'property': Indicates that the object is a property. + /// 'method': Indicates that the object is a method. + /// 'class': Indicates that the object is a class. + /// 'data': Indicates that the object is data. + /// 'event': Indicates that the object is an event. + /// 'baseClass': Indicates that the object is a base class. + /// 'innerClass': Indicates that the object is an inner class. + /// 'interface': Indicates that the object is an interface. + /// 'mostDerivedClass': Indicates that the object is the most derived class. + /// 'virtual': Indicates that the object is virtual, that means it is a synthetic object introduced by the adapter for rendering purposes, e.g. an index range for large arrays. + /// 'dataBreakpoint': Indicates that a data breakpoint is registered for the object. + /// etc. + /// + [Optional] public string Kind { get; set; } + + /// + /// Set of attributes represented as an array of strings. Before introducing additional values, try to use the listed values. + /// Values: + /// 'static': Indicates that the object is static. + /// 'constant': Indicates that the object is a constant. + /// 'readOnly': Indicates that the object is read only. + /// 'rawString': Indicates that the object is a raw string. + /// 'hasObjectId': Indicates that the object can have an Object ID created for it. + /// 'canHaveObjectId': Indicates that the object has an Object ID associated with it. + /// 'hasSideEffects': Indicates that the evaluation had side effects. + /// etc. + /// + [Optional] public Container Attributes { get; set; } + + /// + /// Visibility of variable. Before introducing additional values, try to use the listed values. + /// Values: 'public', 'private', 'protected', 'internal', 'final', etc. + /// + [Optional] public string Visibility { get; set; } + } +} diff --git a/src/Dap.Protocol/Requests/classs1.cs b/src/Dap.Protocol/Requests/classs1.cs new file mode 100644 index 000000000..46d19c5b5 --- /dev/null +++ b/src/Dap.Protocol/Requests/classs1.cs @@ -0,0 +1,1496 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using OmniSharp.Extensions.Embedded.MediatR; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public static class RequestNames + { + public static string Initialize = "initialize"; + public static string ConfigurationDone = "configurationDone"; + public static string Launch = "launch"; + public static string Attach = "attach"; + public static string Restart = "restart"; + public static string Disconnect = "disconnect"; + public static string Terminate = "terminate"; + public static string SetBreakpoints = "setBreakpoints"; + public static string setFunctionBreakpoints = "setFunctionBreakpoints"; + public static string SetExceptionBreakpoints = "setExceptionBreakpoints"; + public static string DataBreakpointInfo = "dataBreakpointInfo"; + public static string SetDataBreakpoints = "setDataBreakpoints"; + public static string Continue = "continue"; + public static string Next = "next"; + public static string StepIn = "stepIn"; + public static string StepOut = "stepOut"; + public static string StepBack = "stepBack"; + public static string ReverseContinue = "reverseContinue"; + public static string RestartFrame = "restartFrame"; + public static string Goto = "goto"; + public static string Pause = "pause"; + public static string StackTrace = "stackTrace"; + public static string Scopes = "scopes"; + public static string Variables = "variables"; + public static string SetVariable = "setVariable"; + public static string Source = "source"; + + public static string Threads = "threads"; + public static string TerminateThreads = "terminateThreads"; + public static string Modules = "modules"; + public static string LoadedSources = "loadedSources"; + public static string Evaluate = "evaluate"; + public static string SetExpression = "setExpression"; + public static string StepInTargets = "stepInTargets"; + public static string GotoTargets = "gotoTargets"; + public static string Completions = "completions"; + public static string ExceptionInfo = "exceptionInfo"; + public static string ReadMemory = "readMemory"; + public static string Disassemble = "disassemble"; + } + + + [Parallel, Method(RequestNames.Initialize)] + public interface IInitializeHandler : IJsonRpcNotificationHandler { } + + public abstract class InitializeHandler : IInitializeHandler + { + public abstract Task Handle(InitializeRequestArguments request, CancellationToken cancellationToken); + } + + public static class InitializeHandlerExtensions + { + public static IDisposable OnPublishDiagnostics(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : InitializeHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(InitializeRequestArguments request, CancellationToken cancellationToken) => _handler.Invoke(request); + } + } + + Requests +:leftwards_arrow_with_hook: Initialize Request +The ‘initialize’ request is sent as the first request from the client to the debug adapter in order to configure it with client capabilities and to retrieve capabilities from the debug adapter. +Until the debug adapter has responded to with an ‘initialize’ response, the client must not send any additional requests or events to the debug adapter.In addition the debug adapter is not allowed to send any requests or events to the client until it has responded with an ‘initialize’ response. +The ‘initialize’ request may only be sent once. + +interface InitializeRequest extends Request + { +public static string initialize = "initialize"; + + arguments: InitializeRequestArguments; +} +Arguments for ‘initialize’ request. + + +interface InitializeRequestArguments +{ + /** + * The ID of the (frontend) client using this adapter. +*/ + clientID?: string; + +/** +* The human readable name of the (frontend) client using this adapter. +*/ +clientName?: string; + +/** +* The ID of the debug adapter. +*/ +adapterID: string; + +/** +* The ISO-639 locale of the (frontend) client using this adapter, e.g. en-US or de-CH. +*/ +locale?: string; + +/** +* If true all line numbers are 1-based (default). +*/ +linesStartAt1?: boolean; + +/** +* If true all column numbers are 1-based (default). +*/ +columnsStartAt1?: boolean; + +/** +* Determines in what format paths are specified. The default is 'path', which is the native format. +* Values: 'path', 'uri', etc. +*/ +pathFormat?: string; + +/** +* Client supports the optional type attribute for variables. +*/ +supportsVariableType?: boolean; + +/** +* Client supports the paging of variables. +*/ +supportsVariablePaging?: boolean; + +/** +* Client supports the runInTerminal request. +*/ +supportsRunInTerminalRequest?: boolean; + +/** +* Client supports memory references. +*/ +supportsMemoryReferences?: boolean; +} +Response to ‘initialize’ request. + + +interface InitializeResponse extends Response +{ + /** + * The capabilities of this debug adapter. +*/ + body?: Capabilities; +} +:leftwards_arrow_with_hook: ConfigurationDone Request +The client of the debug protocol must send this request at the end of the sequence of configuration requests (which was started by the ‘initialized’ event). + +interface ConfigurationDoneRequest extends Request +{ + + arguments?: ConfigurationDoneArguments; +} +Arguments for ‘configurationDone’ request. + + +interface ConfigurationDoneArguments +{ +} +Response to ‘configurationDone’ request.This is just an acknowledgement, so no body field is required. + + +interface ConfigurationDoneResponse extends Response +{ +} +:leftwards_arrow_with_hook: Launch Request +The launch request is sent from the client to the debug adapter to start the debuggee with or without debugging(if ‘noDebug’ is true). Since launching is debugger/runtime specific, the arguments for this request are not part of this specification. + +interface LaunchRequest extends Request +{ + + arguments: LaunchRequestArguments; +} +Arguments for ‘launch’ request.Additional attributes are implementation specific. + + +interface LaunchRequestArguments +{ + /** + * If noDebug is true the launch request should launch the program without enabling debugging. +*/ + noDebug?: boolean; + +/** +* Optional data from the previous, restarted session. +* The data is sent as the 'restart' attribute of the 'terminated' event. +* The client should leave the data intact. +*/ +__restart?: any; +} +Response to ‘launch’ request.This is just an acknowledgement, so no body field is required. + + +interface LaunchResponse extends Response +{ +} +:leftwards_arrow_with_hook: Attach Request +The attach request is sent from the client to the debug adapter to attach to a debuggee that is already running.Since attaching is debugger/runtime specific, the arguments for this request are not part of this specification. + +interface AttachRequest extends Request +{ + + arguments: AttachRequestArguments; +} +Arguments for ‘attach’ request.Additional attributes are implementation specific. + + +interface AttachRequestArguments +{ + /** + * Optional data from the previous, restarted session. + * The data is sent as the 'restart' attribute of the 'terminated' event. + * The client should leave the data intact. +*/ + __restart?: any; +} +Response to ‘attach’ request.This is just an acknowledgement, so no body field is required. + + +interface AttachResponse extends Response +{ +} +:leftwards_arrow_with_hook: Restart Request +Restarts a debug session.If the capability ‘supportsRestartRequest’ is missing or has the value false, + +the client will implement ‘restart’ by terminating the debug adapter first and then launching it anew. + +A debug adapter can override this default behaviour by implementing a restart request + +and setting the capability ‘supportsRestartRequest’ to true. + +interface RestartRequest extends Request +{ + + arguments?: RestartArguments; +} +Arguments for ‘restart’ request. + + +interface RestartArguments +{ +} +Response to ‘restart’ request.This is just an acknowledgement, so no body field is required. + + +interface RestartResponse extends Response +{ +} +:leftwards_arrow_with_hook: Disconnect Request +The ‘disconnect’ request is sent from the client to the debug adapter in order to stop debugging.It asks the debug adapter to disconnect from the debuggee and to terminate the debug adapter.If the debuggee has been started with the ‘launch’ request, the ‘disconnect’ request terminates the debuggee. If the ‘attach’ request was used to connect to the debuggee, ‘disconnect’ does not terminate the debuggee.This behavior can be controlled with the ‘terminateDebuggee’ argument (if supported by the debug adapter). + +interface DisconnectRequest extends Request +{ + + arguments?: DisconnectArguments; +} +Arguments for ‘disconnect’ request. + + +interface DisconnectArguments +{ + /** + * A value of true indicates that this 'disconnect' request is part of a restart sequence. +*/ + restart?: boolean; + +/** +* Indicates whether the debuggee should be terminated when the debugger is disconnected. +* If unspecified, the debug adapter is free to do whatever it thinks is best. +* A client can only rely on this attribute being properly honored if a debug adapter returns true for the 'supportTerminateDebuggee' capability. +*/ +terminateDebuggee?: boolean; +} +Response to ‘disconnect’ request.This is just an acknowledgement, so no body field is required. + + +interface DisconnectResponse extends Response +{ +} +:leftwards_arrow_with_hook: Terminate Request +The ‘terminate’ request is sent from the client to the debug adapter in order to give the debuggee a chance for terminating itself. + +interface TerminateRequest extends Request +{ + + arguments?: TerminateArguments; +} +Arguments for ‘terminate’ request. + + +interface TerminateArguments +{ + /** + * A value of true indicates that this 'terminate' request is part of a restart sequence. +*/ + restart?: boolean; +} +Response to ‘terminate’ request.This is just an acknowledgement, so no body field is required. + + +interface TerminateResponse extends Response +{ +} +:leftwards_arrow_with_hook: SetBreakpoints Request +Sets multiple breakpoints for a single source and clears all previous breakpoints in that source. + +To clear all breakpoint for a source, specify an empty array. + +When a breakpoint is hit, a ‘stopped’ event (with reason ‘breakpoint’) is generated. + +interface SetBreakpointsRequest extends Request +{ + + arguments: SetBreakpointsArguments; +} +Arguments for ‘setBreakpoints’ request. + + +interface SetBreakpointsArguments +{ + /** + * The source location of the breakpoints; either 'source.path' or 'source.reference' must be specified. +*/ + source: Source; + +/** +* The code locations of the breakpoints. +*/ +breakpoints?: SourceBreakpoint[]; + +/** +* Deprecated: The code locations of the breakpoints. +*/ +lines?: number[]; + +/** +* A value of true indicates that the underlying source has been modified which results in new breakpoint locations. +*/ +sourceModified?: boolean; +} +Response to ‘setBreakpoints’ request. + +Returned is information about each breakpoint created by this request. + +This includes the actual code location and whether the breakpoint could be verified. + +The breakpoints returned are in the same order as the elements of the ‘breakpoints’ + + +(or the deprecated ‘lines’) array in the arguments. + + +interface SetBreakpointsResponse extends Response +{ + body: { + /** + * Information about the breakpoints. The array elements are in the same order as the elements of the 'breakpoints' (or the deprecated 'lines') array in the arguments. +*/ + breakpoints: Breakpoint[]; + }; +} +:leftwards_arrow_with_hook: SetFunctionBreakpoints Request +Replaces all existing function breakpoints with new function breakpoints. + +To clear all function breakpoints, specify an empty array. + +When a function breakpoint is hit, a ‘stopped’ event (with reason ‘function breakpoint’) is generated. + +interface SetFunctionBreakpointsRequest extends Request +{ + + arguments: SetFunctionBreakpointsArguments; +} +Arguments for ‘setFunctionBreakpoints’ request. + + +interface SetFunctionBreakpointsArguments +{ + /** + * The function names of the breakpoints. +*/ + breakpoints: FunctionBreakpoint[]; +} +Response to ‘setFunctionBreakpoints’ request. + +Returned is information about each breakpoint created by this request. + + +interface SetFunctionBreakpointsResponse extends Response +{ + body: { + /** + * Information about the breakpoints. The array elements correspond to the elements of the 'breakpoints' array. +*/ + breakpoints: Breakpoint[]; + }; +} +:leftwards_arrow_with_hook: SetExceptionBreakpoints Request +The request configures the debuggers response to thrown exceptions.If an exception is configured to break, a ‘stopped’ event is fired (with reason ‘exception’). + +interface SetExceptionBreakpointsRequest extends Request +{ + + arguments: SetExceptionBreakpointsArguments; +} +Arguments for ‘setExceptionBreakpoints’ request. + + +interface SetExceptionBreakpointsArguments +{ + /** + * IDs of checked exception options. The set of IDs is returned via the 'exceptionBreakpointFilters' capability. +*/ + filters: string[]; + +/** +* Configuration options for selected exceptions. +*/ +exceptionOptions?: ExceptionOptions[]; +} +Response to ‘setExceptionBreakpoints’ request.This is just an acknowledgement, so no body field is required. + + +interface SetExceptionBreakpointsResponse extends Response +{ +} +:leftwards_arrow_with_hook: DataBreakpointInfo Request +Obtains information on a possible data breakpoint that could be set on an expression or variable. + +interface DataBreakpointInfoRequest extends Request +{ + + arguments: DataBreakpointInfoArguments; +} +Arguments for ‘dataBreakpointInfo’ request. + + +interface DataBreakpointInfoArguments +{ + /** + * Reference to the Variable container if the data breakpoint is requested for a child of the container. +*/ + variablesReference?: number; + +/** +* The name of the Variable's child to obtain data breakpoint information for. If variableReference isn’t provided, this can be an expression. +*/ +name: string; +} +Response to ‘dataBreakpointInfo’ request. + + +interface DataBreakpointInfoResponse extends Response +{ + body: { + /** + * An identifier for the data on which a data breakpoint can be registered with the setDataBreakpoints request or null if no data breakpoint is available. +*/ + dataId: string | null; + + /** + * UI string that describes on what data the breakpoint is set on or why a data breakpoint is not available. +*/ + description: string; + + /** + * Optional attribute listing the available access types for a potential data breakpoint. A UI frontend could surface this information. +*/ + accessTypes ?: DataBreakpointAccessType[]; + + /** + * Optional attribute indicating that a potential data breakpoint could be persisted across sessions. +*/ + canPersist ?: boolean; + }; +} +:leftwards_arrow_with_hook: SetDataBreakpoints Request +Replaces all existing data breakpoints with new data breakpoints. + +To clear all data breakpoints, specify an empty array. + +When a data breakpoint is hit, a ‘stopped’ event (with reason ‘data breakpoint’) is generated. + +interface SetDataBreakpointsRequest extends Request +{ + + arguments: SetDataBreakpointsArguments; +} +Arguments for ‘setDataBreakpoints’ request. + + +interface SetDataBreakpointsArguments +{ + /** + * The contents of this array replaces all existing data breakpoints. An empty array clears all data breakpoints. +*/ + breakpoints: DataBreakpoint[]; +} +Response to ‘setDataBreakpoints’ request. + +Returned is information about each breakpoint created by this request. + + +interface SetDataBreakpointsResponse extends Response +{ + body: { + /** + * Information about the data breakpoints. The array elements correspond to the elements of the input argument 'breakpoints' array. +*/ + breakpoints: Breakpoint[]; + }; +} +:leftwards_arrow_with_hook: Continue Request +The request starts the debuggee to run again. + +interface ContinueRequest extends Request +{ + + arguments: ContinueArguments; +} +Arguments for ‘continue’ request. + + +interface ContinueArguments +{ + /** + * Continue execution for the specified thread (if possible). If the backend cannot continue on a single thread but will continue on all threads, it should set the 'allThreadsContinued' attribute in the response to true. +*/ + threadId: number; +} +Response to ‘continue’ request. + + +interface ContinueResponse extends Response +{ + body: { + /** + * If true, the 'continue' request has ignored the specified thread and continued all threads instead. If this attribute is missing a value of 'true' is assumed for backward compatibility. +*/ + allThreadsContinued ?: boolean; + }; +} +:leftwards_arrow_with_hook: Next Request +The request starts the debuggee to run again for one step. + +The debug adapter first sends the response and then a ‘stopped’ event (with reason ‘step’) after the step has completed. + +interface NextRequest extends Request +{ + + arguments: NextArguments; +} +Arguments for ‘next’ request. + + +interface NextArguments +{ + /** + * Execute 'next' for this thread. +*/ + threadId: number; +} +Response to ‘next’ request.This is just an acknowledgement, so no body field is required. + + +interface NextResponse extends Response +{ +} +:leftwards_arrow_with_hook: StepIn Request +The request starts the debuggee to step into a function/method if possible. + +If it cannot step into a target, ‘stepIn’ behaves like ‘next’. + +The debug adapter first sends the response and then a ‘stopped’ event (with reason ‘step’) after the step has completed. + +If there are multiple function/method calls (or other targets) on the source line, + +the optional argument ‘targetId’ can be used to control into which target the ‘stepIn’ should occur. + +The list of possible targets for a given source line can be retrieved via the ‘stepInTargets’ request. + +interface StepInRequest extends Request +{ + + arguments: StepInArguments; +} +Arguments for ‘stepIn’ request. + + +interface StepInArguments { +/** +* Execute 'stepIn' for this thread. +*/ +threadId: number; + +/** +* Optional id of the target to step into. +*/ +targetId?: number; +} +Response to ‘stepIn’ request. This is just an acknowledgement, so no body field is required. + + +interface StepInResponse extends Response { +} +:leftwards_arrow_with_hook: StepOut Request +The request starts the debuggee to run again for one step. + +The debug adapter first sends the response and then a ‘stopped’ event (with reason ‘step’) after the step has completed. + +interface StepOutRequest extends Request { + +arguments: StepOutArguments; +} +Arguments for ‘stepOut’ request. + + +interface StepOutArguments { +/** +* Execute 'stepOut' for this thread. +*/ +threadId: number; +} +Response to ‘stepOut’ request. This is just an acknowledgement, so no body field is required. + + +interface StepOutResponse extends Response { +} +:leftwards_arrow_with_hook: StepBack Request +The request starts the debuggee to run one step backwards. + +The debug adapter first sends the response and then a ‘stopped’ event (with reason ‘step’) after the step has completed. Clients should only call this request if the capability ‘supportsStepBack’ is true. + +interface StepBackRequest extends Request { + +arguments: StepBackArguments; +} +Arguments for ‘stepBack’ request. + + +interface StepBackArguments { +/** +* Execute 'stepBack' for this thread. +*/ +threadId: number; +} +Response to ‘stepBack’ request. This is just an acknowledgement, so no body field is required. + + +interface StepBackResponse extends Response { +} +:leftwards_arrow_with_hook: ReverseContinue Request +The request starts the debuggee to run backward. Clients should only call this request if the capability ‘supportsStepBack’ is true. + +interface ReverseContinueRequest extends Request { + +arguments: ReverseContinueArguments; +} +Arguments for ‘reverseContinue’ request. + + +interface ReverseContinueArguments { +/** +* Execute 'reverseContinue' for this thread. +*/ +threadId: number; +} +Response to ‘reverseContinue’ request. This is just an acknowledgement, so no body field is required. + + +interface ReverseContinueResponse extends Response { +} +:leftwards_arrow_with_hook: RestartFrame Request +The request restarts execution of the specified stackframe. + +The debug adapter first sends the response and then a ‘stopped’ event (with reason ‘restart’) after the restart has completed. + +interface RestartFrameRequest extends Request { + +arguments: RestartFrameArguments; +} +Arguments for ‘restartFrame’ request. + + +interface RestartFrameArguments { +/** +* Restart this stackframe. +*/ +frameId: number; +} +Response to ‘restartFrame’ request. This is just an acknowledgement, so no body field is required. + + +interface RestartFrameResponse extends Response { +} +:leftwards_arrow_with_hook: Goto Request +The request sets the location where the debuggee will continue to run. + +This makes it possible to skip the execution of code or to executed code again. + +The code between the current location and the goto target is not executed but skipped. + +The debug adapter first sends the response and then a ‘stopped’ event with reason ‘goto’. + +interface GotoRequest extends Request { + +arguments: GotoArguments; +} +Arguments for ‘goto’ request. + + +interface GotoArguments { +/** +* Set the goto target for this thread. +*/ +threadId: number; + +/** +* The location where the debuggee will continue to run. +*/ +targetId: number; +} +Response to ‘goto’ request. This is just an acknowledgement, so no body field is required. + + +interface GotoResponse extends Response { +} +:leftwards_arrow_with_hook: Pause Request +The request suspenses the debuggee. + +The debug adapter first sends the response and then a ‘stopped’ event (with reason ‘pause’) after the thread has been paused successfully. + +interface PauseRequest extends Request { + +arguments: PauseArguments; +} +Arguments for ‘pause’ request. + + +interface PauseArguments { +/** +* Pause execution for this thread. +*/ +threadId: number; +} +Response to ‘pause’ request. This is just an acknowledgement, so no body field is required. + + +interface PauseResponse extends Response { +} +:leftwards_arrow_with_hook: StackTrace Request +The request returns a stacktrace from the current execution state. + +interface StackTraceRequest extends Request { + +arguments: StackTraceArguments; +} +Arguments for ‘stackTrace’ request. + + +interface StackTraceArguments { +/** +* Retrieve the stacktrace for this thread. +*/ +threadId: number; + +/** +* The index of the first frame to return; if omitted frames start at 0. +*/ +startFrame?: number; + +/** +* The maximum number of frames to return. If levels is not specified or 0, all frames are returned. +*/ +levels?: number; + +/** +* Specifies details on how to format the stack frames. +*/ +format?: StackFrameFormat; +} +Response to ‘stackTrace’ request. + + +interface StackTraceResponse extends Response { +body: { +/** +* The frames of the stackframe. If the array has length zero, there are no stackframes available. +* This means that there is no location information available. +*/ +stackFrames: StackFrame[]; + +/** +* The total number of frames available. +*/ +totalFrames?: number; +}; +} +:leftwards_arrow_with_hook: Scopes Request +The request returns the variable scopes for a given stackframe ID. + +interface ScopesRequest extends Request { + +arguments: ScopesArguments; +} +Arguments for ‘scopes’ request. + + +interface ScopesArguments { +/** +* Retrieve the scopes for this stackframe. +*/ +frameId: number; +} +Response to ‘scopes’ request. + + +interface ScopesResponse extends Response { +body: { +/** +* The scopes of the stackframe. If the array has length zero, there are no scopes available. +*/ +scopes: Scope[]; +}; +} +:leftwards_arrow_with_hook: Variables Request +Retrieves all child variables for the given variable reference. + +An optional filter can be used to limit the fetched children to either named or indexed children. + +interface VariablesRequest extends Request { + +arguments: VariablesArguments; +} +Arguments for ‘variables’ request. + + +interface VariablesArguments { +/** +* The Variable reference. +*/ +variablesReference: number; + +/** +* Optional filter to limit the child variables to either named or indexed. If ommited, both types are fetched. +*/ +filter?: 'indexed' | 'named'; + +/** +* The index of the first variable to return; if omitted children start at 0. +*/ +start?: number; + +/** +* The number of variables to return. If count is missing or 0, all variables are returned. +*/ +count?: number; + +/** +* Specifies details on how to format the Variable values. +*/ +format?: ValueFormat; +} +Response to ‘variables’ request. + + +interface VariablesResponse extends Response { +body: { +/** +* All (or a range) of variables for the given variable reference. +*/ +variables: Variable[]; +}; +} +:leftwards_arrow_with_hook: SetVariable Request +Set the variable with the given name in the variable container to a new value. + +interface SetVariableRequest extends Request { + +arguments: SetVariableArguments; +} +Arguments for ‘setVariable’ request. + + +interface SetVariableArguments { +/** +* The reference of the variable container. +*/ +variablesReference: number; + +/** +* The name of the variable in the container. +*/ +name: string; + +/** +* The value of the variable. +*/ +value: string; + +/** +* Specifies details on how to format the response value. +*/ +format?: ValueFormat; +} +Response to ‘setVariable’ request. + + +interface SetVariableResponse extends Response { +body: { +/** +* The new value of the variable. +*/ +value: string; + +/** +* The type of the new value. Typically shown in the UI when hovering over the value. +*/ +type?: string; + +/** +* If variablesReference is > 0, the new value is structured and its children can be retrieved by passing variablesReference to the VariablesRequest. +*/ +variablesReference?: number; + +/** +* The number of named child variables. +* The client can use this optional information to present the variables in a paged UI and fetch them in chunks. +*/ +namedVariables?: number; + +/** +* The number of indexed child variables. +* The client can use this optional information to present the variables in a paged UI and fetch them in chunks. +*/ +indexedVariables?: number; +}; +} +:leftwards_arrow_with_hook: Source Request +The request retrieves the source code for a given source reference. + +interface SourceRequest extends Request { +arguments: SourceArguments; +} +Arguments for ‘source’ request. + + +interface SourceArguments { +/** +* Specifies the source content to load. Either source.path or source.sourceReference must be specified. +*/ +source?: Source; + +/** +* The reference to the source. This is the same as source.sourceReference. This is provided for backward compatibility since old backends do not understand the 'source' attribute. +*/ +sourceReference: number; +} +Response to ‘source’ request. + + +interface SourceResponse extends Response { +body: { +/** +* Content of the source reference. +*/ +content: string; + +/** +* Optional content type (mime type) of the source. +*/ +mimeType?: string; +}; +} +:leftwards_arrow_with_hook: Threads Request +The request retrieves a list of all threads. + +interface ThreadsRequest extends Request { +} +Response to ‘threads’ request. + + +interface ThreadsResponse extends Response { +body: { +/** +* All threads. +*/ +threads: Thread[]; +}; +} +:leftwards_arrow_with_hook: TerminateThreads Request +The request terminates the threads with the given ids. + +interface TerminateThreadsRequest extends Request { + +arguments: TerminateThreadsArguments; +} +Arguments for ‘terminateThreads’ request. + + +interface TerminateThreadsArguments { +/** +* Ids of threads to be terminated. +*/ +threadIds?: number[]; +} +Response to ‘terminateThreads’ request. This is just an acknowledgement, so no body field is required. + + +interface TerminateThreadsResponse extends Response { +} +:leftwards_arrow_with_hook: Modules Request +Modules can be retrieved from the debug adapter with the ModulesRequest which can either return all modules or a range of modules to support paging. + +interface ModulesRequest extends Request { + +arguments: ModulesArguments; +} +Arguments for ‘modules’ request. + + +interface ModulesArguments { +/** +* The index of the first module to return; if omitted modules start at 0. +*/ +startModule?: number; + +/** +* The number of modules to return. If moduleCount is not specified or 0, all modules are returned. +*/ +moduleCount?: number; +} +Response to ‘modules’ request. + + +interface ModulesResponse extends Response { +body: { +/** +* All modules or range of modules. +*/ +modules: Module[]; + +/** +* The total number of modules available. +*/ +totalModules?: number; +}; +} +:leftwards_arrow_with_hook: LoadedSources Request +Retrieves the set of all sources currently loaded by the debugged process. + +interface LoadedSourcesRequest extends Request { + +arguments?: LoadedSourcesArguments; +} +Arguments for ‘loadedSources’ request. + + +interface LoadedSourcesArguments { +} +Response to ‘loadedSources’ request. + + +interface LoadedSourcesResponse extends Response { +body: { +/** +* Set of loaded sources. +*/ +sources: Source[]; +}; +} +:leftwards_arrow_with_hook: Evaluate Request +Evaluates the given expression in the context of the top most stack frame. + +The expression has access to any variables and arguments that are in scope. + +interface EvaluateRequest extends Request { + +arguments: EvaluateArguments; +} +Arguments for ‘evaluate’ request. + + +interface EvaluateArguments { +/** +* The expression to evaluate. +*/ +expression: string; + +/** +* Evaluate the expression in the scope of this stack frame. If not specified, the expression is evaluated in the global scope. +*/ +frameId?: number; + +/** +* The context in which the evaluate request is run. +* Values: +* 'watch': evaluate is run in a watch. +* 'repl': evaluate is run from REPL console. +* 'hover': evaluate is run from a data hover. +* etc. +*/ +context?: string; + +/** +* Specifies details on how to format the Evaluate result. +*/ +format?: ValueFormat; +} +Response to ‘evaluate’ request. + + +interface EvaluateResponse extends Response { +body: { +/** +* The result of the evaluate request. +*/ +result: string; + +/** +* The optional type of the evaluate result. +*/ +type?: string; + +/** +* Properties of a evaluate result that can be used to determine how to render the result in the UI. +*/ +presentationHint?: VariablePresentationHint; + +/** +* If variablesReference is > 0, the evaluate result is structured and its children can be retrieved by passing variablesReference to the VariablesRequest. +*/ +variablesReference: number; + +/** +* The number of named child variables. +* The client can use this optional information to present the variables in a paged UI and fetch them in chunks. +*/ +namedVariables?: number; + +/** +* The number of indexed child variables. +* The client can use this optional information to present the variables in a paged UI and fetch them in chunks. +*/ +indexedVariables?: number; + +/** +* Memory reference to a location appropriate for this result. For pointer type eval results, this is generally a reference to the memory address contained in the pointer. +*/ +memoryReference?: string; +}; +} +:leftwards_arrow_with_hook: SetExpression Request +Evaluates the given ‘value’ expression and assigns it to the ‘expression’ which must be a modifiable l-value. + +The expressions have access to any variables and arguments that are in scope of the specified frame. + +interface SetExpressionRequest extends Request { + +arguments: SetExpressionArguments; +} +Arguments for ‘setExpression’ request. + + +interface SetExpressionArguments { +/** +* The l-value expression to assign to. +*/ +expression: string; + +/** +* The value expression to assign to the l-value expression. +*/ +value: string; + +/** +* Evaluate the expressions in the scope of this stack frame. If not specified, the expressions are evaluated in the global scope. +*/ +frameId?: number; + +/** +* Specifies how the resulting value should be formatted. +*/ +format?: ValueFormat; +} +Response to ‘setExpression’ request. + + +interface SetExpressionResponse extends Response { +body: { +/** +* The new value of the expression. +*/ +value: string; + +/** +* The optional type of the value. +*/ +type?: string; + +/** +* Properties of a value that can be used to determine how to render the result in the UI. +*/ +presentationHint?: VariablePresentationHint; + +/** +* If variablesReference is > 0, the value is structured and its children can be retrieved by passing variablesReference to the VariablesRequest. +*/ +variablesReference?: number; + +/** +* The number of named child variables. +* The client can use this optional information to present the variables in a paged UI and fetch them in chunks. +*/ +namedVariables?: number; + +/** +* The number of indexed child variables. +* The client can use this optional information to present the variables in a paged UI and fetch them in chunks. +*/ +indexedVariables?: number; +}; +} +:leftwards_arrow_with_hook: StepInTargets Request +This request retrieves the possible stepIn targets for the specified stack frame. + +These targets can be used in the ‘stepIn’ request. + +The StepInTargets may only be called if the ‘supportsStepInTargetsRequest’ capability exists and is true. + +interface StepInTargetsRequest extends Request { + +arguments: StepInTargetsArguments; +} +Arguments for ‘stepInTargets’ request. + + +interface StepInTargetsArguments { +/** +* The stack frame for which to retrieve the possible stepIn targets. +*/ +frameId: number; +} +Response to ‘stepInTargets’ request. + + +interface StepInTargetsResponse extends Response { +body: { +/** +* The possible stepIn targets of the specified source location. +*/ +targets: StepInTarget[]; +}; +} +:leftwards_arrow_with_hook: GotoTargets Request +This request retrieves the possible goto targets for the specified source location. + +These targets can be used in the ‘goto’ request. + +The GotoTargets request may only be called if the ‘supportsGotoTargetsRequest’ capability exists and is true. + +interface GotoTargetsRequest extends Request { + +arguments: GotoTargetsArguments; +} +Arguments for ‘gotoTargets’ request. + + +interface GotoTargetsArguments { +/** +* The source location for which the goto targets are determined. +*/ +source: Source; + +/** +* The line location for which the goto targets are determined. +*/ +line: number; + +/** +* An optional column location for which the goto targets are determined. +*/ +column?: number; +} +Response to ‘gotoTargets’ request. + + +interface GotoTargetsResponse extends Response { +body: { +/** +* The possible goto targets of the specified location. +*/ +targets: GotoTarget[]; +}; +} +:leftwards_arrow_with_hook: Completions Request +Returns a list of possible completions for a given caret position and text. + +The CompletionsRequest may only be called if the ‘supportsCompletionsRequest’ capability exists and is true. + +interface CompletionsRequest extends Request { + +arguments: CompletionsArguments; +} +Arguments for ‘completions’ request. + + +interface CompletionsArguments { +/** +* Returns completions in the scope of this stack frame. If not specified, the completions are returned for the global scope. +*/ +frameId?: number; + +/** +* One or more source lines. Typically this is the text a user has typed into the debug console before he asked for completion. +*/ +text: string; + +/** +* The character position for which to determine the completion proposals. +*/ +column: number; + +/** +* An optional line for which to determine the completion proposals. If missing the first line of the text is assumed. +*/ +line?: number; +} +Response to ‘completions’ request. + + +interface CompletionsResponse extends Response { +body: { +/** +* The possible completions for . +*/ +targets: CompletionItem[]; +}; +} +:leftwards_arrow_with_hook: ExceptionInfo Request +Retrieves the details of the exception that caused this event to be raised. + +interface ExceptionInfoRequest extends Request { + +arguments: ExceptionInfoArguments; +} +Arguments for ‘exceptionInfo’ request. + + +interface ExceptionInfoArguments { +/** +* Thread for which exception information should be retrieved. +*/ +threadId: number; +} +Response to ‘exceptionInfo’ request. + + +interface ExceptionInfoResponse extends Response { +body: { +/** +* ID of the exception that was thrown. +*/ +exceptionId: string; + +/** +* Descriptive text for the exception provided by the debug adapter. +*/ +description?: string; + +/** +* Mode that caused the exception notification to be raised. +*/ +breakMode: ExceptionBreakMode; + +/** +* Detailed information about the exception. +*/ +details?: ExceptionDetails; +}; +} +:leftwards_arrow_with_hook: ReadMemory Request +Reads bytes from memory at the provided location. + +interface ReadMemoryRequest extends Request { + +arguments: ReadMemoryArguments; +} +Arguments for ‘readMemory’ request. + + +interface ReadMemoryArguments { +/** +* Memory reference to the base location from which data should be read. +*/ +memoryReference: string; + +/** +* Optional offset (in bytes) to be applied to the reference location before reading data. Can be negative. +*/ +offset?: number; + +/** +* Number of bytes to read at the specified location and offset. +*/ +count: number; +} +Response to ‘readMemory’ request. + + +interface ReadMemoryResponse extends Response { +body?: { +/** +* The address of the first byte of data returned. Treated as a hex value if prefixed with '0x', or as a decimal value otherwise. +*/ +address: string; + +/** +* The number of unreadable bytes encountered after the last successfully read byte. This can be used to determine the number of bytes that must be skipped before a subsequent 'readMemory' request will succeed. +*/ +unreadableBytes?: number; + +/** +* The bytes read from memory, encoded using base64. +*/ +data?: string; +}; +} +:leftwards_arrow_with_hook: Disassemble Request +Disassembles code stored at the provided location. + +interface DisassembleRequest extends Request { + +arguments: DisassembleArguments; +} +Arguments for ‘disassemble’ request. + + +interface DisassembleArguments { +/** +* Memory reference to the base location containing the instructions to disassemble. +*/ +memoryReference: string; + +/** +* Optional offset (in bytes) to be applied to the reference location before disassembling. Can be negative. +*/ +offset?: number; + +/** +* Optional offset (in instructions) to be applied after the byte offset (if any) before disassembling. Can be negative. +*/ +instructionOffset?: number; + +/** +* Number of instructions to disassemble starting at the specified location and offset. An adapter must return exactly this number of instructions - any unavailable instructions should be replaced with an implementation-defined 'invalid instruction' value. +*/ +instructionCount: number; + +/** +* If true, the adapter should attempt to resolve memory addresses and other values to symbolic names. +*/ +resolveSymbols?: boolean; +} +Response to ‘disassemble’ request. + + +interface DisassembleResponse extends Response { +body?: { +/** +* The list of disassembled instructions. +*/ +instructions: DisassembledInstruction[]; +}; +} + +} diff --git a/src/Dap.Protocol/Serialization/ContractResolver.cs b/src/Dap.Protocol/Serialization/ContractResolver.cs new file mode 100644 index 000000000..5fa29efbe --- /dev/null +++ b/src/Dap.Protocol/Serialization/ContractResolver.cs @@ -0,0 +1,28 @@ +using System.Linq; +using System.Reflection; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Serialization +{ + class ContractResolver : DefaultContractResolver + { + public ContractResolver() + { + NamingStrategy = new CamelCaseNamingStrategy(true, false, true); + } + + protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization) + { + var property = base.CreateProperty(member, memberSerialization); + if (member.GetCustomAttributes().Any() + || property.DeclaringType.Name.EndsWith("Capabilities") + ) + { + property.NullValueHandling = NullValueHandling.Ignore; + } + + return property; + } + } +} diff --git a/src/Dap.Protocol/Serialization/ISerializer.cs b/src/Dap.Protocol/Serialization/ISerializer.cs new file mode 100644 index 000000000..2b6629b21 --- /dev/null +++ b/src/Dap.Protocol/Serialization/ISerializer.cs @@ -0,0 +1,4 @@ +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Serialization +{ + public interface ISerializer : OmniSharp.Extensions.JsonRpc.ISerializer{} +} diff --git a/src/Dap.Protocol/Serialization/OptionalAttribute.cs b/src/Dap.Protocol/Serialization/OptionalAttribute.cs new file mode 100644 index 000000000..c2f01b84b --- /dev/null +++ b/src/Dap.Protocol/Serialization/OptionalAttribute.cs @@ -0,0 +1,35 @@ +using System; +using Newtonsoft.Json; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Serialization +{ + [AttributeUsage(AttributeTargets.Property)] + class OptionalAttribute : Attribute { } + + class NumberStringConverter : JsonConverter + { + public override void WriteJson(JsonWriter writer, NumberString value, JsonSerializer serializer) + { + if (value.IsLong) serializer.Serialize(writer, value.Long); + else if (value.IsString) serializer.Serialize(writer, value.String); + else writer.WriteNull(); + } + + public override NumberString ReadJson(JsonReader reader, Type objectType, NumberString existingValue, bool hasExistingValue, JsonSerializer serializer) + { + if (reader.TokenType == JsonToken.Integer) + { + return new NumberString((long)reader.Value); + } + + if (reader.TokenType == JsonToken.String) + { + return new NumberString((string)reader.Value); + } + + return new NumberString(); + } + + public override bool CanRead => true; + } +} diff --git a/src/Dap.Protocol/Serialization/Serializer.cs b/src/Dap.Protocol/Serialization/Serializer.cs new file mode 100644 index 000000000..5af9708a1 --- /dev/null +++ b/src/Dap.Protocol/Serialization/Serializer.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Threading; +using Newtonsoft.Json; +using OmniSharp.Extensions.JsonRpc.Serialization; +using OmniSharp.Extensions.JsonRpc.Serialization.Converters; +using OmniSharp.Extensions.JsonRpc.Serialization.DebugAdapterConverters; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Serialization +{ + public class DapProtocolSerializer : DapSerializer + { + protected override void AddOrReplaceConverters(ICollection converters) + { + ReplaceConverter(converters, new NumberStringConverter()); + base.AddOrReplaceConverters(converters); + } + + protected override JsonSerializer CreateSerializer() + { + var serializer = base.CreateSerializer(); + serializer.ContractResolver = new ContractResolver(); + return serializer; + } + + protected override JsonSerializerSettings CreateSerializerSettings() + { + var settings = base.CreateSerializerSettings(); + settings.ContractResolver = new ContractResolver(); + return settings; + } + } +} diff --git a/src/JsonRpc/Serialization/SerializerBase.cs b/src/JsonRpc/Serialization/SerializerBase.cs index 29801fa43..cdb584a66 100644 --- a/src/JsonRpc/Serialization/SerializerBase.cs +++ b/src/JsonRpc/Serialization/SerializerBase.cs @@ -9,24 +9,19 @@ namespace OmniSharp.Extensions.JsonRpc.Serialization public abstract class SerializerBase : ISerializer { private long _id = 0; - public SerializerBase() - { - JsonSerializer = CreateSerializer(); - Settings = CreateSerializerSettings(); - } - protected JsonSerializer CreateSerializer() + protected virtual JsonSerializer CreateSerializer() { var serializer = JsonSerializer.CreateDefault(); AddOrReplaceConverters(serializer.Converters); - return serializer; + return _jsonSerializer = serializer; } - protected JsonSerializerSettings CreateSerializerSettings() + protected virtual JsonSerializerSettings CreateSerializerSettings() { var settings = JsonConvert.DefaultSettings != null ? JsonConvert.DefaultSettings() : new JsonSerializerSettings(); AddOrReplaceConverters(settings.Converters); - return settings; + return _settings = settings; } protected internal static void ReplaceConverter(ICollection converters, T item) @@ -41,9 +36,12 @@ protected internal static void ReplaceConverter(ICollection co converters.Add(item); } - public JsonSerializer JsonSerializer { get; } + private JsonSerializer _jsonSerializer; + public JsonSerializer JsonSerializer => _jsonSerializer ?? ( CreateSerializer() ); + - public JsonSerializerSettings Settings { get; } + private JsonSerializerSettings _settings; + public JsonSerializerSettings Settings => _settings ?? ( CreateSerializerSettings() ); public string SerializeObject(object value) { diff --git a/src/Protocol/Serialization/Serializer.cs b/src/Protocol/Serialization/Serializer.cs index d048b6e4b..13136c5c1 100644 --- a/src/Protocol/Serialization/Serializer.cs +++ b/src/Protocol/Serialization/Serializer.cs @@ -4,6 +4,7 @@ using System.Threading; using Newtonsoft.Json; using OmniSharp.Extensions.JsonRpc; +using OmniSharp.Extensions.JsonRpc.Serialization; using OmniSharp.Extensions.JsonRpc.Serialization.Converters; using OmniSharp.Extensions.LanguageServer.Protocol.Client.Capabilities; using OmniSharp.Extensions.LanguageServer.Protocol.Models; @@ -11,9 +12,8 @@ namespace OmniSharp.Extensions.LanguageServer.Protocol.Serialization { - public class Serializer : ISerializer + public class Serializer : JsonRpcSerializer { - private long _id; private static readonly CompletionItemKind[] DefaultCompletionItemKinds = Enum.GetValues(typeof(CompletionItemKind)) .Cast() .Where(x => x < CompletionItemKind.Folder) @@ -24,41 +24,39 @@ public class Serializer : ISerializer .Where(x => x < SymbolKind.Key) .ToArray(); + public ClientVersion ClientVersion { get; private set; } + public static Serializer Instance { get; } = new Serializer(); public Serializer() : this(ClientVersion.Lsp3) { } public Serializer(ClientVersion clientVersion) { - JsonSerializer = CreateSerializer(clientVersion); - Settings = CreateSerializerSettings(clientVersion); + ClientVersion = clientVersion; } - private static JsonSerializer CreateSerializer(ClientVersion version) + + protected override JsonSerializer CreateSerializer() { - var serializer = JsonSerializer.CreateDefault(); + var serializer = base.CreateSerializer(); serializer.ContractResolver = new ContractResolver( DefaultCompletionItemKinds, DefaultSymbolKinds, DefaultSymbolKinds ); - AddOrReplaceConverters(serializer.Converters, version); - return serializer; } - private static JsonSerializerSettings CreateSerializerSettings(ClientVersion version) + protected override JsonSerializerSettings CreateSerializerSettings() { - var settings = JsonConvert.DefaultSettings != null ? JsonConvert.DefaultSettings() : new JsonSerializerSettings(); + var settings = base.CreateSerializerSettings(); settings.ContractResolver = new ContractResolver( DefaultCompletionItemKinds, DefaultSymbolKinds, DefaultSymbolKinds ); - AddOrReplaceConverters(settings.Converters, version); - return settings; } - private static void AddOrReplaceConverters(ICollection converters, ClientVersion version) + protected override void AddOrReplaceConverters(ICollection converters) { ReplaceConverter(converters, new SupportsConverter()); ReplaceConverter(converters, new CompletionListConverter()); @@ -78,47 +76,10 @@ private static void AddOrReplaceConverters(ICollection converters ReplaceConverter(converters, new WorkspaceEditDocumentChangeConverter()); ReplaceConverter(converters, new ParameterInformationLabelConverter()); ReplaceConverter(converters, new ValueTupleContractResolver()); - - - ReplaceConverter(converters, new ClientNotificationConverter()); - ReplaceConverter(converters, new ClientResponseConverter()); - ReplaceConverter(converters, new ClientRequestConverter()); - ReplaceConverter(converters, new RpcErrorConverter()); - ReplaceConverter(converters, new ErrorMessageConverter()); - } - - private static void ReplaceConverter(ICollection converters, T item) - where T : JsonConverter - { - var existingConverters = converters.OfType().ToArray(); - if (existingConverters.Any()) - { - foreach (var converter in existingConverters) - converters.Remove(converter); - } - converters.Add(item); - } - - public JsonSerializer JsonSerializer { get; } - - public JsonSerializerSettings Settings { get; } - - public string SerializeObject(object value) - { - return JsonConvert.SerializeObject(value, Settings); - } - - public object DeserializeObject(string json, Type type) - { - return JsonConvert.DeserializeObject(json, type, Settings); - } - - public T DeserializeObject(string json) - { - return JsonConvert.DeserializeObject(json, Settings); + base.AddOrReplaceConverters(converters); } - public void SetClientCapabilities(ClientVersion clientVersion, ClientCapabilities clientCapabilities) + public void SetClientCapabilities(ClientCapabilities clientCapabilities) { var completionItemKinds = DefaultCompletionItemKinds; var documentSymbolKinds = DefaultSymbolKinds; @@ -155,23 +116,19 @@ public void SetClientCapabilities(ClientVersion clientVersion, ClientCapabilitie } - AddOrReplaceConverters(Settings.Converters, clientVersion); + AddOrReplaceConverters(Settings.Converters); Settings.ContractResolver = new ContractResolver( completionItemKinds, documentSymbolKinds, workspaceSymbolKinds ); - AddOrReplaceConverters(JsonSerializer.Converters, clientVersion); + AddOrReplaceConverters(JsonSerializer.Converters); JsonSerializer.ContractResolver = new ContractResolver( completionItemKinds, documentSymbolKinds, workspaceSymbolKinds ); } - public long GetNextId() - { - return Interlocked.Increment(ref _id); - } } } From 0fc39390f1e625bae8ff7a7af36600af5d8a9387 Mon Sep 17 00:00:00 2001 From: David Driscoll Date: Sat, 20 Jul 2019 12:50:45 -0400 Subject: [PATCH 07/20] Added DAP models, requests and events --- src/Dap.Protocol/Events/BreakpointEvent.cs | 20 + src/Dap.Protocol/Events/CapabilitiesEvent.cs | 14 + src/Dap.Protocol/Events/ContinuedEvent.cs | 21 + src/Dap.Protocol/Events/EventNames.cs | 24 + src/Dap.Protocol/Events/ExitedEvent.cs | 14 + src/Dap.Protocol/Events/IBreakpointHandler.cs | 35 + .../Events/ICapabilitiesHandler.cs | 35 + src/Dap.Protocol/Events/IContinuedHandler.cs | 35 + src/Dap.Protocol/Events/IExitedHandler.cs | 36 + .../Events/IInitializedHandler.cs | 35 + .../Events/ILoadedSourceHandler.cs | 35 + src/Dap.Protocol/Events/IModuleHandler.cs | 35 + src/Dap.Protocol/Events/IOutputHandler.cs | 35 + src/Dap.Protocol/Events/IProcessHandler.cs | 35 + src/Dap.Protocol/Events/IStoppedHandler.cs | 36 + src/Dap.Protocol/Events/ITerminatedHandler.cs | 35 + src/Dap.Protocol/Events/InitializedEvent.cs | 9 + src/Dap.Protocol/Events/LoadedSourceEvent.cs | 19 + src/Dap.Protocol/Events/LoadedSourceReason.cs | 12 + src/Dap.Protocol/Events/ModuleEvent.cs | 19 + src/Dap.Protocol/Events/ModuleEventReason.cs | 12 + src/Dap.Protocol/Events/OutputEvent.cs | 46 + src/Dap.Protocol/Events/ProcessEvent.cs | 38 + .../Events/ProcessEventStartMethod.cs | 8 + src/Dap.Protocol/Events/StoppedEvent.cs | 43 + src/Dap.Protocol/Events/TerminatedEvent.cs | 17 + src/Dap.Protocol/Events/ThreadEvent.cs | 20 + src/Dap.Protocol/Events/classs1.cs | 10 - .../Requests/AttachRequestArguments.cs | 18 + src/Dap.Protocol/Requests/AttachResponse.cs | 7 + .../Requests/CompletionsArguments.cs | 29 + .../Requests/CompletionsResponse.cs | 11 + .../Requests/ConfigurationDoneArguments.cs | 9 + .../Requests/ConfigurationDoneResponse.cs | 7 + .../Requests/ContinueArguments.cs | 13 + src/Dap.Protocol/Requests/ContinueResponse.cs | 13 + .../Requests/DataBreakpointInfoArguments.cs | 19 + .../Requests/DataBreakpointInfoResponse.cs | 28 + .../Requests/DisassembleArguments.cs | 35 + .../Requests/DisassembleResponse.cs | 11 + .../Requests/DisconnectArguments.cs | 21 + .../Requests/DisconnectResponse.cs | 7 + .../Requests/EvaluateArguments.cs | 34 + src/Dap.Protocol/Requests/EvaluateResponse.cs | 45 + .../Requests/ExceptionInfoArguments.cs | 13 + .../Requests/ExceptionInfoResponse.cs | 28 + src/Dap.Protocol/Requests/GotoArguments.cs | 18 + src/Dap.Protocol/Requests/GotoResponse.cs | 7 + .../Requests/GotoTargetsArguments.cs | 24 + .../Requests/GotoTargetsResponse.cs | 14 + src/Dap.Protocol/Requests/IAttachHandler.cs | 35 + .../Requests/ICompletionsHandler.cs | 36 + .../Requests/IConfigurationDoneHandler.cs | 35 + src/Dap.Protocol/Requests/IContinueHandler.cs | 35 + .../Requests/IDataBreakpointInfoHandler.cs | 35 + .../Requests/IDebugAdapterClient.cs | 7 + .../Requests/IDebugAdapterRegistry.cs | 7 + .../Requests/IDisassembleHandler.cs | 36 + .../Requests/IDisconnectHandler.cs | 35 + src/Dap.Protocol/Requests/IEvaluateHandler.cs | 36 + .../Requests/IExceptionInfoHandler.cs | 36 + src/Dap.Protocol/Requests/IGotoHandler.cs | 35 + .../Requests/IGotoTargetsHandler.cs | 36 + .../Requests/IInitializeHandler.cs | 35 + src/Dap.Protocol/Requests/ILaunchHandler.cs | 35 + .../Requests/ILoadedSourcesHandler.cs | 35 + src/Dap.Protocol/Requests/IModulesHandler.cs | 35 + src/Dap.Protocol/Requests/INextHandler.cs | 35 + src/Dap.Protocol/Requests/IPauseHandler.cs | 35 + .../Requests/IReadMemoryHandler.cs | 36 + .../Requests/IRestartFrameHandler.cs | 35 + src/Dap.Protocol/Requests/IRestartHandler.cs | 35 + .../Requests/IReverseContinueHandler.cs | 35 + src/Dap.Protocol/Requests/IScopesHandler.cs | 35 + .../Requests/ISetBreakpointsHandler.cs | 35 + .../Requests/ISetDataBreakpointsHandler.cs | 35 + .../ISetExceptionBreakpointsHandler.cs | 35 + .../Requests/ISetExpressionHandler.cs | 35 + .../ISetFunctionBreakpointsHandler.cs | 35 + .../Requests/ISetVariableHandler.cs | 35 + src/Dap.Protocol/Requests/ISourceHandler.cs | 35 + .../Requests/IStackTraceHandler.cs | 35 + src/Dap.Protocol/Requests/IStepBackHandler.cs | 35 + src/Dap.Protocol/Requests/IStepInHandler.cs | 35 + .../Requests/IStepInTargetsHandler.cs | 35 + src/Dap.Protocol/Requests/IStepOutHandler.cs | 35 + .../Requests/ITerminateHandler.cs | 35 + .../Requests/ITerminateThreadsHandler.cs | 35 + src/Dap.Protocol/Requests/IThreadsHandler.cs | 35 + .../Requests/IVariablesHandler.cs | 35 + .../Requests/InitializeRequestArguments.cs | 69 + .../Requests/InitializeResponse.cs | 13 + .../Requests/LaunchRequestArguments.cs | 23 + src/Dap.Protocol/Requests/LaunchResponse.cs | 7 + .../Requests/LoadedSourcesArguments.cs | 9 + .../Requests/LoadedSourcesResponse.cs | 11 + src/Dap.Protocol/Requests/ModulesArguments.cs | 19 + src/Dap.Protocol/Requests/ModulesResponse.cs | 18 + src/Dap.Protocol/Requests/NextArguments.cs | 13 + src/Dap.Protocol/Requests/NextResponse.cs | 7 + src/Dap.Protocol/Requests/PauseArguments.cs | 13 + src/Dap.Protocol/Requests/PauseResponse.cs | 7 + .../Requests/ReadMemoryArguments.cs | 25 + .../Requests/ReadMemoryResponse.cs | 23 + src/Dap.Protocol/Requests/RequestNames.cs | 47 + src/Dap.Protocol/Requests/RestartArguments.cs | 9 + .../Requests/RestartFrameArguments.cs | 13 + .../Requests/RestartFrameResponse.cs | 7 + src/Dap.Protocol/Requests/RestartResponse.cs | 7 + .../Requests/ReverseContinueArguments.cs | 13 + .../Requests/ReverseContinueResponse.cs | 7 + .../Requests/RunInTerminalArguments.cs | 50 + .../Requests/RunInTerminalArgumentsKind.cs | 13 + .../Requests/RunInTerminalExtensions.cs | 13 + .../Requests/RunInTerminalResponse.cs | 18 + src/Dap.Protocol/Requests/ScopesArguments.cs | 13 + src/Dap.Protocol/Requests/ScopesResponse.cs | 11 + .../Requests/SetBreakpointsArguments.cs | 31 + .../Requests/SetBreakpointsResponse.cs | 11 + .../Requests/SetDataBreakpointsArguments.cs | 13 + .../Requests/SetDataBreakpointsResponse.cs | 11 + .../SetExceptionBreakpointsArguments.cs | 19 + .../SetExceptionBreakpointsResponse.cs | 7 + .../Requests/SetExpressionArguments.cs | 29 + .../Requests/SetExpressionResponse.cs | 40 + .../SetFunctionBreakpointsArguments.cs | 13 + .../SetFunctionBreakpointsResponse.cs | 11 + .../Requests/SetVariableArguments.cs | 29 + .../Requests/SetVariableResponse.cs | 35 + src/Dap.Protocol/Requests/SourceArguments.cs | 19 + src/Dap.Protocol/Requests/SourceResponse.cs | 18 + .../Requests/StackTraceArguments.cs | 29 + .../Requests/StackTraceResponse.cs | 20 + .../Requests/StepBackArguments.cs | 13 + src/Dap.Protocol/Requests/StepBackResponse.cs | 7 + src/Dap.Protocol/Requests/StepInArguments.cs | 19 + src/Dap.Protocol/Requests/StepInResponse.cs | 7 + .../Requests/StepInTargetsArguments.cs | 13 + .../Requests/StepInTargetsResponse.cs | 11 + src/Dap.Protocol/Requests/StepOutArguments.cs | 13 + src/Dap.Protocol/Requests/StepOutResponse.cs | 7 + .../Requests/TerminateArguments.cs | 14 + .../Requests/TerminateResponse.cs | 7 + .../Requests/TerminateThreadsArguments.cs | 14 + .../Requests/TerminateThreadsResponse.cs | 7 + src/Dap.Protocol/Requests/ThreadsArguments.cs | 9 + src/Dap.Protocol/Requests/ThreadsResponse.cs | 11 + .../Requests/VariablesArguments.cs | 34 + .../Requests/VariablesArgumentsFilter.cs | 12 + .../Requests/VariablesResponse.cs | 11 + src/Dap.Protocol/Requests/classs1.cs | 1496 ----------------- src/Protocol/Serialization/Serializer.cs | 4 +- 152 files changed, 3508 insertions(+), 1508 deletions(-) create mode 100644 src/Dap.Protocol/Events/BreakpointEvent.cs create mode 100644 src/Dap.Protocol/Events/CapabilitiesEvent.cs create mode 100644 src/Dap.Protocol/Events/ContinuedEvent.cs create mode 100644 src/Dap.Protocol/Events/EventNames.cs create mode 100644 src/Dap.Protocol/Events/ExitedEvent.cs create mode 100644 src/Dap.Protocol/Events/IBreakpointHandler.cs create mode 100644 src/Dap.Protocol/Events/ICapabilitiesHandler.cs create mode 100644 src/Dap.Protocol/Events/IContinuedHandler.cs create mode 100644 src/Dap.Protocol/Events/IExitedHandler.cs create mode 100644 src/Dap.Protocol/Events/IInitializedHandler.cs create mode 100644 src/Dap.Protocol/Events/ILoadedSourceHandler.cs create mode 100644 src/Dap.Protocol/Events/IModuleHandler.cs create mode 100644 src/Dap.Protocol/Events/IOutputHandler.cs create mode 100644 src/Dap.Protocol/Events/IProcessHandler.cs create mode 100644 src/Dap.Protocol/Events/IStoppedHandler.cs create mode 100644 src/Dap.Protocol/Events/ITerminatedHandler.cs create mode 100644 src/Dap.Protocol/Events/InitializedEvent.cs create mode 100644 src/Dap.Protocol/Events/LoadedSourceEvent.cs create mode 100644 src/Dap.Protocol/Events/LoadedSourceReason.cs create mode 100644 src/Dap.Protocol/Events/ModuleEvent.cs create mode 100644 src/Dap.Protocol/Events/ModuleEventReason.cs create mode 100644 src/Dap.Protocol/Events/OutputEvent.cs create mode 100644 src/Dap.Protocol/Events/ProcessEvent.cs create mode 100644 src/Dap.Protocol/Events/ProcessEventStartMethod.cs create mode 100644 src/Dap.Protocol/Events/StoppedEvent.cs create mode 100644 src/Dap.Protocol/Events/TerminatedEvent.cs create mode 100644 src/Dap.Protocol/Events/ThreadEvent.cs delete mode 100644 src/Dap.Protocol/Events/classs1.cs create mode 100644 src/Dap.Protocol/Requests/AttachRequestArguments.cs create mode 100644 src/Dap.Protocol/Requests/AttachResponse.cs create mode 100644 src/Dap.Protocol/Requests/CompletionsArguments.cs create mode 100644 src/Dap.Protocol/Requests/CompletionsResponse.cs create mode 100644 src/Dap.Protocol/Requests/ConfigurationDoneArguments.cs create mode 100644 src/Dap.Protocol/Requests/ConfigurationDoneResponse.cs create mode 100644 src/Dap.Protocol/Requests/ContinueArguments.cs create mode 100644 src/Dap.Protocol/Requests/ContinueResponse.cs create mode 100644 src/Dap.Protocol/Requests/DataBreakpointInfoArguments.cs create mode 100644 src/Dap.Protocol/Requests/DataBreakpointInfoResponse.cs create mode 100644 src/Dap.Protocol/Requests/DisassembleArguments.cs create mode 100644 src/Dap.Protocol/Requests/DisassembleResponse.cs create mode 100644 src/Dap.Protocol/Requests/DisconnectArguments.cs create mode 100644 src/Dap.Protocol/Requests/DisconnectResponse.cs create mode 100644 src/Dap.Protocol/Requests/EvaluateArguments.cs create mode 100644 src/Dap.Protocol/Requests/EvaluateResponse.cs create mode 100644 src/Dap.Protocol/Requests/ExceptionInfoArguments.cs create mode 100644 src/Dap.Protocol/Requests/ExceptionInfoResponse.cs create mode 100644 src/Dap.Protocol/Requests/GotoArguments.cs create mode 100644 src/Dap.Protocol/Requests/GotoResponse.cs create mode 100644 src/Dap.Protocol/Requests/GotoTargetsArguments.cs create mode 100644 src/Dap.Protocol/Requests/GotoTargetsResponse.cs create mode 100644 src/Dap.Protocol/Requests/IAttachHandler.cs create mode 100644 src/Dap.Protocol/Requests/ICompletionsHandler.cs create mode 100644 src/Dap.Protocol/Requests/IConfigurationDoneHandler.cs create mode 100644 src/Dap.Protocol/Requests/IContinueHandler.cs create mode 100644 src/Dap.Protocol/Requests/IDataBreakpointInfoHandler.cs create mode 100644 src/Dap.Protocol/Requests/IDebugAdapterClient.cs create mode 100644 src/Dap.Protocol/Requests/IDebugAdapterRegistry.cs create mode 100644 src/Dap.Protocol/Requests/IDisassembleHandler.cs create mode 100644 src/Dap.Protocol/Requests/IDisconnectHandler.cs create mode 100644 src/Dap.Protocol/Requests/IEvaluateHandler.cs create mode 100644 src/Dap.Protocol/Requests/IExceptionInfoHandler.cs create mode 100644 src/Dap.Protocol/Requests/IGotoHandler.cs create mode 100644 src/Dap.Protocol/Requests/IGotoTargetsHandler.cs create mode 100644 src/Dap.Protocol/Requests/IInitializeHandler.cs create mode 100644 src/Dap.Protocol/Requests/ILaunchHandler.cs create mode 100644 src/Dap.Protocol/Requests/ILoadedSourcesHandler.cs create mode 100644 src/Dap.Protocol/Requests/IModulesHandler.cs create mode 100644 src/Dap.Protocol/Requests/INextHandler.cs create mode 100644 src/Dap.Protocol/Requests/IPauseHandler.cs create mode 100644 src/Dap.Protocol/Requests/IReadMemoryHandler.cs create mode 100644 src/Dap.Protocol/Requests/IRestartFrameHandler.cs create mode 100644 src/Dap.Protocol/Requests/IRestartHandler.cs create mode 100644 src/Dap.Protocol/Requests/IReverseContinueHandler.cs create mode 100644 src/Dap.Protocol/Requests/IScopesHandler.cs create mode 100644 src/Dap.Protocol/Requests/ISetBreakpointsHandler.cs create mode 100644 src/Dap.Protocol/Requests/ISetDataBreakpointsHandler.cs create mode 100644 src/Dap.Protocol/Requests/ISetExceptionBreakpointsHandler.cs create mode 100644 src/Dap.Protocol/Requests/ISetExpressionHandler.cs create mode 100644 src/Dap.Protocol/Requests/ISetFunctionBreakpointsHandler.cs create mode 100644 src/Dap.Protocol/Requests/ISetVariableHandler.cs create mode 100644 src/Dap.Protocol/Requests/ISourceHandler.cs create mode 100644 src/Dap.Protocol/Requests/IStackTraceHandler.cs create mode 100644 src/Dap.Protocol/Requests/IStepBackHandler.cs create mode 100644 src/Dap.Protocol/Requests/IStepInHandler.cs create mode 100644 src/Dap.Protocol/Requests/IStepInTargetsHandler.cs create mode 100644 src/Dap.Protocol/Requests/IStepOutHandler.cs create mode 100644 src/Dap.Protocol/Requests/ITerminateHandler.cs create mode 100644 src/Dap.Protocol/Requests/ITerminateThreadsHandler.cs create mode 100644 src/Dap.Protocol/Requests/IThreadsHandler.cs create mode 100644 src/Dap.Protocol/Requests/IVariablesHandler.cs create mode 100644 src/Dap.Protocol/Requests/InitializeRequestArguments.cs create mode 100644 src/Dap.Protocol/Requests/InitializeResponse.cs create mode 100644 src/Dap.Protocol/Requests/LaunchRequestArguments.cs create mode 100644 src/Dap.Protocol/Requests/LaunchResponse.cs create mode 100644 src/Dap.Protocol/Requests/LoadedSourcesArguments.cs create mode 100644 src/Dap.Protocol/Requests/LoadedSourcesResponse.cs create mode 100644 src/Dap.Protocol/Requests/ModulesArguments.cs create mode 100644 src/Dap.Protocol/Requests/ModulesResponse.cs create mode 100644 src/Dap.Protocol/Requests/NextArguments.cs create mode 100644 src/Dap.Protocol/Requests/NextResponse.cs create mode 100644 src/Dap.Protocol/Requests/PauseArguments.cs create mode 100644 src/Dap.Protocol/Requests/PauseResponse.cs create mode 100644 src/Dap.Protocol/Requests/ReadMemoryArguments.cs create mode 100644 src/Dap.Protocol/Requests/ReadMemoryResponse.cs create mode 100644 src/Dap.Protocol/Requests/RequestNames.cs create mode 100644 src/Dap.Protocol/Requests/RestartArguments.cs create mode 100644 src/Dap.Protocol/Requests/RestartFrameArguments.cs create mode 100644 src/Dap.Protocol/Requests/RestartFrameResponse.cs create mode 100644 src/Dap.Protocol/Requests/RestartResponse.cs create mode 100644 src/Dap.Protocol/Requests/ReverseContinueArguments.cs create mode 100644 src/Dap.Protocol/Requests/ReverseContinueResponse.cs create mode 100644 src/Dap.Protocol/Requests/RunInTerminalArguments.cs create mode 100644 src/Dap.Protocol/Requests/RunInTerminalArgumentsKind.cs create mode 100644 src/Dap.Protocol/Requests/RunInTerminalExtensions.cs create mode 100644 src/Dap.Protocol/Requests/RunInTerminalResponse.cs create mode 100644 src/Dap.Protocol/Requests/ScopesArguments.cs create mode 100644 src/Dap.Protocol/Requests/ScopesResponse.cs create mode 100644 src/Dap.Protocol/Requests/SetBreakpointsArguments.cs create mode 100644 src/Dap.Protocol/Requests/SetBreakpointsResponse.cs create mode 100644 src/Dap.Protocol/Requests/SetDataBreakpointsArguments.cs create mode 100644 src/Dap.Protocol/Requests/SetDataBreakpointsResponse.cs create mode 100644 src/Dap.Protocol/Requests/SetExceptionBreakpointsArguments.cs create mode 100644 src/Dap.Protocol/Requests/SetExceptionBreakpointsResponse.cs create mode 100644 src/Dap.Protocol/Requests/SetExpressionArguments.cs create mode 100644 src/Dap.Protocol/Requests/SetExpressionResponse.cs create mode 100644 src/Dap.Protocol/Requests/SetFunctionBreakpointsArguments.cs create mode 100644 src/Dap.Protocol/Requests/SetFunctionBreakpointsResponse.cs create mode 100644 src/Dap.Protocol/Requests/SetVariableArguments.cs create mode 100644 src/Dap.Protocol/Requests/SetVariableResponse.cs create mode 100644 src/Dap.Protocol/Requests/SourceArguments.cs create mode 100644 src/Dap.Protocol/Requests/SourceResponse.cs create mode 100644 src/Dap.Protocol/Requests/StackTraceArguments.cs create mode 100644 src/Dap.Protocol/Requests/StackTraceResponse.cs create mode 100644 src/Dap.Protocol/Requests/StepBackArguments.cs create mode 100644 src/Dap.Protocol/Requests/StepBackResponse.cs create mode 100644 src/Dap.Protocol/Requests/StepInArguments.cs create mode 100644 src/Dap.Protocol/Requests/StepInResponse.cs create mode 100644 src/Dap.Protocol/Requests/StepInTargetsArguments.cs create mode 100644 src/Dap.Protocol/Requests/StepInTargetsResponse.cs create mode 100644 src/Dap.Protocol/Requests/StepOutArguments.cs create mode 100644 src/Dap.Protocol/Requests/StepOutResponse.cs create mode 100644 src/Dap.Protocol/Requests/TerminateArguments.cs create mode 100644 src/Dap.Protocol/Requests/TerminateResponse.cs create mode 100644 src/Dap.Protocol/Requests/TerminateThreadsArguments.cs create mode 100644 src/Dap.Protocol/Requests/TerminateThreadsResponse.cs create mode 100644 src/Dap.Protocol/Requests/ThreadsArguments.cs create mode 100644 src/Dap.Protocol/Requests/ThreadsResponse.cs create mode 100644 src/Dap.Protocol/Requests/VariablesArguments.cs create mode 100644 src/Dap.Protocol/Requests/VariablesArgumentsFilter.cs create mode 100644 src/Dap.Protocol/Requests/VariablesResponse.cs delete mode 100644 src/Dap.Protocol/Requests/classs1.cs diff --git a/src/Dap.Protocol/Events/BreakpointEvent.cs b/src/Dap.Protocol/Events/BreakpointEvent.cs new file mode 100644 index 000000000..2fb36cb08 --- /dev/null +++ b/src/Dap.Protocol/Events/BreakpointEvent.cs @@ -0,0 +1,20 @@ +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class BreakpointEvent : IRequest + { + + /// + /// The reason for the event. + /// Values: 'changed', 'new', 'removed', etc. + /// + public string reason { get; set; } + + /// + /// The 'id' attribute is used to find the target breakpoint and the other attributes are used as the new values. + /// + public Breakpoint breakpoint { get; set; } + } + +} diff --git a/src/Dap.Protocol/Events/CapabilitiesEvent.cs b/src/Dap.Protocol/Events/CapabilitiesEvent.cs new file mode 100644 index 000000000..242cbc103 --- /dev/null +++ b/src/Dap.Protocol/Events/CapabilitiesEvent.cs @@ -0,0 +1,14 @@ +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class CapabilitiesEvent : IRequest + { + + /// + /// The set of updated capabilities. + /// + public Capabilities capabilities { get; set; } + } + +} diff --git a/src/Dap.Protocol/Events/ContinuedEvent.cs b/src/Dap.Protocol/Events/ContinuedEvent.cs new file mode 100644 index 000000000..e2f09164c --- /dev/null +++ b/src/Dap.Protocol/Events/ContinuedEvent.cs @@ -0,0 +1,21 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class ContinuedEvent : IRequest + { + + + /// + /// The thread which was continued. + /// + public long threadId { get; set; } + + /// + /// If 'allThreadsContinued' is true, a debug adapter can announce that all threads have continued. + /// + [Optional] public bool? allThreadsContinued { get; set; } + } + +} diff --git a/src/Dap.Protocol/Events/EventNames.cs b/src/Dap.Protocol/Events/EventNames.cs new file mode 100644 index 000000000..b3b7cd077 --- /dev/null +++ b/src/Dap.Protocol/Events/EventNames.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public static class EventNames + { + public const string Initialized = "initialized"; + public const string Stopped = "stopped"; + public const string Continued = "continued"; + public const string Exited = "exited"; + public const string Terminated = "terminated"; + public const string Thread = "thread"; + public const string Output = "output"; + public const string Breakpoint = "breakpoint"; + public const string Module = "module"; + public const string LoadedSource = "loadedSource"; + public const string Process = "process"; + public const string Capabilities = "capabilities"; + } + +} diff --git a/src/Dap.Protocol/Events/ExitedEvent.cs b/src/Dap.Protocol/Events/ExitedEvent.cs new file mode 100644 index 000000000..406ecb055 --- /dev/null +++ b/src/Dap.Protocol/Events/ExitedEvent.cs @@ -0,0 +1,14 @@ +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class ExitedEvent : IRequest + { + + /// + /// The exit code returned from the debuggee. + /// + public long exitCode { get; set; } + } + +} diff --git a/src/Dap.Protocol/Events/IBreakpointHandler.cs b/src/Dap.Protocol/Events/IBreakpointHandler.cs new file mode 100644 index 000000000..e8959e0c8 --- /dev/null +++ b/src/Dap.Protocol/Events/IBreakpointHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.Embedded.MediatR; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(EventNames.Breakpoint)] + public interface IBreakpointHandler : IJsonRpcNotificationHandler { } + + public abstract class BreakpointHandler : IBreakpointHandler + { + public abstract Task Handle(BreakpointEvent request, CancellationToken cancellationToken); + } + public static class BreakpointHandlerExtensions + { + public static IDisposable OnBreakpoint(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : BreakpointHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(BreakpointEvent request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Events/ICapabilitiesHandler.cs b/src/Dap.Protocol/Events/ICapabilitiesHandler.cs new file mode 100644 index 000000000..fbeaf84c5 --- /dev/null +++ b/src/Dap.Protocol/Events/ICapabilitiesHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.Embedded.MediatR; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(EventNames.Capabilities)] + public interface ICapabilitiesHandler : IJsonRpcNotificationHandler { } + + public abstract class CapabilitiesHandler : ICapabilitiesHandler + { + public abstract Task Handle(CapabilitiesEvent request, CancellationToken cancellationToken); + } + public static class CapabilitiesHandlerExtensions + { + public static IDisposable OnCapabilities(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : CapabilitiesHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(CapabilitiesEvent request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Events/IContinuedHandler.cs b/src/Dap.Protocol/Events/IContinuedHandler.cs new file mode 100644 index 000000000..406de1ab9 --- /dev/null +++ b/src/Dap.Protocol/Events/IContinuedHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.Embedded.MediatR; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(EventNames.Continued)] + public interface IContinuedHandler : IJsonRpcNotificationHandler { } + + public abstract class ContinuedHandler : IContinuedHandler + { + public abstract Task Handle(ContinuedEvent request, CancellationToken cancellationToken); + } + public static class ContinuedHandlerExtensions + { + public static IDisposable OnContinued(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : ContinuedHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(ContinuedEvent request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Events/IExitedHandler.cs b/src/Dap.Protocol/Events/IExitedHandler.cs new file mode 100644 index 000000000..85fc7a284 --- /dev/null +++ b/src/Dap.Protocol/Events/IExitedHandler.cs @@ -0,0 +1,36 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.Embedded.MediatR; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(EventNames.Exited)] + public interface IExitedHandler : IJsonRpcNotificationHandler { } + + public abstract class ExitedHandler : IExitedHandler + { + public abstract Task Handle(ExitedEvent request, CancellationToken cancellationToken); + } + public static class ExitedHandlerExtensions + { + public static IDisposable OnExited(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : ExitedHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(ExitedEvent request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } + +} diff --git a/src/Dap.Protocol/Events/IInitializedHandler.cs b/src/Dap.Protocol/Events/IInitializedHandler.cs new file mode 100644 index 000000000..bdb25cdfa --- /dev/null +++ b/src/Dap.Protocol/Events/IInitializedHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.Embedded.MediatR; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(EventNames.Initialized)] + public interface IInitializedHandler : IJsonRpcNotificationHandler { } + + public abstract class InitializedHandler : IInitializedHandler + { + public abstract Task Handle(InitializedEvent request, CancellationToken cancellationToken); + } + public static class InitializedHandlerExtensions + { + public static IDisposable OnInitializedTextDocument(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : InitializedHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(InitializedEvent request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Events/ILoadedSourceHandler.cs b/src/Dap.Protocol/Events/ILoadedSourceHandler.cs new file mode 100644 index 000000000..d824d4aab --- /dev/null +++ b/src/Dap.Protocol/Events/ILoadedSourceHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.Embedded.MediatR; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(EventNames.LoadedSource)] + public interface ILoadedSourceHandler : IJsonRpcNotificationHandler { } + + public abstract class LoadedSourceHandler : ILoadedSourceHandler + { + public abstract Task Handle(LoadedSourceEvent request, CancellationToken cancellationToken); + } + public static class LoadedSourceHandlerExtensions + { + public static IDisposable OnLoadedSource(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : LoadedSourceHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(LoadedSourceEvent request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Events/IModuleHandler.cs b/src/Dap.Protocol/Events/IModuleHandler.cs new file mode 100644 index 000000000..25dab9326 --- /dev/null +++ b/src/Dap.Protocol/Events/IModuleHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.Embedded.MediatR; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(EventNames.Module)] + public interface IModuleHandler : IJsonRpcNotificationHandler { } + + public abstract class ModuleHandler : IModuleHandler + { + public abstract Task Handle(ModuleEvent request, CancellationToken cancellationToken); + } + public static class ModuleHandlerExtensions + { + public static IDisposable OnModule(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : ModuleHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(ModuleEvent request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Events/IOutputHandler.cs b/src/Dap.Protocol/Events/IOutputHandler.cs new file mode 100644 index 000000000..6e36aed92 --- /dev/null +++ b/src/Dap.Protocol/Events/IOutputHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.Embedded.MediatR; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(EventNames.Output)] + public interface IOutputHandler : IJsonRpcNotificationHandler { } + + public abstract class OutputHandler : IOutputHandler + { + public abstract Task Handle(OutputEvent request, CancellationToken cancellationToken); + } + public static class OutputHandlerExtensions + { + public static IDisposable OnOutput(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : OutputHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(OutputEvent request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Events/IProcessHandler.cs b/src/Dap.Protocol/Events/IProcessHandler.cs new file mode 100644 index 000000000..54482ec9d --- /dev/null +++ b/src/Dap.Protocol/Events/IProcessHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.Embedded.MediatR; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(EventNames.Process)] + public interface IProcessHandler : IJsonRpcNotificationHandler { } + + public abstract class ProcessHandler : IProcessHandler + { + public abstract Task Handle(ProcessEvent request, CancellationToken cancellationToken); + } + public static class ProcessHandlerExtensions + { + public static IDisposable OnProcess(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : ProcessHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(ProcessEvent request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Events/IStoppedHandler.cs b/src/Dap.Protocol/Events/IStoppedHandler.cs new file mode 100644 index 000000000..b9f4d3195 --- /dev/null +++ b/src/Dap.Protocol/Events/IStoppedHandler.cs @@ -0,0 +1,36 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.Embedded.MediatR; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(EventNames.Stopped)] + public interface IStoppedHandler : IJsonRpcNotificationHandler { } + + public abstract class StoppedHandler : IStoppedHandler + { + public abstract Task Handle(StoppedEvent request, CancellationToken cancellationToken); + } + public static class StoppedHandlerExtensions + { + public static IDisposable OnStopped(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : StoppedHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(StoppedEvent request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } + +} diff --git a/src/Dap.Protocol/Events/ITerminatedHandler.cs b/src/Dap.Protocol/Events/ITerminatedHandler.cs new file mode 100644 index 000000000..b7c1e4c61 --- /dev/null +++ b/src/Dap.Protocol/Events/ITerminatedHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.Embedded.MediatR; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(EventNames.Terminated)] + public interface ITerminatedHandler : IJsonRpcNotificationHandler { } + + public abstract class TerminatedHandler : ITerminatedHandler + { + public abstract Task Handle(TerminatedEvent request, CancellationToken cancellationToken); + } + public static class TerminatedHandlerExtensions + { + public static IDisposable OnTerminated(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : TerminatedHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(TerminatedEvent request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Events/InitializedEvent.cs b/src/Dap.Protocol/Events/InitializedEvent.cs new file mode 100644 index 000000000..8c09839ed --- /dev/null +++ b/src/Dap.Protocol/Events/InitializedEvent.cs @@ -0,0 +1,9 @@ +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class InitializedEvent : IRequest + { + } + +} diff --git a/src/Dap.Protocol/Events/LoadedSourceEvent.cs b/src/Dap.Protocol/Events/LoadedSourceEvent.cs new file mode 100644 index 000000000..10b1eb295 --- /dev/null +++ b/src/Dap.Protocol/Events/LoadedSourceEvent.cs @@ -0,0 +1,19 @@ +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class LoadedSourceEvent : IRequest + { + + /// + /// The reason for the event. + /// + public LoadedSourceReason reason { get; set; } + + /// + /// The new, changed, or removed source. + /// + public Source source { get; set; } + } + +} diff --git a/src/Dap.Protocol/Events/LoadedSourceReason.cs b/src/Dap.Protocol/Events/LoadedSourceReason.cs new file mode 100644 index 000000000..4aed837c7 --- /dev/null +++ b/src/Dap.Protocol/Events/LoadedSourceReason.cs @@ -0,0 +1,12 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [JsonConverter(typeof(StringEnumConverter))] + public enum LoadedSourceReason + { + New, Changed, Removed + } + +} diff --git a/src/Dap.Protocol/Events/ModuleEvent.cs b/src/Dap.Protocol/Events/ModuleEvent.cs new file mode 100644 index 000000000..d0bfeee11 --- /dev/null +++ b/src/Dap.Protocol/Events/ModuleEvent.cs @@ -0,0 +1,19 @@ +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class ModuleEvent : IRequest + { + + /// + /// The reason for the event. + /// + public ModuleEventReason reason { get; set; } + + /// + /// The new, changed, or removed module. In case of 'removed' only the module id is used. + /// + public Module module { get; set; } + } + +} diff --git a/src/Dap.Protocol/Events/ModuleEventReason.cs b/src/Dap.Protocol/Events/ModuleEventReason.cs new file mode 100644 index 000000000..c3700164e --- /dev/null +++ b/src/Dap.Protocol/Events/ModuleEventReason.cs @@ -0,0 +1,12 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [JsonConverter(typeof(StringEnumConverter))] + public enum ModuleEventReason + { + New, Changed, Removed + } + +} diff --git a/src/Dap.Protocol/Events/OutputEvent.cs b/src/Dap.Protocol/Events/OutputEvent.cs new file mode 100644 index 000000000..7000588fc --- /dev/null +++ b/src/Dap.Protocol/Events/OutputEvent.cs @@ -0,0 +1,46 @@ +using Newtonsoft.Json.Linq; +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class OutputEvent : IRequest + { + /// + /// The output category. If not specified, 'console' is assumed. + /// Values: 'console', 'stdout', 'stderr', 'telemetry', etc. + /// + [Optional] public string category { get; set; } + + /// + /// The output to report. + /// + public string output { get; set; } + + /// + /// If an attribute 'variablesReference' exists and its value is > 0, the output contains objects which can be retrieved by passing 'variablesReference' to the 'variables' request. + /// + [Optional] public long? variablesReference { get; set; } + + /// + /// An optional source location where the output was produced. + /// + [Optional] public Source source { get; set; } + + /// + /// An optional source location line where the output was produced. + /// + [Optional] public long? line { get; set; } + + /// + /// An optional source location column where the output was produced. + /// + [Optional] public long? column { get; set; } + + /// + /// Optional data to report. For the 'telemetry' category the data will be sent to telemetry, for the other categories the data is shown in JSON format. + /// + [Optional] public JToken data { get; set; } + } + +} diff --git a/src/Dap.Protocol/Events/ProcessEvent.cs b/src/Dap.Protocol/Events/ProcessEvent.cs new file mode 100644 index 000000000..7b4b748a3 --- /dev/null +++ b/src/Dap.Protocol/Events/ProcessEvent.cs @@ -0,0 +1,38 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class ProcessEvent : IRequest + { + + /// + /// The logical name of the process. This is usually the full path to process's executable file. Example: /home/example/myproj/program.js. + /// + public string name { get; set; } + + /// + /// The system process id of the debugged process. This property will be missing for non-system processes. + /// + [Optional] public long? systemProcessId { get; set; } + + /// + /// If true, the process is running on the same computer as the debug adapter. + /// + [Optional] public bool? isLocalProcess { get; set; } + + /// + /// Describes how the debug engine started debugging this process. + /// 'launch': Process was launched under the debugger. + /// 'attach': Debugger attached to an existing process. + /// 'attachForSuspendedLaunch': A project launcher component has launched a new process in a suspended state and then asked the debugger to attach. + /// + [Optional] public ProcessEventStartMethod startMethod { get; set; } + + /// + /// The size of a pointer or address for this process, in bits. This value may be used by clients when formatting addresses for display. + /// + [Optional] public long? pointerSize { get; set; } + } + +} diff --git a/src/Dap.Protocol/Events/ProcessEventStartMethod.cs b/src/Dap.Protocol/Events/ProcessEventStartMethod.cs new file mode 100644 index 000000000..fc306932c --- /dev/null +++ b/src/Dap.Protocol/Events/ProcessEventStartMethod.cs @@ -0,0 +1,8 @@ +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public enum ProcessEventStartMethod + { + Launch, Attach, AttachForSuspendedLaunch + } + +} diff --git a/src/Dap.Protocol/Events/StoppedEvent.cs b/src/Dap.Protocol/Events/StoppedEvent.cs new file mode 100644 index 000000000..73f041195 --- /dev/null +++ b/src/Dap.Protocol/Events/StoppedEvent.cs @@ -0,0 +1,43 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class StoppedEvent : IRequest + { + /// + /// The reason for the event. + /// For backward compatibility this string is shown in the UI if the 'description' attribute is missing (but it must not be translated). + /// Values: 'step', 'breakpoint', 'exception', 'pause', 'entry', 'goto', 'function breakpoint', 'data breakpoint', etc. + /// + public string reason { get; set; } + + /// + /// The full reason for the event, e.g. 'Paused on exception'. This string is shown in the UI as is and must be translated. + /// + [Optional] public string description { get; set; } + + /// + /// The thread which was stopped. + /// + [Optional] public long? threadId { get; set; } + + /// + /// A value of true hints to the frontend that this event should not change the focus. + /// + [Optional] public bool? preserveFocusHint { get; set; } + + /// + /// Additional information. E.g. if reason is 'exception', text contains the exception name. This string is shown in the UI. + /// + [Optional] public string text { get; set; } + + /// + /// If 'allThreadsStopped' is true, a debug adapter can announce that all threads have stopped. + /// - The client should use this information to enable that all threads can be expanded to access their stacktraces. + /// - If the attribute is missing or false, only the thread with the given threadId can be expanded. + /// + [Optional] public bool? allThreadsStopped { get; set; } + } + +} diff --git a/src/Dap.Protocol/Events/TerminatedEvent.cs b/src/Dap.Protocol/Events/TerminatedEvent.cs new file mode 100644 index 000000000..d5fc5cd5e --- /dev/null +++ b/src/Dap.Protocol/Events/TerminatedEvent.cs @@ -0,0 +1,17 @@ +using Newtonsoft.Json.Linq; +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class TerminatedEvent : IRequest + { + + /// + /// A debug adapter may set 'restart' to true (or to an arbitrary object) to request that the front end restarts the session. + /// The value is not interpreted by the client and passed unmodified as an attribute '__restart' to the 'launch' and 'attach' requests. + /// + [Optional] public JToken restart { get; set; } + } + +} diff --git a/src/Dap.Protocol/Events/ThreadEvent.cs b/src/Dap.Protocol/Events/ThreadEvent.cs new file mode 100644 index 000000000..5207a4d55 --- /dev/null +++ b/src/Dap.Protocol/Events/ThreadEvent.cs @@ -0,0 +1,20 @@ +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class ThreadEvent : IRequest + { + + /// + /// The reason for the event. + /// Values: 'started', 'exited', etc. + /// + public string reason { get; set; } + + /// + /// The identifier of the thread. + /// + public long threadId { get; set; } + } + +} diff --git a/src/Dap.Protocol/Events/classs1.cs b/src/Dap.Protocol/Events/classs1.cs deleted file mode 100644 index b893bc7e0..000000000 --- a/src/Dap.Protocol/Events/classs1.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events -{ - class classs1 - { - } -} diff --git a/src/Dap.Protocol/Requests/AttachRequestArguments.cs b/src/Dap.Protocol/Requests/AttachRequestArguments.cs new file mode 100644 index 000000000..1f6d14077 --- /dev/null +++ b/src/Dap.Protocol/Requests/AttachRequestArguments.cs @@ -0,0 +1,18 @@ +using Newtonsoft.Json.Linq; +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class AttachRequestArguments : IRequest + { + /// + /// Optional data from the previous, restarted session. + /// The data is sent as the 'restart' attribute of the 'terminated' event. + /// The client should leave the data intact. + /// + [Optional] + public JToken __restart { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/AttachResponse.cs b/src/Dap.Protocol/Requests/AttachResponse.cs new file mode 100644 index 000000000..88b3e3cb9 --- /dev/null +++ b/src/Dap.Protocol/Requests/AttachResponse.cs @@ -0,0 +1,7 @@ +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class AttachResponse + { + } + +} diff --git a/src/Dap.Protocol/Requests/CompletionsArguments.cs b/src/Dap.Protocol/Requests/CompletionsArguments.cs new file mode 100644 index 000000000..fa45c93a8 --- /dev/null +++ b/src/Dap.Protocol/Requests/CompletionsArguments.cs @@ -0,0 +1,29 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class CompletionsArguments : IRequest + { + /// + /// Returns completions in the scope of this stack frame. If not specified, the completions are returned for the global scope. + /// + [Optional] public long? frameId { get; set; } + + /// + /// One or more source lines.Typically this is the text a user has typed into the debug console before he asked for completion. + /// + public string text { get; set; } + + /// + /// The character position for which to determine the completion proposals. + /// + public long column { get; set; } + + /// + /// An optional line for which to determine the completion proposals.If missing the first line of the text is assumed. + /// + [Optional] public long? line { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/CompletionsResponse.cs b/src/Dap.Protocol/Requests/CompletionsResponse.cs new file mode 100644 index 000000000..4312f0636 --- /dev/null +++ b/src/Dap.Protocol/Requests/CompletionsResponse.cs @@ -0,0 +1,11 @@ +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class CompletionsResponse + { + /// + /// The possible completions for . + /// + public Container targets { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/ConfigurationDoneArguments.cs b/src/Dap.Protocol/Requests/ConfigurationDoneArguments.cs new file mode 100644 index 000000000..b2f85548c --- /dev/null +++ b/src/Dap.Protocol/Requests/ConfigurationDoneArguments.cs @@ -0,0 +1,9 @@ +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class ConfigurationDoneArguments : IRequest + { + } + +} diff --git a/src/Dap.Protocol/Requests/ConfigurationDoneResponse.cs b/src/Dap.Protocol/Requests/ConfigurationDoneResponse.cs new file mode 100644 index 000000000..1aa75d3f3 --- /dev/null +++ b/src/Dap.Protocol/Requests/ConfigurationDoneResponse.cs @@ -0,0 +1,7 @@ +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class ConfigurationDoneResponse + { + } + +} diff --git a/src/Dap.Protocol/Requests/ContinueArguments.cs b/src/Dap.Protocol/Requests/ContinueArguments.cs new file mode 100644 index 000000000..a4a4c550a --- /dev/null +++ b/src/Dap.Protocol/Requests/ContinueArguments.cs @@ -0,0 +1,13 @@ +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class ContinueArguments : IRequest + { + /// + /// Continue execution for the specified thread(if possible). If the backend cannot continue on a single thread but will continue on all threads, it should set the 'allThreadsContinued' attribute in the response to true. + /// + public long threadId { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/ContinueResponse.cs b/src/Dap.Protocol/Requests/ContinueResponse.cs new file mode 100644 index 000000000..0ede79ea0 --- /dev/null +++ b/src/Dap.Protocol/Requests/ContinueResponse.cs @@ -0,0 +1,13 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class ContinueResponse + { + /// + /// If true, the 'continue' request has ignored the specified thread and continued all threads instead.If this attribute is missing a value of 'true' is assumed for backward compatibility. + /// + [Optional] public bool? allThreadsContinued { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/DataBreakpointInfoArguments.cs b/src/Dap.Protocol/Requests/DataBreakpointInfoArguments.cs new file mode 100644 index 000000000..26a2f0108 --- /dev/null +++ b/src/Dap.Protocol/Requests/DataBreakpointInfoArguments.cs @@ -0,0 +1,19 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class DataBreakpointInfoArguments : IRequest + { + /// + /// Reference to the Variable container if the data breakpoint is requested for a child of the container. + /// + [Optional] public long? variablesReference { get; set; } + + /// + /// The name of the Variable's child to obtain data breakpoint information for. If variableReference isn’t provided, this can be an expression. + /// + public string name { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/DataBreakpointInfoResponse.cs b/src/Dap.Protocol/Requests/DataBreakpointInfoResponse.cs new file mode 100644 index 000000000..8030fe1bd --- /dev/null +++ b/src/Dap.Protocol/Requests/DataBreakpointInfoResponse.cs @@ -0,0 +1,28 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class DataBreakpointInfoResponse + { + /// + /// An identifier for the data on which a data breakpoint can be registered with the setDataBreakpoints request or null if no data breakpoint is available. + /// + public string dataId { get; set; } + + /// + /// UI string that describes on what data the breakpoint is set on or why a data breakpoint is not available. + /// + public string description { get; set; } + + /// + /// Optional attribute listing the available access types for a potential data breakpoint.A UI frontend could surface this information. + /// + [Optional] public Container accessTypes { get; set; } + + /// + /// Optional attribute indicating that a potential data breakpoint could be persisted across sessions. + /// + [Optional] public bool? canPersist { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/DisassembleArguments.cs b/src/Dap.Protocol/Requests/DisassembleArguments.cs new file mode 100644 index 000000000..a7b32ed6c --- /dev/null +++ b/src/Dap.Protocol/Requests/DisassembleArguments.cs @@ -0,0 +1,35 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class DisassembleArguments : IRequest + { + /// + /// Memory reference to the base location containing the instructions to disassemble. + /// + public string memoryReference { get; set; } + + /// + /// Optional offset(in bytes) to be applied to the reference location before disassembling.Can be negative. + /// + [Optional] public long? offset { get; set; } + + /// + /// Optional offset(in instructions) to be applied after the byte offset(if any) before disassembling.Can be negative. + /// + + [Optional] public long? instructionOffset { get; set; } + + /// + /// Number of instructions to disassemble starting at the specified location and offset.An adapter must return exactly this number of instructions - any unavailable instructions should be replaced with an implementation-defined 'invalid instruction' value. + /// + public long instructionCount { get; set; } + + /// + /// If true, the adapter should attempt to resolve memory addresses and other values to symbolic names. + /// + [Optional] public bool? resolveSymbols { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/DisassembleResponse.cs b/src/Dap.Protocol/Requests/DisassembleResponse.cs new file mode 100644 index 000000000..0c0285526 --- /dev/null +++ b/src/Dap.Protocol/Requests/DisassembleResponse.cs @@ -0,0 +1,11 @@ +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class DisassembleResponse + { + /// + /// The list of disassembled instructions. + /// + public Container instructions { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/DisconnectArguments.cs b/src/Dap.Protocol/Requests/DisconnectArguments.cs new file mode 100644 index 000000000..9673d2c69 --- /dev/null +++ b/src/Dap.Protocol/Requests/DisconnectArguments.cs @@ -0,0 +1,21 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class DisconnectArguments : IRequest + { + /// + /// A value of true indicates that this 'disconnect' request is part of a restart sequence. + /// + [Optional] public bool? restart { get; set; } + + /// + /// Indicates whether the debuggee should be terminated when the debugger is disconnected. + /// If unspecified, the debug adapter is free to do whatever it thinks is best. + /// A client can only rely on this attribute being properly honored if a debug adapter returns true for the 'supportTerminateDebuggee' capability. + /// + [Optional] public bool? terminateDebuggee { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/DisconnectResponse.cs b/src/Dap.Protocol/Requests/DisconnectResponse.cs new file mode 100644 index 000000000..f8dc95223 --- /dev/null +++ b/src/Dap.Protocol/Requests/DisconnectResponse.cs @@ -0,0 +1,7 @@ +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class DisconnectResponse + { + } + +} diff --git a/src/Dap.Protocol/Requests/EvaluateArguments.cs b/src/Dap.Protocol/Requests/EvaluateArguments.cs new file mode 100644 index 000000000..32b1820b1 --- /dev/null +++ b/src/Dap.Protocol/Requests/EvaluateArguments.cs @@ -0,0 +1,34 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class EvaluateArguments : IRequest + { + /// + /// The expression to evaluate. + /// + public string expression { get; set; } + + /// + /// Evaluate the expression in the scope of this stack frame. If not specified, the expression is evaluated in the global scope. + /// + [Optional] public long? frameId { get; set; } + + /// + /// The context in which the evaluate request is run. + /// Values: + /// 'watch': evaluate is run in a watch. + /// 'repl': evaluate is run from REPL console. + /// 'hover': evaluate is run from a data hover. + /// etc. + /// + [Optional] public string context { get; set; } + + /// + /// Specifies details on how to format the Evaluate result. + /// + [Optional] public ValueFormat format { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/EvaluateResponse.cs b/src/Dap.Protocol/Requests/EvaluateResponse.cs new file mode 100644 index 000000000..ff90326c4 --- /dev/null +++ b/src/Dap.Protocol/Requests/EvaluateResponse.cs @@ -0,0 +1,45 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class EvaluateResponse + { + /// + /// The result of the evaluate request. + /// + public string result { get; set; } + + /// + /// The optional type of the evaluate result. + /// + [Optional] public string type { get; set; } + + /// + /// Properties of a evaluate result that can be used to determine how to render the result in the UI. + /// + [Optional] public VariablePresentationHint presentationHint { get; set; } + + /// + /// If variablesReference is > 0, the evaluate result is structured and its children can be retrieved by passing variablesReference to the VariablesRequest. + /// + public long variablesReference { get; set; } + + /// + /// The number of named child variables. + /// The client can use this optional information to present the variables in a paged UI and fetch them in chunks. + /// + [Optional] public long? namedVariables { get; set; } + + /// + /// The number of indexed child variables. + /// The client can use this optional information to present the variables in a paged UI and fetch them in chunks. + /// + [Optional] public long? indexedVariables { get; set; } + + /// + /// Memory reference to a location appropriate for this result.For pointer type eval results, this is generally a reference to the memory address contained in the pointer. + /// + [Optional] public string memoryReference { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/ExceptionInfoArguments.cs b/src/Dap.Protocol/Requests/ExceptionInfoArguments.cs new file mode 100644 index 000000000..e0289545f --- /dev/null +++ b/src/Dap.Protocol/Requests/ExceptionInfoArguments.cs @@ -0,0 +1,13 @@ +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class ExceptionInfoArguments : IRequest + { + /// + /// Thread for which exception information should be retrieved. + /// + public long threadId { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/ExceptionInfoResponse.cs b/src/Dap.Protocol/Requests/ExceptionInfoResponse.cs new file mode 100644 index 000000000..4abd783f0 --- /dev/null +++ b/src/Dap.Protocol/Requests/ExceptionInfoResponse.cs @@ -0,0 +1,28 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class ExceptionInfoResponse + { + /// + /// ID of the exception that was thrown. + /// + public string exceptionId { get; set; } + + /// + /// Descriptive text for the exception provided by the debug adapter. + /// + [Optional] public string description { get; set; } + + /// + /// Mode that caused the exception notification to be raised. + /// + public ExceptionBreakMode breakMode { get; set; } + + /// + /// Detailed information about the exception. + /// + [Optional] public ExceptionDetails details { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/GotoArguments.cs b/src/Dap.Protocol/Requests/GotoArguments.cs new file mode 100644 index 000000000..fe0fa65c2 --- /dev/null +++ b/src/Dap.Protocol/Requests/GotoArguments.cs @@ -0,0 +1,18 @@ +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class GotoArguments : IRequest + { + /// + /// Set the goto target for this thread. + /// + public long threadId { get; set; } + + /// + /// The location where the debuggee will continue to run. + /// + public long targetId { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/GotoResponse.cs b/src/Dap.Protocol/Requests/GotoResponse.cs new file mode 100644 index 000000000..c9a80f833 --- /dev/null +++ b/src/Dap.Protocol/Requests/GotoResponse.cs @@ -0,0 +1,7 @@ +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class GotoResponse + { + } + +} diff --git a/src/Dap.Protocol/Requests/GotoTargetsArguments.cs b/src/Dap.Protocol/Requests/GotoTargetsArguments.cs new file mode 100644 index 000000000..874ea6a27 --- /dev/null +++ b/src/Dap.Protocol/Requests/GotoTargetsArguments.cs @@ -0,0 +1,24 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class GotoTargetsArguments : IRequest + { + /// + /// The source location for which the goto targets are determined. + /// + public Source source { get; set; } + + /// + /// The line location for which the goto targets are determined. + /// + public long line { get; set; } + + /// + /// An optional column location for which the goto targets are determined. + /// + [Optional] public long? column { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/GotoTargetsResponse.cs b/src/Dap.Protocol/Requests/GotoTargetsResponse.cs new file mode 100644 index 000000000..6f866b45e --- /dev/null +++ b/src/Dap.Protocol/Requests/GotoTargetsResponse.cs @@ -0,0 +1,14 @@ +using System.Text; +using System.Threading; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class GotoTargetsResponse + { + /// + /// The possible goto targets of the specified location. + /// + public Container targets { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/IAttachHandler.cs b/src/Dap.Protocol/Requests/IAttachHandler.cs new file mode 100644 index 000000000..919b9af48 --- /dev/null +++ b/src/Dap.Protocol/Requests/IAttachHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(RequestNames.Attach)] + public interface IAttachHandler : IJsonRpcRequestHandler { } + + public abstract class AttachHandler : IAttachHandler + { + public abstract Task Handle(AttachRequestArguments request, CancellationToken cancellationToken); + } + + public static class AttachHandlerExtensions + { + public static IDisposable OnAttach(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : AttachHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(AttachRequestArguments request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Requests/ICompletionsHandler.cs b/src/Dap.Protocol/Requests/ICompletionsHandler.cs new file mode 100644 index 000000000..5f8bb1a22 --- /dev/null +++ b/src/Dap.Protocol/Requests/ICompletionsHandler.cs @@ -0,0 +1,36 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(RequestNames.Completions)] + public interface ICompletionsHandler : IJsonRpcRequestHandler { } + + public abstract class CompletionsHandler : ICompletionsHandler + { + public abstract Task Handle(CompletionsArguments request, CancellationToken cancellationToken); + } + + public static class CompletionsHandlerExtensions + { + public static IDisposable OnCompletions(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : CompletionsHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(CompletionsArguments request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } + +} diff --git a/src/Dap.Protocol/Requests/IConfigurationDoneHandler.cs b/src/Dap.Protocol/Requests/IConfigurationDoneHandler.cs new file mode 100644 index 000000000..6533bb6e0 --- /dev/null +++ b/src/Dap.Protocol/Requests/IConfigurationDoneHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(RequestNames.ConfigurationDone)] + public interface IConfigurationDoneHandler : IJsonRpcRequestHandler { } + + public abstract class ConfigurationDoneHandler : IConfigurationDoneHandler + { + public abstract Task Handle(ConfigurationDoneArguments request, CancellationToken cancellationToken); + } + + public static class ConfigurationDoneHandlerExtensions + { + public static IDisposable OnConfigurationDone(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : ConfigurationDoneHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(ConfigurationDoneArguments request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Requests/IContinueHandler.cs b/src/Dap.Protocol/Requests/IContinueHandler.cs new file mode 100644 index 000000000..47b612b03 --- /dev/null +++ b/src/Dap.Protocol/Requests/IContinueHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(RequestNames.Continue)] + public interface IContinueHandler : IJsonRpcRequestHandler { } + + public abstract class ContinueHandler : IContinueHandler + { + public abstract Task Handle(ContinueArguments request, CancellationToken cancellationToken); + } + + public static class ContinueHandlerExtensions + { + public static IDisposable OnContinue(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : ContinueHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(ContinueArguments request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Requests/IDataBreakpointInfoHandler.cs b/src/Dap.Protocol/Requests/IDataBreakpointInfoHandler.cs new file mode 100644 index 000000000..06152c5f8 --- /dev/null +++ b/src/Dap.Protocol/Requests/IDataBreakpointInfoHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(RequestNames.DataBreakpointInfo)] + public interface IDataBreakpointInfoHandler : IJsonRpcRequestHandler { } + + public abstract class DataBreakpointInfoHandler : IDataBreakpointInfoHandler + { + public abstract Task Handle(DataBreakpointInfoArguments request, CancellationToken cancellationToken); + } + + public static class DataBreakpointInfoHandlerExtensions + { + public static IDisposable OnDataBreakpointInfo(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : DataBreakpointInfoHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(DataBreakpointInfoArguments request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Requests/IDebugAdapterClient.cs b/src/Dap.Protocol/Requests/IDebugAdapterClient.cs new file mode 100644 index 000000000..6bbc36bae --- /dev/null +++ b/src/Dap.Protocol/Requests/IDebugAdapterClient.cs @@ -0,0 +1,7 @@ +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public interface IDebugAdapterClient : IResponseRouter { } + +} diff --git a/src/Dap.Protocol/Requests/IDebugAdapterRegistry.cs b/src/Dap.Protocol/Requests/IDebugAdapterRegistry.cs new file mode 100644 index 000000000..df93ace3c --- /dev/null +++ b/src/Dap.Protocol/Requests/IDebugAdapterRegistry.cs @@ -0,0 +1,7 @@ +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public interface IDebugAdapterRegistry : IJsonRpcHandlerRegistry { } + +} diff --git a/src/Dap.Protocol/Requests/IDisassembleHandler.cs b/src/Dap.Protocol/Requests/IDisassembleHandler.cs new file mode 100644 index 000000000..c25e99f37 --- /dev/null +++ b/src/Dap.Protocol/Requests/IDisassembleHandler.cs @@ -0,0 +1,36 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(RequestNames.Disassemble)] + public interface IDisassembleHandler : IJsonRpcRequestHandler { } + + public abstract class DisassembleHandler : IDisassembleHandler + { + public abstract Task Handle(DisassembleArguments request, CancellationToken cancellationToken); + } + + public static class DisassembleHandlerExtensions + { + public static IDisposable OnDisassemble(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : DisassembleHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(DisassembleArguments request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } + +} diff --git a/src/Dap.Protocol/Requests/IDisconnectHandler.cs b/src/Dap.Protocol/Requests/IDisconnectHandler.cs new file mode 100644 index 000000000..67d9cbec2 --- /dev/null +++ b/src/Dap.Protocol/Requests/IDisconnectHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(RequestNames.Disconnect)] + public interface IDisconnectHandler : IJsonRpcRequestHandler { } + + public abstract class DisconnectHandler : IDisconnectHandler + { + public abstract Task Handle(DisconnectArguments request, CancellationToken cancellationToken); + } + + public static class DisconnectHandlerExtensions + { + public static IDisposable OnDisconnect(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : DisconnectHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(DisconnectArguments request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Requests/IEvaluateHandler.cs b/src/Dap.Protocol/Requests/IEvaluateHandler.cs new file mode 100644 index 000000000..fbd3ba0da --- /dev/null +++ b/src/Dap.Protocol/Requests/IEvaluateHandler.cs @@ -0,0 +1,36 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(RequestNames.Evaluate)] + public interface IEvaluateHandler : IJsonRpcRequestHandler { } + + + public abstract class EvaluateHandler : IEvaluateHandler + { + public abstract Task Handle(EvaluateArguments request, CancellationToken cancellationToken); + } + + public static class EvaluateHandlerExtensions + { + public static IDisposable OnEvaluate(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : EvaluateHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(EvaluateArguments request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Requests/IExceptionInfoHandler.cs b/src/Dap.Protocol/Requests/IExceptionInfoHandler.cs new file mode 100644 index 000000000..db4b7dbdc --- /dev/null +++ b/src/Dap.Protocol/Requests/IExceptionInfoHandler.cs @@ -0,0 +1,36 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(RequestNames.ExceptionInfo)] + public interface IExceptionInfoHandler : IJsonRpcRequestHandler { } + + public abstract class ExceptionInfoHandler : IExceptionInfoHandler + { + public abstract Task Handle(ExceptionInfoArguments request, CancellationToken cancellationToken); + } + + public static class ExceptionInfoHandlerExtensions + { + public static IDisposable OnExceptionInfo(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : ExceptionInfoHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(ExceptionInfoArguments request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } + +} diff --git a/src/Dap.Protocol/Requests/IGotoHandler.cs b/src/Dap.Protocol/Requests/IGotoHandler.cs new file mode 100644 index 000000000..74f6ddad5 --- /dev/null +++ b/src/Dap.Protocol/Requests/IGotoHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(RequestNames.Goto)] + public interface IGotoHandler : IJsonRpcRequestHandler { } + + public abstract class GotoHandler : IGotoHandler + { + public abstract Task Handle(GotoArguments request, CancellationToken cancellationToken); + } + + public static class GotoHandlerExtensions + { + public static IDisposable OnGoto(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : GotoHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(GotoArguments request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Requests/IGotoTargetsHandler.cs b/src/Dap.Protocol/Requests/IGotoTargetsHandler.cs new file mode 100644 index 000000000..22c141cff --- /dev/null +++ b/src/Dap.Protocol/Requests/IGotoTargetsHandler.cs @@ -0,0 +1,36 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(RequestNames.GotoTargets)] + public interface IGotoTargetsHandler : IJsonRpcRequestHandler { } + + + public abstract class GotoTargetsHandler : IGotoTargetsHandler + { + public abstract Task Handle(GotoTargetsArguments request, CancellationToken cancellationToken); + } + + public static class GotoTargetsHandlerExtensions + { + public static IDisposable OnGotoTargets(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : GotoTargetsHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(GotoTargetsArguments request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Requests/IInitializeHandler.cs b/src/Dap.Protocol/Requests/IInitializeHandler.cs new file mode 100644 index 000000000..d0de287e6 --- /dev/null +++ b/src/Dap.Protocol/Requests/IInitializeHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(RequestNames.Initialize)] + public interface IInitializeHandler : IJsonRpcRequestHandler { } + + public abstract class InitializeHandler : IInitializeHandler + { + public abstract Task Handle(InitializeRequestArguments request, CancellationToken cancellationToken); + } + + public static class InitializeHandlerExtensions + { + public static IDisposable OnInitialize(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : InitializeHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(InitializeRequestArguments request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Requests/ILaunchHandler.cs b/src/Dap.Protocol/Requests/ILaunchHandler.cs new file mode 100644 index 000000000..b308d96ae --- /dev/null +++ b/src/Dap.Protocol/Requests/ILaunchHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(RequestNames.Launch)] + public interface ILaunchHandler : IJsonRpcRequestHandler { } + + public abstract class LaunchHandler : ILaunchHandler + { + public abstract Task Handle(LaunchRequestArguments request, CancellationToken cancellationToken); + } + + public static class LaunchHandlerExtensions + { + public static IDisposable OnLaunch(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : LaunchHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(LaunchRequestArguments request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Requests/ILoadedSourcesHandler.cs b/src/Dap.Protocol/Requests/ILoadedSourcesHandler.cs new file mode 100644 index 000000000..982b48f31 --- /dev/null +++ b/src/Dap.Protocol/Requests/ILoadedSourcesHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(RequestNames.LoadedSources)] + public interface ILoadedSourcesHandler : IJsonRpcRequestHandler { } + + public abstract class LoadedSourcesHandler : ILoadedSourcesHandler + { + public abstract Task Handle(LoadedSourcesArguments request, CancellationToken cancellationToken); + } + + public static class LoadedSourcesHandlerExtensions + { + public static IDisposable OnLoadedSources(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : LoadedSourcesHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(LoadedSourcesArguments request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Requests/IModulesHandler.cs b/src/Dap.Protocol/Requests/IModulesHandler.cs new file mode 100644 index 000000000..e4fd04c4a --- /dev/null +++ b/src/Dap.Protocol/Requests/IModulesHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(RequestNames.Modules)] + public interface IModulesHandler : IJsonRpcRequestHandler { } + + public abstract class ModulesHandler : IModulesHandler + { + public abstract Task Handle(ModulesArguments request, CancellationToken cancellationToken); + } + + public static class ModulesHandlerExtensions + { + public static IDisposable OnModules(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : ModulesHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(ModulesArguments request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Requests/INextHandler.cs b/src/Dap.Protocol/Requests/INextHandler.cs new file mode 100644 index 000000000..947f5f035 --- /dev/null +++ b/src/Dap.Protocol/Requests/INextHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(RequestNames.Next)] + public interface INextHandler : IJsonRpcRequestHandler { } + + public abstract class NextHandler : INextHandler + { + public abstract Task Handle(NextArguments request, CancellationToken cancellationToken); + } + + public static class NextHandlerExtensions + { + public static IDisposable OnNext(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : NextHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(NextArguments request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Requests/IPauseHandler.cs b/src/Dap.Protocol/Requests/IPauseHandler.cs new file mode 100644 index 000000000..e3518a308 --- /dev/null +++ b/src/Dap.Protocol/Requests/IPauseHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(RequestNames.Pause)] + public interface IPauseHandler : IJsonRpcRequestHandler { } + + public abstract class PauseHandler : IPauseHandler + { + public abstract Task Handle(PauseArguments request, CancellationToken cancellationToken); + } + + public static class PauseHandlerExtensions + { + public static IDisposable OnPause(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : PauseHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(PauseArguments request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Requests/IReadMemoryHandler.cs b/src/Dap.Protocol/Requests/IReadMemoryHandler.cs new file mode 100644 index 000000000..994bd352a --- /dev/null +++ b/src/Dap.Protocol/Requests/IReadMemoryHandler.cs @@ -0,0 +1,36 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(RequestNames.ReadMemory)] + public interface IReadMemoryHandler : IJsonRpcRequestHandler { } + + public abstract class ReadMemoryHandler : IReadMemoryHandler + { + public abstract Task Handle(ReadMemoryArguments request, CancellationToken cancellationToken); + } + + public static class ReadMemoryHandlerExtensions + { + public static IDisposable OnReadMemory(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : ReadMemoryHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(ReadMemoryArguments request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } + +} diff --git a/src/Dap.Protocol/Requests/IRestartFrameHandler.cs b/src/Dap.Protocol/Requests/IRestartFrameHandler.cs new file mode 100644 index 000000000..de21ec3a6 --- /dev/null +++ b/src/Dap.Protocol/Requests/IRestartFrameHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(RequestNames.RestartFrame)] + public interface IRestartFrameHandler : IJsonRpcRequestHandler { } + + public abstract class RestartFrameHandler : IRestartFrameHandler + { + public abstract Task Handle(RestartFrameArguments request, CancellationToken cancellationToken); + } + + public static class RestartFrameHandlerExtensions + { + public static IDisposable OnRestartFrame(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : RestartFrameHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(RestartFrameArguments request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Requests/IRestartHandler.cs b/src/Dap.Protocol/Requests/IRestartHandler.cs new file mode 100644 index 000000000..4ed59b1c1 --- /dev/null +++ b/src/Dap.Protocol/Requests/IRestartHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(RequestNames.Restart)] + public interface IRestartHandler : IJsonRpcRequestHandler { } + + public abstract class RestartHandler : IRestartHandler + { + public abstract Task Handle(RestartArguments request, CancellationToken cancellationToken); + } + + public static class RestartHandlerExtensions + { + public static IDisposable OnRestart(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : RestartHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(RestartArguments request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Requests/IReverseContinueHandler.cs b/src/Dap.Protocol/Requests/IReverseContinueHandler.cs new file mode 100644 index 000000000..e64d2ca25 --- /dev/null +++ b/src/Dap.Protocol/Requests/IReverseContinueHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(RequestNames.ReverseContinue)] + public interface IReverseContinueHandler : IJsonRpcRequestHandler { } + + public abstract class ReverseContinueHandler : IReverseContinueHandler + { + public abstract Task Handle(ReverseContinueArguments request, CancellationToken cancellationToken); + } + + public static class ReverseContinueHandlerExtensions + { + public static IDisposable OnReverseContinue(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : ReverseContinueHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(ReverseContinueArguments request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Requests/IScopesHandler.cs b/src/Dap.Protocol/Requests/IScopesHandler.cs new file mode 100644 index 000000000..26c8153c2 --- /dev/null +++ b/src/Dap.Protocol/Requests/IScopesHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(RequestNames.Scopes)] + public interface IScopesHandler : IJsonRpcRequestHandler { } + + public abstract class ScopesHandler : IScopesHandler + { + public abstract Task Handle(ScopesArguments request, CancellationToken cancellationToken); + } + + public static class ScopesHandlerExtensions + { + public static IDisposable OnScopes(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : ScopesHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(ScopesArguments request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Requests/ISetBreakpointsHandler.cs b/src/Dap.Protocol/Requests/ISetBreakpointsHandler.cs new file mode 100644 index 000000000..abed4b7d0 --- /dev/null +++ b/src/Dap.Protocol/Requests/ISetBreakpointsHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(RequestNames.SetBreakpoints)] + public interface ISetBreakpointsHandler : IJsonRpcRequestHandler { } + + public abstract class SetBreakpointsHandler : ISetBreakpointsHandler + { + public abstract Task Handle(SetBreakpointsArguments request, CancellationToken cancellationToken); + } + + public static class SetBreakpointsHandlerExtensions + { + public static IDisposable OnSetBreakpoints(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : SetBreakpointsHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(SetBreakpointsArguments request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Requests/ISetDataBreakpointsHandler.cs b/src/Dap.Protocol/Requests/ISetDataBreakpointsHandler.cs new file mode 100644 index 000000000..d2431ae38 --- /dev/null +++ b/src/Dap.Protocol/Requests/ISetDataBreakpointsHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(RequestNames.SetDataBreakpoints)] + public interface ISetDataBreakpointsHandler : IJsonRpcRequestHandler { } + + public abstract class SetDataBreakpointsHandler : ISetDataBreakpointsHandler + { + public abstract Task Handle(SetDataBreakpointsArguments request, CancellationToken cancellationToken); + } + + public static class SetDataBreakpointsHandlerExtensions + { + public static IDisposable OnSetDataBreakpoints(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : SetDataBreakpointsHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(SetDataBreakpointsArguments request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Requests/ISetExceptionBreakpointsHandler.cs b/src/Dap.Protocol/Requests/ISetExceptionBreakpointsHandler.cs new file mode 100644 index 000000000..ef1296b6d --- /dev/null +++ b/src/Dap.Protocol/Requests/ISetExceptionBreakpointsHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(RequestNames.SetExceptionBreakpoints)] + public interface ISetExceptionBreakpointsHandler : IJsonRpcRequestHandler { } + + public abstract class SetExceptionBreakpointsHandler : ISetExceptionBreakpointsHandler + { + public abstract Task Handle(SetExceptionBreakpointsArguments request, CancellationToken cancellationToken); + } + + public static class SetExceptionBreakpointsHandlerExtensions + { + public static IDisposable OnSetExceptionBreakpoints(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : SetExceptionBreakpointsHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(SetExceptionBreakpointsArguments request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Requests/ISetExpressionHandler.cs b/src/Dap.Protocol/Requests/ISetExpressionHandler.cs new file mode 100644 index 000000000..f2bf2d1ce --- /dev/null +++ b/src/Dap.Protocol/Requests/ISetExpressionHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(RequestNames.SetExpression)] + public interface ISetExpressionHandler : IJsonRpcRequestHandler { } + + public abstract class SetExpressionHandler : ISetExpressionHandler + { + public abstract Task Handle(SetExpressionArguments request, CancellationToken cancellationToken); + } + + public static class SetExpressionHandlerExtensions + { + public static IDisposable OnSetExpression(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : SetExpressionHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(SetExpressionArguments request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Requests/ISetFunctionBreakpointsHandler.cs b/src/Dap.Protocol/Requests/ISetFunctionBreakpointsHandler.cs new file mode 100644 index 000000000..dcc391dfd --- /dev/null +++ b/src/Dap.Protocol/Requests/ISetFunctionBreakpointsHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(RequestNames.SetFunctionBreakpoints)] + public interface ISetFunctionBreakpointsHandler : IJsonRpcRequestHandler { } + + public abstract class SetFunctionBreakpointsHandler : ISetFunctionBreakpointsHandler + { + public abstract Task Handle(SetFunctionBreakpointsArguments request, CancellationToken cancellationToken); + } + + public static class SetFunctionBreakpointsHandlerExtensions + { + public static IDisposable OnSetFunctionBreakpoints(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : SetFunctionBreakpointsHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(SetFunctionBreakpointsArguments request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Requests/ISetVariableHandler.cs b/src/Dap.Protocol/Requests/ISetVariableHandler.cs new file mode 100644 index 000000000..c647db7a1 --- /dev/null +++ b/src/Dap.Protocol/Requests/ISetVariableHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(RequestNames.SetVariable)] + public interface ISetVariableHandler : IJsonRpcRequestHandler { } + + public abstract class SetVariableHandler : ISetVariableHandler + { + public abstract Task Handle(SetVariableArguments request, CancellationToken cancellationToken); + } + + public static class SetVariableHandlerExtensions + { + public static IDisposable OnSetVariable(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : SetVariableHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(SetVariableArguments request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Requests/ISourceHandler.cs b/src/Dap.Protocol/Requests/ISourceHandler.cs new file mode 100644 index 000000000..54c97d59b --- /dev/null +++ b/src/Dap.Protocol/Requests/ISourceHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(RequestNames.Source)] + public interface ISourceHandler : IJsonRpcRequestHandler { } + + public abstract class SourceHandler : ISourceHandler + { + public abstract Task Handle(SourceArguments request, CancellationToken cancellationToken); + } + + public static class SourceHandlerExtensions + { + public static IDisposable OnSource(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : SourceHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(SourceArguments request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Requests/IStackTraceHandler.cs b/src/Dap.Protocol/Requests/IStackTraceHandler.cs new file mode 100644 index 000000000..75318ebb8 --- /dev/null +++ b/src/Dap.Protocol/Requests/IStackTraceHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(RequestNames.StackTrace)] + public interface IStackTraceHandler : IJsonRpcRequestHandler { } + + public abstract class StackTraceHandler : IStackTraceHandler + { + public abstract Task Handle(StackTraceArguments request, CancellationToken cancellationToken); + } + + public static class StackTraceHandlerExtensions + { + public static IDisposable OnStackTrace(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : StackTraceHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(StackTraceArguments request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Requests/IStepBackHandler.cs b/src/Dap.Protocol/Requests/IStepBackHandler.cs new file mode 100644 index 000000000..ab4e71a30 --- /dev/null +++ b/src/Dap.Protocol/Requests/IStepBackHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(RequestNames.StepBack)] + public interface IStepBackHandler : IJsonRpcRequestHandler { } + + public abstract class StepBackHandler : IStepBackHandler + { + public abstract Task Handle(StepBackArguments request, CancellationToken cancellationToken); + } + + public static class StepBackHandlerExtensions + { + public static IDisposable OnStepBack(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : StepBackHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(StepBackArguments request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Requests/IStepInHandler.cs b/src/Dap.Protocol/Requests/IStepInHandler.cs new file mode 100644 index 000000000..939b70a24 --- /dev/null +++ b/src/Dap.Protocol/Requests/IStepInHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(RequestNames.StepIn)] + public interface IStepInHandler : IJsonRpcRequestHandler { } + + public abstract class StepInHandler : IStepInHandler + { + public abstract Task Handle(StepInArguments request, CancellationToken cancellationToken); + } + + public static class StepInHandlerExtensions + { + public static IDisposable OnStepIn(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : StepInHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(StepInArguments request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Requests/IStepInTargetsHandler.cs b/src/Dap.Protocol/Requests/IStepInTargetsHandler.cs new file mode 100644 index 000000000..8932bbb9d --- /dev/null +++ b/src/Dap.Protocol/Requests/IStepInTargetsHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(RequestNames.StepInTargets)] + public interface IStepInTargetsHandler : IJsonRpcRequestHandler { } + + public abstract class StepInTargetsHandler : IStepInTargetsHandler + { + public abstract Task Handle(StepInTargetsArguments request, CancellationToken cancellationToken); + } + + public static class StepInTargetsHandlerExtensions + { + public static IDisposable OnStepInTargets(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : StepInTargetsHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(StepInTargetsArguments request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Requests/IStepOutHandler.cs b/src/Dap.Protocol/Requests/IStepOutHandler.cs new file mode 100644 index 000000000..86d47f89e --- /dev/null +++ b/src/Dap.Protocol/Requests/IStepOutHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(RequestNames.StepOut)] + public interface IStepOutHandler : IJsonRpcRequestHandler { } + + public abstract class StepOutHandler : IStepOutHandler + { + public abstract Task Handle(StepOutArguments request, CancellationToken cancellationToken); + } + + public static class StepOutHandlerExtensions + { + public static IDisposable OnStepOut(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : StepOutHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(StepOutArguments request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Requests/ITerminateHandler.cs b/src/Dap.Protocol/Requests/ITerminateHandler.cs new file mode 100644 index 000000000..d927c5a61 --- /dev/null +++ b/src/Dap.Protocol/Requests/ITerminateHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(RequestNames.Terminate)] + public interface ITerminateHandler : IJsonRpcRequestHandler { } + + public abstract class TerminateHandler : ITerminateHandler + { + public abstract Task Handle(TerminateArguments request, CancellationToken cancellationToken); + } + + public static class TerminateHandlerExtensions + { + public static IDisposable OnTerminate(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : TerminateHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(TerminateArguments request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Requests/ITerminateThreadsHandler.cs b/src/Dap.Protocol/Requests/ITerminateThreadsHandler.cs new file mode 100644 index 000000000..40a93069b --- /dev/null +++ b/src/Dap.Protocol/Requests/ITerminateThreadsHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(RequestNames.TerminateThreads)] + public interface ITerminateThreadsHandler : IJsonRpcRequestHandler { } + + public abstract class TerminateThreadsHandler : ITerminateThreadsHandler + { + public abstract Task Handle(TerminateThreadsArguments request, CancellationToken cancellationToken); + } + + public static class TerminateThreadsHandlerExtensions + { + public static IDisposable OnTerminateThreads(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : TerminateThreadsHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(TerminateThreadsArguments request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Requests/IThreadsHandler.cs b/src/Dap.Protocol/Requests/IThreadsHandler.cs new file mode 100644 index 000000000..53bcf57bd --- /dev/null +++ b/src/Dap.Protocol/Requests/IThreadsHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(RequestNames.Threads)] + public interface IThreadsHandler : IJsonRpcRequestHandler { } + + public abstract class ThreadsHandler : IThreadsHandler + { + public abstract Task Handle(ThreadsArguments request, CancellationToken cancellationToken); + } + + public static class ThreadsHandlerExtensions + { + public static IDisposable OnThreads(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : ThreadsHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(ThreadsArguments request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Requests/IVariablesHandler.cs b/src/Dap.Protocol/Requests/IVariablesHandler.cs new file mode 100644 index 000000000..520da6a43 --- /dev/null +++ b/src/Dap.Protocol/Requests/IVariablesHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(RequestNames.Variables)] + public interface IVariablesHandler : IJsonRpcRequestHandler { } + + public abstract class VariablesHandler : IVariablesHandler + { + public abstract Task Handle(VariablesArguments request, CancellationToken cancellationToken); + } + + public static class VariablesHandlerExtensions + { + public static IDisposable OnVariables(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : VariablesHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(VariablesArguments request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Requests/InitializeRequestArguments.cs b/src/Dap.Protocol/Requests/InitializeRequestArguments.cs new file mode 100644 index 000000000..bb404d11b --- /dev/null +++ b/src/Dap.Protocol/Requests/InitializeRequestArguments.cs @@ -0,0 +1,69 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class InitializeRequestArguments : IRequest + { + /// + /// The ID of the(frontend) client using this adapter. + /// + + [Optional] public string clientID { get; set; } + + /// + /// The human readable name of the(frontend) client using this adapter. + /// + + [Optional] public string clientName { get; set; } + + /// + /// The ID of the debug adapter. + /// + public string adapterID { get; set; } + + /// + /// The ISO-639 locale of the(frontend) client using this adapter, e.g.en-US or de-CH. + /// + + [Optional] public string locale { get; set; } + + /// + /// If true all line numbers are 1-based(default). + /// + [Optional] public bool? linesStartAt1 { get; set; } + + /// + /// If true all column numbers are 1-based(default). + /// + [Optional] public bool? columnsStartAt1 { get; set; } + + /// + /// Determines in what format paths are specified.The default is 'path', which is the native format. + + /// Values: 'path', 'uri', etc. + /// + [Optional] public string pathFormat { get; set; } + + /// + /// Client supports the optional type attribute for variables. + /// + [Optional] public bool? supportsVariableType { get; set; } + + /// + /// Client supports the paging of variables. + /// + [Optional] public bool? supportsVariablePaging { get; set; } + + /// + /// Client supports the runInTerminal request. + /// + [Optional] public bool? supportsRunInTerminalRequest { get; set; } + + /// + /// Client supports memory references. + /// + [Optional] public bool? supportsMemoryReferences { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/InitializeResponse.cs b/src/Dap.Protocol/Requests/InitializeResponse.cs new file mode 100644 index 000000000..fdcf8b2da --- /dev/null +++ b/src/Dap.Protocol/Requests/InitializeResponse.cs @@ -0,0 +1,13 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class InitializeResponse + { + /// + /// The capabilities of this debug adapter. + /// + [Optional] public Capabilities body { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/LaunchRequestArguments.cs b/src/Dap.Protocol/Requests/LaunchRequestArguments.cs new file mode 100644 index 000000000..fb3b14a39 --- /dev/null +++ b/src/Dap.Protocol/Requests/LaunchRequestArguments.cs @@ -0,0 +1,23 @@ +using Newtonsoft.Json.Linq; +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class LaunchRequestArguments : IRequest + { + /// + /// If noDebug is true the launch request should launch the program without enabling debugging. + /// + [Optional] public bool? noDebug { get; set; } + + /// + /// Optional data from the previous, restarted session. + /// The data is sent as the 'restart' attribute of the 'terminated' event. + /// The client should leave the data intact. + /// + [Optional] + public JToken __restart { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/LaunchResponse.cs b/src/Dap.Protocol/Requests/LaunchResponse.cs new file mode 100644 index 000000000..01bd86be6 --- /dev/null +++ b/src/Dap.Protocol/Requests/LaunchResponse.cs @@ -0,0 +1,7 @@ +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class LaunchResponse + { + } + +} diff --git a/src/Dap.Protocol/Requests/LoadedSourcesArguments.cs b/src/Dap.Protocol/Requests/LoadedSourcesArguments.cs new file mode 100644 index 000000000..e20eddc3f --- /dev/null +++ b/src/Dap.Protocol/Requests/LoadedSourcesArguments.cs @@ -0,0 +1,9 @@ +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class LoadedSourcesArguments : IRequest + { + } + +} diff --git a/src/Dap.Protocol/Requests/LoadedSourcesResponse.cs b/src/Dap.Protocol/Requests/LoadedSourcesResponse.cs new file mode 100644 index 000000000..0a7eb59b9 --- /dev/null +++ b/src/Dap.Protocol/Requests/LoadedSourcesResponse.cs @@ -0,0 +1,11 @@ +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class LoadedSourcesResponse + { + /// + /// Set of loaded sources. + /// + public Container sources { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/ModulesArguments.cs b/src/Dap.Protocol/Requests/ModulesArguments.cs new file mode 100644 index 000000000..464a37154 --- /dev/null +++ b/src/Dap.Protocol/Requests/ModulesArguments.cs @@ -0,0 +1,19 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class ModulesArguments : IRequest + { + /// + /// The index of the first module to return; if omitted modules start at 0. + /// + [Optional] public long? startModule { get; set; } + + /// + /// The number of modules to return. If moduleCount is not specified or 0, all modules are returned. + /// + [Optional] public long? moduleCount { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/ModulesResponse.cs b/src/Dap.Protocol/Requests/ModulesResponse.cs new file mode 100644 index 000000000..f52314a18 --- /dev/null +++ b/src/Dap.Protocol/Requests/ModulesResponse.cs @@ -0,0 +1,18 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class ModulesResponse + { + /// + /// All modules or range of modules. + /// + public Container modules { get; set; } + + /// + /// The total number of modules available. + /// + [Optional] public long? totalModules { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/NextArguments.cs b/src/Dap.Protocol/Requests/NextArguments.cs new file mode 100644 index 000000000..82bf3fcd5 --- /dev/null +++ b/src/Dap.Protocol/Requests/NextArguments.cs @@ -0,0 +1,13 @@ +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class NextArguments : IRequest + { + /// + /// Execute 'next' for this thread. + /// + public long threadId { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/NextResponse.cs b/src/Dap.Protocol/Requests/NextResponse.cs new file mode 100644 index 000000000..de6675b95 --- /dev/null +++ b/src/Dap.Protocol/Requests/NextResponse.cs @@ -0,0 +1,7 @@ +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class NextResponse + { + } + +} diff --git a/src/Dap.Protocol/Requests/PauseArguments.cs b/src/Dap.Protocol/Requests/PauseArguments.cs new file mode 100644 index 000000000..87fe3f713 --- /dev/null +++ b/src/Dap.Protocol/Requests/PauseArguments.cs @@ -0,0 +1,13 @@ +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class PauseArguments : IRequest + { + /// + /// Pause execution for this thread. + /// + public long threadId { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/PauseResponse.cs b/src/Dap.Protocol/Requests/PauseResponse.cs new file mode 100644 index 000000000..6c7900ee3 --- /dev/null +++ b/src/Dap.Protocol/Requests/PauseResponse.cs @@ -0,0 +1,7 @@ +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class PauseResponse + { + } + +} diff --git a/src/Dap.Protocol/Requests/ReadMemoryArguments.cs b/src/Dap.Protocol/Requests/ReadMemoryArguments.cs new file mode 100644 index 000000000..92bf577ad --- /dev/null +++ b/src/Dap.Protocol/Requests/ReadMemoryArguments.cs @@ -0,0 +1,25 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class ReadMemoryArguments : IRequest + { + /// + /// Memory reference to the base location from which data should be read. + /// + public string memoryReference { get; set; } + + /// + /// Optional offset(in bytes) to be applied to the reference location before reading data.Can be negative. + /// + + [Optional] public long? offset { get; set; } + + /// + /// Number of bytes to read at the specified location and offset. + /// + public long count { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/ReadMemoryResponse.cs b/src/Dap.Protocol/Requests/ReadMemoryResponse.cs new file mode 100644 index 000000000..efaaf1f2e --- /dev/null +++ b/src/Dap.Protocol/Requests/ReadMemoryResponse.cs @@ -0,0 +1,23 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class ReadMemoryResponse + { + /// + /// The address of the first byte of data returned.Treated as a hex value if prefixed with '0x', or as a decimal value otherwise. + /// + public string address { get; set; } + + /// + /// The number of unreadable bytes encountered after the last successfully read byte. This can be used to determine the number of bytes that must be skipped before a subsequent 'readMemory' request will succeed. + /// + [Optional] public long? unreadableBytes { get; set; } + + /// + /// The bytes read from memory, encoded using base64. + /// + [Optional] public string data { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/RequestNames.cs b/src/Dap.Protocol/Requests/RequestNames.cs new file mode 100644 index 000000000..b5b221341 --- /dev/null +++ b/src/Dap.Protocol/Requests/RequestNames.cs @@ -0,0 +1,47 @@ +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public static class RequestNames + { + public const string Initialize = "initialize"; + public const string ConfigurationDone = "configurationDone"; + public const string Launch = "launch"; + public const string Attach = "attach"; + public const string Restart = "restart"; + public const string Disconnect = "disconnect"; + public const string Terminate = "terminate"; + public const string SetBreakpoints = "setBreakpoints"; + public const string SetFunctionBreakpoints = "setFunctionBreakpoints"; + public const string SetExceptionBreakpoints = "setExceptionBreakpoints"; + public const string DataBreakpointInfo = "dataBreakpointInfo"; + public const string SetDataBreakpoints = "setDataBreakpoints"; + public const string Continue = "continue"; + public const string Next = "next"; + public const string StepIn = "stepIn"; + public const string StepOut = "stepOut"; + public const string StepBack = "stepBack"; + public const string ReverseContinue = "reverseContinue"; + public const string RestartFrame = "restartFrame"; + public const string Goto = "goto"; + public const string Pause = "pause"; + public const string StackTrace = "stackTrace"; + public const string Scopes = "scopes"; + public const string Variables = "variables"; + public const string SetVariable = "setVariable"; + public const string Source = "source"; + + public const string Threads = "threads"; + public const string TerminateThreads = "terminateThreads"; + public const string Modules = "modules"; + public const string LoadedSources = "loadedSources"; + public const string Evaluate = "evaluate"; + public const string SetExpression = "setExpression"; + public const string StepInTargets = "stepInTargets"; + public const string GotoTargets = "gotoTargets"; + public const string Completions = "completions"; + public const string ExceptionInfo = "exceptionInfo"; + public const string ReadMemory = "readMemory"; + public const string Disassemble = "disassemble"; + public const string RunInTerminal = "runInTerminal"; + } + +} diff --git a/src/Dap.Protocol/Requests/RestartArguments.cs b/src/Dap.Protocol/Requests/RestartArguments.cs new file mode 100644 index 000000000..87d0effda --- /dev/null +++ b/src/Dap.Protocol/Requests/RestartArguments.cs @@ -0,0 +1,9 @@ +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class RestartArguments : IRequest + { + } + +} diff --git a/src/Dap.Protocol/Requests/RestartFrameArguments.cs b/src/Dap.Protocol/Requests/RestartFrameArguments.cs new file mode 100644 index 000000000..0d05ff36f --- /dev/null +++ b/src/Dap.Protocol/Requests/RestartFrameArguments.cs @@ -0,0 +1,13 @@ +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class RestartFrameArguments : IRequest + { + /// + /// Restart this stackframe. + /// + public long frameId { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/RestartFrameResponse.cs b/src/Dap.Protocol/Requests/RestartFrameResponse.cs new file mode 100644 index 000000000..d78c9e396 --- /dev/null +++ b/src/Dap.Protocol/Requests/RestartFrameResponse.cs @@ -0,0 +1,7 @@ +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class RestartFrameResponse + { + } + +} diff --git a/src/Dap.Protocol/Requests/RestartResponse.cs b/src/Dap.Protocol/Requests/RestartResponse.cs new file mode 100644 index 000000000..a9648363c --- /dev/null +++ b/src/Dap.Protocol/Requests/RestartResponse.cs @@ -0,0 +1,7 @@ +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class RestartResponse + { + } + +} diff --git a/src/Dap.Protocol/Requests/ReverseContinueArguments.cs b/src/Dap.Protocol/Requests/ReverseContinueArguments.cs new file mode 100644 index 000000000..430d7cfc8 --- /dev/null +++ b/src/Dap.Protocol/Requests/ReverseContinueArguments.cs @@ -0,0 +1,13 @@ +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class ReverseContinueArguments : IRequest + { + /// + /// Execute 'reverseContinue' for this thread. + /// + public long threadId { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/ReverseContinueResponse.cs b/src/Dap.Protocol/Requests/ReverseContinueResponse.cs new file mode 100644 index 000000000..40f711f40 --- /dev/null +++ b/src/Dap.Protocol/Requests/ReverseContinueResponse.cs @@ -0,0 +1,7 @@ +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class ReverseContinueResponse + { + } + +} diff --git a/src/Dap.Protocol/Requests/RunInTerminalArguments.cs b/src/Dap.Protocol/Requests/RunInTerminalArguments.cs new file mode 100644 index 000000000..d482b67c5 --- /dev/null +++ b/src/Dap.Protocol/Requests/RunInTerminalArguments.cs @@ -0,0 +1,50 @@ +using System.Collections.Generic; +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class RunInTerminalArguments : IRequest + { + /// + /// What kind of terminal to launch. + /// + [Optional] public RunInTerminalArgumentsKind kind { get; set; } + + /// + /// Optional title of the terminal. + /// + [Optional] public string title { get; set; } + + /// + /// Working directory of the command. + /// + public string cwd { get; set; } + + /// + /// List of arguments.The first argument is the command to run. + /// + public Container args { get; set; } + + /// + /// Environment key-value pairs that are added to or removed from the default environment. + /// + [Optional] public IDictionary env { get; set; } + + public override bool Equals(object obj) + { + return base.Equals(obj); + } + + public override int GetHashCode() + { + return base.GetHashCode(); + } + + public override string ToString() + { + return base.ToString(); + } + } + +} diff --git a/src/Dap.Protocol/Requests/RunInTerminalArgumentsKind.cs b/src/Dap.Protocol/Requests/RunInTerminalArgumentsKind.cs new file mode 100644 index 000000000..64c42558b --- /dev/null +++ b/src/Dap.Protocol/Requests/RunInTerminalArgumentsKind.cs @@ -0,0 +1,13 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [JsonConverter(typeof(StringEnumConverter))] + public enum RunInTerminalArgumentsKind + { + Integrated, + External + } + +} diff --git a/src/Dap.Protocol/Requests/RunInTerminalExtensions.cs b/src/Dap.Protocol/Requests/RunInTerminalExtensions.cs new file mode 100644 index 000000000..d0ba300b7 --- /dev/null +++ b/src/Dap.Protocol/Requests/RunInTerminalExtensions.cs @@ -0,0 +1,13 @@ +using System.Threading.Tasks; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public static class RunInTerminalExtensions + { + public static Task RunInTerminal(this IDebugAdapterClient mediator, RunInTerminalArguments @params) + { + return mediator.SendRequest(RequestNames.RunInTerminal, @params); + } + } + +} diff --git a/src/Dap.Protocol/Requests/RunInTerminalResponse.cs b/src/Dap.Protocol/Requests/RunInTerminalResponse.cs new file mode 100644 index 000000000..95ae2ee71 --- /dev/null +++ b/src/Dap.Protocol/Requests/RunInTerminalResponse.cs @@ -0,0 +1,18 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class RunInTerminalResponse + { + /// + /// The process ID. + /// + [Optional] public long? processId { get; set; } + + /// + /// The process ID of the terminal shell. + /// + [Optional] public long? shellProcessId { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/ScopesArguments.cs b/src/Dap.Protocol/Requests/ScopesArguments.cs new file mode 100644 index 000000000..a45e37bce --- /dev/null +++ b/src/Dap.Protocol/Requests/ScopesArguments.cs @@ -0,0 +1,13 @@ +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class ScopesArguments : IRequest + { + /// + /// Retrieve the scopes for this stackframe. + /// + public long frameId { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/ScopesResponse.cs b/src/Dap.Protocol/Requests/ScopesResponse.cs new file mode 100644 index 000000000..9cbca13c4 --- /dev/null +++ b/src/Dap.Protocol/Requests/ScopesResponse.cs @@ -0,0 +1,11 @@ +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class ScopesResponse + { + /// + /// The scopes of the stackframe.If the array has length zero, there are no scopes available. + /// + public Container scopes { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/SetBreakpointsArguments.cs b/src/Dap.Protocol/Requests/SetBreakpointsArguments.cs new file mode 100644 index 000000000..2c93f6737 --- /dev/null +++ b/src/Dap.Protocol/Requests/SetBreakpointsArguments.cs @@ -0,0 +1,31 @@ +using System; +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class SetBreakpointsArguments : IRequest + { + /// + /// The source location of the breakpoints; either 'source.path' or 'source.reference' must be specified. + /// + public Source source { get; set; } + + /// + /// The code locations of the breakpoints. + /// + [Optional] public Container breakpoints { get; set; } + + /// + /// Deprecated: The code locations of the breakpoints. + /// + [Obsolete("Deprecated")] + [Optional] public Container lines { get; set; } + + /// + /// A value of true indicates that the underlying source has been modified which results in new breakpoint locations. + /// + [Optional] public bool? sourceModified { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/SetBreakpointsResponse.cs b/src/Dap.Protocol/Requests/SetBreakpointsResponse.cs new file mode 100644 index 000000000..899881ba4 --- /dev/null +++ b/src/Dap.Protocol/Requests/SetBreakpointsResponse.cs @@ -0,0 +1,11 @@ +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class SetBreakpointsResponse + { + /// + /// Information about the breakpoints.The array elements are in the same order as the elements of the 'breakpoints' (or the deprecated 'lines') array in the arguments. + /// + public Container breakpoints { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/SetDataBreakpointsArguments.cs b/src/Dap.Protocol/Requests/SetDataBreakpointsArguments.cs new file mode 100644 index 000000000..6338cd3ab --- /dev/null +++ b/src/Dap.Protocol/Requests/SetDataBreakpointsArguments.cs @@ -0,0 +1,13 @@ +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class SetDataBreakpointsArguments : IRequest + { + /// + /// The contents of this array replaces all existing data breakpoints. An empty array clears all data breakpoints. + /// + public Container breakpoints { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/SetDataBreakpointsResponse.cs b/src/Dap.Protocol/Requests/SetDataBreakpointsResponse.cs new file mode 100644 index 000000000..b66c6737d --- /dev/null +++ b/src/Dap.Protocol/Requests/SetDataBreakpointsResponse.cs @@ -0,0 +1,11 @@ +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class SetDataBreakpointsResponse + { + /// + /// Information about the data breakpoints.The array elements correspond to the elements of the input argument 'breakpoints' array. + /// + public Container breakpoints { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/SetExceptionBreakpointsArguments.cs b/src/Dap.Protocol/Requests/SetExceptionBreakpointsArguments.cs new file mode 100644 index 000000000..e9ac36720 --- /dev/null +++ b/src/Dap.Protocol/Requests/SetExceptionBreakpointsArguments.cs @@ -0,0 +1,19 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class SetExceptionBreakpointsArguments : IRequest + { + /// + /// IDs of checked exception options.The set of IDs is returned via the 'exceptionBreakpointFilters' capability. + /// + public Container filters { get; set; } + + /// + /// Configuration options for selected exceptions. + /// + [Optional] public Container exceptionOptions { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/SetExceptionBreakpointsResponse.cs b/src/Dap.Protocol/Requests/SetExceptionBreakpointsResponse.cs new file mode 100644 index 000000000..a664a6b7e --- /dev/null +++ b/src/Dap.Protocol/Requests/SetExceptionBreakpointsResponse.cs @@ -0,0 +1,7 @@ +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class SetExceptionBreakpointsResponse + { + } + +} diff --git a/src/Dap.Protocol/Requests/SetExpressionArguments.cs b/src/Dap.Protocol/Requests/SetExpressionArguments.cs new file mode 100644 index 000000000..dbd1a7db2 --- /dev/null +++ b/src/Dap.Protocol/Requests/SetExpressionArguments.cs @@ -0,0 +1,29 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class SetExpressionArguments : IRequest + { + /// + /// The l-value expression to assign to. + /// + public string expression { get; set; } + + /// + /// The value expression to assign to the l-value expression. + /// + public string value { get; set; } + + /// + /// Evaluate the expressions in the scope of this stack frame. If not specified, the expressions are evaluated in the global scope. + /// + [Optional] public long? frameId { get; set; } + + /// + /// Specifies how the resulting value should be formatted. + /// + [Optional] public ValueFormat format { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/SetExpressionResponse.cs b/src/Dap.Protocol/Requests/SetExpressionResponse.cs new file mode 100644 index 000000000..e69256cb1 --- /dev/null +++ b/src/Dap.Protocol/Requests/SetExpressionResponse.cs @@ -0,0 +1,40 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class SetExpressionResponse + { + /// + /// The new value of the expression. + /// + public string value { get; set; } + + /// + /// The optional type of the value. + /// + [Optional] public string type { get; set; } + + /// + /// Properties of a value that can be used to determine how to render the result in the UI. + /// + [Optional] public VariablePresentationHint presentationHint { get; set; } + + /// + /// If variablesReference is > 0, the value is structured and its children can be retrieved by passing variablesReference to the VariablesRequest. + /// + [Optional] public long? variablesReference { get; set; } + + /// + /// The number of named child variables. + /// The client can use this optional information to present the variables in a paged UI and fetch them in chunks. + /// + [Optional] public long? namedVariables { get; set; } + + /// + /// The number of indexed child variables. + /// The client can use this optional information to present the variables in a paged UI and fetch them in chunks. + /// + [Optional] public long? indexedVariables { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/SetFunctionBreakpointsArguments.cs b/src/Dap.Protocol/Requests/SetFunctionBreakpointsArguments.cs new file mode 100644 index 000000000..a510489bd --- /dev/null +++ b/src/Dap.Protocol/Requests/SetFunctionBreakpointsArguments.cs @@ -0,0 +1,13 @@ +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class SetFunctionBreakpointsArguments : IRequest + { + /// + /// The function names of the breakpoints. + /// + public Container breakpoints { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/SetFunctionBreakpointsResponse.cs b/src/Dap.Protocol/Requests/SetFunctionBreakpointsResponse.cs new file mode 100644 index 000000000..fad4c35f3 --- /dev/null +++ b/src/Dap.Protocol/Requests/SetFunctionBreakpointsResponse.cs @@ -0,0 +1,11 @@ +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class SetFunctionBreakpointsResponse + { + /// + /// Information about the breakpoints.The array elements correspond to the elements of the 'breakpoints' array. + /// + public Container breakpoints { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/SetVariableArguments.cs b/src/Dap.Protocol/Requests/SetVariableArguments.cs new file mode 100644 index 000000000..0f92aca34 --- /dev/null +++ b/src/Dap.Protocol/Requests/SetVariableArguments.cs @@ -0,0 +1,29 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class SetVariableArguments : IRequest + { + /// + /// The reference of the variable container. + /// + public long variablesReference { get; set; } + + /// + /// The name of the variable in the container. + /// + public string name { get; set; } + + /// + /// The value of the variable. + /// + public string value { get; set; } + + /// + /// Specifies details on how to format the response value. + /// + [Optional] public ValueFormat format { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/SetVariableResponse.cs b/src/Dap.Protocol/Requests/SetVariableResponse.cs new file mode 100644 index 000000000..f4a467c71 --- /dev/null +++ b/src/Dap.Protocol/Requests/SetVariableResponse.cs @@ -0,0 +1,35 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class SetVariableResponse + { + /// + /// The new value of the variable. + /// + public string value { get; set; } + + /// + /// The type of the new value.Typically shown in the UI when hovering over the value. + /// + [Optional] public string type { get; set; } + + /// + /// If variablesReference is > 0, the new value is structured and its children can be retrieved by passing variablesReference to the VariablesRequest. + /// + [Optional] public long? variablesReference { get; set; } + + /// + /// The number of named child variables. + /// The client can use this optional information to present the variables in a paged UI and fetch them in chunks. + /// + [Optional] public long? namedVariables { get; set; } + + /// + /// The number of indexed child variables. + /// The client can use this optional information to present the variables in a paged UI and fetch them in chunks. + /// + [Optional] public long? indexedVariables { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/SourceArguments.cs b/src/Dap.Protocol/Requests/SourceArguments.cs new file mode 100644 index 000000000..d13da4869 --- /dev/null +++ b/src/Dap.Protocol/Requests/SourceArguments.cs @@ -0,0 +1,19 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class SourceArguments : IRequest + { + /// + /// Specifies the source content to load.Either source.path or source.sourceReference must be specified. + /// + [Optional] public Source source { get; set; } + + /// + /// The reference to the source.This is the same as source.sourceReference.This is provided for backward compatibility since old backends do not understand the 'source' attribute. + /// + public long sourceReference { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/SourceResponse.cs b/src/Dap.Protocol/Requests/SourceResponse.cs new file mode 100644 index 000000000..357210df4 --- /dev/null +++ b/src/Dap.Protocol/Requests/SourceResponse.cs @@ -0,0 +1,18 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class SourceResponse + { + /// + /// Content of the source reference. + /// + public string content { get; set; } + + /// + /// Optional content type(mime type) of the source. + /// + [Optional] public string mimeType { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/StackTraceArguments.cs b/src/Dap.Protocol/Requests/StackTraceArguments.cs new file mode 100644 index 000000000..a678d56be --- /dev/null +++ b/src/Dap.Protocol/Requests/StackTraceArguments.cs @@ -0,0 +1,29 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class StackTraceArguments : IRequest + { + /// + /// Retrieve the stacktrace for this thread. + /// + public long threadId { get; set; } + + /// + /// The index of the first frame to return; if omitted frames start at 0. + /// + [Optional] public long? startFrame { get; set; } + + /// + /// The maximum number of frames to return. If levels is not specified or 0, all frames are returned. + /// + [Optional] public long? levels { get; set; } + + /// + /// Specifies details on how to format the stack frames. + /// + [Optional] public StackFrameFormat format { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/StackTraceResponse.cs b/src/Dap.Protocol/Requests/StackTraceResponse.cs new file mode 100644 index 000000000..251fd5804 --- /dev/null +++ b/src/Dap.Protocol/Requests/StackTraceResponse.cs @@ -0,0 +1,20 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class StackTraceResponse + { + /// + /// The frames of the stackframe.If the array has length zero, there are no stackframes available. + /// This means that there is no location information available. + /// + public Container stackFrames { get; set; } + + /// + /// The total number of frames available. + /// + [Optional] public long? totalFrames { get; set; } + + } + +} diff --git a/src/Dap.Protocol/Requests/StepBackArguments.cs b/src/Dap.Protocol/Requests/StepBackArguments.cs new file mode 100644 index 000000000..8bff37da8 --- /dev/null +++ b/src/Dap.Protocol/Requests/StepBackArguments.cs @@ -0,0 +1,13 @@ +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class StepBackArguments : IRequest + { + /// + /// Execute 'stepBack' for this thread. + /// + public long threadId { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/StepBackResponse.cs b/src/Dap.Protocol/Requests/StepBackResponse.cs new file mode 100644 index 000000000..e735ab43c --- /dev/null +++ b/src/Dap.Protocol/Requests/StepBackResponse.cs @@ -0,0 +1,7 @@ +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class StepBackResponse + { + } + +} diff --git a/src/Dap.Protocol/Requests/StepInArguments.cs b/src/Dap.Protocol/Requests/StepInArguments.cs new file mode 100644 index 000000000..9ee6dde8f --- /dev/null +++ b/src/Dap.Protocol/Requests/StepInArguments.cs @@ -0,0 +1,19 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class StepInArguments : IRequest + { + /// + /// Execute 'stepIn' for this thread. + /// + public long threadId { get; set; } + + /// + /// Optional id of the target to step into. + /// + [Optional] public long? targetId { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/StepInResponse.cs b/src/Dap.Protocol/Requests/StepInResponse.cs new file mode 100644 index 000000000..d1de6f2d5 --- /dev/null +++ b/src/Dap.Protocol/Requests/StepInResponse.cs @@ -0,0 +1,7 @@ +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class StepInResponse + { + } + +} diff --git a/src/Dap.Protocol/Requests/StepInTargetsArguments.cs b/src/Dap.Protocol/Requests/StepInTargetsArguments.cs new file mode 100644 index 000000000..955f9aa0a --- /dev/null +++ b/src/Dap.Protocol/Requests/StepInTargetsArguments.cs @@ -0,0 +1,13 @@ +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class StepInTargetsArguments : IRequest + { + /// + /// The stack frame for which to retrieve the possible stepIn targets. + /// + public long frameId { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/StepInTargetsResponse.cs b/src/Dap.Protocol/Requests/StepInTargetsResponse.cs new file mode 100644 index 000000000..6dbfc4fdb --- /dev/null +++ b/src/Dap.Protocol/Requests/StepInTargetsResponse.cs @@ -0,0 +1,11 @@ +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class StepInTargetsResponse + { + /// + /// The possible stepIn targets of the specified source location. + /// + public Container targets { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/StepOutArguments.cs b/src/Dap.Protocol/Requests/StepOutArguments.cs new file mode 100644 index 000000000..6f1f387cd --- /dev/null +++ b/src/Dap.Protocol/Requests/StepOutArguments.cs @@ -0,0 +1,13 @@ +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class StepOutArguments : IRequest + { + /// + /// Execute 'stepOut' for this thread. + /// + public long threadId { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/StepOutResponse.cs b/src/Dap.Protocol/Requests/StepOutResponse.cs new file mode 100644 index 000000000..23dc22966 --- /dev/null +++ b/src/Dap.Protocol/Requests/StepOutResponse.cs @@ -0,0 +1,7 @@ +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class StepOutResponse + { + } + +} diff --git a/src/Dap.Protocol/Requests/TerminateArguments.cs b/src/Dap.Protocol/Requests/TerminateArguments.cs new file mode 100644 index 000000000..50c9dfac7 --- /dev/null +++ b/src/Dap.Protocol/Requests/TerminateArguments.cs @@ -0,0 +1,14 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class TerminateArguments : IRequest + { + /// + /// A value of true indicates that this 'terminate' request is part of a restart sequence. + /// + [Optional] public bool? restart { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/TerminateResponse.cs b/src/Dap.Protocol/Requests/TerminateResponse.cs new file mode 100644 index 000000000..87da317ae --- /dev/null +++ b/src/Dap.Protocol/Requests/TerminateResponse.cs @@ -0,0 +1,7 @@ +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class TerminateResponse + { + } + +} diff --git a/src/Dap.Protocol/Requests/TerminateThreadsArguments.cs b/src/Dap.Protocol/Requests/TerminateThreadsArguments.cs new file mode 100644 index 000000000..ecf14c7b7 --- /dev/null +++ b/src/Dap.Protocol/Requests/TerminateThreadsArguments.cs @@ -0,0 +1,14 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class TerminateThreadsArguments : IRequest + { + /// + /// Ids of threads to be terminated. + /// + [Optional] public Container threadIds { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/TerminateThreadsResponse.cs b/src/Dap.Protocol/Requests/TerminateThreadsResponse.cs new file mode 100644 index 000000000..2464b8996 --- /dev/null +++ b/src/Dap.Protocol/Requests/TerminateThreadsResponse.cs @@ -0,0 +1,7 @@ +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class TerminateThreadsResponse + { + } + +} diff --git a/src/Dap.Protocol/Requests/ThreadsArguments.cs b/src/Dap.Protocol/Requests/ThreadsArguments.cs new file mode 100644 index 000000000..8b8951595 --- /dev/null +++ b/src/Dap.Protocol/Requests/ThreadsArguments.cs @@ -0,0 +1,9 @@ +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class ThreadsArguments : IRequest + { + } + +} diff --git a/src/Dap.Protocol/Requests/ThreadsResponse.cs b/src/Dap.Protocol/Requests/ThreadsResponse.cs new file mode 100644 index 000000000..0b06d00cd --- /dev/null +++ b/src/Dap.Protocol/Requests/ThreadsResponse.cs @@ -0,0 +1,11 @@ +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class ThreadsResponse + { + /// + /// All threads. + /// + public Container threads { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/VariablesArguments.cs b/src/Dap.Protocol/Requests/VariablesArguments.cs new file mode 100644 index 000000000..4c7b7c665 --- /dev/null +++ b/src/Dap.Protocol/Requests/VariablesArguments.cs @@ -0,0 +1,34 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; +using OmniSharp.Extensions.Embedded.MediatR; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class VariablesArguments : IRequest + { + /// + /// The Variable reference. + /// + public long variablesReference { get; set; } + + /// + /// Optional filter to limit the child variables to either named or indexed.If ommited, both types are fetched. + /// + [Optional] public VariablesArgumentsFilter filter { get; set; } + + /// + /// The index of the first variable to return; if omitted children start at 0. + /// + [Optional] public long? start { get; set; } + + /// + /// The number of variables to return. If count is missing or 0, all variables are returned. + /// + [Optional] public long? count { get; set; } + + /// + /// Specifies details on how to format the Variable values. + /// + [Optional] public ValueFormat format { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/VariablesArgumentsFilter.cs b/src/Dap.Protocol/Requests/VariablesArgumentsFilter.cs new file mode 100644 index 000000000..01b6946b3 --- /dev/null +++ b/src/Dap.Protocol/Requests/VariablesArgumentsFilter.cs @@ -0,0 +1,12 @@ +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [JsonConverter(typeof(StringEnumConverter))] + public enum VariablesArgumentsFilter + { + Indexed, Named + } + +} diff --git a/src/Dap.Protocol/Requests/VariablesResponse.cs b/src/Dap.Protocol/Requests/VariablesResponse.cs new file mode 100644 index 000000000..d9c56464f --- /dev/null +++ b/src/Dap.Protocol/Requests/VariablesResponse.cs @@ -0,0 +1,11 @@ +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public class VariablesResponse + { + /// + /// All(or a range) of variables for the given variable reference. + /// + public Container variables { get; set; } + } + +} diff --git a/src/Dap.Protocol/Requests/classs1.cs b/src/Dap.Protocol/Requests/classs1.cs deleted file mode 100644 index 46d19c5b5..000000000 --- a/src/Dap.Protocol/Requests/classs1.cs +++ /dev/null @@ -1,1496 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Threading.Tasks; -using OmniSharp.Extensions.Embedded.MediatR; -using OmniSharp.Extensions.JsonRpc; - -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events -{ - public static class RequestNames - { - public static string Initialize = "initialize"; - public static string ConfigurationDone = "configurationDone"; - public static string Launch = "launch"; - public static string Attach = "attach"; - public static string Restart = "restart"; - public static string Disconnect = "disconnect"; - public static string Terminate = "terminate"; - public static string SetBreakpoints = "setBreakpoints"; - public static string setFunctionBreakpoints = "setFunctionBreakpoints"; - public static string SetExceptionBreakpoints = "setExceptionBreakpoints"; - public static string DataBreakpointInfo = "dataBreakpointInfo"; - public static string SetDataBreakpoints = "setDataBreakpoints"; - public static string Continue = "continue"; - public static string Next = "next"; - public static string StepIn = "stepIn"; - public static string StepOut = "stepOut"; - public static string StepBack = "stepBack"; - public static string ReverseContinue = "reverseContinue"; - public static string RestartFrame = "restartFrame"; - public static string Goto = "goto"; - public static string Pause = "pause"; - public static string StackTrace = "stackTrace"; - public static string Scopes = "scopes"; - public static string Variables = "variables"; - public static string SetVariable = "setVariable"; - public static string Source = "source"; - - public static string Threads = "threads"; - public static string TerminateThreads = "terminateThreads"; - public static string Modules = "modules"; - public static string LoadedSources = "loadedSources"; - public static string Evaluate = "evaluate"; - public static string SetExpression = "setExpression"; - public static string StepInTargets = "stepInTargets"; - public static string GotoTargets = "gotoTargets"; - public static string Completions = "completions"; - public static string ExceptionInfo = "exceptionInfo"; - public static string ReadMemory = "readMemory"; - public static string Disassemble = "disassemble"; - } - - - [Parallel, Method(RequestNames.Initialize)] - public interface IInitializeHandler : IJsonRpcNotificationHandler { } - - public abstract class InitializeHandler : IInitializeHandler - { - public abstract Task Handle(InitializeRequestArguments request, CancellationToken cancellationToken); - } - - public static class InitializeHandlerExtensions - { - public static IDisposable OnPublishDiagnostics(this IDebugAdapterRegistry registry, Func> handler) - { - return registry.AddHandlers(new DelegatingHandler(handler)); - } - - class DelegatingHandler : InitializeHandler - { - private readonly Func> _handler; - - public DelegatingHandler(Func> handler) - { - _handler = handler; - } - - public override Task Handle(InitializeRequestArguments request, CancellationToken cancellationToken) => _handler.Invoke(request); - } - } - - Requests -:leftwards_arrow_with_hook: Initialize Request -The ‘initialize’ request is sent as the first request from the client to the debug adapter in order to configure it with client capabilities and to retrieve capabilities from the debug adapter. -Until the debug adapter has responded to with an ‘initialize’ response, the client must not send any additional requests or events to the debug adapter.In addition the debug adapter is not allowed to send any requests or events to the client until it has responded with an ‘initialize’ response. -The ‘initialize’ request may only be sent once. - -interface InitializeRequest extends Request - { -public static string initialize = "initialize"; - - arguments: InitializeRequestArguments; -} -Arguments for ‘initialize’ request. - - -interface InitializeRequestArguments -{ - /** - * The ID of the (frontend) client using this adapter. -*/ - clientID?: string; - -/** -* The human readable name of the (frontend) client using this adapter. -*/ -clientName?: string; - -/** -* The ID of the debug adapter. -*/ -adapterID: string; - -/** -* The ISO-639 locale of the (frontend) client using this adapter, e.g. en-US or de-CH. -*/ -locale?: string; - -/** -* If true all line numbers are 1-based (default). -*/ -linesStartAt1?: boolean; - -/** -* If true all column numbers are 1-based (default). -*/ -columnsStartAt1?: boolean; - -/** -* Determines in what format paths are specified. The default is 'path', which is the native format. -* Values: 'path', 'uri', etc. -*/ -pathFormat?: string; - -/** -* Client supports the optional type attribute for variables. -*/ -supportsVariableType?: boolean; - -/** -* Client supports the paging of variables. -*/ -supportsVariablePaging?: boolean; - -/** -* Client supports the runInTerminal request. -*/ -supportsRunInTerminalRequest?: boolean; - -/** -* Client supports memory references. -*/ -supportsMemoryReferences?: boolean; -} -Response to ‘initialize’ request. - - -interface InitializeResponse extends Response -{ - /** - * The capabilities of this debug adapter. -*/ - body?: Capabilities; -} -:leftwards_arrow_with_hook: ConfigurationDone Request -The client of the debug protocol must send this request at the end of the sequence of configuration requests (which was started by the ‘initialized’ event). - -interface ConfigurationDoneRequest extends Request -{ - - arguments?: ConfigurationDoneArguments; -} -Arguments for ‘configurationDone’ request. - - -interface ConfigurationDoneArguments -{ -} -Response to ‘configurationDone’ request.This is just an acknowledgement, so no body field is required. - - -interface ConfigurationDoneResponse extends Response -{ -} -:leftwards_arrow_with_hook: Launch Request -The launch request is sent from the client to the debug adapter to start the debuggee with or without debugging(if ‘noDebug’ is true). Since launching is debugger/runtime specific, the arguments for this request are not part of this specification. - -interface LaunchRequest extends Request -{ - - arguments: LaunchRequestArguments; -} -Arguments for ‘launch’ request.Additional attributes are implementation specific. - - -interface LaunchRequestArguments -{ - /** - * If noDebug is true the launch request should launch the program without enabling debugging. -*/ - noDebug?: boolean; - -/** -* Optional data from the previous, restarted session. -* The data is sent as the 'restart' attribute of the 'terminated' event. -* The client should leave the data intact. -*/ -__restart?: any; -} -Response to ‘launch’ request.This is just an acknowledgement, so no body field is required. - - -interface LaunchResponse extends Response -{ -} -:leftwards_arrow_with_hook: Attach Request -The attach request is sent from the client to the debug adapter to attach to a debuggee that is already running.Since attaching is debugger/runtime specific, the arguments for this request are not part of this specification. - -interface AttachRequest extends Request -{ - - arguments: AttachRequestArguments; -} -Arguments for ‘attach’ request.Additional attributes are implementation specific. - - -interface AttachRequestArguments -{ - /** - * Optional data from the previous, restarted session. - * The data is sent as the 'restart' attribute of the 'terminated' event. - * The client should leave the data intact. -*/ - __restart?: any; -} -Response to ‘attach’ request.This is just an acknowledgement, so no body field is required. - - -interface AttachResponse extends Response -{ -} -:leftwards_arrow_with_hook: Restart Request -Restarts a debug session.If the capability ‘supportsRestartRequest’ is missing or has the value false, - -the client will implement ‘restart’ by terminating the debug adapter first and then launching it anew. - -A debug adapter can override this default behaviour by implementing a restart request - -and setting the capability ‘supportsRestartRequest’ to true. - -interface RestartRequest extends Request -{ - - arguments?: RestartArguments; -} -Arguments for ‘restart’ request. - - -interface RestartArguments -{ -} -Response to ‘restart’ request.This is just an acknowledgement, so no body field is required. - - -interface RestartResponse extends Response -{ -} -:leftwards_arrow_with_hook: Disconnect Request -The ‘disconnect’ request is sent from the client to the debug adapter in order to stop debugging.It asks the debug adapter to disconnect from the debuggee and to terminate the debug adapter.If the debuggee has been started with the ‘launch’ request, the ‘disconnect’ request terminates the debuggee. If the ‘attach’ request was used to connect to the debuggee, ‘disconnect’ does not terminate the debuggee.This behavior can be controlled with the ‘terminateDebuggee’ argument (if supported by the debug adapter). - -interface DisconnectRequest extends Request -{ - - arguments?: DisconnectArguments; -} -Arguments for ‘disconnect’ request. - - -interface DisconnectArguments -{ - /** - * A value of true indicates that this 'disconnect' request is part of a restart sequence. -*/ - restart?: boolean; - -/** -* Indicates whether the debuggee should be terminated when the debugger is disconnected. -* If unspecified, the debug adapter is free to do whatever it thinks is best. -* A client can only rely on this attribute being properly honored if a debug adapter returns true for the 'supportTerminateDebuggee' capability. -*/ -terminateDebuggee?: boolean; -} -Response to ‘disconnect’ request.This is just an acknowledgement, so no body field is required. - - -interface DisconnectResponse extends Response -{ -} -:leftwards_arrow_with_hook: Terminate Request -The ‘terminate’ request is sent from the client to the debug adapter in order to give the debuggee a chance for terminating itself. - -interface TerminateRequest extends Request -{ - - arguments?: TerminateArguments; -} -Arguments for ‘terminate’ request. - - -interface TerminateArguments -{ - /** - * A value of true indicates that this 'terminate' request is part of a restart sequence. -*/ - restart?: boolean; -} -Response to ‘terminate’ request.This is just an acknowledgement, so no body field is required. - - -interface TerminateResponse extends Response -{ -} -:leftwards_arrow_with_hook: SetBreakpoints Request -Sets multiple breakpoints for a single source and clears all previous breakpoints in that source. - -To clear all breakpoint for a source, specify an empty array. - -When a breakpoint is hit, a ‘stopped’ event (with reason ‘breakpoint’) is generated. - -interface SetBreakpointsRequest extends Request -{ - - arguments: SetBreakpointsArguments; -} -Arguments for ‘setBreakpoints’ request. - - -interface SetBreakpointsArguments -{ - /** - * The source location of the breakpoints; either 'source.path' or 'source.reference' must be specified. -*/ - source: Source; - -/** -* The code locations of the breakpoints. -*/ -breakpoints?: SourceBreakpoint[]; - -/** -* Deprecated: The code locations of the breakpoints. -*/ -lines?: number[]; - -/** -* A value of true indicates that the underlying source has been modified which results in new breakpoint locations. -*/ -sourceModified?: boolean; -} -Response to ‘setBreakpoints’ request. - -Returned is information about each breakpoint created by this request. - -This includes the actual code location and whether the breakpoint could be verified. - -The breakpoints returned are in the same order as the elements of the ‘breakpoints’ - - -(or the deprecated ‘lines’) array in the arguments. - - -interface SetBreakpointsResponse extends Response -{ - body: { - /** - * Information about the breakpoints. The array elements are in the same order as the elements of the 'breakpoints' (or the deprecated 'lines') array in the arguments. -*/ - breakpoints: Breakpoint[]; - }; -} -:leftwards_arrow_with_hook: SetFunctionBreakpoints Request -Replaces all existing function breakpoints with new function breakpoints. - -To clear all function breakpoints, specify an empty array. - -When a function breakpoint is hit, a ‘stopped’ event (with reason ‘function breakpoint’) is generated. - -interface SetFunctionBreakpointsRequest extends Request -{ - - arguments: SetFunctionBreakpointsArguments; -} -Arguments for ‘setFunctionBreakpoints’ request. - - -interface SetFunctionBreakpointsArguments -{ - /** - * The function names of the breakpoints. -*/ - breakpoints: FunctionBreakpoint[]; -} -Response to ‘setFunctionBreakpoints’ request. - -Returned is information about each breakpoint created by this request. - - -interface SetFunctionBreakpointsResponse extends Response -{ - body: { - /** - * Information about the breakpoints. The array elements correspond to the elements of the 'breakpoints' array. -*/ - breakpoints: Breakpoint[]; - }; -} -:leftwards_arrow_with_hook: SetExceptionBreakpoints Request -The request configures the debuggers response to thrown exceptions.If an exception is configured to break, a ‘stopped’ event is fired (with reason ‘exception’). - -interface SetExceptionBreakpointsRequest extends Request -{ - - arguments: SetExceptionBreakpointsArguments; -} -Arguments for ‘setExceptionBreakpoints’ request. - - -interface SetExceptionBreakpointsArguments -{ - /** - * IDs of checked exception options. The set of IDs is returned via the 'exceptionBreakpointFilters' capability. -*/ - filters: string[]; - -/** -* Configuration options for selected exceptions. -*/ -exceptionOptions?: ExceptionOptions[]; -} -Response to ‘setExceptionBreakpoints’ request.This is just an acknowledgement, so no body field is required. - - -interface SetExceptionBreakpointsResponse extends Response -{ -} -:leftwards_arrow_with_hook: DataBreakpointInfo Request -Obtains information on a possible data breakpoint that could be set on an expression or variable. - -interface DataBreakpointInfoRequest extends Request -{ - - arguments: DataBreakpointInfoArguments; -} -Arguments for ‘dataBreakpointInfo’ request. - - -interface DataBreakpointInfoArguments -{ - /** - * Reference to the Variable container if the data breakpoint is requested for a child of the container. -*/ - variablesReference?: number; - -/** -* The name of the Variable's child to obtain data breakpoint information for. If variableReference isn’t provided, this can be an expression. -*/ -name: string; -} -Response to ‘dataBreakpointInfo’ request. - - -interface DataBreakpointInfoResponse extends Response -{ - body: { - /** - * An identifier for the data on which a data breakpoint can be registered with the setDataBreakpoints request or null if no data breakpoint is available. -*/ - dataId: string | null; - - /** - * UI string that describes on what data the breakpoint is set on or why a data breakpoint is not available. -*/ - description: string; - - /** - * Optional attribute listing the available access types for a potential data breakpoint. A UI frontend could surface this information. -*/ - accessTypes ?: DataBreakpointAccessType[]; - - /** - * Optional attribute indicating that a potential data breakpoint could be persisted across sessions. -*/ - canPersist ?: boolean; - }; -} -:leftwards_arrow_with_hook: SetDataBreakpoints Request -Replaces all existing data breakpoints with new data breakpoints. - -To clear all data breakpoints, specify an empty array. - -When a data breakpoint is hit, a ‘stopped’ event (with reason ‘data breakpoint’) is generated. - -interface SetDataBreakpointsRequest extends Request -{ - - arguments: SetDataBreakpointsArguments; -} -Arguments for ‘setDataBreakpoints’ request. - - -interface SetDataBreakpointsArguments -{ - /** - * The contents of this array replaces all existing data breakpoints. An empty array clears all data breakpoints. -*/ - breakpoints: DataBreakpoint[]; -} -Response to ‘setDataBreakpoints’ request. - -Returned is information about each breakpoint created by this request. - - -interface SetDataBreakpointsResponse extends Response -{ - body: { - /** - * Information about the data breakpoints. The array elements correspond to the elements of the input argument 'breakpoints' array. -*/ - breakpoints: Breakpoint[]; - }; -} -:leftwards_arrow_with_hook: Continue Request -The request starts the debuggee to run again. - -interface ContinueRequest extends Request -{ - - arguments: ContinueArguments; -} -Arguments for ‘continue’ request. - - -interface ContinueArguments -{ - /** - * Continue execution for the specified thread (if possible). If the backend cannot continue on a single thread but will continue on all threads, it should set the 'allThreadsContinued' attribute in the response to true. -*/ - threadId: number; -} -Response to ‘continue’ request. - - -interface ContinueResponse extends Response -{ - body: { - /** - * If true, the 'continue' request has ignored the specified thread and continued all threads instead. If this attribute is missing a value of 'true' is assumed for backward compatibility. -*/ - allThreadsContinued ?: boolean; - }; -} -:leftwards_arrow_with_hook: Next Request -The request starts the debuggee to run again for one step. - -The debug adapter first sends the response and then a ‘stopped’ event (with reason ‘step’) after the step has completed. - -interface NextRequest extends Request -{ - - arguments: NextArguments; -} -Arguments for ‘next’ request. - - -interface NextArguments -{ - /** - * Execute 'next' for this thread. -*/ - threadId: number; -} -Response to ‘next’ request.This is just an acknowledgement, so no body field is required. - - -interface NextResponse extends Response -{ -} -:leftwards_arrow_with_hook: StepIn Request -The request starts the debuggee to step into a function/method if possible. - -If it cannot step into a target, ‘stepIn’ behaves like ‘next’. - -The debug adapter first sends the response and then a ‘stopped’ event (with reason ‘step’) after the step has completed. - -If there are multiple function/method calls (or other targets) on the source line, - -the optional argument ‘targetId’ can be used to control into which target the ‘stepIn’ should occur. - -The list of possible targets for a given source line can be retrieved via the ‘stepInTargets’ request. - -interface StepInRequest extends Request -{ - - arguments: StepInArguments; -} -Arguments for ‘stepIn’ request. - - -interface StepInArguments { -/** -* Execute 'stepIn' for this thread. -*/ -threadId: number; - -/** -* Optional id of the target to step into. -*/ -targetId?: number; -} -Response to ‘stepIn’ request. This is just an acknowledgement, so no body field is required. - - -interface StepInResponse extends Response { -} -:leftwards_arrow_with_hook: StepOut Request -The request starts the debuggee to run again for one step. - -The debug adapter first sends the response and then a ‘stopped’ event (with reason ‘step’) after the step has completed. - -interface StepOutRequest extends Request { - -arguments: StepOutArguments; -} -Arguments for ‘stepOut’ request. - - -interface StepOutArguments { -/** -* Execute 'stepOut' for this thread. -*/ -threadId: number; -} -Response to ‘stepOut’ request. This is just an acknowledgement, so no body field is required. - - -interface StepOutResponse extends Response { -} -:leftwards_arrow_with_hook: StepBack Request -The request starts the debuggee to run one step backwards. - -The debug adapter first sends the response and then a ‘stopped’ event (with reason ‘step’) after the step has completed. Clients should only call this request if the capability ‘supportsStepBack’ is true. - -interface StepBackRequest extends Request { - -arguments: StepBackArguments; -} -Arguments for ‘stepBack’ request. - - -interface StepBackArguments { -/** -* Execute 'stepBack' for this thread. -*/ -threadId: number; -} -Response to ‘stepBack’ request. This is just an acknowledgement, so no body field is required. - - -interface StepBackResponse extends Response { -} -:leftwards_arrow_with_hook: ReverseContinue Request -The request starts the debuggee to run backward. Clients should only call this request if the capability ‘supportsStepBack’ is true. - -interface ReverseContinueRequest extends Request { - -arguments: ReverseContinueArguments; -} -Arguments for ‘reverseContinue’ request. - - -interface ReverseContinueArguments { -/** -* Execute 'reverseContinue' for this thread. -*/ -threadId: number; -} -Response to ‘reverseContinue’ request. This is just an acknowledgement, so no body field is required. - - -interface ReverseContinueResponse extends Response { -} -:leftwards_arrow_with_hook: RestartFrame Request -The request restarts execution of the specified stackframe. - -The debug adapter first sends the response and then a ‘stopped’ event (with reason ‘restart’) after the restart has completed. - -interface RestartFrameRequest extends Request { - -arguments: RestartFrameArguments; -} -Arguments for ‘restartFrame’ request. - - -interface RestartFrameArguments { -/** -* Restart this stackframe. -*/ -frameId: number; -} -Response to ‘restartFrame’ request. This is just an acknowledgement, so no body field is required. - - -interface RestartFrameResponse extends Response { -} -:leftwards_arrow_with_hook: Goto Request -The request sets the location where the debuggee will continue to run. - -This makes it possible to skip the execution of code or to executed code again. - -The code between the current location and the goto target is not executed but skipped. - -The debug adapter first sends the response and then a ‘stopped’ event with reason ‘goto’. - -interface GotoRequest extends Request { - -arguments: GotoArguments; -} -Arguments for ‘goto’ request. - - -interface GotoArguments { -/** -* Set the goto target for this thread. -*/ -threadId: number; - -/** -* The location where the debuggee will continue to run. -*/ -targetId: number; -} -Response to ‘goto’ request. This is just an acknowledgement, so no body field is required. - - -interface GotoResponse extends Response { -} -:leftwards_arrow_with_hook: Pause Request -The request suspenses the debuggee. - -The debug adapter first sends the response and then a ‘stopped’ event (with reason ‘pause’) after the thread has been paused successfully. - -interface PauseRequest extends Request { - -arguments: PauseArguments; -} -Arguments for ‘pause’ request. - - -interface PauseArguments { -/** -* Pause execution for this thread. -*/ -threadId: number; -} -Response to ‘pause’ request. This is just an acknowledgement, so no body field is required. - - -interface PauseResponse extends Response { -} -:leftwards_arrow_with_hook: StackTrace Request -The request returns a stacktrace from the current execution state. - -interface StackTraceRequest extends Request { - -arguments: StackTraceArguments; -} -Arguments for ‘stackTrace’ request. - - -interface StackTraceArguments { -/** -* Retrieve the stacktrace for this thread. -*/ -threadId: number; - -/** -* The index of the first frame to return; if omitted frames start at 0. -*/ -startFrame?: number; - -/** -* The maximum number of frames to return. If levels is not specified or 0, all frames are returned. -*/ -levels?: number; - -/** -* Specifies details on how to format the stack frames. -*/ -format?: StackFrameFormat; -} -Response to ‘stackTrace’ request. - - -interface StackTraceResponse extends Response { -body: { -/** -* The frames of the stackframe. If the array has length zero, there are no stackframes available. -* This means that there is no location information available. -*/ -stackFrames: StackFrame[]; - -/** -* The total number of frames available. -*/ -totalFrames?: number; -}; -} -:leftwards_arrow_with_hook: Scopes Request -The request returns the variable scopes for a given stackframe ID. - -interface ScopesRequest extends Request { - -arguments: ScopesArguments; -} -Arguments for ‘scopes’ request. - - -interface ScopesArguments { -/** -* Retrieve the scopes for this stackframe. -*/ -frameId: number; -} -Response to ‘scopes’ request. - - -interface ScopesResponse extends Response { -body: { -/** -* The scopes of the stackframe. If the array has length zero, there are no scopes available. -*/ -scopes: Scope[]; -}; -} -:leftwards_arrow_with_hook: Variables Request -Retrieves all child variables for the given variable reference. - -An optional filter can be used to limit the fetched children to either named or indexed children. - -interface VariablesRequest extends Request { - -arguments: VariablesArguments; -} -Arguments for ‘variables’ request. - - -interface VariablesArguments { -/** -* The Variable reference. -*/ -variablesReference: number; - -/** -* Optional filter to limit the child variables to either named or indexed. If ommited, both types are fetched. -*/ -filter?: 'indexed' | 'named'; - -/** -* The index of the first variable to return; if omitted children start at 0. -*/ -start?: number; - -/** -* The number of variables to return. If count is missing or 0, all variables are returned. -*/ -count?: number; - -/** -* Specifies details on how to format the Variable values. -*/ -format?: ValueFormat; -} -Response to ‘variables’ request. - - -interface VariablesResponse extends Response { -body: { -/** -* All (or a range) of variables for the given variable reference. -*/ -variables: Variable[]; -}; -} -:leftwards_arrow_with_hook: SetVariable Request -Set the variable with the given name in the variable container to a new value. - -interface SetVariableRequest extends Request { - -arguments: SetVariableArguments; -} -Arguments for ‘setVariable’ request. - - -interface SetVariableArguments { -/** -* The reference of the variable container. -*/ -variablesReference: number; - -/** -* The name of the variable in the container. -*/ -name: string; - -/** -* The value of the variable. -*/ -value: string; - -/** -* Specifies details on how to format the response value. -*/ -format?: ValueFormat; -} -Response to ‘setVariable’ request. - - -interface SetVariableResponse extends Response { -body: { -/** -* The new value of the variable. -*/ -value: string; - -/** -* The type of the new value. Typically shown in the UI when hovering over the value. -*/ -type?: string; - -/** -* If variablesReference is > 0, the new value is structured and its children can be retrieved by passing variablesReference to the VariablesRequest. -*/ -variablesReference?: number; - -/** -* The number of named child variables. -* The client can use this optional information to present the variables in a paged UI and fetch them in chunks. -*/ -namedVariables?: number; - -/** -* The number of indexed child variables. -* The client can use this optional information to present the variables in a paged UI and fetch them in chunks. -*/ -indexedVariables?: number; -}; -} -:leftwards_arrow_with_hook: Source Request -The request retrieves the source code for a given source reference. - -interface SourceRequest extends Request { -arguments: SourceArguments; -} -Arguments for ‘source’ request. - - -interface SourceArguments { -/** -* Specifies the source content to load. Either source.path or source.sourceReference must be specified. -*/ -source?: Source; - -/** -* The reference to the source. This is the same as source.sourceReference. This is provided for backward compatibility since old backends do not understand the 'source' attribute. -*/ -sourceReference: number; -} -Response to ‘source’ request. - - -interface SourceResponse extends Response { -body: { -/** -* Content of the source reference. -*/ -content: string; - -/** -* Optional content type (mime type) of the source. -*/ -mimeType?: string; -}; -} -:leftwards_arrow_with_hook: Threads Request -The request retrieves a list of all threads. - -interface ThreadsRequest extends Request { -} -Response to ‘threads’ request. - - -interface ThreadsResponse extends Response { -body: { -/** -* All threads. -*/ -threads: Thread[]; -}; -} -:leftwards_arrow_with_hook: TerminateThreads Request -The request terminates the threads with the given ids. - -interface TerminateThreadsRequest extends Request { - -arguments: TerminateThreadsArguments; -} -Arguments for ‘terminateThreads’ request. - - -interface TerminateThreadsArguments { -/** -* Ids of threads to be terminated. -*/ -threadIds?: number[]; -} -Response to ‘terminateThreads’ request. This is just an acknowledgement, so no body field is required. - - -interface TerminateThreadsResponse extends Response { -} -:leftwards_arrow_with_hook: Modules Request -Modules can be retrieved from the debug adapter with the ModulesRequest which can either return all modules or a range of modules to support paging. - -interface ModulesRequest extends Request { - -arguments: ModulesArguments; -} -Arguments for ‘modules’ request. - - -interface ModulesArguments { -/** -* The index of the first module to return; if omitted modules start at 0. -*/ -startModule?: number; - -/** -* The number of modules to return. If moduleCount is not specified or 0, all modules are returned. -*/ -moduleCount?: number; -} -Response to ‘modules’ request. - - -interface ModulesResponse extends Response { -body: { -/** -* All modules or range of modules. -*/ -modules: Module[]; - -/** -* The total number of modules available. -*/ -totalModules?: number; -}; -} -:leftwards_arrow_with_hook: LoadedSources Request -Retrieves the set of all sources currently loaded by the debugged process. - -interface LoadedSourcesRequest extends Request { - -arguments?: LoadedSourcesArguments; -} -Arguments for ‘loadedSources’ request. - - -interface LoadedSourcesArguments { -} -Response to ‘loadedSources’ request. - - -interface LoadedSourcesResponse extends Response { -body: { -/** -* Set of loaded sources. -*/ -sources: Source[]; -}; -} -:leftwards_arrow_with_hook: Evaluate Request -Evaluates the given expression in the context of the top most stack frame. - -The expression has access to any variables and arguments that are in scope. - -interface EvaluateRequest extends Request { - -arguments: EvaluateArguments; -} -Arguments for ‘evaluate’ request. - - -interface EvaluateArguments { -/** -* The expression to evaluate. -*/ -expression: string; - -/** -* Evaluate the expression in the scope of this stack frame. If not specified, the expression is evaluated in the global scope. -*/ -frameId?: number; - -/** -* The context in which the evaluate request is run. -* Values: -* 'watch': evaluate is run in a watch. -* 'repl': evaluate is run from REPL console. -* 'hover': evaluate is run from a data hover. -* etc. -*/ -context?: string; - -/** -* Specifies details on how to format the Evaluate result. -*/ -format?: ValueFormat; -} -Response to ‘evaluate’ request. - - -interface EvaluateResponse extends Response { -body: { -/** -* The result of the evaluate request. -*/ -result: string; - -/** -* The optional type of the evaluate result. -*/ -type?: string; - -/** -* Properties of a evaluate result that can be used to determine how to render the result in the UI. -*/ -presentationHint?: VariablePresentationHint; - -/** -* If variablesReference is > 0, the evaluate result is structured and its children can be retrieved by passing variablesReference to the VariablesRequest. -*/ -variablesReference: number; - -/** -* The number of named child variables. -* The client can use this optional information to present the variables in a paged UI and fetch them in chunks. -*/ -namedVariables?: number; - -/** -* The number of indexed child variables. -* The client can use this optional information to present the variables in a paged UI and fetch them in chunks. -*/ -indexedVariables?: number; - -/** -* Memory reference to a location appropriate for this result. For pointer type eval results, this is generally a reference to the memory address contained in the pointer. -*/ -memoryReference?: string; -}; -} -:leftwards_arrow_with_hook: SetExpression Request -Evaluates the given ‘value’ expression and assigns it to the ‘expression’ which must be a modifiable l-value. - -The expressions have access to any variables and arguments that are in scope of the specified frame. - -interface SetExpressionRequest extends Request { - -arguments: SetExpressionArguments; -} -Arguments for ‘setExpression’ request. - - -interface SetExpressionArguments { -/** -* The l-value expression to assign to. -*/ -expression: string; - -/** -* The value expression to assign to the l-value expression. -*/ -value: string; - -/** -* Evaluate the expressions in the scope of this stack frame. If not specified, the expressions are evaluated in the global scope. -*/ -frameId?: number; - -/** -* Specifies how the resulting value should be formatted. -*/ -format?: ValueFormat; -} -Response to ‘setExpression’ request. - - -interface SetExpressionResponse extends Response { -body: { -/** -* The new value of the expression. -*/ -value: string; - -/** -* The optional type of the value. -*/ -type?: string; - -/** -* Properties of a value that can be used to determine how to render the result in the UI. -*/ -presentationHint?: VariablePresentationHint; - -/** -* If variablesReference is > 0, the value is structured and its children can be retrieved by passing variablesReference to the VariablesRequest. -*/ -variablesReference?: number; - -/** -* The number of named child variables. -* The client can use this optional information to present the variables in a paged UI and fetch them in chunks. -*/ -namedVariables?: number; - -/** -* The number of indexed child variables. -* The client can use this optional information to present the variables in a paged UI and fetch them in chunks. -*/ -indexedVariables?: number; -}; -} -:leftwards_arrow_with_hook: StepInTargets Request -This request retrieves the possible stepIn targets for the specified stack frame. - -These targets can be used in the ‘stepIn’ request. - -The StepInTargets may only be called if the ‘supportsStepInTargetsRequest’ capability exists and is true. - -interface StepInTargetsRequest extends Request { - -arguments: StepInTargetsArguments; -} -Arguments for ‘stepInTargets’ request. - - -interface StepInTargetsArguments { -/** -* The stack frame for which to retrieve the possible stepIn targets. -*/ -frameId: number; -} -Response to ‘stepInTargets’ request. - - -interface StepInTargetsResponse extends Response { -body: { -/** -* The possible stepIn targets of the specified source location. -*/ -targets: StepInTarget[]; -}; -} -:leftwards_arrow_with_hook: GotoTargets Request -This request retrieves the possible goto targets for the specified source location. - -These targets can be used in the ‘goto’ request. - -The GotoTargets request may only be called if the ‘supportsGotoTargetsRequest’ capability exists and is true. - -interface GotoTargetsRequest extends Request { - -arguments: GotoTargetsArguments; -} -Arguments for ‘gotoTargets’ request. - - -interface GotoTargetsArguments { -/** -* The source location for which the goto targets are determined. -*/ -source: Source; - -/** -* The line location for which the goto targets are determined. -*/ -line: number; - -/** -* An optional column location for which the goto targets are determined. -*/ -column?: number; -} -Response to ‘gotoTargets’ request. - - -interface GotoTargetsResponse extends Response { -body: { -/** -* The possible goto targets of the specified location. -*/ -targets: GotoTarget[]; -}; -} -:leftwards_arrow_with_hook: Completions Request -Returns a list of possible completions for a given caret position and text. - -The CompletionsRequest may only be called if the ‘supportsCompletionsRequest’ capability exists and is true. - -interface CompletionsRequest extends Request { - -arguments: CompletionsArguments; -} -Arguments for ‘completions’ request. - - -interface CompletionsArguments { -/** -* Returns completions in the scope of this stack frame. If not specified, the completions are returned for the global scope. -*/ -frameId?: number; - -/** -* One or more source lines. Typically this is the text a user has typed into the debug console before he asked for completion. -*/ -text: string; - -/** -* The character position for which to determine the completion proposals. -*/ -column: number; - -/** -* An optional line for which to determine the completion proposals. If missing the first line of the text is assumed. -*/ -line?: number; -} -Response to ‘completions’ request. - - -interface CompletionsResponse extends Response { -body: { -/** -* The possible completions for . -*/ -targets: CompletionItem[]; -}; -} -:leftwards_arrow_with_hook: ExceptionInfo Request -Retrieves the details of the exception that caused this event to be raised. - -interface ExceptionInfoRequest extends Request { - -arguments: ExceptionInfoArguments; -} -Arguments for ‘exceptionInfo’ request. - - -interface ExceptionInfoArguments { -/** -* Thread for which exception information should be retrieved. -*/ -threadId: number; -} -Response to ‘exceptionInfo’ request. - - -interface ExceptionInfoResponse extends Response { -body: { -/** -* ID of the exception that was thrown. -*/ -exceptionId: string; - -/** -* Descriptive text for the exception provided by the debug adapter. -*/ -description?: string; - -/** -* Mode that caused the exception notification to be raised. -*/ -breakMode: ExceptionBreakMode; - -/** -* Detailed information about the exception. -*/ -details?: ExceptionDetails; -}; -} -:leftwards_arrow_with_hook: ReadMemory Request -Reads bytes from memory at the provided location. - -interface ReadMemoryRequest extends Request { - -arguments: ReadMemoryArguments; -} -Arguments for ‘readMemory’ request. - - -interface ReadMemoryArguments { -/** -* Memory reference to the base location from which data should be read. -*/ -memoryReference: string; - -/** -* Optional offset (in bytes) to be applied to the reference location before reading data. Can be negative. -*/ -offset?: number; - -/** -* Number of bytes to read at the specified location and offset. -*/ -count: number; -} -Response to ‘readMemory’ request. - - -interface ReadMemoryResponse extends Response { -body?: { -/** -* The address of the first byte of data returned. Treated as a hex value if prefixed with '0x', or as a decimal value otherwise. -*/ -address: string; - -/** -* The number of unreadable bytes encountered after the last successfully read byte. This can be used to determine the number of bytes that must be skipped before a subsequent 'readMemory' request will succeed. -*/ -unreadableBytes?: number; - -/** -* The bytes read from memory, encoded using base64. -*/ -data?: string; -}; -} -:leftwards_arrow_with_hook: Disassemble Request -Disassembles code stored at the provided location. - -interface DisassembleRequest extends Request { - -arguments: DisassembleArguments; -} -Arguments for ‘disassemble’ request. - - -interface DisassembleArguments { -/** -* Memory reference to the base location containing the instructions to disassemble. -*/ -memoryReference: string; - -/** -* Optional offset (in bytes) to be applied to the reference location before disassembling. Can be negative. -*/ -offset?: number; - -/** -* Optional offset (in instructions) to be applied after the byte offset (if any) before disassembling. Can be negative. -*/ -instructionOffset?: number; - -/** -* Number of instructions to disassemble starting at the specified location and offset. An adapter must return exactly this number of instructions - any unavailable instructions should be replaced with an implementation-defined 'invalid instruction' value. -*/ -instructionCount: number; - -/** -* If true, the adapter should attempt to resolve memory addresses and other values to symbolic names. -*/ -resolveSymbols?: boolean; -} -Response to ‘disassemble’ request. - - -interface DisassembleResponse extends Response { -body?: { -/** -* The list of disassembled instructions. -*/ -instructions: DisassembledInstruction[]; -}; -} - -} diff --git a/src/Protocol/Serialization/Serializer.cs b/src/Protocol/Serialization/Serializer.cs index 13136c5c1..acad8b412 100644 --- a/src/Protocol/Serialization/Serializer.cs +++ b/src/Protocol/Serialization/Serializer.cs @@ -12,7 +12,7 @@ namespace OmniSharp.Extensions.LanguageServer.Protocol.Serialization { - public class Serializer : JsonRpcSerializer + public class Serializer : JsonRpcSerializer, ISerializer { private static readonly CompletionItemKind[] DefaultCompletionItemKinds = Enum.GetValues(typeof(CompletionItemKind)) .Cast() @@ -79,7 +79,7 @@ protected override void AddOrReplaceConverters(ICollection conver base.AddOrReplaceConverters(converters); } - public void SetClientCapabilities(ClientCapabilities clientCapabilities) + public void SetClientCapabilities(ClientVersion clientVersion, ClientCapabilities clientCapabilities) { var completionItemKinds = DefaultCompletionItemKinds; var documentSymbolKinds = DefaultSymbolKinds; From 7286c747ab061fbbc7b6a101423b4ad726206750 Mon Sep 17 00:00:00 2001 From: David Driscoll Date: Sat, 20 Jul 2019 12:54:49 -0400 Subject: [PATCH 08/20] Fixed casing on property names --- src/Dap.Protocol/Events/BreakpointEvent.cs | 4 +-- src/Dap.Protocol/Events/CapabilitiesEvent.cs | 2 +- src/Dap.Protocol/Events/ContinuedEvent.cs | 4 +-- src/Dap.Protocol/Events/ExitedEvent.cs | 2 +- src/Dap.Protocol/Events/ITerminatedHandler.cs | 1 + src/Dap.Protocol/Events/IThreadHandler.cs | 35 +++++++++++++++++++ src/Dap.Protocol/Events/LoadedSourceEvent.cs | 4 +-- src/Dap.Protocol/Events/ModuleEvent.cs | 4 +-- src/Dap.Protocol/Events/OutputEvent.cs | 14 ++++---- src/Dap.Protocol/Events/ProcessEvent.cs | 10 +++--- src/Dap.Protocol/Events/StoppedEvent.cs | 12 +++---- src/Dap.Protocol/Events/TerminatedEvent.cs | 2 +- src/Dap.Protocol/Events/ThreadEvent.cs | 4 +-- .../Requests/AttachRequestArguments.cs | 2 +- .../Requests/CompletionsArguments.cs | 8 ++--- .../Requests/CompletionsResponse.cs | 2 +- .../Requests/ContinueArguments.cs | 2 +- src/Dap.Protocol/Requests/ContinueResponse.cs | 2 +- .../Requests/DataBreakpointInfoArguments.cs | 4 +-- .../Requests/DataBreakpointInfoResponse.cs | 8 ++--- .../Requests/DisassembleArguments.cs | 10 +++--- .../Requests/DisassembleResponse.cs | 2 +- .../Requests/DisconnectArguments.cs | 4 +-- .../Requests/EvaluateArguments.cs | 8 ++--- src/Dap.Protocol/Requests/EvaluateResponse.cs | 14 ++++---- .../Requests/ExceptionInfoArguments.cs | 2 +- .../Requests/ExceptionInfoResponse.cs | 8 ++--- src/Dap.Protocol/Requests/GotoArguments.cs | 4 +-- .../Requests/GotoTargetsArguments.cs | 6 ++-- .../Requests/GotoTargetsResponse.cs | 2 +- .../Requests/InitializeRequestArguments.cs | 22 ++++++------ .../Requests/InitializeResponse.cs | 2 +- .../Requests/LaunchRequestArguments.cs | 4 +-- .../Requests/LoadedSourcesResponse.cs | 2 +- src/Dap.Protocol/Requests/ModulesArguments.cs | 4 +-- src/Dap.Protocol/Requests/ModulesResponse.cs | 4 +-- src/Dap.Protocol/Requests/NextArguments.cs | 2 +- src/Dap.Protocol/Requests/PauseArguments.cs | 2 +- .../Requests/ReadMemoryArguments.cs | 6 ++-- .../Requests/ReadMemoryResponse.cs | 6 ++-- .../Requests/RestartFrameArguments.cs | 2 +- .../Requests/ReverseContinueArguments.cs | 2 +- .../Requests/RunInTerminalArguments.cs | 10 +++--- .../Requests/RunInTerminalResponse.cs | 4 +-- src/Dap.Protocol/Requests/ScopesArguments.cs | 2 +- src/Dap.Protocol/Requests/ScopesResponse.cs | 2 +- .../Requests/SetBreakpointsArguments.cs | 8 ++--- .../Requests/SetBreakpointsResponse.cs | 2 +- .../Requests/SetDataBreakpointsArguments.cs | 2 +- .../Requests/SetDataBreakpointsResponse.cs | 2 +- .../SetExceptionBreakpointsArguments.cs | 4 +-- .../Requests/SetExpressionArguments.cs | 8 ++--- .../Requests/SetExpressionResponse.cs | 12 +++---- .../SetFunctionBreakpointsArguments.cs | 2 +- .../SetFunctionBreakpointsResponse.cs | 2 +- .../Requests/SetVariableArguments.cs | 8 ++--- .../Requests/SetVariableResponse.cs | 10 +++--- src/Dap.Protocol/Requests/SourceArguments.cs | 4 +-- src/Dap.Protocol/Requests/SourceResponse.cs | 4 +-- .../Requests/StackTraceArguments.cs | 8 ++--- .../Requests/StackTraceResponse.cs | 4 +-- .../Requests/StepBackArguments.cs | 2 +- src/Dap.Protocol/Requests/StepInArguments.cs | 4 +-- .../Requests/StepInTargetsArguments.cs | 2 +- .../Requests/StepInTargetsResponse.cs | 2 +- src/Dap.Protocol/Requests/StepOutArguments.cs | 2 +- .../Requests/TerminateArguments.cs | 2 +- .../Requests/TerminateThreadsArguments.cs | 2 +- src/Dap.Protocol/Requests/ThreadsResponse.cs | 2 +- .../Requests/VariablesArguments.cs | 10 +++--- .../Requests/VariablesResponse.cs | 2 +- 71 files changed, 204 insertions(+), 168 deletions(-) create mode 100644 src/Dap.Protocol/Events/IThreadHandler.cs diff --git a/src/Dap.Protocol/Events/BreakpointEvent.cs b/src/Dap.Protocol/Events/BreakpointEvent.cs index 2fb36cb08..8b501820b 100644 --- a/src/Dap.Protocol/Events/BreakpointEvent.cs +++ b/src/Dap.Protocol/Events/BreakpointEvent.cs @@ -9,12 +9,12 @@ public class BreakpointEvent : IRequest /// The reason for the event. /// Values: 'changed', 'new', 'removed', etc. /// - public string reason { get; set; } + public string Reason { get; set; } /// /// The 'id' attribute is used to find the target breakpoint and the other attributes are used as the new values. /// - public Breakpoint breakpoint { get; set; } + public Breakpoint Breakpoint { get; set; } } } diff --git a/src/Dap.Protocol/Events/CapabilitiesEvent.cs b/src/Dap.Protocol/Events/CapabilitiesEvent.cs index 242cbc103..b2bd1fd29 100644 --- a/src/Dap.Protocol/Events/CapabilitiesEvent.cs +++ b/src/Dap.Protocol/Events/CapabilitiesEvent.cs @@ -8,7 +8,7 @@ public class CapabilitiesEvent : IRequest /// /// The set of updated capabilities. /// - public Capabilities capabilities { get; set; } + public Capabilities Capabilities { get; set; } } } diff --git a/src/Dap.Protocol/Events/ContinuedEvent.cs b/src/Dap.Protocol/Events/ContinuedEvent.cs index e2f09164c..b2cddf5e5 100644 --- a/src/Dap.Protocol/Events/ContinuedEvent.cs +++ b/src/Dap.Protocol/Events/ContinuedEvent.cs @@ -10,12 +10,12 @@ public class ContinuedEvent : IRequest /// /// The thread which was continued. /// - public long threadId { get; set; } + public long ThreadId { get; set; } /// /// If 'allThreadsContinued' is true, a debug adapter can announce that all threads have continued. /// - [Optional] public bool? allThreadsContinued { get; set; } + [Optional] public bool? AllThreadsContinued { get; set; } } } diff --git a/src/Dap.Protocol/Events/ExitedEvent.cs b/src/Dap.Protocol/Events/ExitedEvent.cs index 406ecb055..7d5d15f18 100644 --- a/src/Dap.Protocol/Events/ExitedEvent.cs +++ b/src/Dap.Protocol/Events/ExitedEvent.cs @@ -8,7 +8,7 @@ public class ExitedEvent : IRequest /// /// The exit code returned from the debuggee. /// - public long exitCode { get; set; } + public long ExitCode { get; set; } } } diff --git a/src/Dap.Protocol/Events/ITerminatedHandler.cs b/src/Dap.Protocol/Events/ITerminatedHandler.cs index b7c1e4c61..bb1eb363b 100644 --- a/src/Dap.Protocol/Events/ITerminatedHandler.cs +++ b/src/Dap.Protocol/Events/ITerminatedHandler.cs @@ -32,4 +32,5 @@ public DelegatingHandler(Func> ha public override Task Handle(TerminatedEvent request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); } } + } diff --git a/src/Dap.Protocol/Events/IThreadHandler.cs b/src/Dap.Protocol/Events/IThreadHandler.cs new file mode 100644 index 000000000..91462f7b9 --- /dev/null +++ b/src/Dap.Protocol/Events/IThreadHandler.cs @@ -0,0 +1,35 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.Embedded.MediatR; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + [Parallel, Method(EventNames.Thread)] + public interface IThreadHandler : IJsonRpcNotificationHandler { } + + public abstract class ThreadHandler : IThreadHandler + { + public abstract Task Handle(ThreadEvent request, CancellationToken cancellationToken); + } + public static class ThreadHandlerExtensions + { + public static IDisposable OnThread(this IDebugAdapterRegistry registry, Func> handler) + { + return registry.AddHandlers(new DelegatingHandler(handler)); + } + + class DelegatingHandler : ThreadHandler + { + private readonly Func> _handler; + + public DelegatingHandler(Func> handler) + { + _handler = handler; + } + + public override Task Handle(ThreadEvent request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); + } + } +} diff --git a/src/Dap.Protocol/Events/LoadedSourceEvent.cs b/src/Dap.Protocol/Events/LoadedSourceEvent.cs index 10b1eb295..e1d7a7404 100644 --- a/src/Dap.Protocol/Events/LoadedSourceEvent.cs +++ b/src/Dap.Protocol/Events/LoadedSourceEvent.cs @@ -8,12 +8,12 @@ public class LoadedSourceEvent : IRequest /// /// The reason for the event. /// - public LoadedSourceReason reason { get; set; } + public LoadedSourceReason Reason { get; set; } /// /// The new, changed, or removed source. /// - public Source source { get; set; } + public Source Source { get; set; } } } diff --git a/src/Dap.Protocol/Events/ModuleEvent.cs b/src/Dap.Protocol/Events/ModuleEvent.cs index d0bfeee11..aa42053b9 100644 --- a/src/Dap.Protocol/Events/ModuleEvent.cs +++ b/src/Dap.Protocol/Events/ModuleEvent.cs @@ -8,12 +8,12 @@ public class ModuleEvent : IRequest /// /// The reason for the event. /// - public ModuleEventReason reason { get; set; } + public ModuleEventReason Reason { get; set; } /// /// The new, changed, or removed module. In case of 'removed' only the module id is used. /// - public Module module { get; set; } + public Module Module { get; set; } } } diff --git a/src/Dap.Protocol/Events/OutputEvent.cs b/src/Dap.Protocol/Events/OutputEvent.cs index 7000588fc..e28864816 100644 --- a/src/Dap.Protocol/Events/OutputEvent.cs +++ b/src/Dap.Protocol/Events/OutputEvent.cs @@ -10,37 +10,37 @@ public class OutputEvent : IRequest /// The output category. If not specified, 'console' is assumed. /// Values: 'console', 'stdout', 'stderr', 'telemetry', etc. /// - [Optional] public string category { get; set; } + [Optional] public string Category { get; set; } /// /// The output to report. /// - public string output { get; set; } + public string Output { get; set; } /// /// If an attribute 'variablesReference' exists and its value is > 0, the output contains objects which can be retrieved by passing 'variablesReference' to the 'variables' request. /// - [Optional] public long? variablesReference { get; set; } + [Optional] public long? VariablesReference { get; set; } /// /// An optional source location where the output was produced. /// - [Optional] public Source source { get; set; } + [Optional] public Source Source { get; set; } /// /// An optional source location line where the output was produced. /// - [Optional] public long? line { get; set; } + [Optional] public long? Line { get; set; } /// /// An optional source location column where the output was produced. /// - [Optional] public long? column { get; set; } + [Optional] public long? Column { get; set; } /// /// Optional data to report. For the 'telemetry' category the data will be sent to telemetry, for the other categories the data is shown in JSON format. /// - [Optional] public JToken data { get; set; } + [Optional] public JToken Data { get; set; } } } diff --git a/src/Dap.Protocol/Events/ProcessEvent.cs b/src/Dap.Protocol/Events/ProcessEvent.cs index 7b4b748a3..96a78c1d0 100644 --- a/src/Dap.Protocol/Events/ProcessEvent.cs +++ b/src/Dap.Protocol/Events/ProcessEvent.cs @@ -9,17 +9,17 @@ public class ProcessEvent : IRequest /// /// The logical name of the process. This is usually the full path to process's executable file. Example: /home/example/myproj/program.js. /// - public string name { get; set; } + public string Name { get; set; } /// /// The system process id of the debugged process. This property will be missing for non-system processes. /// - [Optional] public long? systemProcessId { get; set; } + [Optional] public long? SystemProcessId { get; set; } /// /// If true, the process is running on the same computer as the debug adapter. /// - [Optional] public bool? isLocalProcess { get; set; } + [Optional] public bool? IsLocalProcess { get; set; } /// /// Describes how the debug engine started debugging this process. @@ -27,12 +27,12 @@ public class ProcessEvent : IRequest /// 'attach': Debugger attached to an existing process. /// 'attachForSuspendedLaunch': A project launcher component has launched a new process in a suspended state and then asked the debugger to attach. /// - [Optional] public ProcessEventStartMethod startMethod { get; set; } + [Optional] public ProcessEventStartMethod StartMethod { get; set; } /// /// The size of a pointer or address for this process, in bits. This value may be used by clients when formatting addresses for display. /// - [Optional] public long? pointerSize { get; set; } + [Optional] public long? PointerSize { get; set; } } } diff --git a/src/Dap.Protocol/Events/StoppedEvent.cs b/src/Dap.Protocol/Events/StoppedEvent.cs index 73f041195..80f5fc25d 100644 --- a/src/Dap.Protocol/Events/StoppedEvent.cs +++ b/src/Dap.Protocol/Events/StoppedEvent.cs @@ -10,34 +10,34 @@ public class StoppedEvent : IRequest /// For backward compatibility this string is shown in the UI if the 'description' attribute is missing (but it must not be translated). /// Values: 'step', 'breakpoint', 'exception', 'pause', 'entry', 'goto', 'function breakpoint', 'data breakpoint', etc. /// - public string reason { get; set; } + public string Reason { get; set; } /// /// The full reason for the event, e.g. 'Paused on exception'. This string is shown in the UI as is and must be translated. /// - [Optional] public string description { get; set; } + [Optional] public string Description { get; set; } /// /// The thread which was stopped. /// - [Optional] public long? threadId { get; set; } + [Optional] public long? ThreadId { get; set; } /// /// A value of true hints to the frontend that this event should not change the focus. /// - [Optional] public bool? preserveFocusHint { get; set; } + [Optional] public bool? PreserveFocusHint { get; set; } /// /// Additional information. E.g. if reason is 'exception', text contains the exception name. This string is shown in the UI. /// - [Optional] public string text { get; set; } + [Optional] public string Text { get; set; } /// /// If 'allThreadsStopped' is true, a debug adapter can announce that all threads have stopped. /// - The client should use this information to enable that all threads can be expanded to access their stacktraces. /// - If the attribute is missing or false, only the thread with the given threadId can be expanded. /// - [Optional] public bool? allThreadsStopped { get; set; } + [Optional] public bool? AllThreadsStopped { get; set; } } } diff --git a/src/Dap.Protocol/Events/TerminatedEvent.cs b/src/Dap.Protocol/Events/TerminatedEvent.cs index d5fc5cd5e..ec43ecc23 100644 --- a/src/Dap.Protocol/Events/TerminatedEvent.cs +++ b/src/Dap.Protocol/Events/TerminatedEvent.cs @@ -11,7 +11,7 @@ public class TerminatedEvent : IRequest /// A debug adapter may set 'restart' to true (or to an arbitrary object) to request that the front end restarts the session. /// The value is not interpreted by the client and passed unmodified as an attribute '__restart' to the 'launch' and 'attach' requests. /// - [Optional] public JToken restart { get; set; } + [Optional] public JToken Restart { get; set; } } } diff --git a/src/Dap.Protocol/Events/ThreadEvent.cs b/src/Dap.Protocol/Events/ThreadEvent.cs index 5207a4d55..1d78e5491 100644 --- a/src/Dap.Protocol/Events/ThreadEvent.cs +++ b/src/Dap.Protocol/Events/ThreadEvent.cs @@ -9,12 +9,12 @@ public class ThreadEvent : IRequest /// The reason for the event. /// Values: 'started', 'exited', etc. /// - public string reason { get; set; } + public string Reason { get; set; } /// /// The identifier of the thread. /// - public long threadId { get; set; } + public long ThreadId { get; set; } } } diff --git a/src/Dap.Protocol/Requests/AttachRequestArguments.cs b/src/Dap.Protocol/Requests/AttachRequestArguments.cs index 1f6d14077..b937abdf6 100644 --- a/src/Dap.Protocol/Requests/AttachRequestArguments.cs +++ b/src/Dap.Protocol/Requests/AttachRequestArguments.cs @@ -12,7 +12,7 @@ public class AttachRequestArguments : IRequest /// The client should leave the data intact. /// [Optional] - public JToken __restart { get; set; } + public JToken Restart { get; set; } } } diff --git a/src/Dap.Protocol/Requests/CompletionsArguments.cs b/src/Dap.Protocol/Requests/CompletionsArguments.cs index fa45c93a8..c432e7704 100644 --- a/src/Dap.Protocol/Requests/CompletionsArguments.cs +++ b/src/Dap.Protocol/Requests/CompletionsArguments.cs @@ -8,22 +8,22 @@ public class CompletionsArguments : IRequest /// /// Returns completions in the scope of this stack frame. If not specified, the completions are returned for the global scope. /// - [Optional] public long? frameId { get; set; } + [Optional] public long? FrameId { get; set; } /// /// One or more source lines.Typically this is the text a user has typed into the debug console before he asked for completion. /// - public string text { get; set; } + public string Text { get; set; } /// /// The character position for which to determine the completion proposals. /// - public long column { get; set; } + public long Column { get; set; } /// /// An optional line for which to determine the completion proposals.If missing the first line of the text is assumed. /// - [Optional] public long? line { get; set; } + [Optional] public long? Line { get; set; } } } diff --git a/src/Dap.Protocol/Requests/CompletionsResponse.cs b/src/Dap.Protocol/Requests/CompletionsResponse.cs index 4312f0636..b6c13a382 100644 --- a/src/Dap.Protocol/Requests/CompletionsResponse.cs +++ b/src/Dap.Protocol/Requests/CompletionsResponse.cs @@ -5,7 +5,7 @@ public class CompletionsResponse /// /// The possible completions for . /// - public Container targets { get; set; } + public Container Targets { get; set; } } } diff --git a/src/Dap.Protocol/Requests/ContinueArguments.cs b/src/Dap.Protocol/Requests/ContinueArguments.cs index a4a4c550a..ca08bf271 100644 --- a/src/Dap.Protocol/Requests/ContinueArguments.cs +++ b/src/Dap.Protocol/Requests/ContinueArguments.cs @@ -7,7 +7,7 @@ public class ContinueArguments : IRequest /// /// Continue execution for the specified thread(if possible). If the backend cannot continue on a single thread but will continue on all threads, it should set the 'allThreadsContinued' attribute in the response to true. /// - public long threadId { get; set; } + public long ThreadId { get; set; } } } diff --git a/src/Dap.Protocol/Requests/ContinueResponse.cs b/src/Dap.Protocol/Requests/ContinueResponse.cs index 0ede79ea0..6a614f9c9 100644 --- a/src/Dap.Protocol/Requests/ContinueResponse.cs +++ b/src/Dap.Protocol/Requests/ContinueResponse.cs @@ -7,7 +7,7 @@ public class ContinueResponse /// /// If true, the 'continue' request has ignored the specified thread and continued all threads instead.If this attribute is missing a value of 'true' is assumed for backward compatibility. /// - [Optional] public bool? allThreadsContinued { get; set; } + [Optional] public bool? AllThreadsContinued { get; set; } } } diff --git a/src/Dap.Protocol/Requests/DataBreakpointInfoArguments.cs b/src/Dap.Protocol/Requests/DataBreakpointInfoArguments.cs index 26a2f0108..7a57d8d59 100644 --- a/src/Dap.Protocol/Requests/DataBreakpointInfoArguments.cs +++ b/src/Dap.Protocol/Requests/DataBreakpointInfoArguments.cs @@ -8,12 +8,12 @@ public class DataBreakpointInfoArguments : IRequest /// /// Reference to the Variable container if the data breakpoint is requested for a child of the container. /// - [Optional] public long? variablesReference { get; set; } + [Optional] public long? VariablesReference { get; set; } /// /// The name of the Variable's child to obtain data breakpoint information for. If variableReference isn’t provided, this can be an expression. /// - public string name { get; set; } + public string Name { get; set; } } } diff --git a/src/Dap.Protocol/Requests/DataBreakpointInfoResponse.cs b/src/Dap.Protocol/Requests/DataBreakpointInfoResponse.cs index 8030fe1bd..d8591ca5f 100644 --- a/src/Dap.Protocol/Requests/DataBreakpointInfoResponse.cs +++ b/src/Dap.Protocol/Requests/DataBreakpointInfoResponse.cs @@ -7,22 +7,22 @@ public class DataBreakpointInfoResponse /// /// An identifier for the data on which a data breakpoint can be registered with the setDataBreakpoints request or null if no data breakpoint is available. /// - public string dataId { get; set; } + public string DataId { get; set; } /// /// UI string that describes on what data the breakpoint is set on or why a data breakpoint is not available. /// - public string description { get; set; } + public string Description { get; set; } /// /// Optional attribute listing the available access types for a potential data breakpoint.A UI frontend could surface this information. /// - [Optional] public Container accessTypes { get; set; } + [Optional] public Container AccessTypes { get; set; } /// /// Optional attribute indicating that a potential data breakpoint could be persisted across sessions. /// - [Optional] public bool? canPersist { get; set; } + [Optional] public bool? CanPersist { get; set; } } } diff --git a/src/Dap.Protocol/Requests/DisassembleArguments.cs b/src/Dap.Protocol/Requests/DisassembleArguments.cs index a7b32ed6c..becb11364 100644 --- a/src/Dap.Protocol/Requests/DisassembleArguments.cs +++ b/src/Dap.Protocol/Requests/DisassembleArguments.cs @@ -8,28 +8,28 @@ public class DisassembleArguments : IRequest /// /// Memory reference to the base location containing the instructions to disassemble. /// - public string memoryReference { get; set; } + public string MemoryReference { get; set; } /// /// Optional offset(in bytes) to be applied to the reference location before disassembling.Can be negative. /// - [Optional] public long? offset { get; set; } + [Optional] public long? Offset { get; set; } /// /// Optional offset(in instructions) to be applied after the byte offset(if any) before disassembling.Can be negative. /// - [Optional] public long? instructionOffset { get; set; } + [Optional] public long? InstructionOffset { get; set; } /// /// Number of instructions to disassemble starting at the specified location and offset.An adapter must return exactly this number of instructions - any unavailable instructions should be replaced with an implementation-defined 'invalid instruction' value. /// - public long instructionCount { get; set; } + public long InstructionCount { get; set; } /// /// If true, the adapter should attempt to resolve memory addresses and other values to symbolic names. /// - [Optional] public bool? resolveSymbols { get; set; } + [Optional] public bool? ResolveSymbols { get; set; } } } diff --git a/src/Dap.Protocol/Requests/DisassembleResponse.cs b/src/Dap.Protocol/Requests/DisassembleResponse.cs index 0c0285526..93b887b1d 100644 --- a/src/Dap.Protocol/Requests/DisassembleResponse.cs +++ b/src/Dap.Protocol/Requests/DisassembleResponse.cs @@ -5,7 +5,7 @@ public class DisassembleResponse /// /// The list of disassembled instructions. /// - public Container instructions { get; set; } + public Container Instructions { get; set; } } } diff --git a/src/Dap.Protocol/Requests/DisconnectArguments.cs b/src/Dap.Protocol/Requests/DisconnectArguments.cs index 9673d2c69..7bc8ae32b 100644 --- a/src/Dap.Protocol/Requests/DisconnectArguments.cs +++ b/src/Dap.Protocol/Requests/DisconnectArguments.cs @@ -8,14 +8,14 @@ public class DisconnectArguments : IRequest /// /// A value of true indicates that this 'disconnect' request is part of a restart sequence. /// - [Optional] public bool? restart { get; set; } + [Optional] public bool? Restart { get; set; } /// /// Indicates whether the debuggee should be terminated when the debugger is disconnected. /// If unspecified, the debug adapter is free to do whatever it thinks is best. /// A client can only rely on this attribute being properly honored if a debug adapter returns true for the 'supportTerminateDebuggee' capability. /// - [Optional] public bool? terminateDebuggee { get; set; } + [Optional] public bool? TerminateDebuggee { get; set; } } } diff --git a/src/Dap.Protocol/Requests/EvaluateArguments.cs b/src/Dap.Protocol/Requests/EvaluateArguments.cs index 32b1820b1..843c42f7f 100644 --- a/src/Dap.Protocol/Requests/EvaluateArguments.cs +++ b/src/Dap.Protocol/Requests/EvaluateArguments.cs @@ -8,12 +8,12 @@ public class EvaluateArguments : IRequest /// /// The expression to evaluate. /// - public string expression { get; set; } + public string Expression { get; set; } /// /// Evaluate the expression in the scope of this stack frame. If not specified, the expression is evaluated in the global scope. /// - [Optional] public long? frameId { get; set; } + [Optional] public long? FrameId { get; set; } /// /// The context in which the evaluate request is run. @@ -23,12 +23,12 @@ public class EvaluateArguments : IRequest /// 'hover': evaluate is run from a data hover. /// etc. /// - [Optional] public string context { get; set; } + [Optional] public string Context { get; set; } /// /// Specifies details on how to format the Evaluate result. /// - [Optional] public ValueFormat format { get; set; } + [Optional] public ValueFormat Format { get; set; } } } diff --git a/src/Dap.Protocol/Requests/EvaluateResponse.cs b/src/Dap.Protocol/Requests/EvaluateResponse.cs index ff90326c4..46c1e900e 100644 --- a/src/Dap.Protocol/Requests/EvaluateResponse.cs +++ b/src/Dap.Protocol/Requests/EvaluateResponse.cs @@ -7,39 +7,39 @@ public class EvaluateResponse /// /// The result of the evaluate request. /// - public string result { get; set; } + public string Result { get; set; } /// /// The optional type of the evaluate result. /// - [Optional] public string type { get; set; } + [Optional] public string Type { get; set; } /// /// Properties of a evaluate result that can be used to determine how to render the result in the UI. /// - [Optional] public VariablePresentationHint presentationHint { get; set; } + [Optional] public VariablePresentationHint PresentationHint { get; set; } /// /// If variablesReference is > 0, the evaluate result is structured and its children can be retrieved by passing variablesReference to the VariablesRequest. /// - public long variablesReference { get; set; } + public long VariablesReference { get; set; } /// /// The number of named child variables. /// The client can use this optional information to present the variables in a paged UI and fetch them in chunks. /// - [Optional] public long? namedVariables { get; set; } + [Optional] public long? NamedVariables { get; set; } /// /// The number of indexed child variables. /// The client can use this optional information to present the variables in a paged UI and fetch them in chunks. /// - [Optional] public long? indexedVariables { get; set; } + [Optional] public long? IndexedVariables { get; set; } /// /// Memory reference to a location appropriate for this result.For pointer type eval results, this is generally a reference to the memory address contained in the pointer. /// - [Optional] public string memoryReference { get; set; } + [Optional] public string MemoryReference { get; set; } } } diff --git a/src/Dap.Protocol/Requests/ExceptionInfoArguments.cs b/src/Dap.Protocol/Requests/ExceptionInfoArguments.cs index e0289545f..e88c301e0 100644 --- a/src/Dap.Protocol/Requests/ExceptionInfoArguments.cs +++ b/src/Dap.Protocol/Requests/ExceptionInfoArguments.cs @@ -7,7 +7,7 @@ public class ExceptionInfoArguments : IRequest /// /// Thread for which exception information should be retrieved. /// - public long threadId { get; set; } + public long ThreadId { get; set; } } } diff --git a/src/Dap.Protocol/Requests/ExceptionInfoResponse.cs b/src/Dap.Protocol/Requests/ExceptionInfoResponse.cs index 4abd783f0..a76a24339 100644 --- a/src/Dap.Protocol/Requests/ExceptionInfoResponse.cs +++ b/src/Dap.Protocol/Requests/ExceptionInfoResponse.cs @@ -7,22 +7,22 @@ public class ExceptionInfoResponse /// /// ID of the exception that was thrown. /// - public string exceptionId { get; set; } + public string ExceptionId { get; set; } /// /// Descriptive text for the exception provided by the debug adapter. /// - [Optional] public string description { get; set; } + [Optional] public string Description { get; set; } /// /// Mode that caused the exception notification to be raised. /// - public ExceptionBreakMode breakMode { get; set; } + public ExceptionBreakMode BreakMode { get; set; } /// /// Detailed information about the exception. /// - [Optional] public ExceptionDetails details { get; set; } + [Optional] public ExceptionDetails Details { get; set; } } } diff --git a/src/Dap.Protocol/Requests/GotoArguments.cs b/src/Dap.Protocol/Requests/GotoArguments.cs index fe0fa65c2..482250e94 100644 --- a/src/Dap.Protocol/Requests/GotoArguments.cs +++ b/src/Dap.Protocol/Requests/GotoArguments.cs @@ -7,12 +7,12 @@ public class GotoArguments : IRequest /// /// Set the goto target for this thread. /// - public long threadId { get; set; } + public long ThreadId { get; set; } /// /// The location where the debuggee will continue to run. /// - public long targetId { get; set; } + public long TargetId { get; set; } } } diff --git a/src/Dap.Protocol/Requests/GotoTargetsArguments.cs b/src/Dap.Protocol/Requests/GotoTargetsArguments.cs index 874ea6a27..124e30400 100644 --- a/src/Dap.Protocol/Requests/GotoTargetsArguments.cs +++ b/src/Dap.Protocol/Requests/GotoTargetsArguments.cs @@ -8,17 +8,17 @@ public class GotoTargetsArguments : IRequest /// /// The source location for which the goto targets are determined. /// - public Source source { get; set; } + public Source Source { get; set; } /// /// The line location for which the goto targets are determined. /// - public long line { get; set; } + public long Line { get; set; } /// /// An optional column location for which the goto targets are determined. /// - [Optional] public long? column { get; set; } + [Optional] public long? Column { get; set; } } } diff --git a/src/Dap.Protocol/Requests/GotoTargetsResponse.cs b/src/Dap.Protocol/Requests/GotoTargetsResponse.cs index 6f866b45e..73fd95100 100644 --- a/src/Dap.Protocol/Requests/GotoTargetsResponse.cs +++ b/src/Dap.Protocol/Requests/GotoTargetsResponse.cs @@ -8,7 +8,7 @@ public class GotoTargetsResponse /// /// The possible goto targets of the specified location. /// - public Container targets { get; set; } + public Container Targets { get; set; } } } diff --git a/src/Dap.Protocol/Requests/InitializeRequestArguments.cs b/src/Dap.Protocol/Requests/InitializeRequestArguments.cs index bb404d11b..1be53ce1f 100644 --- a/src/Dap.Protocol/Requests/InitializeRequestArguments.cs +++ b/src/Dap.Protocol/Requests/InitializeRequestArguments.cs @@ -9,61 +9,61 @@ public class InitializeRequestArguments : IRequest /// The ID of the(frontend) client using this adapter. /// - [Optional] public string clientID { get; set; } + [Optional] public string ClientId { get; set; } /// /// The human readable name of the(frontend) client using this adapter. /// - [Optional] public string clientName { get; set; } + [Optional] public string ClientName { get; set; } /// /// The ID of the debug adapter. /// - public string adapterID { get; set; } + public string AdapterId { get; set; } /// /// The ISO-639 locale of the(frontend) client using this adapter, e.g.en-US or de-CH. /// - [Optional] public string locale { get; set; } + [Optional] public string Locale { get; set; } /// /// If true all line numbers are 1-based(default). /// - [Optional] public bool? linesStartAt1 { get; set; } + [Optional] public bool? LinesStartAt1 { get; set; } /// /// If true all column numbers are 1-based(default). /// - [Optional] public bool? columnsStartAt1 { get; set; } + [Optional] public bool? ColumnsStartAt1 { get; set; } /// /// Determines in what format paths are specified.The default is 'path', which is the native format. /// Values: 'path', 'uri', etc. /// - [Optional] public string pathFormat { get; set; } + [Optional] public string PathFormat { get; set; } /// /// Client supports the optional type attribute for variables. /// - [Optional] public bool? supportsVariableType { get; set; } + [Optional] public bool? SupportsVariableType { get; set; } /// /// Client supports the paging of variables. /// - [Optional] public bool? supportsVariablePaging { get; set; } + [Optional] public bool? SupportsVariablePaging { get; set; } /// /// Client supports the runInTerminal request. /// - [Optional] public bool? supportsRunInTerminalRequest { get; set; } + [Optional] public bool? SupportsRunInTerminalRequest { get; set; } /// /// Client supports memory references. /// - [Optional] public bool? supportsMemoryReferences { get; set; } + [Optional] public bool? SupportsMemoryReferences { get; set; } } } diff --git a/src/Dap.Protocol/Requests/InitializeResponse.cs b/src/Dap.Protocol/Requests/InitializeResponse.cs index fdcf8b2da..ebeb7fe87 100644 --- a/src/Dap.Protocol/Requests/InitializeResponse.cs +++ b/src/Dap.Protocol/Requests/InitializeResponse.cs @@ -7,7 +7,7 @@ public class InitializeResponse /// /// The capabilities of this debug adapter. /// - [Optional] public Capabilities body { get; set; } + [Optional] public Capabilities Body { get; set; } } } diff --git a/src/Dap.Protocol/Requests/LaunchRequestArguments.cs b/src/Dap.Protocol/Requests/LaunchRequestArguments.cs index fb3b14a39..f555426e0 100644 --- a/src/Dap.Protocol/Requests/LaunchRequestArguments.cs +++ b/src/Dap.Protocol/Requests/LaunchRequestArguments.cs @@ -9,7 +9,7 @@ public class LaunchRequestArguments : IRequest /// /// If noDebug is true the launch request should launch the program without enabling debugging. /// - [Optional] public bool? noDebug { get; set; } + [Optional] public bool? NoDebug { get; set; } /// /// Optional data from the previous, restarted session. @@ -17,7 +17,7 @@ public class LaunchRequestArguments : IRequest /// The client should leave the data intact. /// [Optional] - public JToken __restart { get; set; } + public JToken Restart { get; set; } } } diff --git a/src/Dap.Protocol/Requests/LoadedSourcesResponse.cs b/src/Dap.Protocol/Requests/LoadedSourcesResponse.cs index 0a7eb59b9..556bc1624 100644 --- a/src/Dap.Protocol/Requests/LoadedSourcesResponse.cs +++ b/src/Dap.Protocol/Requests/LoadedSourcesResponse.cs @@ -5,7 +5,7 @@ public class LoadedSourcesResponse /// /// Set of loaded sources. /// - public Container sources { get; set; } + public Container Sources { get; set; } } } diff --git a/src/Dap.Protocol/Requests/ModulesArguments.cs b/src/Dap.Protocol/Requests/ModulesArguments.cs index 464a37154..6cf352340 100644 --- a/src/Dap.Protocol/Requests/ModulesArguments.cs +++ b/src/Dap.Protocol/Requests/ModulesArguments.cs @@ -8,12 +8,12 @@ public class ModulesArguments : IRequest /// /// The index of the first module to return; if omitted modules start at 0. /// - [Optional] public long? startModule { get; set; } + [Optional] public long? StartModule { get; set; } /// /// The number of modules to return. If moduleCount is not specified or 0, all modules are returned. /// - [Optional] public long? moduleCount { get; set; } + [Optional] public long? ModuleCount { get; set; } } } diff --git a/src/Dap.Protocol/Requests/ModulesResponse.cs b/src/Dap.Protocol/Requests/ModulesResponse.cs index f52314a18..0b79a3cc0 100644 --- a/src/Dap.Protocol/Requests/ModulesResponse.cs +++ b/src/Dap.Protocol/Requests/ModulesResponse.cs @@ -7,12 +7,12 @@ public class ModulesResponse /// /// All modules or range of modules. /// - public Container modules { get; set; } + public Container Modules { get; set; } /// /// The total number of modules available. /// - [Optional] public long? totalModules { get; set; } + [Optional] public long? TotalModules { get; set; } } } diff --git a/src/Dap.Protocol/Requests/NextArguments.cs b/src/Dap.Protocol/Requests/NextArguments.cs index 82bf3fcd5..d5d6af07c 100644 --- a/src/Dap.Protocol/Requests/NextArguments.cs +++ b/src/Dap.Protocol/Requests/NextArguments.cs @@ -7,7 +7,7 @@ public class NextArguments : IRequest /// /// Execute 'next' for this thread. /// - public long threadId { get; set; } + public long ThreadId { get; set; } } } diff --git a/src/Dap.Protocol/Requests/PauseArguments.cs b/src/Dap.Protocol/Requests/PauseArguments.cs index 87fe3f713..7fe2bfc07 100644 --- a/src/Dap.Protocol/Requests/PauseArguments.cs +++ b/src/Dap.Protocol/Requests/PauseArguments.cs @@ -7,7 +7,7 @@ public class PauseArguments : IRequest /// /// Pause execution for this thread. /// - public long threadId { get; set; } + public long ThreadId { get; set; } } } diff --git a/src/Dap.Protocol/Requests/ReadMemoryArguments.cs b/src/Dap.Protocol/Requests/ReadMemoryArguments.cs index 92bf577ad..2a13d37b6 100644 --- a/src/Dap.Protocol/Requests/ReadMemoryArguments.cs +++ b/src/Dap.Protocol/Requests/ReadMemoryArguments.cs @@ -8,18 +8,18 @@ public class ReadMemoryArguments : IRequest /// /// Memory reference to the base location from which data should be read. /// - public string memoryReference { get; set; } + public string MemoryReference { get; set; } /// /// Optional offset(in bytes) to be applied to the reference location before reading data.Can be negative. /// - [Optional] public long? offset { get; set; } + [Optional] public long? Offset { get; set; } /// /// Number of bytes to read at the specified location and offset. /// - public long count { get; set; } + public long Count { get; set; } } } diff --git a/src/Dap.Protocol/Requests/ReadMemoryResponse.cs b/src/Dap.Protocol/Requests/ReadMemoryResponse.cs index efaaf1f2e..29da1b364 100644 --- a/src/Dap.Protocol/Requests/ReadMemoryResponse.cs +++ b/src/Dap.Protocol/Requests/ReadMemoryResponse.cs @@ -7,17 +7,17 @@ public class ReadMemoryResponse /// /// The address of the first byte of data returned.Treated as a hex value if prefixed with '0x', or as a decimal value otherwise. /// - public string address { get; set; } + public string Address { get; set; } /// /// The number of unreadable bytes encountered after the last successfully read byte. This can be used to determine the number of bytes that must be skipped before a subsequent 'readMemory' request will succeed. /// - [Optional] public long? unreadableBytes { get; set; } + [Optional] public long? UnreadableBytes { get; set; } /// /// The bytes read from memory, encoded using base64. /// - [Optional] public string data { get; set; } + [Optional] public string Data { get; set; } } } diff --git a/src/Dap.Protocol/Requests/RestartFrameArguments.cs b/src/Dap.Protocol/Requests/RestartFrameArguments.cs index 0d05ff36f..477dd84b1 100644 --- a/src/Dap.Protocol/Requests/RestartFrameArguments.cs +++ b/src/Dap.Protocol/Requests/RestartFrameArguments.cs @@ -7,7 +7,7 @@ public class RestartFrameArguments : IRequest /// /// Restart this stackframe. /// - public long frameId { get; set; } + public long FrameId { get; set; } } } diff --git a/src/Dap.Protocol/Requests/ReverseContinueArguments.cs b/src/Dap.Protocol/Requests/ReverseContinueArguments.cs index 430d7cfc8..31e86a98e 100644 --- a/src/Dap.Protocol/Requests/ReverseContinueArguments.cs +++ b/src/Dap.Protocol/Requests/ReverseContinueArguments.cs @@ -7,7 +7,7 @@ public class ReverseContinueArguments : IRequest /// /// Execute 'reverseContinue' for this thread. /// - public long threadId { get; set; } + public long ThreadId { get; set; } } } diff --git a/src/Dap.Protocol/Requests/RunInTerminalArguments.cs b/src/Dap.Protocol/Requests/RunInTerminalArguments.cs index d482b67c5..79b43617e 100644 --- a/src/Dap.Protocol/Requests/RunInTerminalArguments.cs +++ b/src/Dap.Protocol/Requests/RunInTerminalArguments.cs @@ -9,27 +9,27 @@ public class RunInTerminalArguments : IRequest /// /// What kind of terminal to launch. /// - [Optional] public RunInTerminalArgumentsKind kind { get; set; } + [Optional] public RunInTerminalArgumentsKind Kind { get; set; } /// /// Optional title of the terminal. /// - [Optional] public string title { get; set; } + [Optional] public string Title { get; set; } /// /// Working directory of the command. /// - public string cwd { get; set; } + public string Cwd { get; set; } /// /// List of arguments.The first argument is the command to run. /// - public Container args { get; set; } + public Container Args { get; set; } /// /// Environment key-value pairs that are added to or removed from the default environment. /// - [Optional] public IDictionary env { get; set; } + [Optional] public IDictionary Env { get; set; } public override bool Equals(object obj) { diff --git a/src/Dap.Protocol/Requests/RunInTerminalResponse.cs b/src/Dap.Protocol/Requests/RunInTerminalResponse.cs index 95ae2ee71..be42fb680 100644 --- a/src/Dap.Protocol/Requests/RunInTerminalResponse.cs +++ b/src/Dap.Protocol/Requests/RunInTerminalResponse.cs @@ -7,12 +7,12 @@ public class RunInTerminalResponse /// /// The process ID. /// - [Optional] public long? processId { get; set; } + [Optional] public long? ProcessId { get; set; } /// /// The process ID of the terminal shell. /// - [Optional] public long? shellProcessId { get; set; } + [Optional] public long? ShellProcessId { get; set; } } } diff --git a/src/Dap.Protocol/Requests/ScopesArguments.cs b/src/Dap.Protocol/Requests/ScopesArguments.cs index a45e37bce..db1699bab 100644 --- a/src/Dap.Protocol/Requests/ScopesArguments.cs +++ b/src/Dap.Protocol/Requests/ScopesArguments.cs @@ -7,7 +7,7 @@ public class ScopesArguments : IRequest /// /// Retrieve the scopes for this stackframe. /// - public long frameId { get; set; } + public long FrameId { get; set; } } } diff --git a/src/Dap.Protocol/Requests/ScopesResponse.cs b/src/Dap.Protocol/Requests/ScopesResponse.cs index 9cbca13c4..f03c3bd07 100644 --- a/src/Dap.Protocol/Requests/ScopesResponse.cs +++ b/src/Dap.Protocol/Requests/ScopesResponse.cs @@ -5,7 +5,7 @@ public class ScopesResponse /// /// The scopes of the stackframe.If the array has length zero, there are no scopes available. /// - public Container scopes { get; set; } + public Container Scopes { get; set; } } } diff --git a/src/Dap.Protocol/Requests/SetBreakpointsArguments.cs b/src/Dap.Protocol/Requests/SetBreakpointsArguments.cs index 2c93f6737..1ff6fedfa 100644 --- a/src/Dap.Protocol/Requests/SetBreakpointsArguments.cs +++ b/src/Dap.Protocol/Requests/SetBreakpointsArguments.cs @@ -9,23 +9,23 @@ public class SetBreakpointsArguments : IRequest /// /// The source location of the breakpoints; either 'source.path' or 'source.reference' must be specified. /// - public Source source { get; set; } + public Source Source { get; set; } /// /// The code locations of the breakpoints. /// - [Optional] public Container breakpoints { get; set; } + [Optional] public Container Breakpoints { get; set; } /// /// Deprecated: The code locations of the breakpoints. /// [Obsolete("Deprecated")] - [Optional] public Container lines { get; set; } + [Optional] public Container Lines { get; set; } /// /// A value of true indicates that the underlying source has been modified which results in new breakpoint locations. /// - [Optional] public bool? sourceModified { get; set; } + [Optional] public bool? SourceModified { get; set; } } } diff --git a/src/Dap.Protocol/Requests/SetBreakpointsResponse.cs b/src/Dap.Protocol/Requests/SetBreakpointsResponse.cs index 899881ba4..3ad94e086 100644 --- a/src/Dap.Protocol/Requests/SetBreakpointsResponse.cs +++ b/src/Dap.Protocol/Requests/SetBreakpointsResponse.cs @@ -5,7 +5,7 @@ public class SetBreakpointsResponse /// /// Information about the breakpoints.The array elements are in the same order as the elements of the 'breakpoints' (or the deprecated 'lines') array in the arguments. /// - public Container breakpoints { get; set; } + public Container Breakpoints { get; set; } } } diff --git a/src/Dap.Protocol/Requests/SetDataBreakpointsArguments.cs b/src/Dap.Protocol/Requests/SetDataBreakpointsArguments.cs index 6338cd3ab..5303b9df7 100644 --- a/src/Dap.Protocol/Requests/SetDataBreakpointsArguments.cs +++ b/src/Dap.Protocol/Requests/SetDataBreakpointsArguments.cs @@ -7,7 +7,7 @@ public class SetDataBreakpointsArguments : IRequest /// /// The contents of this array replaces all existing data breakpoints. An empty array clears all data breakpoints. /// - public Container breakpoints { get; set; } + public Container Breakpoints { get; set; } } } diff --git a/src/Dap.Protocol/Requests/SetDataBreakpointsResponse.cs b/src/Dap.Protocol/Requests/SetDataBreakpointsResponse.cs index b66c6737d..8ad6adda9 100644 --- a/src/Dap.Protocol/Requests/SetDataBreakpointsResponse.cs +++ b/src/Dap.Protocol/Requests/SetDataBreakpointsResponse.cs @@ -5,7 +5,7 @@ public class SetDataBreakpointsResponse /// /// Information about the data breakpoints.The array elements correspond to the elements of the input argument 'breakpoints' array. /// - public Container breakpoints { get; set; } + public Container Breakpoints { get; set; } } } diff --git a/src/Dap.Protocol/Requests/SetExceptionBreakpointsArguments.cs b/src/Dap.Protocol/Requests/SetExceptionBreakpointsArguments.cs index e9ac36720..4688c2af7 100644 --- a/src/Dap.Protocol/Requests/SetExceptionBreakpointsArguments.cs +++ b/src/Dap.Protocol/Requests/SetExceptionBreakpointsArguments.cs @@ -8,12 +8,12 @@ public class SetExceptionBreakpointsArguments : IRequest /// IDs of checked exception options.The set of IDs is returned via the 'exceptionBreakpointFilters' capability. /// - public Container filters { get; set; } + public Container Filters { get; set; } /// /// Configuration options for selected exceptions. /// - [Optional] public Container exceptionOptions { get; set; } + [Optional] public Container ExceptionOptions { get; set; } } } diff --git a/src/Dap.Protocol/Requests/SetExpressionArguments.cs b/src/Dap.Protocol/Requests/SetExpressionArguments.cs index dbd1a7db2..4ab4f0f8e 100644 --- a/src/Dap.Protocol/Requests/SetExpressionArguments.cs +++ b/src/Dap.Protocol/Requests/SetExpressionArguments.cs @@ -8,22 +8,22 @@ public class SetExpressionArguments : IRequest /// /// The l-value expression to assign to. /// - public string expression { get; set; } + public string Expression { get; set; } /// /// The value expression to assign to the l-value expression. /// - public string value { get; set; } + public string Value { get; set; } /// /// Evaluate the expressions in the scope of this stack frame. If not specified, the expressions are evaluated in the global scope. /// - [Optional] public long? frameId { get; set; } + [Optional] public long? FrameId { get; set; } /// /// Specifies how the resulting value should be formatted. /// - [Optional] public ValueFormat format { get; set; } + [Optional] public ValueFormat Format { get; set; } } } diff --git a/src/Dap.Protocol/Requests/SetExpressionResponse.cs b/src/Dap.Protocol/Requests/SetExpressionResponse.cs index e69256cb1..e0a55019f 100644 --- a/src/Dap.Protocol/Requests/SetExpressionResponse.cs +++ b/src/Dap.Protocol/Requests/SetExpressionResponse.cs @@ -7,34 +7,34 @@ public class SetExpressionResponse /// /// The new value of the expression. /// - public string value { get; set; } + public string Value { get; set; } /// /// The optional type of the value. /// - [Optional] public string type { get; set; } + [Optional] public string Type { get; set; } /// /// Properties of a value that can be used to determine how to render the result in the UI. /// - [Optional] public VariablePresentationHint presentationHint { get; set; } + [Optional] public VariablePresentationHint PresentationHint { get; set; } /// /// If variablesReference is > 0, the value is structured and its children can be retrieved by passing variablesReference to the VariablesRequest. /// - [Optional] public long? variablesReference { get; set; } + [Optional] public long? VariablesReference { get; set; } /// /// The number of named child variables. /// The client can use this optional information to present the variables in a paged UI and fetch them in chunks. /// - [Optional] public long? namedVariables { get; set; } + [Optional] public long? NamedVariables { get; set; } /// /// The number of indexed child variables. /// The client can use this optional information to present the variables in a paged UI and fetch them in chunks. /// - [Optional] public long? indexedVariables { get; set; } + [Optional] public long? IndexedVariables { get; set; } } } diff --git a/src/Dap.Protocol/Requests/SetFunctionBreakpointsArguments.cs b/src/Dap.Protocol/Requests/SetFunctionBreakpointsArguments.cs index a510489bd..44214eb36 100644 --- a/src/Dap.Protocol/Requests/SetFunctionBreakpointsArguments.cs +++ b/src/Dap.Protocol/Requests/SetFunctionBreakpointsArguments.cs @@ -7,7 +7,7 @@ public class SetFunctionBreakpointsArguments : IRequest /// The function names of the breakpoints. /// - public Container breakpoints { get; set; } + public Container Breakpoints { get; set; } } } diff --git a/src/Dap.Protocol/Requests/SetFunctionBreakpointsResponse.cs b/src/Dap.Protocol/Requests/SetFunctionBreakpointsResponse.cs index fad4c35f3..7e2d95211 100644 --- a/src/Dap.Protocol/Requests/SetFunctionBreakpointsResponse.cs +++ b/src/Dap.Protocol/Requests/SetFunctionBreakpointsResponse.cs @@ -5,7 +5,7 @@ public class SetFunctionBreakpointsResponse /// /// Information about the breakpoints.The array elements correspond to the elements of the 'breakpoints' array. /// - public Container breakpoints { get; set; } + public Container Breakpoints { get; set; } } } diff --git a/src/Dap.Protocol/Requests/SetVariableArguments.cs b/src/Dap.Protocol/Requests/SetVariableArguments.cs index 0f92aca34..0b1616c77 100644 --- a/src/Dap.Protocol/Requests/SetVariableArguments.cs +++ b/src/Dap.Protocol/Requests/SetVariableArguments.cs @@ -8,22 +8,22 @@ public class SetVariableArguments : IRequest /// /// The reference of the variable container. /// - public long variablesReference { get; set; } + public long VariablesReference { get; set; } /// /// The name of the variable in the container. /// - public string name { get; set; } + public string Name { get; set; } /// /// The value of the variable. /// - public string value { get; set; } + public string Value { get; set; } /// /// Specifies details on how to format the response value. /// - [Optional] public ValueFormat format { get; set; } + [Optional] public ValueFormat Format { get; set; } } } diff --git a/src/Dap.Protocol/Requests/SetVariableResponse.cs b/src/Dap.Protocol/Requests/SetVariableResponse.cs index f4a467c71..f6cbedccf 100644 --- a/src/Dap.Protocol/Requests/SetVariableResponse.cs +++ b/src/Dap.Protocol/Requests/SetVariableResponse.cs @@ -7,29 +7,29 @@ public class SetVariableResponse /// /// The new value of the variable. /// - public string value { get; set; } + public string Value { get; set; } /// /// The type of the new value.Typically shown in the UI when hovering over the value. /// - [Optional] public string type { get; set; } + [Optional] public string Type { get; set; } /// /// If variablesReference is > 0, the new value is structured and its children can be retrieved by passing variablesReference to the VariablesRequest. /// - [Optional] public long? variablesReference { get; set; } + [Optional] public long? VariablesReference { get; set; } /// /// The number of named child variables. /// The client can use this optional information to present the variables in a paged UI and fetch them in chunks. /// - [Optional] public long? namedVariables { get; set; } + [Optional] public long? NamedVariables { get; set; } /// /// The number of indexed child variables. /// The client can use this optional information to present the variables in a paged UI and fetch them in chunks. /// - [Optional] public long? indexedVariables { get; set; } + [Optional] public long? IndexedVariables { get; set; } } } diff --git a/src/Dap.Protocol/Requests/SourceArguments.cs b/src/Dap.Protocol/Requests/SourceArguments.cs index d13da4869..c6b0a621b 100644 --- a/src/Dap.Protocol/Requests/SourceArguments.cs +++ b/src/Dap.Protocol/Requests/SourceArguments.cs @@ -8,12 +8,12 @@ public class SourceArguments : IRequest /// /// Specifies the source content to load.Either source.path or source.sourceReference must be specified. /// - [Optional] public Source source { get; set; } + [Optional] public Source Source { get; set; } /// /// The reference to the source.This is the same as source.sourceReference.This is provided for backward compatibility since old backends do not understand the 'source' attribute. /// - public long sourceReference { get; set; } + public long SourceReference { get; set; } } } diff --git a/src/Dap.Protocol/Requests/SourceResponse.cs b/src/Dap.Protocol/Requests/SourceResponse.cs index 357210df4..c30a31f45 100644 --- a/src/Dap.Protocol/Requests/SourceResponse.cs +++ b/src/Dap.Protocol/Requests/SourceResponse.cs @@ -7,12 +7,12 @@ public class SourceResponse /// /// Content of the source reference. /// - public string content { get; set; } + public string Content { get; set; } /// /// Optional content type(mime type) of the source. /// - [Optional] public string mimeType { get; set; } + [Optional] public string MimeType { get; set; } } } diff --git a/src/Dap.Protocol/Requests/StackTraceArguments.cs b/src/Dap.Protocol/Requests/StackTraceArguments.cs index a678d56be..c59cb9367 100644 --- a/src/Dap.Protocol/Requests/StackTraceArguments.cs +++ b/src/Dap.Protocol/Requests/StackTraceArguments.cs @@ -8,22 +8,22 @@ public class StackTraceArguments : IRequest /// /// Retrieve the stacktrace for this thread. /// - public long threadId { get; set; } + public long ThreadId { get; set; } /// /// The index of the first frame to return; if omitted frames start at 0. /// - [Optional] public long? startFrame { get; set; } + [Optional] public long? StartFrame { get; set; } /// /// The maximum number of frames to return. If levels is not specified or 0, all frames are returned. /// - [Optional] public long? levels { get; set; } + [Optional] public long? Levels { get; set; } /// /// Specifies details on how to format the stack frames. /// - [Optional] public StackFrameFormat format { get; set; } + [Optional] public StackFrameFormat Format { get; set; } } } diff --git a/src/Dap.Protocol/Requests/StackTraceResponse.cs b/src/Dap.Protocol/Requests/StackTraceResponse.cs index 251fd5804..27660eb31 100644 --- a/src/Dap.Protocol/Requests/StackTraceResponse.cs +++ b/src/Dap.Protocol/Requests/StackTraceResponse.cs @@ -8,12 +8,12 @@ public class StackTraceResponse /// The frames of the stackframe.If the array has length zero, there are no stackframes available. /// This means that there is no location information available. /// - public Container stackFrames { get; set; } + public Container StackFrames { get; set; } /// /// The total number of frames available. /// - [Optional] public long? totalFrames { get; set; } + [Optional] public long? TotalFrames { get; set; } } diff --git a/src/Dap.Protocol/Requests/StepBackArguments.cs b/src/Dap.Protocol/Requests/StepBackArguments.cs index 8bff37da8..687401c25 100644 --- a/src/Dap.Protocol/Requests/StepBackArguments.cs +++ b/src/Dap.Protocol/Requests/StepBackArguments.cs @@ -7,7 +7,7 @@ public class StepBackArguments : IRequest /// /// Execute 'stepBack' for this thread. /// - public long threadId { get; set; } + public long ThreadId { get; set; } } } diff --git a/src/Dap.Protocol/Requests/StepInArguments.cs b/src/Dap.Protocol/Requests/StepInArguments.cs index 9ee6dde8f..2de2b361a 100644 --- a/src/Dap.Protocol/Requests/StepInArguments.cs +++ b/src/Dap.Protocol/Requests/StepInArguments.cs @@ -8,12 +8,12 @@ public class StepInArguments : IRequest /// /// Execute 'stepIn' for this thread. /// - public long threadId { get; set; } + public long ThreadId { get; set; } /// /// Optional id of the target to step into. /// - [Optional] public long? targetId { get; set; } + [Optional] public long? TargetId { get; set; } } } diff --git a/src/Dap.Protocol/Requests/StepInTargetsArguments.cs b/src/Dap.Protocol/Requests/StepInTargetsArguments.cs index 955f9aa0a..1f89c3eb7 100644 --- a/src/Dap.Protocol/Requests/StepInTargetsArguments.cs +++ b/src/Dap.Protocol/Requests/StepInTargetsArguments.cs @@ -7,7 +7,7 @@ public class StepInTargetsArguments : IRequest /// /// The stack frame for which to retrieve the possible stepIn targets. /// - public long frameId { get; set; } + public long FrameId { get; set; } } } diff --git a/src/Dap.Protocol/Requests/StepInTargetsResponse.cs b/src/Dap.Protocol/Requests/StepInTargetsResponse.cs index 6dbfc4fdb..a6538f664 100644 --- a/src/Dap.Protocol/Requests/StepInTargetsResponse.cs +++ b/src/Dap.Protocol/Requests/StepInTargetsResponse.cs @@ -5,7 +5,7 @@ public class StepInTargetsResponse /// /// The possible stepIn targets of the specified source location. /// - public Container targets { get; set; } + public Container Targets { get; set; } } } diff --git a/src/Dap.Protocol/Requests/StepOutArguments.cs b/src/Dap.Protocol/Requests/StepOutArguments.cs index 6f1f387cd..0519c1402 100644 --- a/src/Dap.Protocol/Requests/StepOutArguments.cs +++ b/src/Dap.Protocol/Requests/StepOutArguments.cs @@ -7,7 +7,7 @@ public class StepOutArguments : IRequest /// /// Execute 'stepOut' for this thread. /// - public long threadId { get; set; } + public long ThreadId { get; set; } } } diff --git a/src/Dap.Protocol/Requests/TerminateArguments.cs b/src/Dap.Protocol/Requests/TerminateArguments.cs index 50c9dfac7..05be39997 100644 --- a/src/Dap.Protocol/Requests/TerminateArguments.cs +++ b/src/Dap.Protocol/Requests/TerminateArguments.cs @@ -8,7 +8,7 @@ public class TerminateArguments : IRequest /// /// A value of true indicates that this 'terminate' request is part of a restart sequence. /// - [Optional] public bool? restart { get; set; } + [Optional] public bool? Restart { get; set; } } } diff --git a/src/Dap.Protocol/Requests/TerminateThreadsArguments.cs b/src/Dap.Protocol/Requests/TerminateThreadsArguments.cs index ecf14c7b7..d239a1f4e 100644 --- a/src/Dap.Protocol/Requests/TerminateThreadsArguments.cs +++ b/src/Dap.Protocol/Requests/TerminateThreadsArguments.cs @@ -8,7 +8,7 @@ public class TerminateThreadsArguments : IRequest /// /// Ids of threads to be terminated. /// - [Optional] public Container threadIds { get; set; } + [Optional] public Container ThreadIds { get; set; } } } diff --git a/src/Dap.Protocol/Requests/ThreadsResponse.cs b/src/Dap.Protocol/Requests/ThreadsResponse.cs index 0b06d00cd..6bec1925d 100644 --- a/src/Dap.Protocol/Requests/ThreadsResponse.cs +++ b/src/Dap.Protocol/Requests/ThreadsResponse.cs @@ -5,7 +5,7 @@ public class ThreadsResponse /// /// All threads. /// - public Container threads { get; set; } + public Container Threads { get; set; } } } diff --git a/src/Dap.Protocol/Requests/VariablesArguments.cs b/src/Dap.Protocol/Requests/VariablesArguments.cs index 4c7b7c665..7e1cdd108 100644 --- a/src/Dap.Protocol/Requests/VariablesArguments.cs +++ b/src/Dap.Protocol/Requests/VariablesArguments.cs @@ -8,27 +8,27 @@ public class VariablesArguments : IRequest /// /// The Variable reference. /// - public long variablesReference { get; set; } + public long VariablesReference { get; set; } /// /// Optional filter to limit the child variables to either named or indexed.If ommited, both types are fetched. /// - [Optional] public VariablesArgumentsFilter filter { get; set; } + [Optional] public VariablesArgumentsFilter Filter { get; set; } /// /// The index of the first variable to return; if omitted children start at 0. /// - [Optional] public long? start { get; set; } + [Optional] public long? Start { get; set; } /// /// The number of variables to return. If count is missing or 0, all variables are returned. /// - [Optional] public long? count { get; set; } + [Optional] public long? Count { get; set; } /// /// Specifies details on how to format the Variable values. /// - [Optional] public ValueFormat format { get; set; } + [Optional] public ValueFormat Format { get; set; } } } diff --git a/src/Dap.Protocol/Requests/VariablesResponse.cs b/src/Dap.Protocol/Requests/VariablesResponse.cs index d9c56464f..79308e0f8 100644 --- a/src/Dap.Protocol/Requests/VariablesResponse.cs +++ b/src/Dap.Protocol/Requests/VariablesResponse.cs @@ -5,7 +5,7 @@ public class VariablesResponse /// /// All(or a range) of variables for the given variable reference. /// - public Container variables { get; set; } + public Container Variables { get; set; } } } From 3abbb2391ef69e133a3b362f69ab1b7527ab80ad Mon Sep 17 00:00:00 2001 From: David Driscoll Date: Sun, 21 Jul 2019 09:07:40 -0400 Subject: [PATCH 09/20] Updated namespaces --- src/Dap.Protocol/Events/BreakpointEvent.cs | 2 +- src/Dap.Protocol/Events/CapabilitiesEvent.cs | 1 + src/Dap.Protocol/Events/ContinuedEvent.cs | 3 --- src/Dap.Protocol/Events/EventNames.cs | 3 +-- src/Dap.Protocol/Events/ExitedEvent.cs | 1 - src/Dap.Protocol/Events/IBreakpointHandler.cs | 1 + src/Dap.Protocol/Events/ICapabilitiesHandler.cs | 1 + src/Dap.Protocol/Events/IContinuedHandler.cs | 1 + src/Dap.Protocol/Events/IExitedHandler.cs | 1 + src/Dap.Protocol/Events/IInitializedHandler.cs | 1 + src/Dap.Protocol/Events/ILoadedSourceHandler.cs | 1 + src/Dap.Protocol/Events/IModuleHandler.cs | 1 + src/Dap.Protocol/Events/IOutputHandler.cs | 1 + src/Dap.Protocol/Events/IProcessHandler.cs | 1 + src/Dap.Protocol/Events/IStoppedHandler.cs | 1 + src/Dap.Protocol/Events/ITerminatedHandler.cs | 1 + src/Dap.Protocol/Events/IThreadHandler.cs | 1 + src/Dap.Protocol/Events/InitializedEvent.cs | 1 - src/Dap.Protocol/Events/LoadedSourceEvent.cs | 1 + src/Dap.Protocol/Events/LoadedSourceReason.cs | 1 - src/Dap.Protocol/Events/ModuleEvent.cs | 1 + src/Dap.Protocol/Events/OutputEvent.cs | 1 + src/Dap.Protocol/Models/Breakpoint.cs | 2 +- src/Dap.Protocol/Models/Capabilities.cs | 4 ++-- src/Dap.Protocol/Models/Checksum.cs | 2 +- src/Dap.Protocol/Models/ChecksumAlgorithm.cs | 2 +- src/Dap.Protocol/Models/ColumnDescriptor.cs | 2 +- src/Dap.Protocol/Models/ColumnDescriptorType.cs | 2 +- src/Dap.Protocol/Models/CompletionItem.cs | 2 +- src/Dap.Protocol/Models/CompletionItemType.cs | 2 +- src/Dap.Protocol/Models/Container.cs | 2 +- src/Dap.Protocol/Models/ContainerBase.cs | 4 +--- src/Dap.Protocol/Models/DataBreakpoint.cs | 2 +- src/Dap.Protocol/Models/DataBreakpointAccessType.cs | 2 +- src/Dap.Protocol/Models/DisassembledInstruction.cs | 2 +- src/Dap.Protocol/Models/ExceptionBreakMode.cs | 2 +- src/Dap.Protocol/Models/ExceptionBreakpointsFilter.cs | 2 +- src/Dap.Protocol/Models/ExceptionDetails.cs | 2 +- src/Dap.Protocol/Models/ExceptionOptions.cs | 2 +- src/Dap.Protocol/Models/ExceptionPathSegment.cs | 2 +- src/Dap.Protocol/Models/FunctionBreakpoint.cs | 2 +- src/Dap.Protocol/Models/GotoTarget.cs | 2 +- src/Dap.Protocol/Models/Message.cs | 2 +- src/Dap.Protocol/Models/Module.cs | 2 +- src/Dap.Protocol/Models/ModulesViewDescriptor.cs | 2 +- src/Dap.Protocol/Models/NumberString.cs | 8 +------- src/Dap.Protocol/Models/Scope.cs | 2 +- src/Dap.Protocol/Models/Source.cs | 2 +- src/Dap.Protocol/Models/SourceBreakpoint.cs | 2 +- src/Dap.Protocol/Models/SourcePresentationHint.cs | 2 +- src/Dap.Protocol/Models/StackFrame.cs | 2 +- src/Dap.Protocol/Models/StackFrameFormat.cs | 2 +- src/Dap.Protocol/Models/StackFramePresentationHint.cs | 2 +- src/Dap.Protocol/Models/StepInTarget.cs | 2 +- src/Dap.Protocol/Models/Thread.cs | 2 +- src/Dap.Protocol/Models/ValueFormat.cs | 2 +- src/Dap.Protocol/Models/Variable.cs | 2 +- src/Dap.Protocol/Models/VariablePresentationHint.cs | 2 +- src/Dap.Protocol/Requests/AttachRequestArguments.cs | 2 +- src/Dap.Protocol/Requests/AttachResponse.cs | 2 +- src/Dap.Protocol/Requests/CompletionsArguments.cs | 2 +- src/Dap.Protocol/Requests/CompletionsResponse.cs | 4 +++- src/Dap.Protocol/Requests/ConfigurationDoneArguments.cs | 2 +- src/Dap.Protocol/Requests/ConfigurationDoneResponse.cs | 2 +- src/Dap.Protocol/Requests/ContinueArguments.cs | 2 +- src/Dap.Protocol/Requests/ContinueResponse.cs | 2 +- src/Dap.Protocol/Requests/DataBreakpointInfoArguments.cs | 2 +- src/Dap.Protocol/Requests/DataBreakpointInfoResponse.cs | 3 ++- src/Dap.Protocol/Requests/DisassembleArguments.cs | 2 +- src/Dap.Protocol/Requests/DisassembleResponse.cs | 4 +++- src/Dap.Protocol/Requests/DisconnectArguments.cs | 2 +- src/Dap.Protocol/Requests/DisconnectResponse.cs | 2 +- src/Dap.Protocol/Requests/EvaluateArguments.cs | 3 ++- src/Dap.Protocol/Requests/EvaluateResponse.cs | 3 ++- src/Dap.Protocol/Requests/ExceptionInfoArguments.cs | 2 +- src/Dap.Protocol/Requests/ExceptionInfoResponse.cs | 3 ++- src/Dap.Protocol/Requests/GotoArguments.cs | 2 +- src/Dap.Protocol/Requests/GotoResponse.cs | 2 +- src/Dap.Protocol/Requests/GotoTargetsArguments.cs | 3 ++- src/Dap.Protocol/Requests/GotoTargetsResponse.cs | 5 ++--- src/Dap.Protocol/Requests/IAttachHandler.cs | 2 +- src/Dap.Protocol/Requests/ICompletionsHandler.cs | 2 +- src/Dap.Protocol/Requests/IConfigurationDoneHandler.cs | 2 +- src/Dap.Protocol/Requests/IContinueHandler.cs | 2 +- src/Dap.Protocol/Requests/IDataBreakpointInfoHandler.cs | 2 +- src/Dap.Protocol/Requests/IDebugAdapterClient.cs | 2 +- src/Dap.Protocol/Requests/IDebugAdapterRegistry.cs | 2 +- src/Dap.Protocol/Requests/IDisassembleHandler.cs | 2 +- src/Dap.Protocol/Requests/IDisconnectHandler.cs | 2 +- src/Dap.Protocol/Requests/IEvaluateHandler.cs | 2 +- src/Dap.Protocol/Requests/IExceptionInfoHandler.cs | 2 +- src/Dap.Protocol/Requests/IGotoHandler.cs | 2 +- src/Dap.Protocol/Requests/IGotoTargetsHandler.cs | 2 +- src/Dap.Protocol/Requests/IInitializeHandler.cs | 2 +- src/Dap.Protocol/Requests/ILaunchHandler.cs | 2 +- src/Dap.Protocol/Requests/ILoadedSourcesHandler.cs | 2 +- src/Dap.Protocol/Requests/IModulesHandler.cs | 2 +- src/Dap.Protocol/Requests/INextHandler.cs | 2 +- src/Dap.Protocol/Requests/IPauseHandler.cs | 2 +- src/Dap.Protocol/Requests/IReadMemoryHandler.cs | 2 +- src/Dap.Protocol/Requests/IRestartFrameHandler.cs | 2 +- src/Dap.Protocol/Requests/IRestartHandler.cs | 2 +- src/Dap.Protocol/Requests/IReverseContinueHandler.cs | 2 +- src/Dap.Protocol/Requests/IScopesHandler.cs | 2 +- src/Dap.Protocol/Requests/ISetBreakpointsHandler.cs | 2 +- src/Dap.Protocol/Requests/ISetDataBreakpointsHandler.cs | 2 +- .../Requests/ISetExceptionBreakpointsHandler.cs | 2 +- src/Dap.Protocol/Requests/ISetExpressionHandler.cs | 2 +- .../Requests/ISetFunctionBreakpointsHandler.cs | 2 +- src/Dap.Protocol/Requests/ISetVariableHandler.cs | 2 +- src/Dap.Protocol/Requests/ISourceHandler.cs | 2 +- src/Dap.Protocol/Requests/IStackTraceHandler.cs | 2 +- src/Dap.Protocol/Requests/IStepBackHandler.cs | 2 +- src/Dap.Protocol/Requests/IStepInHandler.cs | 2 +- src/Dap.Protocol/Requests/IStepInTargetsHandler.cs | 2 +- src/Dap.Protocol/Requests/IStepOutHandler.cs | 2 +- src/Dap.Protocol/Requests/ITerminateHandler.cs | 2 +- src/Dap.Protocol/Requests/ITerminateThreadsHandler.cs | 2 +- src/Dap.Protocol/Requests/IThreadsHandler.cs | 2 +- src/Dap.Protocol/Requests/IVariablesHandler.cs | 2 +- src/Dap.Protocol/Requests/InitializeRequestArguments.cs | 2 +- src/Dap.Protocol/Requests/InitializeResponse.cs | 3 ++- src/Dap.Protocol/Requests/LaunchRequestArguments.cs | 2 +- src/Dap.Protocol/Requests/LaunchResponse.cs | 2 +- src/Dap.Protocol/Requests/LoadedSourcesArguments.cs | 2 +- src/Dap.Protocol/Requests/LoadedSourcesResponse.cs | 4 +++- src/Dap.Protocol/Requests/ModulesArguments.cs | 2 +- src/Dap.Protocol/Requests/ModulesResponse.cs | 3 ++- src/Dap.Protocol/Requests/NextArguments.cs | 2 +- src/Dap.Protocol/Requests/NextResponse.cs | 2 +- src/Dap.Protocol/Requests/PauseArguments.cs | 2 +- src/Dap.Protocol/Requests/PauseResponse.cs | 2 +- src/Dap.Protocol/Requests/ReadMemoryArguments.cs | 2 +- src/Dap.Protocol/Requests/ReadMemoryResponse.cs | 2 +- src/Dap.Protocol/Requests/RequestNames.cs | 2 +- src/Dap.Protocol/Requests/RestartArguments.cs | 2 +- src/Dap.Protocol/Requests/RestartFrameArguments.cs | 2 +- src/Dap.Protocol/Requests/RestartFrameResponse.cs | 2 +- src/Dap.Protocol/Requests/RestartResponse.cs | 2 +- src/Dap.Protocol/Requests/ReverseContinueArguments.cs | 2 +- src/Dap.Protocol/Requests/ReverseContinueResponse.cs | 2 +- src/Dap.Protocol/Requests/RunInTerminalArguments.cs | 3 ++- src/Dap.Protocol/Requests/RunInTerminalArgumentsKind.cs | 2 +- src/Dap.Protocol/Requests/RunInTerminalExtensions.cs | 2 +- src/Dap.Protocol/Requests/RunInTerminalResponse.cs | 2 +- src/Dap.Protocol/Requests/ScopesArguments.cs | 2 +- src/Dap.Protocol/Requests/ScopesResponse.cs | 4 +++- src/Dap.Protocol/Requests/SetBreakpointsArguments.cs | 3 ++- src/Dap.Protocol/Requests/SetBreakpointsResponse.cs | 4 +++- src/Dap.Protocol/Requests/SetDataBreakpointsArguments.cs | 3 ++- src/Dap.Protocol/Requests/SetDataBreakpointsResponse.cs | 4 +++- .../Requests/SetExceptionBreakpointsArguments.cs | 3 ++- .../Requests/SetExceptionBreakpointsResponse.cs | 2 +- src/Dap.Protocol/Requests/SetExpressionArguments.cs | 3 ++- src/Dap.Protocol/Requests/SetExpressionResponse.cs | 3 ++- .../Requests/SetFunctionBreakpointsArguments.cs | 3 ++- .../Requests/SetFunctionBreakpointsResponse.cs | 4 +++- src/Dap.Protocol/Requests/SetVariableArguments.cs | 3 ++- src/Dap.Protocol/Requests/SetVariableResponse.cs | 2 +- src/Dap.Protocol/Requests/SourceArguments.cs | 3 ++- src/Dap.Protocol/Requests/SourceResponse.cs | 2 +- src/Dap.Protocol/Requests/StackTraceArguments.cs | 3 ++- src/Dap.Protocol/Requests/StackTraceResponse.cs | 3 ++- src/Dap.Protocol/Requests/StepBackArguments.cs | 2 +- src/Dap.Protocol/Requests/StepBackResponse.cs | 2 +- src/Dap.Protocol/Requests/StepInArguments.cs | 2 +- src/Dap.Protocol/Requests/StepInResponse.cs | 2 +- src/Dap.Protocol/Requests/StepInTargetsArguments.cs | 2 +- src/Dap.Protocol/Requests/StepInTargetsResponse.cs | 4 +++- src/Dap.Protocol/Requests/StepOutArguments.cs | 2 +- src/Dap.Protocol/Requests/StepOutResponse.cs | 2 +- src/Dap.Protocol/Requests/TerminateArguments.cs | 2 +- src/Dap.Protocol/Requests/TerminateResponse.cs | 2 +- src/Dap.Protocol/Requests/TerminateThreadsArguments.cs | 3 ++- src/Dap.Protocol/Requests/TerminateThreadsResponse.cs | 2 +- src/Dap.Protocol/Requests/ThreadsArguments.cs | 2 +- src/Dap.Protocol/Requests/ThreadsResponse.cs | 4 +++- src/Dap.Protocol/Requests/VariablesArguments.cs | 3 ++- src/Dap.Protocol/Requests/VariablesArgumentsFilter.cs | 2 +- src/Dap.Protocol/Requests/VariablesResponse.cs | 4 +++- src/Dap.Protocol/Serialization/OptionalAttribute.cs | 1 + src/Dap.Protocol/Serialization/Serializer.cs | 2 +- 182 files changed, 220 insertions(+), 179 deletions(-) diff --git a/src/Dap.Protocol/Events/BreakpointEvent.cs b/src/Dap.Protocol/Events/BreakpointEvent.cs index 8b501820b..6b78ee81e 100644 --- a/src/Dap.Protocol/Events/BreakpointEvent.cs +++ b/src/Dap.Protocol/Events/BreakpointEvent.cs @@ -1,10 +1,10 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Models; using OmniSharp.Extensions.Embedded.MediatR; namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events { public class BreakpointEvent : IRequest { - /// /// The reason for the event. /// Values: 'changed', 'new', 'removed', etc. diff --git a/src/Dap.Protocol/Events/CapabilitiesEvent.cs b/src/Dap.Protocol/Events/CapabilitiesEvent.cs index b2bd1fd29..7c9b058b6 100644 --- a/src/Dap.Protocol/Events/CapabilitiesEvent.cs +++ b/src/Dap.Protocol/Events/CapabilitiesEvent.cs @@ -1,3 +1,4 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Models; using OmniSharp.Extensions.Embedded.MediatR; namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events diff --git a/src/Dap.Protocol/Events/ContinuedEvent.cs b/src/Dap.Protocol/Events/ContinuedEvent.cs index b2cddf5e5..3fbf9f28b 100644 --- a/src/Dap.Protocol/Events/ContinuedEvent.cs +++ b/src/Dap.Protocol/Events/ContinuedEvent.cs @@ -5,8 +5,6 @@ namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events { public class ContinuedEvent : IRequest { - - /// /// The thread which was continued. /// @@ -17,5 +15,4 @@ public class ContinuedEvent : IRequest /// [Optional] public bool? AllThreadsContinued { get; set; } } - } diff --git a/src/Dap.Protocol/Events/EventNames.cs b/src/Dap.Protocol/Events/EventNames.cs index b3b7cd077..745992653 100644 --- a/src/Dap.Protocol/Events/EventNames.cs +++ b/src/Dap.Protocol/Events/EventNames.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Text; using System.Threading; @@ -20,5 +20,4 @@ public static class EventNames public const string Process = "process"; public const string Capabilities = "capabilities"; } - } diff --git a/src/Dap.Protocol/Events/ExitedEvent.cs b/src/Dap.Protocol/Events/ExitedEvent.cs index 7d5d15f18..28dd98e87 100644 --- a/src/Dap.Protocol/Events/ExitedEvent.cs +++ b/src/Dap.Protocol/Events/ExitedEvent.cs @@ -10,5 +10,4 @@ public class ExitedEvent : IRequest /// public long ExitCode { get; set; } } - } diff --git a/src/Dap.Protocol/Events/IBreakpointHandler.cs b/src/Dap.Protocol/Events/IBreakpointHandler.cs index e8959e0c8..2f04dfc8c 100644 --- a/src/Dap.Protocol/Events/IBreakpointHandler.cs +++ b/src/Dap.Protocol/Events/IBreakpointHandler.cs @@ -1,6 +1,7 @@ using System; using System.Threading; using System.Threading.Tasks; +using OmniSharp.Extensions.DebugAdapter.Protocol.Requests; using OmniSharp.Extensions.Embedded.MediatR; using OmniSharp.Extensions.JsonRpc; diff --git a/src/Dap.Protocol/Events/ICapabilitiesHandler.cs b/src/Dap.Protocol/Events/ICapabilitiesHandler.cs index fbeaf84c5..b1018f84b 100644 --- a/src/Dap.Protocol/Events/ICapabilitiesHandler.cs +++ b/src/Dap.Protocol/Events/ICapabilitiesHandler.cs @@ -1,6 +1,7 @@ using System; using System.Threading; using System.Threading.Tasks; +using OmniSharp.Extensions.DebugAdapter.Protocol.Requests; using OmniSharp.Extensions.Embedded.MediatR; using OmniSharp.Extensions.JsonRpc; diff --git a/src/Dap.Protocol/Events/IContinuedHandler.cs b/src/Dap.Protocol/Events/IContinuedHandler.cs index 406de1ab9..e3729cc46 100644 --- a/src/Dap.Protocol/Events/IContinuedHandler.cs +++ b/src/Dap.Protocol/Events/IContinuedHandler.cs @@ -1,6 +1,7 @@ using System; using System.Threading; using System.Threading.Tasks; +using OmniSharp.Extensions.DebugAdapter.Protocol.Requests; using OmniSharp.Extensions.Embedded.MediatR; using OmniSharp.Extensions.JsonRpc; diff --git a/src/Dap.Protocol/Events/IExitedHandler.cs b/src/Dap.Protocol/Events/IExitedHandler.cs index 85fc7a284..2aa27a30c 100644 --- a/src/Dap.Protocol/Events/IExitedHandler.cs +++ b/src/Dap.Protocol/Events/IExitedHandler.cs @@ -1,6 +1,7 @@ using System; using System.Threading; using System.Threading.Tasks; +using OmniSharp.Extensions.DebugAdapter.Protocol.Requests; using OmniSharp.Extensions.Embedded.MediatR; using OmniSharp.Extensions.JsonRpc; diff --git a/src/Dap.Protocol/Events/IInitializedHandler.cs b/src/Dap.Protocol/Events/IInitializedHandler.cs index bdb25cdfa..729176809 100644 --- a/src/Dap.Protocol/Events/IInitializedHandler.cs +++ b/src/Dap.Protocol/Events/IInitializedHandler.cs @@ -1,6 +1,7 @@ using System; using System.Threading; using System.Threading.Tasks; +using OmniSharp.Extensions.DebugAdapter.Protocol.Requests; using OmniSharp.Extensions.Embedded.MediatR; using OmniSharp.Extensions.JsonRpc; diff --git a/src/Dap.Protocol/Events/ILoadedSourceHandler.cs b/src/Dap.Protocol/Events/ILoadedSourceHandler.cs index d824d4aab..7d123a51a 100644 --- a/src/Dap.Protocol/Events/ILoadedSourceHandler.cs +++ b/src/Dap.Protocol/Events/ILoadedSourceHandler.cs @@ -1,6 +1,7 @@ using System; using System.Threading; using System.Threading.Tasks; +using OmniSharp.Extensions.DebugAdapter.Protocol.Requests; using OmniSharp.Extensions.Embedded.MediatR; using OmniSharp.Extensions.JsonRpc; diff --git a/src/Dap.Protocol/Events/IModuleHandler.cs b/src/Dap.Protocol/Events/IModuleHandler.cs index 25dab9326..a69a96315 100644 --- a/src/Dap.Protocol/Events/IModuleHandler.cs +++ b/src/Dap.Protocol/Events/IModuleHandler.cs @@ -1,6 +1,7 @@ using System; using System.Threading; using System.Threading.Tasks; +using OmniSharp.Extensions.DebugAdapter.Protocol.Requests; using OmniSharp.Extensions.Embedded.MediatR; using OmniSharp.Extensions.JsonRpc; diff --git a/src/Dap.Protocol/Events/IOutputHandler.cs b/src/Dap.Protocol/Events/IOutputHandler.cs index 6e36aed92..f8a8a43db 100644 --- a/src/Dap.Protocol/Events/IOutputHandler.cs +++ b/src/Dap.Protocol/Events/IOutputHandler.cs @@ -1,6 +1,7 @@ using System; using System.Threading; using System.Threading.Tasks; +using OmniSharp.Extensions.DebugAdapter.Protocol.Requests; using OmniSharp.Extensions.Embedded.MediatR; using OmniSharp.Extensions.JsonRpc; diff --git a/src/Dap.Protocol/Events/IProcessHandler.cs b/src/Dap.Protocol/Events/IProcessHandler.cs index 54482ec9d..1830d6c2b 100644 --- a/src/Dap.Protocol/Events/IProcessHandler.cs +++ b/src/Dap.Protocol/Events/IProcessHandler.cs @@ -1,6 +1,7 @@ using System; using System.Threading; using System.Threading.Tasks; +using OmniSharp.Extensions.DebugAdapter.Protocol.Requests; using OmniSharp.Extensions.Embedded.MediatR; using OmniSharp.Extensions.JsonRpc; diff --git a/src/Dap.Protocol/Events/IStoppedHandler.cs b/src/Dap.Protocol/Events/IStoppedHandler.cs index b9f4d3195..c1fbb7030 100644 --- a/src/Dap.Protocol/Events/IStoppedHandler.cs +++ b/src/Dap.Protocol/Events/IStoppedHandler.cs @@ -1,6 +1,7 @@ using System; using System.Threading; using System.Threading.Tasks; +using OmniSharp.Extensions.DebugAdapter.Protocol.Requests; using OmniSharp.Extensions.Embedded.MediatR; using OmniSharp.Extensions.JsonRpc; diff --git a/src/Dap.Protocol/Events/ITerminatedHandler.cs b/src/Dap.Protocol/Events/ITerminatedHandler.cs index bb1eb363b..70858dded 100644 --- a/src/Dap.Protocol/Events/ITerminatedHandler.cs +++ b/src/Dap.Protocol/Events/ITerminatedHandler.cs @@ -1,6 +1,7 @@ using System; using System.Threading; using System.Threading.Tasks; +using OmniSharp.Extensions.DebugAdapter.Protocol.Requests; using OmniSharp.Extensions.Embedded.MediatR; using OmniSharp.Extensions.JsonRpc; diff --git a/src/Dap.Protocol/Events/IThreadHandler.cs b/src/Dap.Protocol/Events/IThreadHandler.cs index 91462f7b9..f8395d3b4 100644 --- a/src/Dap.Protocol/Events/IThreadHandler.cs +++ b/src/Dap.Protocol/Events/IThreadHandler.cs @@ -1,6 +1,7 @@ using System; using System.Threading; using System.Threading.Tasks; +using OmniSharp.Extensions.DebugAdapter.Protocol.Requests; using OmniSharp.Extensions.Embedded.MediatR; using OmniSharp.Extensions.JsonRpc; diff --git a/src/Dap.Protocol/Events/InitializedEvent.cs b/src/Dap.Protocol/Events/InitializedEvent.cs index 8c09839ed..8ee8f0b80 100644 --- a/src/Dap.Protocol/Events/InitializedEvent.cs +++ b/src/Dap.Protocol/Events/InitializedEvent.cs @@ -5,5 +5,4 @@ namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events public class InitializedEvent : IRequest { } - } diff --git a/src/Dap.Protocol/Events/LoadedSourceEvent.cs b/src/Dap.Protocol/Events/LoadedSourceEvent.cs index e1d7a7404..b11c3a88e 100644 --- a/src/Dap.Protocol/Events/LoadedSourceEvent.cs +++ b/src/Dap.Protocol/Events/LoadedSourceEvent.cs @@ -1,3 +1,4 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Models; using OmniSharp.Extensions.Embedded.MediatR; namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events diff --git a/src/Dap.Protocol/Events/LoadedSourceReason.cs b/src/Dap.Protocol/Events/LoadedSourceReason.cs index 4aed837c7..e0eafb3a9 100644 --- a/src/Dap.Protocol/Events/LoadedSourceReason.cs +++ b/src/Dap.Protocol/Events/LoadedSourceReason.cs @@ -8,5 +8,4 @@ public enum LoadedSourceReason { New, Changed, Removed } - } diff --git a/src/Dap.Protocol/Events/ModuleEvent.cs b/src/Dap.Protocol/Events/ModuleEvent.cs index aa42053b9..66bbe4520 100644 --- a/src/Dap.Protocol/Events/ModuleEvent.cs +++ b/src/Dap.Protocol/Events/ModuleEvent.cs @@ -1,3 +1,4 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Models; using OmniSharp.Extensions.Embedded.MediatR; namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events diff --git a/src/Dap.Protocol/Events/OutputEvent.cs b/src/Dap.Protocol/Events/OutputEvent.cs index e28864816..427879257 100644 --- a/src/Dap.Protocol/Events/OutputEvent.cs +++ b/src/Dap.Protocol/Events/OutputEvent.cs @@ -1,4 +1,5 @@ using Newtonsoft.Json.Linq; +using OmniSharp.Extensions.DebugAdapter.Protocol.Models; using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; using OmniSharp.Extensions.Embedded.MediatR; diff --git a/src/Dap.Protocol/Models/Breakpoint.cs b/src/Dap.Protocol/Models/Breakpoint.cs index 42b0738a7..45690b51c 100644 --- a/src/Dap.Protocol/Models/Breakpoint.cs +++ b/src/Dap.Protocol/Models/Breakpoint.cs @@ -1,6 +1,6 @@ using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; -namespace OmniSharp.Extensions.DebugAdapter.Protocol +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Models { /// /// Information about a Breakpoint created in setBreakpoints or setFunctionBreakpoints. diff --git a/src/Dap.Protocol/Models/Capabilities.cs b/src/Dap.Protocol/Models/Capabilities.cs index 171652de3..47ab81523 100644 --- a/src/Dap.Protocol/Models/Capabilities.cs +++ b/src/Dap.Protocol/Models/Capabilities.cs @@ -1,6 +1,6 @@ -using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; +using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; -namespace OmniSharp.Extensions.DebugAdapter.Protocol +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Models { /// /// Information about the capabilities of a debug adapter. diff --git a/src/Dap.Protocol/Models/Checksum.cs b/src/Dap.Protocol/Models/Checksum.cs index 4e80be80d..e1b2afd08 100644 --- a/src/Dap.Protocol/Models/Checksum.cs +++ b/src/Dap.Protocol/Models/Checksum.cs @@ -1,6 +1,6 @@ using Newtonsoft.Json; -namespace OmniSharp.Extensions.DebugAdapter.Protocol +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Models { /// /// The checksum of an item calculated by the specified algorithm. diff --git a/src/Dap.Protocol/Models/ChecksumAlgorithm.cs b/src/Dap.Protocol/Models/ChecksumAlgorithm.cs index da34e936b..37b7a13c4 100644 --- a/src/Dap.Protocol/Models/ChecksumAlgorithm.cs +++ b/src/Dap.Protocol/Models/ChecksumAlgorithm.cs @@ -1,7 +1,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Converters; -namespace OmniSharp.Extensions.DebugAdapter.Protocol +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Models { /// /// Names of checksum algorithms that may be supported by a debug adapter. diff --git a/src/Dap.Protocol/Models/ColumnDescriptor.cs b/src/Dap.Protocol/Models/ColumnDescriptor.cs index 150e69499..8049410a1 100644 --- a/src/Dap.Protocol/Models/ColumnDescriptor.cs +++ b/src/Dap.Protocol/Models/ColumnDescriptor.cs @@ -1,6 +1,6 @@ using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; -namespace OmniSharp.Extensions.DebugAdapter.Protocol +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Models { /// /// A ColumnDescriptor specifies what module attribute to show in a column of the ModulesView, how to format it, and what the column’s label should be. diff --git a/src/Dap.Protocol/Models/ColumnDescriptorType.cs b/src/Dap.Protocol/Models/ColumnDescriptorType.cs index 13fc080ae..1a7aa21cf 100644 --- a/src/Dap.Protocol/Models/ColumnDescriptorType.cs +++ b/src/Dap.Protocol/Models/ColumnDescriptorType.cs @@ -1,7 +1,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Converters; -namespace OmniSharp.Extensions.DebugAdapter.Protocol +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Models { [JsonConverter(typeof(StringEnumConverter))] public enum ColumnDescriptorType diff --git a/src/Dap.Protocol/Models/CompletionItem.cs b/src/Dap.Protocol/Models/CompletionItem.cs index 84dec98ca..7044a380f 100644 --- a/src/Dap.Protocol/Models/CompletionItem.cs +++ b/src/Dap.Protocol/Models/CompletionItem.cs @@ -1,6 +1,6 @@ using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; -namespace OmniSharp.Extensions.DebugAdapter.Protocol +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Models { /// /// CompletionItems are the suggestions returned from the CompletionsRequest. diff --git a/src/Dap.Protocol/Models/CompletionItemType.cs b/src/Dap.Protocol/Models/CompletionItemType.cs index af1d5985b..662295c28 100644 --- a/src/Dap.Protocol/Models/CompletionItemType.cs +++ b/src/Dap.Protocol/Models/CompletionItemType.cs @@ -1,7 +1,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Converters; -namespace OmniSharp.Extensions.DebugAdapter.Protocol +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Models { /// /// Some predefined types for the CompletionItem.Please note that not all clients have specific icons for all of them. diff --git a/src/Dap.Protocol/Models/Container.cs b/src/Dap.Protocol/Models/Container.cs index c88ecb326..a32b40865 100644 --- a/src/Dap.Protocol/Models/Container.cs +++ b/src/Dap.Protocol/Models/Container.cs @@ -2,7 +2,7 @@ using System.Collections.ObjectModel; using System.Linq; -namespace OmniSharp.Extensions.DebugAdapter.Protocol +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Models { public class Container : ContainerBase { diff --git a/src/Dap.Protocol/Models/ContainerBase.cs b/src/Dap.Protocol/Models/ContainerBase.cs index 6ec86c66c..5ce5ec75b 100644 --- a/src/Dap.Protocol/Models/ContainerBase.cs +++ b/src/Dap.Protocol/Models/ContainerBase.cs @@ -1,10 +1,8 @@ using System; using System.Collections; using System.Collections.Generic; -using Newtonsoft.Json; -using Newtonsoft.Json.Serialization; -namespace OmniSharp.Extensions.DebugAdapter.Protocol +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Models { public abstract class ContainerBase : IEnumerable, IEquatable> { diff --git a/src/Dap.Protocol/Models/DataBreakpoint.cs b/src/Dap.Protocol/Models/DataBreakpoint.cs index 9202bdcea..92a0bbf1e 100644 --- a/src/Dap.Protocol/Models/DataBreakpoint.cs +++ b/src/Dap.Protocol/Models/DataBreakpoint.cs @@ -1,6 +1,6 @@ using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; -namespace OmniSharp.Extensions.DebugAdapter.Protocol +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Models { /// /// Properties of a data breakpoint passed to the setDataBreakpoints request. diff --git a/src/Dap.Protocol/Models/DataBreakpointAccessType.cs b/src/Dap.Protocol/Models/DataBreakpointAccessType.cs index cd71da3b7..81da1dd47 100644 --- a/src/Dap.Protocol/Models/DataBreakpointAccessType.cs +++ b/src/Dap.Protocol/Models/DataBreakpointAccessType.cs @@ -1,7 +1,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Converters; -namespace OmniSharp.Extensions.DebugAdapter.Protocol +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Models { /// /// This enumeration defines all possible access types for data breakpoints. diff --git a/src/Dap.Protocol/Models/DisassembledInstruction.cs b/src/Dap.Protocol/Models/DisassembledInstruction.cs index 75869a47b..1a3d76519 100644 --- a/src/Dap.Protocol/Models/DisassembledInstruction.cs +++ b/src/Dap.Protocol/Models/DisassembledInstruction.cs @@ -1,6 +1,6 @@ using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; -namespace OmniSharp.Extensions.DebugAdapter.Protocol +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Models { /// DisassembledInstruction /// Represents a single disassembled instruction. diff --git a/src/Dap.Protocol/Models/ExceptionBreakMode.cs b/src/Dap.Protocol/Models/ExceptionBreakMode.cs index 48ff05373..6cdaf4432 100644 --- a/src/Dap.Protocol/Models/ExceptionBreakMode.cs +++ b/src/Dap.Protocol/Models/ExceptionBreakMode.cs @@ -1,7 +1,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Converters; -namespace OmniSharp.Extensions.DebugAdapter.Protocol +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Models { /// /// This enumeration defines all possible conditions when a thrown exception should result in a break. diff --git a/src/Dap.Protocol/Models/ExceptionBreakpointsFilter.cs b/src/Dap.Protocol/Models/ExceptionBreakpointsFilter.cs index 0a88fa124..38bb15cb0 100644 --- a/src/Dap.Protocol/Models/ExceptionBreakpointsFilter.cs +++ b/src/Dap.Protocol/Models/ExceptionBreakpointsFilter.cs @@ -1,6 +1,6 @@ using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; -namespace OmniSharp.Extensions.DebugAdapter.Protocol +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Models { /// ExceptionBreakpointsFilter /// An ExceptionBreakpointsFilter is shown in the UI as an option for configuring how exceptions are dealt with. diff --git a/src/Dap.Protocol/Models/ExceptionDetails.cs b/src/Dap.Protocol/Models/ExceptionDetails.cs index d755ce041..d14cefa5d 100644 --- a/src/Dap.Protocol/Models/ExceptionDetails.cs +++ b/src/Dap.Protocol/Models/ExceptionDetails.cs @@ -1,6 +1,6 @@ using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; -namespace OmniSharp.Extensions.DebugAdapter.Protocol +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Models { /// ExceptionDetails /// Detailed information about an exception that has occurred. diff --git a/src/Dap.Protocol/Models/ExceptionOptions.cs b/src/Dap.Protocol/Models/ExceptionOptions.cs index 6f2f71b4e..07487f865 100644 --- a/src/Dap.Protocol/Models/ExceptionOptions.cs +++ b/src/Dap.Protocol/Models/ExceptionOptions.cs @@ -1,6 +1,6 @@ using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; -namespace OmniSharp.Extensions.DebugAdapter.Protocol +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Models { /// ExceptionOptions /// An ExceptionOptions assigns configuration options to a set of exceptions. diff --git a/src/Dap.Protocol/Models/ExceptionPathSegment.cs b/src/Dap.Protocol/Models/ExceptionPathSegment.cs index 57e703eaa..24e326920 100644 --- a/src/Dap.Protocol/Models/ExceptionPathSegment.cs +++ b/src/Dap.Protocol/Models/ExceptionPathSegment.cs @@ -1,6 +1,6 @@ using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; -namespace OmniSharp.Extensions.DebugAdapter.Protocol +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Models { /// /// An ExceptionPathSegment represents a segment in a path that is used to match leafs or nodes in a tree of exceptions.If a segment consists of more than one name, it matches the names provided if ‘negate’ is false or missing or it matches anything except the names provided if ‘negate’ is true. diff --git a/src/Dap.Protocol/Models/FunctionBreakpoint.cs b/src/Dap.Protocol/Models/FunctionBreakpoint.cs index ed328903b..6717074b5 100644 --- a/src/Dap.Protocol/Models/FunctionBreakpoint.cs +++ b/src/Dap.Protocol/Models/FunctionBreakpoint.cs @@ -1,6 +1,6 @@ using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; -namespace OmniSharp.Extensions.DebugAdapter.Protocol +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Models { /// FunctionBreakpoint /// Properties of a breakpoint passed to the setFunctionBreakpoints request. diff --git a/src/Dap.Protocol/Models/GotoTarget.cs b/src/Dap.Protocol/Models/GotoTarget.cs index 042e37334..a03cbfd90 100644 --- a/src/Dap.Protocol/Models/GotoTarget.cs +++ b/src/Dap.Protocol/Models/GotoTarget.cs @@ -1,6 +1,6 @@ using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; -namespace OmniSharp.Extensions.DebugAdapter.Protocol +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Models { /// /// A GotoTarget describes a code location that can be used as a target in the ‘goto’ request. diff --git a/src/Dap.Protocol/Models/Message.cs b/src/Dap.Protocol/Models/Message.cs index 393be6b4b..659eec90f 100644 --- a/src/Dap.Protocol/Models/Message.cs +++ b/src/Dap.Protocol/Models/Message.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; -namespace OmniSharp.Extensions.DebugAdapter.Protocol +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Models { /// /// A structured message object. Used to return errors from requests. diff --git a/src/Dap.Protocol/Models/Module.cs b/src/Dap.Protocol/Models/Module.cs index 02a66ad9b..cc038c086 100644 --- a/src/Dap.Protocol/Models/Module.cs +++ b/src/Dap.Protocol/Models/Module.cs @@ -1,6 +1,6 @@ using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; -namespace OmniSharp.Extensions.DebugAdapter.Protocol +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Models { /// /// A Module object represents a row in the modules view. diff --git a/src/Dap.Protocol/Models/ModulesViewDescriptor.cs b/src/Dap.Protocol/Models/ModulesViewDescriptor.cs index 8bfe11fb0..a8b5e5722 100644 --- a/src/Dap.Protocol/Models/ModulesViewDescriptor.cs +++ b/src/Dap.Protocol/Models/ModulesViewDescriptor.cs @@ -1,4 +1,4 @@ -namespace OmniSharp.Extensions.DebugAdapter.Protocol +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Models { /// /// The ModulesViewDescriptor is the container for all declarative configuration options of a ModuleView. diff --git a/src/Dap.Protocol/Models/NumberString.cs b/src/Dap.Protocol/Models/NumberString.cs index 5dc2ae83f..f31423055 100644 --- a/src/Dap.Protocol/Models/NumberString.cs +++ b/src/Dap.Protocol/Models/NumberString.cs @@ -1,10 +1,4 @@ -using System.Collections.Generic; -using Newtonsoft.Json; -using Newtonsoft.Json.Converters; -using Newtonsoft.Json.Linq; -using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; - -namespace OmniSharp.Extensions.DebugAdapter.Protocol +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Models { public struct NumberString { diff --git a/src/Dap.Protocol/Models/Scope.cs b/src/Dap.Protocol/Models/Scope.cs index 548f170a3..8666a7ccc 100644 --- a/src/Dap.Protocol/Models/Scope.cs +++ b/src/Dap.Protocol/Models/Scope.cs @@ -1,6 +1,6 @@ using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; -namespace OmniSharp.Extensions.DebugAdapter.Protocol +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Models { /// /// A Scope is a named container for variables.Optionally a scope can map to a source or a range within a source. diff --git a/src/Dap.Protocol/Models/Source.cs b/src/Dap.Protocol/Models/Source.cs index 0aa2122f8..47fdf2b01 100644 --- a/src/Dap.Protocol/Models/Source.cs +++ b/src/Dap.Protocol/Models/Source.cs @@ -1,7 +1,7 @@ using Newtonsoft.Json.Linq; using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; -namespace OmniSharp.Extensions.DebugAdapter.Protocol +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Models { /// /// A Source is a descriptor for source code.It is returned from the debug adapter as part of a StackFrame and it is used by clients when specifying breakpoints. diff --git a/src/Dap.Protocol/Models/SourceBreakpoint.cs b/src/Dap.Protocol/Models/SourceBreakpoint.cs index fa569ed21..7ab91a1eb 100644 --- a/src/Dap.Protocol/Models/SourceBreakpoint.cs +++ b/src/Dap.Protocol/Models/SourceBreakpoint.cs @@ -1,6 +1,6 @@ using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; -namespace OmniSharp.Extensions.DebugAdapter.Protocol +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Models { /// SourceBreakpoint /// Properties of a breakpoint or logpoint passed to the setBreakpoints request. diff --git a/src/Dap.Protocol/Models/SourcePresentationHint.cs b/src/Dap.Protocol/Models/SourcePresentationHint.cs index 7e4da05d7..95c463ec7 100644 --- a/src/Dap.Protocol/Models/SourcePresentationHint.cs +++ b/src/Dap.Protocol/Models/SourcePresentationHint.cs @@ -1,7 +1,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Converters; -namespace OmniSharp.Extensions.DebugAdapter.Protocol +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Models { [JsonConverter(typeof(StringEnumConverter))] public enum SourcePresentationHint diff --git a/src/Dap.Protocol/Models/StackFrame.cs b/src/Dap.Protocol/Models/StackFrame.cs index 9c378a89b..93199b3f6 100644 --- a/src/Dap.Protocol/Models/StackFrame.cs +++ b/src/Dap.Protocol/Models/StackFrame.cs @@ -1,6 +1,6 @@ using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; -namespace OmniSharp.Extensions.DebugAdapter.Protocol +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Models { /// /// A Stackframe contains the source location. diff --git a/src/Dap.Protocol/Models/StackFrameFormat.cs b/src/Dap.Protocol/Models/StackFrameFormat.cs index ab73d1bec..b9ffd0058 100644 --- a/src/Dap.Protocol/Models/StackFrameFormat.cs +++ b/src/Dap.Protocol/Models/StackFrameFormat.cs @@ -1,6 +1,6 @@ using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; -namespace OmniSharp.Extensions.DebugAdapter.Protocol +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Models { /// /// Provides formatting information for a stack frame. diff --git a/src/Dap.Protocol/Models/StackFramePresentationHint.cs b/src/Dap.Protocol/Models/StackFramePresentationHint.cs index 7e10245da..e9cac0f3c 100644 --- a/src/Dap.Protocol/Models/StackFramePresentationHint.cs +++ b/src/Dap.Protocol/Models/StackFramePresentationHint.cs @@ -1,7 +1,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Converters; -namespace OmniSharp.Extensions.DebugAdapter.Protocol +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Models { [JsonConverter(typeof(StringEnumConverter))] public enum StackFramePresentationHint diff --git a/src/Dap.Protocol/Models/StepInTarget.cs b/src/Dap.Protocol/Models/StepInTarget.cs index 2417c2ffa..5dce0e983 100644 --- a/src/Dap.Protocol/Models/StepInTarget.cs +++ b/src/Dap.Protocol/Models/StepInTarget.cs @@ -1,4 +1,4 @@ -namespace OmniSharp.Extensions.DebugAdapter.Protocol +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Models { /// /// A StepInTarget can be used in the ‘stepIn’ request and determines into which single target the stepIn request should step. diff --git a/src/Dap.Protocol/Models/Thread.cs b/src/Dap.Protocol/Models/Thread.cs index f1653cfda..35be9951c 100644 --- a/src/Dap.Protocol/Models/Thread.cs +++ b/src/Dap.Protocol/Models/Thread.cs @@ -1,4 +1,4 @@ -namespace OmniSharp.Extensions.DebugAdapter.Protocol +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Models { /// /// A Thread diff --git a/src/Dap.Protocol/Models/ValueFormat.cs b/src/Dap.Protocol/Models/ValueFormat.cs index 44e33dd0a..8442f6465 100644 --- a/src/Dap.Protocol/Models/ValueFormat.cs +++ b/src/Dap.Protocol/Models/ValueFormat.cs @@ -1,6 +1,6 @@ using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; -namespace OmniSharp.Extensions.DebugAdapter.Protocol +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Models { /// /// Provides formatting information for a value. diff --git a/src/Dap.Protocol/Models/Variable.cs b/src/Dap.Protocol/Models/Variable.cs index 429581e57..af2244f4e 100644 --- a/src/Dap.Protocol/Models/Variable.cs +++ b/src/Dap.Protocol/Models/Variable.cs @@ -1,6 +1,6 @@ using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; -namespace OmniSharp.Extensions.DebugAdapter.Protocol +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Models { /// /// A Variable is a name/value pair. diff --git a/src/Dap.Protocol/Models/VariablePresentationHint.cs b/src/Dap.Protocol/Models/VariablePresentationHint.cs index 2ba2b7c1e..e79aaf00a 100644 --- a/src/Dap.Protocol/Models/VariablePresentationHint.cs +++ b/src/Dap.Protocol/Models/VariablePresentationHint.cs @@ -1,6 +1,6 @@ using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; -namespace OmniSharp.Extensions.DebugAdapter.Protocol +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Models { /// VariablePresentationHint /// Optional properties of a variable that can be used to determine how to render the variable in the UI. diff --git a/src/Dap.Protocol/Requests/AttachRequestArguments.cs b/src/Dap.Protocol/Requests/AttachRequestArguments.cs index b937abdf6..76667dfe1 100644 --- a/src/Dap.Protocol/Requests/AttachRequestArguments.cs +++ b/src/Dap.Protocol/Requests/AttachRequestArguments.cs @@ -2,7 +2,7 @@ using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; using OmniSharp.Extensions.Embedded.MediatR; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class AttachRequestArguments : IRequest { diff --git a/src/Dap.Protocol/Requests/AttachResponse.cs b/src/Dap.Protocol/Requests/AttachResponse.cs index 88b3e3cb9..d4fd074e5 100644 --- a/src/Dap.Protocol/Requests/AttachResponse.cs +++ b/src/Dap.Protocol/Requests/AttachResponse.cs @@ -1,4 +1,4 @@ -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class AttachResponse { diff --git a/src/Dap.Protocol/Requests/CompletionsArguments.cs b/src/Dap.Protocol/Requests/CompletionsArguments.cs index c432e7704..7371cace0 100644 --- a/src/Dap.Protocol/Requests/CompletionsArguments.cs +++ b/src/Dap.Protocol/Requests/CompletionsArguments.cs @@ -1,7 +1,7 @@ using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; using OmniSharp.Extensions.Embedded.MediatR; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class CompletionsArguments : IRequest { diff --git a/src/Dap.Protocol/Requests/CompletionsResponse.cs b/src/Dap.Protocol/Requests/CompletionsResponse.cs index b6c13a382..a79ecf5ea 100644 --- a/src/Dap.Protocol/Requests/CompletionsResponse.cs +++ b/src/Dap.Protocol/Requests/CompletionsResponse.cs @@ -1,4 +1,6 @@ -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +using OmniSharp.Extensions.DebugAdapter.Protocol.Models; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class CompletionsResponse { diff --git a/src/Dap.Protocol/Requests/ConfigurationDoneArguments.cs b/src/Dap.Protocol/Requests/ConfigurationDoneArguments.cs index b2f85548c..b8d09a91e 100644 --- a/src/Dap.Protocol/Requests/ConfigurationDoneArguments.cs +++ b/src/Dap.Protocol/Requests/ConfigurationDoneArguments.cs @@ -1,6 +1,6 @@ using OmniSharp.Extensions.Embedded.MediatR; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class ConfigurationDoneArguments : IRequest { diff --git a/src/Dap.Protocol/Requests/ConfigurationDoneResponse.cs b/src/Dap.Protocol/Requests/ConfigurationDoneResponse.cs index 1aa75d3f3..9314455a4 100644 --- a/src/Dap.Protocol/Requests/ConfigurationDoneResponse.cs +++ b/src/Dap.Protocol/Requests/ConfigurationDoneResponse.cs @@ -1,4 +1,4 @@ -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class ConfigurationDoneResponse { diff --git a/src/Dap.Protocol/Requests/ContinueArguments.cs b/src/Dap.Protocol/Requests/ContinueArguments.cs index ca08bf271..598f624d2 100644 --- a/src/Dap.Protocol/Requests/ContinueArguments.cs +++ b/src/Dap.Protocol/Requests/ContinueArguments.cs @@ -1,6 +1,6 @@ using OmniSharp.Extensions.Embedded.MediatR; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class ContinueArguments : IRequest { diff --git a/src/Dap.Protocol/Requests/ContinueResponse.cs b/src/Dap.Protocol/Requests/ContinueResponse.cs index 6a614f9c9..0dcf54e06 100644 --- a/src/Dap.Protocol/Requests/ContinueResponse.cs +++ b/src/Dap.Protocol/Requests/ContinueResponse.cs @@ -1,6 +1,6 @@ using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class ContinueResponse { diff --git a/src/Dap.Protocol/Requests/DataBreakpointInfoArguments.cs b/src/Dap.Protocol/Requests/DataBreakpointInfoArguments.cs index 7a57d8d59..1e7f8c88f 100644 --- a/src/Dap.Protocol/Requests/DataBreakpointInfoArguments.cs +++ b/src/Dap.Protocol/Requests/DataBreakpointInfoArguments.cs @@ -1,7 +1,7 @@ using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; using OmniSharp.Extensions.Embedded.MediatR; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class DataBreakpointInfoArguments : IRequest { diff --git a/src/Dap.Protocol/Requests/DataBreakpointInfoResponse.cs b/src/Dap.Protocol/Requests/DataBreakpointInfoResponse.cs index d8591ca5f..16be64d43 100644 --- a/src/Dap.Protocol/Requests/DataBreakpointInfoResponse.cs +++ b/src/Dap.Protocol/Requests/DataBreakpointInfoResponse.cs @@ -1,6 +1,7 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Models; using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class DataBreakpointInfoResponse { diff --git a/src/Dap.Protocol/Requests/DisassembleArguments.cs b/src/Dap.Protocol/Requests/DisassembleArguments.cs index becb11364..0397936f6 100644 --- a/src/Dap.Protocol/Requests/DisassembleArguments.cs +++ b/src/Dap.Protocol/Requests/DisassembleArguments.cs @@ -1,7 +1,7 @@ using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; using OmniSharp.Extensions.Embedded.MediatR; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class DisassembleArguments : IRequest { diff --git a/src/Dap.Protocol/Requests/DisassembleResponse.cs b/src/Dap.Protocol/Requests/DisassembleResponse.cs index 93b887b1d..f67a38715 100644 --- a/src/Dap.Protocol/Requests/DisassembleResponse.cs +++ b/src/Dap.Protocol/Requests/DisassembleResponse.cs @@ -1,4 +1,6 @@ -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +using OmniSharp.Extensions.DebugAdapter.Protocol.Models; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class DisassembleResponse { diff --git a/src/Dap.Protocol/Requests/DisconnectArguments.cs b/src/Dap.Protocol/Requests/DisconnectArguments.cs index 7bc8ae32b..da699ae8c 100644 --- a/src/Dap.Protocol/Requests/DisconnectArguments.cs +++ b/src/Dap.Protocol/Requests/DisconnectArguments.cs @@ -1,7 +1,7 @@ using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; using OmniSharp.Extensions.Embedded.MediatR; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class DisconnectArguments : IRequest { diff --git a/src/Dap.Protocol/Requests/DisconnectResponse.cs b/src/Dap.Protocol/Requests/DisconnectResponse.cs index f8dc95223..d028981aa 100644 --- a/src/Dap.Protocol/Requests/DisconnectResponse.cs +++ b/src/Dap.Protocol/Requests/DisconnectResponse.cs @@ -1,4 +1,4 @@ -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class DisconnectResponse { diff --git a/src/Dap.Protocol/Requests/EvaluateArguments.cs b/src/Dap.Protocol/Requests/EvaluateArguments.cs index 843c42f7f..252385313 100644 --- a/src/Dap.Protocol/Requests/EvaluateArguments.cs +++ b/src/Dap.Protocol/Requests/EvaluateArguments.cs @@ -1,7 +1,8 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Models; using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; using OmniSharp.Extensions.Embedded.MediatR; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class EvaluateArguments : IRequest { diff --git a/src/Dap.Protocol/Requests/EvaluateResponse.cs b/src/Dap.Protocol/Requests/EvaluateResponse.cs index 46c1e900e..cfc22c718 100644 --- a/src/Dap.Protocol/Requests/EvaluateResponse.cs +++ b/src/Dap.Protocol/Requests/EvaluateResponse.cs @@ -1,6 +1,7 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Models; using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class EvaluateResponse { diff --git a/src/Dap.Protocol/Requests/ExceptionInfoArguments.cs b/src/Dap.Protocol/Requests/ExceptionInfoArguments.cs index e88c301e0..195a4bb65 100644 --- a/src/Dap.Protocol/Requests/ExceptionInfoArguments.cs +++ b/src/Dap.Protocol/Requests/ExceptionInfoArguments.cs @@ -1,6 +1,6 @@ using OmniSharp.Extensions.Embedded.MediatR; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class ExceptionInfoArguments : IRequest { diff --git a/src/Dap.Protocol/Requests/ExceptionInfoResponse.cs b/src/Dap.Protocol/Requests/ExceptionInfoResponse.cs index a76a24339..fd4e986b7 100644 --- a/src/Dap.Protocol/Requests/ExceptionInfoResponse.cs +++ b/src/Dap.Protocol/Requests/ExceptionInfoResponse.cs @@ -1,6 +1,7 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Models; using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class ExceptionInfoResponse { diff --git a/src/Dap.Protocol/Requests/GotoArguments.cs b/src/Dap.Protocol/Requests/GotoArguments.cs index 482250e94..7791ced0a 100644 --- a/src/Dap.Protocol/Requests/GotoArguments.cs +++ b/src/Dap.Protocol/Requests/GotoArguments.cs @@ -1,6 +1,6 @@ using OmniSharp.Extensions.Embedded.MediatR; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class GotoArguments : IRequest { diff --git a/src/Dap.Protocol/Requests/GotoResponse.cs b/src/Dap.Protocol/Requests/GotoResponse.cs index c9a80f833..606c214f1 100644 --- a/src/Dap.Protocol/Requests/GotoResponse.cs +++ b/src/Dap.Protocol/Requests/GotoResponse.cs @@ -1,4 +1,4 @@ -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class GotoResponse { diff --git a/src/Dap.Protocol/Requests/GotoTargetsArguments.cs b/src/Dap.Protocol/Requests/GotoTargetsArguments.cs index 124e30400..78881b059 100644 --- a/src/Dap.Protocol/Requests/GotoTargetsArguments.cs +++ b/src/Dap.Protocol/Requests/GotoTargetsArguments.cs @@ -1,7 +1,8 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Models; using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; using OmniSharp.Extensions.Embedded.MediatR; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class GotoTargetsArguments : IRequest { diff --git a/src/Dap.Protocol/Requests/GotoTargetsResponse.cs b/src/Dap.Protocol/Requests/GotoTargetsResponse.cs index 73fd95100..eece7e037 100644 --- a/src/Dap.Protocol/Requests/GotoTargetsResponse.cs +++ b/src/Dap.Protocol/Requests/GotoTargetsResponse.cs @@ -1,7 +1,6 @@ -using System.Text; -using System.Threading; +using OmniSharp.Extensions.DebugAdapter.Protocol.Models; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class GotoTargetsResponse { diff --git a/src/Dap.Protocol/Requests/IAttachHandler.cs b/src/Dap.Protocol/Requests/IAttachHandler.cs index 919b9af48..7549d1238 100644 --- a/src/Dap.Protocol/Requests/IAttachHandler.cs +++ b/src/Dap.Protocol/Requests/IAttachHandler.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using OmniSharp.Extensions.JsonRpc; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { [Parallel, Method(RequestNames.Attach)] public interface IAttachHandler : IJsonRpcRequestHandler { } diff --git a/src/Dap.Protocol/Requests/ICompletionsHandler.cs b/src/Dap.Protocol/Requests/ICompletionsHandler.cs index 5f8bb1a22..791ccb1f2 100644 --- a/src/Dap.Protocol/Requests/ICompletionsHandler.cs +++ b/src/Dap.Protocol/Requests/ICompletionsHandler.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using OmniSharp.Extensions.JsonRpc; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { [Parallel, Method(RequestNames.Completions)] public interface ICompletionsHandler : IJsonRpcRequestHandler { } diff --git a/src/Dap.Protocol/Requests/IConfigurationDoneHandler.cs b/src/Dap.Protocol/Requests/IConfigurationDoneHandler.cs index 6533bb6e0..f8fa6bc64 100644 --- a/src/Dap.Protocol/Requests/IConfigurationDoneHandler.cs +++ b/src/Dap.Protocol/Requests/IConfigurationDoneHandler.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using OmniSharp.Extensions.JsonRpc; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { [Parallel, Method(RequestNames.ConfigurationDone)] public interface IConfigurationDoneHandler : IJsonRpcRequestHandler { } diff --git a/src/Dap.Protocol/Requests/IContinueHandler.cs b/src/Dap.Protocol/Requests/IContinueHandler.cs index 47b612b03..f099dfe41 100644 --- a/src/Dap.Protocol/Requests/IContinueHandler.cs +++ b/src/Dap.Protocol/Requests/IContinueHandler.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using OmniSharp.Extensions.JsonRpc; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { [Parallel, Method(RequestNames.Continue)] public interface IContinueHandler : IJsonRpcRequestHandler { } diff --git a/src/Dap.Protocol/Requests/IDataBreakpointInfoHandler.cs b/src/Dap.Protocol/Requests/IDataBreakpointInfoHandler.cs index 06152c5f8..db2df6757 100644 --- a/src/Dap.Protocol/Requests/IDataBreakpointInfoHandler.cs +++ b/src/Dap.Protocol/Requests/IDataBreakpointInfoHandler.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using OmniSharp.Extensions.JsonRpc; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { [Parallel, Method(RequestNames.DataBreakpointInfo)] public interface IDataBreakpointInfoHandler : IJsonRpcRequestHandler { } diff --git a/src/Dap.Protocol/Requests/IDebugAdapterClient.cs b/src/Dap.Protocol/Requests/IDebugAdapterClient.cs index 6bbc36bae..3c3f03c02 100644 --- a/src/Dap.Protocol/Requests/IDebugAdapterClient.cs +++ b/src/Dap.Protocol/Requests/IDebugAdapterClient.cs @@ -1,6 +1,6 @@ using OmniSharp.Extensions.JsonRpc; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public interface IDebugAdapterClient : IResponseRouter { } diff --git a/src/Dap.Protocol/Requests/IDebugAdapterRegistry.cs b/src/Dap.Protocol/Requests/IDebugAdapterRegistry.cs index df93ace3c..482163273 100644 --- a/src/Dap.Protocol/Requests/IDebugAdapterRegistry.cs +++ b/src/Dap.Protocol/Requests/IDebugAdapterRegistry.cs @@ -1,6 +1,6 @@ using OmniSharp.Extensions.JsonRpc; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public interface IDebugAdapterRegistry : IJsonRpcHandlerRegistry { } diff --git a/src/Dap.Protocol/Requests/IDisassembleHandler.cs b/src/Dap.Protocol/Requests/IDisassembleHandler.cs index c25e99f37..d13060553 100644 --- a/src/Dap.Protocol/Requests/IDisassembleHandler.cs +++ b/src/Dap.Protocol/Requests/IDisassembleHandler.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using OmniSharp.Extensions.JsonRpc; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { [Parallel, Method(RequestNames.Disassemble)] public interface IDisassembleHandler : IJsonRpcRequestHandler { } diff --git a/src/Dap.Protocol/Requests/IDisconnectHandler.cs b/src/Dap.Protocol/Requests/IDisconnectHandler.cs index 67d9cbec2..445d41074 100644 --- a/src/Dap.Protocol/Requests/IDisconnectHandler.cs +++ b/src/Dap.Protocol/Requests/IDisconnectHandler.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using OmniSharp.Extensions.JsonRpc; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { [Parallel, Method(RequestNames.Disconnect)] public interface IDisconnectHandler : IJsonRpcRequestHandler { } diff --git a/src/Dap.Protocol/Requests/IEvaluateHandler.cs b/src/Dap.Protocol/Requests/IEvaluateHandler.cs index fbd3ba0da..3733d5086 100644 --- a/src/Dap.Protocol/Requests/IEvaluateHandler.cs +++ b/src/Dap.Protocol/Requests/IEvaluateHandler.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using OmniSharp.Extensions.JsonRpc; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { [Parallel, Method(RequestNames.Evaluate)] public interface IEvaluateHandler : IJsonRpcRequestHandler { } diff --git a/src/Dap.Protocol/Requests/IExceptionInfoHandler.cs b/src/Dap.Protocol/Requests/IExceptionInfoHandler.cs index db4b7dbdc..4132551f6 100644 --- a/src/Dap.Protocol/Requests/IExceptionInfoHandler.cs +++ b/src/Dap.Protocol/Requests/IExceptionInfoHandler.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using OmniSharp.Extensions.JsonRpc; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { [Parallel, Method(RequestNames.ExceptionInfo)] public interface IExceptionInfoHandler : IJsonRpcRequestHandler { } diff --git a/src/Dap.Protocol/Requests/IGotoHandler.cs b/src/Dap.Protocol/Requests/IGotoHandler.cs index 74f6ddad5..ce7497bd7 100644 --- a/src/Dap.Protocol/Requests/IGotoHandler.cs +++ b/src/Dap.Protocol/Requests/IGotoHandler.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using OmniSharp.Extensions.JsonRpc; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { [Parallel, Method(RequestNames.Goto)] public interface IGotoHandler : IJsonRpcRequestHandler { } diff --git a/src/Dap.Protocol/Requests/IGotoTargetsHandler.cs b/src/Dap.Protocol/Requests/IGotoTargetsHandler.cs index 22c141cff..f8feece54 100644 --- a/src/Dap.Protocol/Requests/IGotoTargetsHandler.cs +++ b/src/Dap.Protocol/Requests/IGotoTargetsHandler.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using OmniSharp.Extensions.JsonRpc; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { [Parallel, Method(RequestNames.GotoTargets)] public interface IGotoTargetsHandler : IJsonRpcRequestHandler { } diff --git a/src/Dap.Protocol/Requests/IInitializeHandler.cs b/src/Dap.Protocol/Requests/IInitializeHandler.cs index d0de287e6..6f22d4565 100644 --- a/src/Dap.Protocol/Requests/IInitializeHandler.cs +++ b/src/Dap.Protocol/Requests/IInitializeHandler.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using OmniSharp.Extensions.JsonRpc; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { [Parallel, Method(RequestNames.Initialize)] public interface IInitializeHandler : IJsonRpcRequestHandler { } diff --git a/src/Dap.Protocol/Requests/ILaunchHandler.cs b/src/Dap.Protocol/Requests/ILaunchHandler.cs index b308d96ae..eded98d5d 100644 --- a/src/Dap.Protocol/Requests/ILaunchHandler.cs +++ b/src/Dap.Protocol/Requests/ILaunchHandler.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using OmniSharp.Extensions.JsonRpc; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { [Parallel, Method(RequestNames.Launch)] public interface ILaunchHandler : IJsonRpcRequestHandler { } diff --git a/src/Dap.Protocol/Requests/ILoadedSourcesHandler.cs b/src/Dap.Protocol/Requests/ILoadedSourcesHandler.cs index 982b48f31..55b9dc772 100644 --- a/src/Dap.Protocol/Requests/ILoadedSourcesHandler.cs +++ b/src/Dap.Protocol/Requests/ILoadedSourcesHandler.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using OmniSharp.Extensions.JsonRpc; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { [Parallel, Method(RequestNames.LoadedSources)] public interface ILoadedSourcesHandler : IJsonRpcRequestHandler { } diff --git a/src/Dap.Protocol/Requests/IModulesHandler.cs b/src/Dap.Protocol/Requests/IModulesHandler.cs index e4fd04c4a..1e4a52cc0 100644 --- a/src/Dap.Protocol/Requests/IModulesHandler.cs +++ b/src/Dap.Protocol/Requests/IModulesHandler.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using OmniSharp.Extensions.JsonRpc; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { [Parallel, Method(RequestNames.Modules)] public interface IModulesHandler : IJsonRpcRequestHandler { } diff --git a/src/Dap.Protocol/Requests/INextHandler.cs b/src/Dap.Protocol/Requests/INextHandler.cs index 947f5f035..a701c5900 100644 --- a/src/Dap.Protocol/Requests/INextHandler.cs +++ b/src/Dap.Protocol/Requests/INextHandler.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using OmniSharp.Extensions.JsonRpc; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { [Parallel, Method(RequestNames.Next)] public interface INextHandler : IJsonRpcRequestHandler { } diff --git a/src/Dap.Protocol/Requests/IPauseHandler.cs b/src/Dap.Protocol/Requests/IPauseHandler.cs index e3518a308..50230817c 100644 --- a/src/Dap.Protocol/Requests/IPauseHandler.cs +++ b/src/Dap.Protocol/Requests/IPauseHandler.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using OmniSharp.Extensions.JsonRpc; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { [Parallel, Method(RequestNames.Pause)] public interface IPauseHandler : IJsonRpcRequestHandler { } diff --git a/src/Dap.Protocol/Requests/IReadMemoryHandler.cs b/src/Dap.Protocol/Requests/IReadMemoryHandler.cs index 994bd352a..30c7457ac 100644 --- a/src/Dap.Protocol/Requests/IReadMemoryHandler.cs +++ b/src/Dap.Protocol/Requests/IReadMemoryHandler.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using OmniSharp.Extensions.JsonRpc; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { [Parallel, Method(RequestNames.ReadMemory)] public interface IReadMemoryHandler : IJsonRpcRequestHandler { } diff --git a/src/Dap.Protocol/Requests/IRestartFrameHandler.cs b/src/Dap.Protocol/Requests/IRestartFrameHandler.cs index de21ec3a6..4bc1b2c2e 100644 --- a/src/Dap.Protocol/Requests/IRestartFrameHandler.cs +++ b/src/Dap.Protocol/Requests/IRestartFrameHandler.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using OmniSharp.Extensions.JsonRpc; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { [Parallel, Method(RequestNames.RestartFrame)] public interface IRestartFrameHandler : IJsonRpcRequestHandler { } diff --git a/src/Dap.Protocol/Requests/IRestartHandler.cs b/src/Dap.Protocol/Requests/IRestartHandler.cs index 4ed59b1c1..5c9ee4542 100644 --- a/src/Dap.Protocol/Requests/IRestartHandler.cs +++ b/src/Dap.Protocol/Requests/IRestartHandler.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using OmniSharp.Extensions.JsonRpc; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { [Parallel, Method(RequestNames.Restart)] public interface IRestartHandler : IJsonRpcRequestHandler { } diff --git a/src/Dap.Protocol/Requests/IReverseContinueHandler.cs b/src/Dap.Protocol/Requests/IReverseContinueHandler.cs index e64d2ca25..0465b311a 100644 --- a/src/Dap.Protocol/Requests/IReverseContinueHandler.cs +++ b/src/Dap.Protocol/Requests/IReverseContinueHandler.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using OmniSharp.Extensions.JsonRpc; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { [Parallel, Method(RequestNames.ReverseContinue)] public interface IReverseContinueHandler : IJsonRpcRequestHandler { } diff --git a/src/Dap.Protocol/Requests/IScopesHandler.cs b/src/Dap.Protocol/Requests/IScopesHandler.cs index 26c8153c2..1bea77375 100644 --- a/src/Dap.Protocol/Requests/IScopesHandler.cs +++ b/src/Dap.Protocol/Requests/IScopesHandler.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using OmniSharp.Extensions.JsonRpc; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { [Parallel, Method(RequestNames.Scopes)] public interface IScopesHandler : IJsonRpcRequestHandler { } diff --git a/src/Dap.Protocol/Requests/ISetBreakpointsHandler.cs b/src/Dap.Protocol/Requests/ISetBreakpointsHandler.cs index abed4b7d0..eb1f5a664 100644 --- a/src/Dap.Protocol/Requests/ISetBreakpointsHandler.cs +++ b/src/Dap.Protocol/Requests/ISetBreakpointsHandler.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using OmniSharp.Extensions.JsonRpc; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { [Parallel, Method(RequestNames.SetBreakpoints)] public interface ISetBreakpointsHandler : IJsonRpcRequestHandler { } diff --git a/src/Dap.Protocol/Requests/ISetDataBreakpointsHandler.cs b/src/Dap.Protocol/Requests/ISetDataBreakpointsHandler.cs index d2431ae38..5d656ff10 100644 --- a/src/Dap.Protocol/Requests/ISetDataBreakpointsHandler.cs +++ b/src/Dap.Protocol/Requests/ISetDataBreakpointsHandler.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using OmniSharp.Extensions.JsonRpc; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { [Parallel, Method(RequestNames.SetDataBreakpoints)] public interface ISetDataBreakpointsHandler : IJsonRpcRequestHandler { } diff --git a/src/Dap.Protocol/Requests/ISetExceptionBreakpointsHandler.cs b/src/Dap.Protocol/Requests/ISetExceptionBreakpointsHandler.cs index ef1296b6d..1b82b15b1 100644 --- a/src/Dap.Protocol/Requests/ISetExceptionBreakpointsHandler.cs +++ b/src/Dap.Protocol/Requests/ISetExceptionBreakpointsHandler.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using OmniSharp.Extensions.JsonRpc; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { [Parallel, Method(RequestNames.SetExceptionBreakpoints)] public interface ISetExceptionBreakpointsHandler : IJsonRpcRequestHandler { } diff --git a/src/Dap.Protocol/Requests/ISetExpressionHandler.cs b/src/Dap.Protocol/Requests/ISetExpressionHandler.cs index f2bf2d1ce..1bcf2fa22 100644 --- a/src/Dap.Protocol/Requests/ISetExpressionHandler.cs +++ b/src/Dap.Protocol/Requests/ISetExpressionHandler.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using OmniSharp.Extensions.JsonRpc; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { [Parallel, Method(RequestNames.SetExpression)] public interface ISetExpressionHandler : IJsonRpcRequestHandler { } diff --git a/src/Dap.Protocol/Requests/ISetFunctionBreakpointsHandler.cs b/src/Dap.Protocol/Requests/ISetFunctionBreakpointsHandler.cs index dcc391dfd..9a45d675f 100644 --- a/src/Dap.Protocol/Requests/ISetFunctionBreakpointsHandler.cs +++ b/src/Dap.Protocol/Requests/ISetFunctionBreakpointsHandler.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using OmniSharp.Extensions.JsonRpc; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { [Parallel, Method(RequestNames.SetFunctionBreakpoints)] public interface ISetFunctionBreakpointsHandler : IJsonRpcRequestHandler { } diff --git a/src/Dap.Protocol/Requests/ISetVariableHandler.cs b/src/Dap.Protocol/Requests/ISetVariableHandler.cs index c647db7a1..1524d32ad 100644 --- a/src/Dap.Protocol/Requests/ISetVariableHandler.cs +++ b/src/Dap.Protocol/Requests/ISetVariableHandler.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using OmniSharp.Extensions.JsonRpc; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { [Parallel, Method(RequestNames.SetVariable)] public interface ISetVariableHandler : IJsonRpcRequestHandler { } diff --git a/src/Dap.Protocol/Requests/ISourceHandler.cs b/src/Dap.Protocol/Requests/ISourceHandler.cs index 54c97d59b..2afc6913a 100644 --- a/src/Dap.Protocol/Requests/ISourceHandler.cs +++ b/src/Dap.Protocol/Requests/ISourceHandler.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using OmniSharp.Extensions.JsonRpc; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { [Parallel, Method(RequestNames.Source)] public interface ISourceHandler : IJsonRpcRequestHandler { } diff --git a/src/Dap.Protocol/Requests/IStackTraceHandler.cs b/src/Dap.Protocol/Requests/IStackTraceHandler.cs index 75318ebb8..f3fbbc2ad 100644 --- a/src/Dap.Protocol/Requests/IStackTraceHandler.cs +++ b/src/Dap.Protocol/Requests/IStackTraceHandler.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using OmniSharp.Extensions.JsonRpc; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { [Parallel, Method(RequestNames.StackTrace)] public interface IStackTraceHandler : IJsonRpcRequestHandler { } diff --git a/src/Dap.Protocol/Requests/IStepBackHandler.cs b/src/Dap.Protocol/Requests/IStepBackHandler.cs index ab4e71a30..c1cab961b 100644 --- a/src/Dap.Protocol/Requests/IStepBackHandler.cs +++ b/src/Dap.Protocol/Requests/IStepBackHandler.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using OmniSharp.Extensions.JsonRpc; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { [Parallel, Method(RequestNames.StepBack)] public interface IStepBackHandler : IJsonRpcRequestHandler { } diff --git a/src/Dap.Protocol/Requests/IStepInHandler.cs b/src/Dap.Protocol/Requests/IStepInHandler.cs index 939b70a24..c1741c5f8 100644 --- a/src/Dap.Protocol/Requests/IStepInHandler.cs +++ b/src/Dap.Protocol/Requests/IStepInHandler.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using OmniSharp.Extensions.JsonRpc; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { [Parallel, Method(RequestNames.StepIn)] public interface IStepInHandler : IJsonRpcRequestHandler { } diff --git a/src/Dap.Protocol/Requests/IStepInTargetsHandler.cs b/src/Dap.Protocol/Requests/IStepInTargetsHandler.cs index 8932bbb9d..b216f60b5 100644 --- a/src/Dap.Protocol/Requests/IStepInTargetsHandler.cs +++ b/src/Dap.Protocol/Requests/IStepInTargetsHandler.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using OmniSharp.Extensions.JsonRpc; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { [Parallel, Method(RequestNames.StepInTargets)] public interface IStepInTargetsHandler : IJsonRpcRequestHandler { } diff --git a/src/Dap.Protocol/Requests/IStepOutHandler.cs b/src/Dap.Protocol/Requests/IStepOutHandler.cs index 86d47f89e..221f20f31 100644 --- a/src/Dap.Protocol/Requests/IStepOutHandler.cs +++ b/src/Dap.Protocol/Requests/IStepOutHandler.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using OmniSharp.Extensions.JsonRpc; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { [Parallel, Method(RequestNames.StepOut)] public interface IStepOutHandler : IJsonRpcRequestHandler { } diff --git a/src/Dap.Protocol/Requests/ITerminateHandler.cs b/src/Dap.Protocol/Requests/ITerminateHandler.cs index d927c5a61..24e9afb52 100644 --- a/src/Dap.Protocol/Requests/ITerminateHandler.cs +++ b/src/Dap.Protocol/Requests/ITerminateHandler.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using OmniSharp.Extensions.JsonRpc; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { [Parallel, Method(RequestNames.Terminate)] public interface ITerminateHandler : IJsonRpcRequestHandler { } diff --git a/src/Dap.Protocol/Requests/ITerminateThreadsHandler.cs b/src/Dap.Protocol/Requests/ITerminateThreadsHandler.cs index 40a93069b..1f8aeae20 100644 --- a/src/Dap.Protocol/Requests/ITerminateThreadsHandler.cs +++ b/src/Dap.Protocol/Requests/ITerminateThreadsHandler.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using OmniSharp.Extensions.JsonRpc; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { [Parallel, Method(RequestNames.TerminateThreads)] public interface ITerminateThreadsHandler : IJsonRpcRequestHandler { } diff --git a/src/Dap.Protocol/Requests/IThreadsHandler.cs b/src/Dap.Protocol/Requests/IThreadsHandler.cs index 53bcf57bd..96a83fabf 100644 --- a/src/Dap.Protocol/Requests/IThreadsHandler.cs +++ b/src/Dap.Protocol/Requests/IThreadsHandler.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using OmniSharp.Extensions.JsonRpc; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { [Parallel, Method(RequestNames.Threads)] public interface IThreadsHandler : IJsonRpcRequestHandler { } diff --git a/src/Dap.Protocol/Requests/IVariablesHandler.cs b/src/Dap.Protocol/Requests/IVariablesHandler.cs index 520da6a43..7bc43d358 100644 --- a/src/Dap.Protocol/Requests/IVariablesHandler.cs +++ b/src/Dap.Protocol/Requests/IVariablesHandler.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using OmniSharp.Extensions.JsonRpc; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { [Parallel, Method(RequestNames.Variables)] public interface IVariablesHandler : IJsonRpcRequestHandler { } diff --git a/src/Dap.Protocol/Requests/InitializeRequestArguments.cs b/src/Dap.Protocol/Requests/InitializeRequestArguments.cs index 1be53ce1f..865791233 100644 --- a/src/Dap.Protocol/Requests/InitializeRequestArguments.cs +++ b/src/Dap.Protocol/Requests/InitializeRequestArguments.cs @@ -1,7 +1,7 @@ using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; using OmniSharp.Extensions.Embedded.MediatR; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class InitializeRequestArguments : IRequest { diff --git a/src/Dap.Protocol/Requests/InitializeResponse.cs b/src/Dap.Protocol/Requests/InitializeResponse.cs index ebeb7fe87..cdb26c4bc 100644 --- a/src/Dap.Protocol/Requests/InitializeResponse.cs +++ b/src/Dap.Protocol/Requests/InitializeResponse.cs @@ -1,6 +1,7 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Models; using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class InitializeResponse { diff --git a/src/Dap.Protocol/Requests/LaunchRequestArguments.cs b/src/Dap.Protocol/Requests/LaunchRequestArguments.cs index f555426e0..b724a9330 100644 --- a/src/Dap.Protocol/Requests/LaunchRequestArguments.cs +++ b/src/Dap.Protocol/Requests/LaunchRequestArguments.cs @@ -2,7 +2,7 @@ using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; using OmniSharp.Extensions.Embedded.MediatR; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class LaunchRequestArguments : IRequest { diff --git a/src/Dap.Protocol/Requests/LaunchResponse.cs b/src/Dap.Protocol/Requests/LaunchResponse.cs index 01bd86be6..134489d56 100644 --- a/src/Dap.Protocol/Requests/LaunchResponse.cs +++ b/src/Dap.Protocol/Requests/LaunchResponse.cs @@ -1,4 +1,4 @@ -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class LaunchResponse { diff --git a/src/Dap.Protocol/Requests/LoadedSourcesArguments.cs b/src/Dap.Protocol/Requests/LoadedSourcesArguments.cs index e20eddc3f..3a98a1ac9 100644 --- a/src/Dap.Protocol/Requests/LoadedSourcesArguments.cs +++ b/src/Dap.Protocol/Requests/LoadedSourcesArguments.cs @@ -1,6 +1,6 @@ using OmniSharp.Extensions.Embedded.MediatR; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class LoadedSourcesArguments : IRequest { diff --git a/src/Dap.Protocol/Requests/LoadedSourcesResponse.cs b/src/Dap.Protocol/Requests/LoadedSourcesResponse.cs index 556bc1624..1160715c5 100644 --- a/src/Dap.Protocol/Requests/LoadedSourcesResponse.cs +++ b/src/Dap.Protocol/Requests/LoadedSourcesResponse.cs @@ -1,4 +1,6 @@ -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +using OmniSharp.Extensions.DebugAdapter.Protocol.Models; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class LoadedSourcesResponse { diff --git a/src/Dap.Protocol/Requests/ModulesArguments.cs b/src/Dap.Protocol/Requests/ModulesArguments.cs index 6cf352340..6c58006b1 100644 --- a/src/Dap.Protocol/Requests/ModulesArguments.cs +++ b/src/Dap.Protocol/Requests/ModulesArguments.cs @@ -1,7 +1,7 @@ using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; using OmniSharp.Extensions.Embedded.MediatR; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class ModulesArguments : IRequest { diff --git a/src/Dap.Protocol/Requests/ModulesResponse.cs b/src/Dap.Protocol/Requests/ModulesResponse.cs index 0b79a3cc0..a535b266b 100644 --- a/src/Dap.Protocol/Requests/ModulesResponse.cs +++ b/src/Dap.Protocol/Requests/ModulesResponse.cs @@ -1,6 +1,7 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Models; using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class ModulesResponse { diff --git a/src/Dap.Protocol/Requests/NextArguments.cs b/src/Dap.Protocol/Requests/NextArguments.cs index d5d6af07c..8005c2ee1 100644 --- a/src/Dap.Protocol/Requests/NextArguments.cs +++ b/src/Dap.Protocol/Requests/NextArguments.cs @@ -1,6 +1,6 @@ using OmniSharp.Extensions.Embedded.MediatR; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class NextArguments : IRequest { diff --git a/src/Dap.Protocol/Requests/NextResponse.cs b/src/Dap.Protocol/Requests/NextResponse.cs index de6675b95..71aa9839a 100644 --- a/src/Dap.Protocol/Requests/NextResponse.cs +++ b/src/Dap.Protocol/Requests/NextResponse.cs @@ -1,4 +1,4 @@ -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class NextResponse { diff --git a/src/Dap.Protocol/Requests/PauseArguments.cs b/src/Dap.Protocol/Requests/PauseArguments.cs index 7fe2bfc07..82bcd937e 100644 --- a/src/Dap.Protocol/Requests/PauseArguments.cs +++ b/src/Dap.Protocol/Requests/PauseArguments.cs @@ -1,6 +1,6 @@ using OmniSharp.Extensions.Embedded.MediatR; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class PauseArguments : IRequest { diff --git a/src/Dap.Protocol/Requests/PauseResponse.cs b/src/Dap.Protocol/Requests/PauseResponse.cs index 6c7900ee3..5fd71fc6b 100644 --- a/src/Dap.Protocol/Requests/PauseResponse.cs +++ b/src/Dap.Protocol/Requests/PauseResponse.cs @@ -1,4 +1,4 @@ -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class PauseResponse { diff --git a/src/Dap.Protocol/Requests/ReadMemoryArguments.cs b/src/Dap.Protocol/Requests/ReadMemoryArguments.cs index 2a13d37b6..a4cb3d8fa 100644 --- a/src/Dap.Protocol/Requests/ReadMemoryArguments.cs +++ b/src/Dap.Protocol/Requests/ReadMemoryArguments.cs @@ -1,7 +1,7 @@ using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; using OmniSharp.Extensions.Embedded.MediatR; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class ReadMemoryArguments : IRequest { diff --git a/src/Dap.Protocol/Requests/ReadMemoryResponse.cs b/src/Dap.Protocol/Requests/ReadMemoryResponse.cs index 29da1b364..ecd5a70b5 100644 --- a/src/Dap.Protocol/Requests/ReadMemoryResponse.cs +++ b/src/Dap.Protocol/Requests/ReadMemoryResponse.cs @@ -1,6 +1,6 @@ using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class ReadMemoryResponse { diff --git a/src/Dap.Protocol/Requests/RequestNames.cs b/src/Dap.Protocol/Requests/RequestNames.cs index b5b221341..660a50600 100644 --- a/src/Dap.Protocol/Requests/RequestNames.cs +++ b/src/Dap.Protocol/Requests/RequestNames.cs @@ -1,4 +1,4 @@ -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public static class RequestNames { diff --git a/src/Dap.Protocol/Requests/RestartArguments.cs b/src/Dap.Protocol/Requests/RestartArguments.cs index 87d0effda..e6f863d68 100644 --- a/src/Dap.Protocol/Requests/RestartArguments.cs +++ b/src/Dap.Protocol/Requests/RestartArguments.cs @@ -1,6 +1,6 @@ using OmniSharp.Extensions.Embedded.MediatR; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class RestartArguments : IRequest { diff --git a/src/Dap.Protocol/Requests/RestartFrameArguments.cs b/src/Dap.Protocol/Requests/RestartFrameArguments.cs index 477dd84b1..fdfcb863f 100644 --- a/src/Dap.Protocol/Requests/RestartFrameArguments.cs +++ b/src/Dap.Protocol/Requests/RestartFrameArguments.cs @@ -1,6 +1,6 @@ using OmniSharp.Extensions.Embedded.MediatR; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class RestartFrameArguments : IRequest { diff --git a/src/Dap.Protocol/Requests/RestartFrameResponse.cs b/src/Dap.Protocol/Requests/RestartFrameResponse.cs index d78c9e396..b227a6bc3 100644 --- a/src/Dap.Protocol/Requests/RestartFrameResponse.cs +++ b/src/Dap.Protocol/Requests/RestartFrameResponse.cs @@ -1,4 +1,4 @@ -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class RestartFrameResponse { diff --git a/src/Dap.Protocol/Requests/RestartResponse.cs b/src/Dap.Protocol/Requests/RestartResponse.cs index a9648363c..64515d622 100644 --- a/src/Dap.Protocol/Requests/RestartResponse.cs +++ b/src/Dap.Protocol/Requests/RestartResponse.cs @@ -1,4 +1,4 @@ -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class RestartResponse { diff --git a/src/Dap.Protocol/Requests/ReverseContinueArguments.cs b/src/Dap.Protocol/Requests/ReverseContinueArguments.cs index 31e86a98e..db9047c27 100644 --- a/src/Dap.Protocol/Requests/ReverseContinueArguments.cs +++ b/src/Dap.Protocol/Requests/ReverseContinueArguments.cs @@ -1,6 +1,6 @@ using OmniSharp.Extensions.Embedded.MediatR; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class ReverseContinueArguments : IRequest { diff --git a/src/Dap.Protocol/Requests/ReverseContinueResponse.cs b/src/Dap.Protocol/Requests/ReverseContinueResponse.cs index 40f711f40..e7a13baaf 100644 --- a/src/Dap.Protocol/Requests/ReverseContinueResponse.cs +++ b/src/Dap.Protocol/Requests/ReverseContinueResponse.cs @@ -1,4 +1,4 @@ -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class ReverseContinueResponse { diff --git a/src/Dap.Protocol/Requests/RunInTerminalArguments.cs b/src/Dap.Protocol/Requests/RunInTerminalArguments.cs index 79b43617e..91320f5e8 100644 --- a/src/Dap.Protocol/Requests/RunInTerminalArguments.cs +++ b/src/Dap.Protocol/Requests/RunInTerminalArguments.cs @@ -1,8 +1,9 @@ using System.Collections.Generic; +using OmniSharp.Extensions.DebugAdapter.Protocol.Models; using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; using OmniSharp.Extensions.Embedded.MediatR; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class RunInTerminalArguments : IRequest { diff --git a/src/Dap.Protocol/Requests/RunInTerminalArgumentsKind.cs b/src/Dap.Protocol/Requests/RunInTerminalArgumentsKind.cs index 64c42558b..3688f2a19 100644 --- a/src/Dap.Protocol/Requests/RunInTerminalArgumentsKind.cs +++ b/src/Dap.Protocol/Requests/RunInTerminalArgumentsKind.cs @@ -1,7 +1,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Converters; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { [JsonConverter(typeof(StringEnumConverter))] public enum RunInTerminalArgumentsKind diff --git a/src/Dap.Protocol/Requests/RunInTerminalExtensions.cs b/src/Dap.Protocol/Requests/RunInTerminalExtensions.cs index d0ba300b7..0872fc0ee 100644 --- a/src/Dap.Protocol/Requests/RunInTerminalExtensions.cs +++ b/src/Dap.Protocol/Requests/RunInTerminalExtensions.cs @@ -1,6 +1,6 @@ using System.Threading.Tasks; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public static class RunInTerminalExtensions { diff --git a/src/Dap.Protocol/Requests/RunInTerminalResponse.cs b/src/Dap.Protocol/Requests/RunInTerminalResponse.cs index be42fb680..c8343355c 100644 --- a/src/Dap.Protocol/Requests/RunInTerminalResponse.cs +++ b/src/Dap.Protocol/Requests/RunInTerminalResponse.cs @@ -1,6 +1,6 @@ using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class RunInTerminalResponse { diff --git a/src/Dap.Protocol/Requests/ScopesArguments.cs b/src/Dap.Protocol/Requests/ScopesArguments.cs index db1699bab..06750db4e 100644 --- a/src/Dap.Protocol/Requests/ScopesArguments.cs +++ b/src/Dap.Protocol/Requests/ScopesArguments.cs @@ -1,6 +1,6 @@ using OmniSharp.Extensions.Embedded.MediatR; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class ScopesArguments : IRequest { diff --git a/src/Dap.Protocol/Requests/ScopesResponse.cs b/src/Dap.Protocol/Requests/ScopesResponse.cs index f03c3bd07..d398fb6a8 100644 --- a/src/Dap.Protocol/Requests/ScopesResponse.cs +++ b/src/Dap.Protocol/Requests/ScopesResponse.cs @@ -1,4 +1,6 @@ -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +using OmniSharp.Extensions.DebugAdapter.Protocol.Models; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class ScopesResponse { diff --git a/src/Dap.Protocol/Requests/SetBreakpointsArguments.cs b/src/Dap.Protocol/Requests/SetBreakpointsArguments.cs index 1ff6fedfa..63a6e93bc 100644 --- a/src/Dap.Protocol/Requests/SetBreakpointsArguments.cs +++ b/src/Dap.Protocol/Requests/SetBreakpointsArguments.cs @@ -1,8 +1,9 @@ using System; +using OmniSharp.Extensions.DebugAdapter.Protocol.Models; using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; using OmniSharp.Extensions.Embedded.MediatR; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class SetBreakpointsArguments : IRequest { diff --git a/src/Dap.Protocol/Requests/SetBreakpointsResponse.cs b/src/Dap.Protocol/Requests/SetBreakpointsResponse.cs index 3ad94e086..d782d5f8f 100644 --- a/src/Dap.Protocol/Requests/SetBreakpointsResponse.cs +++ b/src/Dap.Protocol/Requests/SetBreakpointsResponse.cs @@ -1,4 +1,6 @@ -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +using OmniSharp.Extensions.DebugAdapter.Protocol.Models; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class SetBreakpointsResponse { diff --git a/src/Dap.Protocol/Requests/SetDataBreakpointsArguments.cs b/src/Dap.Protocol/Requests/SetDataBreakpointsArguments.cs index 5303b9df7..ce3dc3d48 100644 --- a/src/Dap.Protocol/Requests/SetDataBreakpointsArguments.cs +++ b/src/Dap.Protocol/Requests/SetDataBreakpointsArguments.cs @@ -1,6 +1,7 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Models; using OmniSharp.Extensions.Embedded.MediatR; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class SetDataBreakpointsArguments : IRequest { diff --git a/src/Dap.Protocol/Requests/SetDataBreakpointsResponse.cs b/src/Dap.Protocol/Requests/SetDataBreakpointsResponse.cs index 8ad6adda9..ee28ed857 100644 --- a/src/Dap.Protocol/Requests/SetDataBreakpointsResponse.cs +++ b/src/Dap.Protocol/Requests/SetDataBreakpointsResponse.cs @@ -1,4 +1,6 @@ -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +using OmniSharp.Extensions.DebugAdapter.Protocol.Models; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class SetDataBreakpointsResponse { diff --git a/src/Dap.Protocol/Requests/SetExceptionBreakpointsArguments.cs b/src/Dap.Protocol/Requests/SetExceptionBreakpointsArguments.cs index 4688c2af7..03ba05e07 100644 --- a/src/Dap.Protocol/Requests/SetExceptionBreakpointsArguments.cs +++ b/src/Dap.Protocol/Requests/SetExceptionBreakpointsArguments.cs @@ -1,7 +1,8 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Models; using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; using OmniSharp.Extensions.Embedded.MediatR; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class SetExceptionBreakpointsArguments : IRequest { diff --git a/src/Dap.Protocol/Requests/SetExceptionBreakpointsResponse.cs b/src/Dap.Protocol/Requests/SetExceptionBreakpointsResponse.cs index a664a6b7e..d8b845115 100644 --- a/src/Dap.Protocol/Requests/SetExceptionBreakpointsResponse.cs +++ b/src/Dap.Protocol/Requests/SetExceptionBreakpointsResponse.cs @@ -1,4 +1,4 @@ -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class SetExceptionBreakpointsResponse { diff --git a/src/Dap.Protocol/Requests/SetExpressionArguments.cs b/src/Dap.Protocol/Requests/SetExpressionArguments.cs index 4ab4f0f8e..03f046577 100644 --- a/src/Dap.Protocol/Requests/SetExpressionArguments.cs +++ b/src/Dap.Protocol/Requests/SetExpressionArguments.cs @@ -1,7 +1,8 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Models; using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; using OmniSharp.Extensions.Embedded.MediatR; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class SetExpressionArguments : IRequest { diff --git a/src/Dap.Protocol/Requests/SetExpressionResponse.cs b/src/Dap.Protocol/Requests/SetExpressionResponse.cs index e0a55019f..b34fa7edd 100644 --- a/src/Dap.Protocol/Requests/SetExpressionResponse.cs +++ b/src/Dap.Protocol/Requests/SetExpressionResponse.cs @@ -1,6 +1,7 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Models; using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class SetExpressionResponse { diff --git a/src/Dap.Protocol/Requests/SetFunctionBreakpointsArguments.cs b/src/Dap.Protocol/Requests/SetFunctionBreakpointsArguments.cs index 44214eb36..e7b00bd37 100644 --- a/src/Dap.Protocol/Requests/SetFunctionBreakpointsArguments.cs +++ b/src/Dap.Protocol/Requests/SetFunctionBreakpointsArguments.cs @@ -1,6 +1,7 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Models; using OmniSharp.Extensions.Embedded.MediatR; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class SetFunctionBreakpointsArguments : IRequest { diff --git a/src/Dap.Protocol/Requests/SetFunctionBreakpointsResponse.cs b/src/Dap.Protocol/Requests/SetFunctionBreakpointsResponse.cs index 7e2d95211..fabfb66bd 100644 --- a/src/Dap.Protocol/Requests/SetFunctionBreakpointsResponse.cs +++ b/src/Dap.Protocol/Requests/SetFunctionBreakpointsResponse.cs @@ -1,4 +1,6 @@ -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +using OmniSharp.Extensions.DebugAdapter.Protocol.Models; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class SetFunctionBreakpointsResponse { diff --git a/src/Dap.Protocol/Requests/SetVariableArguments.cs b/src/Dap.Protocol/Requests/SetVariableArguments.cs index 0b1616c77..0600fccd7 100644 --- a/src/Dap.Protocol/Requests/SetVariableArguments.cs +++ b/src/Dap.Protocol/Requests/SetVariableArguments.cs @@ -1,7 +1,8 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Models; using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; using OmniSharp.Extensions.Embedded.MediatR; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class SetVariableArguments : IRequest { diff --git a/src/Dap.Protocol/Requests/SetVariableResponse.cs b/src/Dap.Protocol/Requests/SetVariableResponse.cs index f6cbedccf..657f9eada 100644 --- a/src/Dap.Protocol/Requests/SetVariableResponse.cs +++ b/src/Dap.Protocol/Requests/SetVariableResponse.cs @@ -1,6 +1,6 @@ using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class SetVariableResponse { diff --git a/src/Dap.Protocol/Requests/SourceArguments.cs b/src/Dap.Protocol/Requests/SourceArguments.cs index c6b0a621b..cd0170183 100644 --- a/src/Dap.Protocol/Requests/SourceArguments.cs +++ b/src/Dap.Protocol/Requests/SourceArguments.cs @@ -1,7 +1,8 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Models; using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; using OmniSharp.Extensions.Embedded.MediatR; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class SourceArguments : IRequest { diff --git a/src/Dap.Protocol/Requests/SourceResponse.cs b/src/Dap.Protocol/Requests/SourceResponse.cs index c30a31f45..b38600ff0 100644 --- a/src/Dap.Protocol/Requests/SourceResponse.cs +++ b/src/Dap.Protocol/Requests/SourceResponse.cs @@ -1,6 +1,6 @@ using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class SourceResponse { diff --git a/src/Dap.Protocol/Requests/StackTraceArguments.cs b/src/Dap.Protocol/Requests/StackTraceArguments.cs index c59cb9367..98384d3dd 100644 --- a/src/Dap.Protocol/Requests/StackTraceArguments.cs +++ b/src/Dap.Protocol/Requests/StackTraceArguments.cs @@ -1,7 +1,8 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Models; using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; using OmniSharp.Extensions.Embedded.MediatR; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class StackTraceArguments : IRequest { diff --git a/src/Dap.Protocol/Requests/StackTraceResponse.cs b/src/Dap.Protocol/Requests/StackTraceResponse.cs index 27660eb31..c6e28ade5 100644 --- a/src/Dap.Protocol/Requests/StackTraceResponse.cs +++ b/src/Dap.Protocol/Requests/StackTraceResponse.cs @@ -1,6 +1,7 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Models; using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class StackTraceResponse { diff --git a/src/Dap.Protocol/Requests/StepBackArguments.cs b/src/Dap.Protocol/Requests/StepBackArguments.cs index 687401c25..45e82f241 100644 --- a/src/Dap.Protocol/Requests/StepBackArguments.cs +++ b/src/Dap.Protocol/Requests/StepBackArguments.cs @@ -1,6 +1,6 @@ using OmniSharp.Extensions.Embedded.MediatR; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class StepBackArguments : IRequest { diff --git a/src/Dap.Protocol/Requests/StepBackResponse.cs b/src/Dap.Protocol/Requests/StepBackResponse.cs index e735ab43c..5f9c87b09 100644 --- a/src/Dap.Protocol/Requests/StepBackResponse.cs +++ b/src/Dap.Protocol/Requests/StepBackResponse.cs @@ -1,4 +1,4 @@ -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class StepBackResponse { diff --git a/src/Dap.Protocol/Requests/StepInArguments.cs b/src/Dap.Protocol/Requests/StepInArguments.cs index 2de2b361a..56199d5ca 100644 --- a/src/Dap.Protocol/Requests/StepInArguments.cs +++ b/src/Dap.Protocol/Requests/StepInArguments.cs @@ -1,7 +1,7 @@ using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; using OmniSharp.Extensions.Embedded.MediatR; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class StepInArguments : IRequest { diff --git a/src/Dap.Protocol/Requests/StepInResponse.cs b/src/Dap.Protocol/Requests/StepInResponse.cs index d1de6f2d5..ff17478da 100644 --- a/src/Dap.Protocol/Requests/StepInResponse.cs +++ b/src/Dap.Protocol/Requests/StepInResponse.cs @@ -1,4 +1,4 @@ -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class StepInResponse { diff --git a/src/Dap.Protocol/Requests/StepInTargetsArguments.cs b/src/Dap.Protocol/Requests/StepInTargetsArguments.cs index 1f89c3eb7..42f7f8ab9 100644 --- a/src/Dap.Protocol/Requests/StepInTargetsArguments.cs +++ b/src/Dap.Protocol/Requests/StepInTargetsArguments.cs @@ -1,6 +1,6 @@ using OmniSharp.Extensions.Embedded.MediatR; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class StepInTargetsArguments : IRequest { diff --git a/src/Dap.Protocol/Requests/StepInTargetsResponse.cs b/src/Dap.Protocol/Requests/StepInTargetsResponse.cs index a6538f664..a24832ebf 100644 --- a/src/Dap.Protocol/Requests/StepInTargetsResponse.cs +++ b/src/Dap.Protocol/Requests/StepInTargetsResponse.cs @@ -1,4 +1,6 @@ -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +using OmniSharp.Extensions.DebugAdapter.Protocol.Models; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class StepInTargetsResponse { diff --git a/src/Dap.Protocol/Requests/StepOutArguments.cs b/src/Dap.Protocol/Requests/StepOutArguments.cs index 0519c1402..8d955f5a6 100644 --- a/src/Dap.Protocol/Requests/StepOutArguments.cs +++ b/src/Dap.Protocol/Requests/StepOutArguments.cs @@ -1,6 +1,6 @@ using OmniSharp.Extensions.Embedded.MediatR; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class StepOutArguments : IRequest { diff --git a/src/Dap.Protocol/Requests/StepOutResponse.cs b/src/Dap.Protocol/Requests/StepOutResponse.cs index 23dc22966..3927a42ce 100644 --- a/src/Dap.Protocol/Requests/StepOutResponse.cs +++ b/src/Dap.Protocol/Requests/StepOutResponse.cs @@ -1,4 +1,4 @@ -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class StepOutResponse { diff --git a/src/Dap.Protocol/Requests/TerminateArguments.cs b/src/Dap.Protocol/Requests/TerminateArguments.cs index 05be39997..08ce38dae 100644 --- a/src/Dap.Protocol/Requests/TerminateArguments.cs +++ b/src/Dap.Protocol/Requests/TerminateArguments.cs @@ -1,7 +1,7 @@ using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; using OmniSharp.Extensions.Embedded.MediatR; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class TerminateArguments : IRequest { diff --git a/src/Dap.Protocol/Requests/TerminateResponse.cs b/src/Dap.Protocol/Requests/TerminateResponse.cs index 87da317ae..bbf545bd6 100644 --- a/src/Dap.Protocol/Requests/TerminateResponse.cs +++ b/src/Dap.Protocol/Requests/TerminateResponse.cs @@ -1,4 +1,4 @@ -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class TerminateResponse { diff --git a/src/Dap.Protocol/Requests/TerminateThreadsArguments.cs b/src/Dap.Protocol/Requests/TerminateThreadsArguments.cs index d239a1f4e..71945a9e9 100644 --- a/src/Dap.Protocol/Requests/TerminateThreadsArguments.cs +++ b/src/Dap.Protocol/Requests/TerminateThreadsArguments.cs @@ -1,7 +1,8 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Models; using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; using OmniSharp.Extensions.Embedded.MediatR; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class TerminateThreadsArguments : IRequest { diff --git a/src/Dap.Protocol/Requests/TerminateThreadsResponse.cs b/src/Dap.Protocol/Requests/TerminateThreadsResponse.cs index 2464b8996..77d587086 100644 --- a/src/Dap.Protocol/Requests/TerminateThreadsResponse.cs +++ b/src/Dap.Protocol/Requests/TerminateThreadsResponse.cs @@ -1,4 +1,4 @@ -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class TerminateThreadsResponse { diff --git a/src/Dap.Protocol/Requests/ThreadsArguments.cs b/src/Dap.Protocol/Requests/ThreadsArguments.cs index 8b8951595..35f608b89 100644 --- a/src/Dap.Protocol/Requests/ThreadsArguments.cs +++ b/src/Dap.Protocol/Requests/ThreadsArguments.cs @@ -1,6 +1,6 @@ using OmniSharp.Extensions.Embedded.MediatR; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class ThreadsArguments : IRequest { diff --git a/src/Dap.Protocol/Requests/ThreadsResponse.cs b/src/Dap.Protocol/Requests/ThreadsResponse.cs index 6bec1925d..5ee7b872a 100644 --- a/src/Dap.Protocol/Requests/ThreadsResponse.cs +++ b/src/Dap.Protocol/Requests/ThreadsResponse.cs @@ -1,4 +1,6 @@ -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +using OmniSharp.Extensions.DebugAdapter.Protocol.Models; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class ThreadsResponse { diff --git a/src/Dap.Protocol/Requests/VariablesArguments.cs b/src/Dap.Protocol/Requests/VariablesArguments.cs index 7e1cdd108..8050459d5 100644 --- a/src/Dap.Protocol/Requests/VariablesArguments.cs +++ b/src/Dap.Protocol/Requests/VariablesArguments.cs @@ -1,7 +1,8 @@ +using OmniSharp.Extensions.DebugAdapter.Protocol.Models; using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization; using OmniSharp.Extensions.Embedded.MediatR; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class VariablesArguments : IRequest { diff --git a/src/Dap.Protocol/Requests/VariablesArgumentsFilter.cs b/src/Dap.Protocol/Requests/VariablesArgumentsFilter.cs index 01b6946b3..5d9b5bae2 100644 --- a/src/Dap.Protocol/Requests/VariablesArgumentsFilter.cs +++ b/src/Dap.Protocol/Requests/VariablesArgumentsFilter.cs @@ -1,7 +1,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Converters; -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { [JsonConverter(typeof(StringEnumConverter))] public enum VariablesArgumentsFilter diff --git a/src/Dap.Protocol/Requests/VariablesResponse.cs b/src/Dap.Protocol/Requests/VariablesResponse.cs index 79308e0f8..699d3da49 100644 --- a/src/Dap.Protocol/Requests/VariablesResponse.cs +++ b/src/Dap.Protocol/Requests/VariablesResponse.cs @@ -1,4 +1,6 @@ -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +using OmniSharp.Extensions.DebugAdapter.Protocol.Models; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { public class VariablesResponse { diff --git a/src/Dap.Protocol/Serialization/OptionalAttribute.cs b/src/Dap.Protocol/Serialization/OptionalAttribute.cs index c2f01b84b..d74c7b9dc 100644 --- a/src/Dap.Protocol/Serialization/OptionalAttribute.cs +++ b/src/Dap.Protocol/Serialization/OptionalAttribute.cs @@ -1,5 +1,6 @@ using System; using Newtonsoft.Json; +using OmniSharp.Extensions.DebugAdapter.Protocol.Models; namespace OmniSharp.Extensions.DebugAdapter.Protocol.Serialization { diff --git a/src/Dap.Protocol/Serialization/Serializer.cs b/src/Dap.Protocol/Serialization/Serializer.cs index 5af9708a1..7085c4893 100644 --- a/src/Dap.Protocol/Serialization/Serializer.cs +++ b/src/Dap.Protocol/Serialization/Serializer.cs @@ -8,7 +8,7 @@ namespace OmniSharp.Extensions.DebugAdapter.Protocol.Serialization { - public class DapProtocolSerializer : DapSerializer + public class DapProtocolSerializer : DapSerializer, ISerializer { protected override void AddOrReplaceConverters(ICollection converters) { From 460b55d87cd841ed90e2dbb37d6b25e937e99986 Mon Sep 17 00:00:00 2001 From: David Driscoll Date: Tue, 3 Sep 2019 20:24:34 -0400 Subject: [PATCH 10/20] Updated events to go the correct direction (from the adapter to the client) --- .../Events/BreakpointExtensions.cs | 17 +++++++++ .../Events/CapabilitiesExtensions.cs | 17 +++++++++ .../Events/ContinuedExtensions.cs | 17 +++++++++ src/Dap.Protocol/Events/ExitedExtensions.cs | 17 +++++++++ src/Dap.Protocol/Events/IBreakpointHandler.cs | 36 ------------------ .../Events/ICapabilitiesHandler.cs | 36 ------------------ src/Dap.Protocol/Events/IContinuedHandler.cs | 36 ------------------ src/Dap.Protocol/Events/IExitedHandler.cs | 37 ------------------- .../Events/IInitializedHandler.cs | 36 ------------------ .../Events/ILoadedSourceHandler.cs | 36 ------------------ src/Dap.Protocol/Events/IModuleHandler.cs | 36 ------------------ src/Dap.Protocol/Events/IOutputHandler.cs | 36 ------------------ src/Dap.Protocol/Events/IProcessHandler.cs | 36 ------------------ src/Dap.Protocol/Events/IStoppedHandler.cs | 37 ------------------- src/Dap.Protocol/Events/ITerminatedHandler.cs | 37 ------------------- src/Dap.Protocol/Events/IThreadHandler.cs | 36 ------------------ .../Events/InitializedExtensions.cs | 17 +++++++++ .../Events/LoadedSourceExtensions.cs | 17 +++++++++ src/Dap.Protocol/Events/ModuleExtensions.cs | 17 +++++++++ src/Dap.Protocol/Events/OutputExtensions.cs | 17 +++++++++ src/Dap.Protocol/Events/ProcessExtensions.cs | 17 +++++++++ src/Dap.Protocol/Events/StoppedExtensions.cs | 17 +++++++++ .../Events/TerminatedExtensions.cs | 17 +++++++++ src/Dap.Protocol/Events/ThreadExtensions.cs | 17 +++++++++ src/Dap.Protocol/IDebugClient.cs | 10 +++++ src/JsonRpc/IOutputHandler.cs | 4 +- src/JsonRpc/OutputHandler.cs | 14 ++++++- 27 files changed, 230 insertions(+), 437 deletions(-) create mode 100644 src/Dap.Protocol/Events/BreakpointExtensions.cs create mode 100644 src/Dap.Protocol/Events/CapabilitiesExtensions.cs create mode 100644 src/Dap.Protocol/Events/ContinuedExtensions.cs create mode 100644 src/Dap.Protocol/Events/ExitedExtensions.cs delete mode 100644 src/Dap.Protocol/Events/IBreakpointHandler.cs delete mode 100644 src/Dap.Protocol/Events/ICapabilitiesHandler.cs delete mode 100644 src/Dap.Protocol/Events/IContinuedHandler.cs delete mode 100644 src/Dap.Protocol/Events/IExitedHandler.cs delete mode 100644 src/Dap.Protocol/Events/IInitializedHandler.cs delete mode 100644 src/Dap.Protocol/Events/ILoadedSourceHandler.cs delete mode 100644 src/Dap.Protocol/Events/IModuleHandler.cs delete mode 100644 src/Dap.Protocol/Events/IOutputHandler.cs delete mode 100644 src/Dap.Protocol/Events/IProcessHandler.cs delete mode 100644 src/Dap.Protocol/Events/IStoppedHandler.cs delete mode 100644 src/Dap.Protocol/Events/ITerminatedHandler.cs delete mode 100644 src/Dap.Protocol/Events/IThreadHandler.cs create mode 100644 src/Dap.Protocol/Events/InitializedExtensions.cs create mode 100644 src/Dap.Protocol/Events/LoadedSourceExtensions.cs create mode 100644 src/Dap.Protocol/Events/ModuleExtensions.cs create mode 100644 src/Dap.Protocol/Events/OutputExtensions.cs create mode 100644 src/Dap.Protocol/Events/ProcessExtensions.cs create mode 100644 src/Dap.Protocol/Events/StoppedExtensions.cs create mode 100644 src/Dap.Protocol/Events/TerminatedExtensions.cs create mode 100644 src/Dap.Protocol/Events/ThreadExtensions.cs create mode 100644 src/Dap.Protocol/IDebugClient.cs diff --git a/src/Dap.Protocol/Events/BreakpointExtensions.cs b/src/Dap.Protocol/Events/BreakpointExtensions.cs new file mode 100644 index 000000000..2d314cd4a --- /dev/null +++ b/src/Dap.Protocol/Events/BreakpointExtensions.cs @@ -0,0 +1,17 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.DebugAdapter.Protocol.Requests; +using OmniSharp.Extensions.Embedded.MediatR; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public static class BreakpointExtensions + { + public static void SendBreakpoint(this IDebugClient mediator, BreakpointEvent @event) + { + mediator.SendNotification(EventNames.Breakpoint, @event); + } + } +} diff --git a/src/Dap.Protocol/Events/CapabilitiesExtensions.cs b/src/Dap.Protocol/Events/CapabilitiesExtensions.cs new file mode 100644 index 000000000..35619fda7 --- /dev/null +++ b/src/Dap.Protocol/Events/CapabilitiesExtensions.cs @@ -0,0 +1,17 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.DebugAdapter.Protocol.Requests; +using OmniSharp.Extensions.Embedded.MediatR; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public static class CapabilitiesExtensions + { + public static void SendCapabilities(this IDebugClient mediator, CapabilitiesEvent @event) + { + mediator.SendNotification(EventNames.Capabilities, @event); + } + } +} diff --git a/src/Dap.Protocol/Events/ContinuedExtensions.cs b/src/Dap.Protocol/Events/ContinuedExtensions.cs new file mode 100644 index 000000000..ef82a1758 --- /dev/null +++ b/src/Dap.Protocol/Events/ContinuedExtensions.cs @@ -0,0 +1,17 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.DebugAdapter.Protocol.Requests; +using OmniSharp.Extensions.Embedded.MediatR; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public static class ContinuedExtensions + { + public static void SendContinued(this IDebugClient mediator, ContinuedEvent @event) + { + mediator.SendNotification(EventNames.Continued, @event); + } + } +} diff --git a/src/Dap.Protocol/Events/ExitedExtensions.cs b/src/Dap.Protocol/Events/ExitedExtensions.cs new file mode 100644 index 000000000..84b06c6f7 --- /dev/null +++ b/src/Dap.Protocol/Events/ExitedExtensions.cs @@ -0,0 +1,17 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.DebugAdapter.Protocol.Requests; +using OmniSharp.Extensions.Embedded.MediatR; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public static class ExitedExtensions + { + public static void SendExited(this IDebugClient mediator, ExitedEvent @event) + { + mediator.SendNotification(EventNames.Exited, @event); + } + } +} diff --git a/src/Dap.Protocol/Events/IBreakpointHandler.cs b/src/Dap.Protocol/Events/IBreakpointHandler.cs deleted file mode 100644 index 2f04dfc8c..000000000 --- a/src/Dap.Protocol/Events/IBreakpointHandler.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Threading; -using System.Threading.Tasks; -using OmniSharp.Extensions.DebugAdapter.Protocol.Requests; -using OmniSharp.Extensions.Embedded.MediatR; -using OmniSharp.Extensions.JsonRpc; - -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events -{ - [Parallel, Method(EventNames.Breakpoint)] - public interface IBreakpointHandler : IJsonRpcNotificationHandler { } - - public abstract class BreakpointHandler : IBreakpointHandler - { - public abstract Task Handle(BreakpointEvent request, CancellationToken cancellationToken); - } - public static class BreakpointHandlerExtensions - { - public static IDisposable OnBreakpoint(this IDebugAdapterRegistry registry, Func> handler) - { - return registry.AddHandlers(new DelegatingHandler(handler)); - } - - class DelegatingHandler : BreakpointHandler - { - private readonly Func> _handler; - - public DelegatingHandler(Func> handler) - { - _handler = handler; - } - - public override Task Handle(BreakpointEvent request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); - } - } -} diff --git a/src/Dap.Protocol/Events/ICapabilitiesHandler.cs b/src/Dap.Protocol/Events/ICapabilitiesHandler.cs deleted file mode 100644 index b1018f84b..000000000 --- a/src/Dap.Protocol/Events/ICapabilitiesHandler.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Threading; -using System.Threading.Tasks; -using OmniSharp.Extensions.DebugAdapter.Protocol.Requests; -using OmniSharp.Extensions.Embedded.MediatR; -using OmniSharp.Extensions.JsonRpc; - -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events -{ - [Parallel, Method(EventNames.Capabilities)] - public interface ICapabilitiesHandler : IJsonRpcNotificationHandler { } - - public abstract class CapabilitiesHandler : ICapabilitiesHandler - { - public abstract Task Handle(CapabilitiesEvent request, CancellationToken cancellationToken); - } - public static class CapabilitiesHandlerExtensions - { - public static IDisposable OnCapabilities(this IDebugAdapterRegistry registry, Func> handler) - { - return registry.AddHandlers(new DelegatingHandler(handler)); - } - - class DelegatingHandler : CapabilitiesHandler - { - private readonly Func> _handler; - - public DelegatingHandler(Func> handler) - { - _handler = handler; - } - - public override Task Handle(CapabilitiesEvent request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); - } - } -} diff --git a/src/Dap.Protocol/Events/IContinuedHandler.cs b/src/Dap.Protocol/Events/IContinuedHandler.cs deleted file mode 100644 index e3729cc46..000000000 --- a/src/Dap.Protocol/Events/IContinuedHandler.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Threading; -using System.Threading.Tasks; -using OmniSharp.Extensions.DebugAdapter.Protocol.Requests; -using OmniSharp.Extensions.Embedded.MediatR; -using OmniSharp.Extensions.JsonRpc; - -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events -{ - [Parallel, Method(EventNames.Continued)] - public interface IContinuedHandler : IJsonRpcNotificationHandler { } - - public abstract class ContinuedHandler : IContinuedHandler - { - public abstract Task Handle(ContinuedEvent request, CancellationToken cancellationToken); - } - public static class ContinuedHandlerExtensions - { - public static IDisposable OnContinued(this IDebugAdapterRegistry registry, Func> handler) - { - return registry.AddHandlers(new DelegatingHandler(handler)); - } - - class DelegatingHandler : ContinuedHandler - { - private readonly Func> _handler; - - public DelegatingHandler(Func> handler) - { - _handler = handler; - } - - public override Task Handle(ContinuedEvent request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); - } - } -} diff --git a/src/Dap.Protocol/Events/IExitedHandler.cs b/src/Dap.Protocol/Events/IExitedHandler.cs deleted file mode 100644 index 2aa27a30c..000000000 --- a/src/Dap.Protocol/Events/IExitedHandler.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.Threading; -using System.Threading.Tasks; -using OmniSharp.Extensions.DebugAdapter.Protocol.Requests; -using OmniSharp.Extensions.Embedded.MediatR; -using OmniSharp.Extensions.JsonRpc; - -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events -{ - [Parallel, Method(EventNames.Exited)] - public interface IExitedHandler : IJsonRpcNotificationHandler { } - - public abstract class ExitedHandler : IExitedHandler - { - public abstract Task Handle(ExitedEvent request, CancellationToken cancellationToken); - } - public static class ExitedHandlerExtensions - { - public static IDisposable OnExited(this IDebugAdapterRegistry registry, Func> handler) - { - return registry.AddHandlers(new DelegatingHandler(handler)); - } - - class DelegatingHandler : ExitedHandler - { - private readonly Func> _handler; - - public DelegatingHandler(Func> handler) - { - _handler = handler; - } - - public override Task Handle(ExitedEvent request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); - } - } - -} diff --git a/src/Dap.Protocol/Events/IInitializedHandler.cs b/src/Dap.Protocol/Events/IInitializedHandler.cs deleted file mode 100644 index 729176809..000000000 --- a/src/Dap.Protocol/Events/IInitializedHandler.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Threading; -using System.Threading.Tasks; -using OmniSharp.Extensions.DebugAdapter.Protocol.Requests; -using OmniSharp.Extensions.Embedded.MediatR; -using OmniSharp.Extensions.JsonRpc; - -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events -{ - [Parallel, Method(EventNames.Initialized)] - public interface IInitializedHandler : IJsonRpcNotificationHandler { } - - public abstract class InitializedHandler : IInitializedHandler - { - public abstract Task Handle(InitializedEvent request, CancellationToken cancellationToken); - } - public static class InitializedHandlerExtensions - { - public static IDisposable OnInitializedTextDocument(this IDebugAdapterRegistry registry, Func> handler) - { - return registry.AddHandlers(new DelegatingHandler(handler)); - } - - class DelegatingHandler : InitializedHandler - { - private readonly Func> _handler; - - public DelegatingHandler(Func> handler) - { - _handler = handler; - } - - public override Task Handle(InitializedEvent request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); - } - } -} diff --git a/src/Dap.Protocol/Events/ILoadedSourceHandler.cs b/src/Dap.Protocol/Events/ILoadedSourceHandler.cs deleted file mode 100644 index 7d123a51a..000000000 --- a/src/Dap.Protocol/Events/ILoadedSourceHandler.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Threading; -using System.Threading.Tasks; -using OmniSharp.Extensions.DebugAdapter.Protocol.Requests; -using OmniSharp.Extensions.Embedded.MediatR; -using OmniSharp.Extensions.JsonRpc; - -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events -{ - [Parallel, Method(EventNames.LoadedSource)] - public interface ILoadedSourceHandler : IJsonRpcNotificationHandler { } - - public abstract class LoadedSourceHandler : ILoadedSourceHandler - { - public abstract Task Handle(LoadedSourceEvent request, CancellationToken cancellationToken); - } - public static class LoadedSourceHandlerExtensions - { - public static IDisposable OnLoadedSource(this IDebugAdapterRegistry registry, Func> handler) - { - return registry.AddHandlers(new DelegatingHandler(handler)); - } - - class DelegatingHandler : LoadedSourceHandler - { - private readonly Func> _handler; - - public DelegatingHandler(Func> handler) - { - _handler = handler; - } - - public override Task Handle(LoadedSourceEvent request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); - } - } -} diff --git a/src/Dap.Protocol/Events/IModuleHandler.cs b/src/Dap.Protocol/Events/IModuleHandler.cs deleted file mode 100644 index a69a96315..000000000 --- a/src/Dap.Protocol/Events/IModuleHandler.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Threading; -using System.Threading.Tasks; -using OmniSharp.Extensions.DebugAdapter.Protocol.Requests; -using OmniSharp.Extensions.Embedded.MediatR; -using OmniSharp.Extensions.JsonRpc; - -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events -{ - [Parallel, Method(EventNames.Module)] - public interface IModuleHandler : IJsonRpcNotificationHandler { } - - public abstract class ModuleHandler : IModuleHandler - { - public abstract Task Handle(ModuleEvent request, CancellationToken cancellationToken); - } - public static class ModuleHandlerExtensions - { - public static IDisposable OnModule(this IDebugAdapterRegistry registry, Func> handler) - { - return registry.AddHandlers(new DelegatingHandler(handler)); - } - - class DelegatingHandler : ModuleHandler - { - private readonly Func> _handler; - - public DelegatingHandler(Func> handler) - { - _handler = handler; - } - - public override Task Handle(ModuleEvent request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); - } - } -} diff --git a/src/Dap.Protocol/Events/IOutputHandler.cs b/src/Dap.Protocol/Events/IOutputHandler.cs deleted file mode 100644 index f8a8a43db..000000000 --- a/src/Dap.Protocol/Events/IOutputHandler.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Threading; -using System.Threading.Tasks; -using OmniSharp.Extensions.DebugAdapter.Protocol.Requests; -using OmniSharp.Extensions.Embedded.MediatR; -using OmniSharp.Extensions.JsonRpc; - -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events -{ - [Parallel, Method(EventNames.Output)] - public interface IOutputHandler : IJsonRpcNotificationHandler { } - - public abstract class OutputHandler : IOutputHandler - { - public abstract Task Handle(OutputEvent request, CancellationToken cancellationToken); - } - public static class OutputHandlerExtensions - { - public static IDisposable OnOutput(this IDebugAdapterRegistry registry, Func> handler) - { - return registry.AddHandlers(new DelegatingHandler(handler)); - } - - class DelegatingHandler : OutputHandler - { - private readonly Func> _handler; - - public DelegatingHandler(Func> handler) - { - _handler = handler; - } - - public override Task Handle(OutputEvent request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); - } - } -} diff --git a/src/Dap.Protocol/Events/IProcessHandler.cs b/src/Dap.Protocol/Events/IProcessHandler.cs deleted file mode 100644 index 1830d6c2b..000000000 --- a/src/Dap.Protocol/Events/IProcessHandler.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Threading; -using System.Threading.Tasks; -using OmniSharp.Extensions.DebugAdapter.Protocol.Requests; -using OmniSharp.Extensions.Embedded.MediatR; -using OmniSharp.Extensions.JsonRpc; - -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events -{ - [Parallel, Method(EventNames.Process)] - public interface IProcessHandler : IJsonRpcNotificationHandler { } - - public abstract class ProcessHandler : IProcessHandler - { - public abstract Task Handle(ProcessEvent request, CancellationToken cancellationToken); - } - public static class ProcessHandlerExtensions - { - public static IDisposable OnProcess(this IDebugAdapterRegistry registry, Func> handler) - { - return registry.AddHandlers(new DelegatingHandler(handler)); - } - - class DelegatingHandler : ProcessHandler - { - private readonly Func> _handler; - - public DelegatingHandler(Func> handler) - { - _handler = handler; - } - - public override Task Handle(ProcessEvent request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); - } - } -} diff --git a/src/Dap.Protocol/Events/IStoppedHandler.cs b/src/Dap.Protocol/Events/IStoppedHandler.cs deleted file mode 100644 index c1fbb7030..000000000 --- a/src/Dap.Protocol/Events/IStoppedHandler.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.Threading; -using System.Threading.Tasks; -using OmniSharp.Extensions.DebugAdapter.Protocol.Requests; -using OmniSharp.Extensions.Embedded.MediatR; -using OmniSharp.Extensions.JsonRpc; - -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events -{ - [Parallel, Method(EventNames.Stopped)] - public interface IStoppedHandler : IJsonRpcNotificationHandler { } - - public abstract class StoppedHandler : IStoppedHandler - { - public abstract Task Handle(StoppedEvent request, CancellationToken cancellationToken); - } - public static class StoppedHandlerExtensions - { - public static IDisposable OnStopped(this IDebugAdapterRegistry registry, Func> handler) - { - return registry.AddHandlers(new DelegatingHandler(handler)); - } - - class DelegatingHandler : StoppedHandler - { - private readonly Func> _handler; - - public DelegatingHandler(Func> handler) - { - _handler = handler; - } - - public override Task Handle(StoppedEvent request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); - } - } - -} diff --git a/src/Dap.Protocol/Events/ITerminatedHandler.cs b/src/Dap.Protocol/Events/ITerminatedHandler.cs deleted file mode 100644 index 70858dded..000000000 --- a/src/Dap.Protocol/Events/ITerminatedHandler.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.Threading; -using System.Threading.Tasks; -using OmniSharp.Extensions.DebugAdapter.Protocol.Requests; -using OmniSharp.Extensions.Embedded.MediatR; -using OmniSharp.Extensions.JsonRpc; - -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events -{ - [Parallel, Method(EventNames.Terminated)] - public interface ITerminatedHandler : IJsonRpcNotificationHandler { } - - public abstract class TerminatedHandler : ITerminatedHandler - { - public abstract Task Handle(TerminatedEvent request, CancellationToken cancellationToken); - } - public static class TerminatedHandlerExtensions - { - public static IDisposable OnTerminated(this IDebugAdapterRegistry registry, Func> handler) - { - return registry.AddHandlers(new DelegatingHandler(handler)); - } - - class DelegatingHandler : TerminatedHandler - { - private readonly Func> _handler; - - public DelegatingHandler(Func> handler) - { - _handler = handler; - } - - public override Task Handle(TerminatedEvent request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); - } - } - -} diff --git a/src/Dap.Protocol/Events/IThreadHandler.cs b/src/Dap.Protocol/Events/IThreadHandler.cs deleted file mode 100644 index f8395d3b4..000000000 --- a/src/Dap.Protocol/Events/IThreadHandler.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Threading; -using System.Threading.Tasks; -using OmniSharp.Extensions.DebugAdapter.Protocol.Requests; -using OmniSharp.Extensions.Embedded.MediatR; -using OmniSharp.Extensions.JsonRpc; - -namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events -{ - [Parallel, Method(EventNames.Thread)] - public interface IThreadHandler : IJsonRpcNotificationHandler { } - - public abstract class ThreadHandler : IThreadHandler - { - public abstract Task Handle(ThreadEvent request, CancellationToken cancellationToken); - } - public static class ThreadHandlerExtensions - { - public static IDisposable OnThread(this IDebugAdapterRegistry registry, Func> handler) - { - return registry.AddHandlers(new DelegatingHandler(handler)); - } - - class DelegatingHandler : ThreadHandler - { - private readonly Func> _handler; - - public DelegatingHandler(Func> handler) - { - _handler = handler; - } - - public override Task Handle(ThreadEvent request, CancellationToken cancellationToken) => _handler.Invoke(request, cancellationToken); - } - } -} diff --git a/src/Dap.Protocol/Events/InitializedExtensions.cs b/src/Dap.Protocol/Events/InitializedExtensions.cs new file mode 100644 index 000000000..ae0a83371 --- /dev/null +++ b/src/Dap.Protocol/Events/InitializedExtensions.cs @@ -0,0 +1,17 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.DebugAdapter.Protocol.Requests; +using OmniSharp.Extensions.Embedded.MediatR; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public static class InitializedExtensions + { + public static void SendInitialized(this IDebugClient mediator, InitializedEvent @event) + { + mediator.SendNotification(EventNames.Initialized, @event); + } + } +} diff --git a/src/Dap.Protocol/Events/LoadedSourceExtensions.cs b/src/Dap.Protocol/Events/LoadedSourceExtensions.cs new file mode 100644 index 000000000..bfd7e5f1d --- /dev/null +++ b/src/Dap.Protocol/Events/LoadedSourceExtensions.cs @@ -0,0 +1,17 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.DebugAdapter.Protocol.Requests; +using OmniSharp.Extensions.Embedded.MediatR; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public static class LoadedSourceExtensions + { + public static void SendLoadedSource(this IDebugClient mediator, LoadedSourceEvent @event) + { + mediator.SendNotification(EventNames.LoadedSource, @event); + } + } +} diff --git a/src/Dap.Protocol/Events/ModuleExtensions.cs b/src/Dap.Protocol/Events/ModuleExtensions.cs new file mode 100644 index 000000000..a61063cf2 --- /dev/null +++ b/src/Dap.Protocol/Events/ModuleExtensions.cs @@ -0,0 +1,17 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.DebugAdapter.Protocol.Requests; +using OmniSharp.Extensions.Embedded.MediatR; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public static class ModuleExtensions + { + public static void SendModule(this IDebugClient mediator, ModuleEvent @event) + { + mediator.SendNotification(EventNames.Module, @event); + } + } +} diff --git a/src/Dap.Protocol/Events/OutputExtensions.cs b/src/Dap.Protocol/Events/OutputExtensions.cs new file mode 100644 index 000000000..d42584e0c --- /dev/null +++ b/src/Dap.Protocol/Events/OutputExtensions.cs @@ -0,0 +1,17 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.DebugAdapter.Protocol.Requests; +using OmniSharp.Extensions.Embedded.MediatR; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public static class OutputExtensions + { + public static void SendOutput(this IDebugClient mediator, OutputEvent @event) + { + mediator.SendNotification(EventNames.Output, @event); + } + } +} diff --git a/src/Dap.Protocol/Events/ProcessExtensions.cs b/src/Dap.Protocol/Events/ProcessExtensions.cs new file mode 100644 index 000000000..b86003e6f --- /dev/null +++ b/src/Dap.Protocol/Events/ProcessExtensions.cs @@ -0,0 +1,17 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.DebugAdapter.Protocol.Requests; +using OmniSharp.Extensions.Embedded.MediatR; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public static class ProcessExtensions + { + public static void SendProcess(this IDebugClient mediator, ProcessEvent @event) + { + mediator.SendNotification(EventNames.Process, @event); + } + } +} diff --git a/src/Dap.Protocol/Events/StoppedExtensions.cs b/src/Dap.Protocol/Events/StoppedExtensions.cs new file mode 100644 index 000000000..cd972887d --- /dev/null +++ b/src/Dap.Protocol/Events/StoppedExtensions.cs @@ -0,0 +1,17 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.DebugAdapter.Protocol.Requests; +using OmniSharp.Extensions.Embedded.MediatR; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public static class StoppedExtensions + { + public static void SendStopped(this IDebugClient mediator, StoppedEvent @event) + { + mediator.SendNotification(EventNames.Stopped, @event); + } + } +} diff --git a/src/Dap.Protocol/Events/TerminatedExtensions.cs b/src/Dap.Protocol/Events/TerminatedExtensions.cs new file mode 100644 index 000000000..7a99acdee --- /dev/null +++ b/src/Dap.Protocol/Events/TerminatedExtensions.cs @@ -0,0 +1,17 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.DebugAdapter.Protocol.Requests; +using OmniSharp.Extensions.Embedded.MediatR; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public static class TerminatedExtensions + { + public static void SendTerminated(this IDebugClient mediator, TerminatedEvent @event) + { + mediator.SendNotification(EventNames.Terminated, @event); + } + } +} diff --git a/src/Dap.Protocol/Events/ThreadExtensions.cs b/src/Dap.Protocol/Events/ThreadExtensions.cs new file mode 100644 index 000000000..d3a5ce214 --- /dev/null +++ b/src/Dap.Protocol/Events/ThreadExtensions.cs @@ -0,0 +1,17 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using OmniSharp.Extensions.DebugAdapter.Protocol.Requests; +using OmniSharp.Extensions.Embedded.MediatR; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events +{ + public static class ThreadExtensions + { + public static void SendThread(this IDebugClient mediator, ThreadEvent @event) + { + mediator.SendNotification(EventNames.Thread, @event); + } + } +} diff --git a/src/Dap.Protocol/IDebugClient.cs b/src/Dap.Protocol/IDebugClient.cs new file mode 100644 index 000000000..41c781cf1 --- /dev/null +++ b/src/Dap.Protocol/IDebugClient.cs @@ -0,0 +1,10 @@ +using System.Linq; +using System.Reflection; +using Newtonsoft.Json; +using Newtonsoft.Json.Serialization; +using OmniSharp.Extensions.JsonRpc; + +namespace OmniSharp.Extensions.DebugAdapter.Protocol +{ + public interface IDebugClient : IResponseRouter { } +} diff --git a/src/JsonRpc/IOutputHandler.cs b/src/JsonRpc/IOutputHandler.cs index 2032895c8..22d6eb2c2 100644 --- a/src/JsonRpc/IOutputHandler.cs +++ b/src/JsonRpc/IOutputHandler.cs @@ -1,4 +1,5 @@ using System; +using System.Threading.Tasks; namespace OmniSharp.Extensions.JsonRpc { @@ -6,5 +7,6 @@ public interface IOutputHandler : IDisposable { void Start(); void Send(object value); + Task WaitForShutdown(); } -} \ No newline at end of file +} diff --git a/src/JsonRpc/OutputHandler.cs b/src/JsonRpc/OutputHandler.cs index d0c00745b..4b27c999f 100644 --- a/src/JsonRpc/OutputHandler.cs +++ b/src/JsonRpc/OutputHandler.cs @@ -3,6 +3,7 @@ using System.IO; using System.Text; using System.Threading; +using System.Threading.Tasks; namespace OmniSharp.Extensions.JsonRpc { @@ -13,6 +14,7 @@ public class OutputHandler : IOutputHandler private readonly Thread _thread; private readonly BlockingCollection _queue; private readonly CancellationTokenSource _cancel; + private readonly TaskCompletionSource _outputIsFinished; public OutputHandler(Stream output, ISerializer serializer) { @@ -65,13 +67,23 @@ private void ProcessOutputQueue() catch (OperationCanceledException ex) { if (ex.CancellationToken != token) - throw; + _outputIsFinished.SetException(ex); // else ignore. Exceptions: OperationCanceledException - The CancellationToken has been canceled. } + catch (Exception e) + { + _outputIsFinished.SetException(e); + } + } + + public Task WaitForShutdown() + { + return _outputIsFinished.Task; } public void Dispose() { + _outputIsFinished.TrySetResult(null); _cancel.Cancel(); _thread.Join(); _cancel.Dispose(); From 9d3c7cdac763c64df066406064e7570a93707fd0 Mon Sep 17 00:00:00 2001 From: Tyler James Leonhardt Date: Tue, 3 Sep 2019 23:41:03 -0700 Subject: [PATCH 11/20] remove extra Reciever --- src/JsonRpc/JsonRpcServer.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/JsonRpc/JsonRpcServer.cs b/src/JsonRpc/JsonRpcServer.cs index 306bdb2d3..92f5dfceb 100644 --- a/src/JsonRpc/JsonRpcServer.cs +++ b/src/JsonRpc/JsonRpcServer.cs @@ -90,7 +90,6 @@ internal JsonRpcServer( services.AddJsonRpcMediatR(assemblies); services.AddSingleton(this); services.AddSingleton, RequestRouter>(); - services.AddSingleton(); services.AddSingleton(); var foundHandlers = services From 376a4114f705ab00480a01063c6350e396005de2 Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Thu, 5 Sep 2019 08:57:02 -0700 Subject: [PATCH 12/20] fix initializeresponse payload --- src/Dap.Protocol/Requests/InitializeResponse.cs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/Dap.Protocol/Requests/InitializeResponse.cs b/src/Dap.Protocol/Requests/InitializeResponse.cs index cdb26c4bc..2af888916 100644 --- a/src/Dap.Protocol/Requests/InitializeResponse.cs +++ b/src/Dap.Protocol/Requests/InitializeResponse.cs @@ -3,12 +3,5 @@ namespace OmniSharp.Extensions.DebugAdapter.Protocol.Requests { - public class InitializeResponse - { - /// - /// The capabilities of this debug adapter. - /// - [Optional] public Capabilities Body { get; set; } - } - + public class InitializeResponse : Capabilities {} } From 0291179387acfdea61a7873a8d9fe1608976f69b Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Thu, 5 Sep 2019 08:57:54 -0700 Subject: [PATCH 13/20] WORKAROUND: set success to true to allow messaging to work for now --- .../DebugAdapterConverters/DapClientResponseConverter.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/JsonRpc/Serialization/DebugAdapterConverters/DapClientResponseConverter.cs b/src/JsonRpc/Serialization/DebugAdapterConverters/DapClientResponseConverter.cs index 12d1d834b..853ab6cd7 100644 --- a/src/JsonRpc/Serialization/DebugAdapterConverters/DapClientResponseConverter.cs +++ b/src/JsonRpc/Serialization/DebugAdapterConverters/DapClientResponseConverter.cs @@ -30,6 +30,9 @@ public override void WriteJson(JsonWriter writer, Response value, JsonSerializer writer.WriteValue("response"); writer.WritePropertyName("request_seq"); writer.WriteValue(value.Id); + // TODO: Dynamically set this based on handler execution. + writer.WritePropertyName("success"); + writer.WriteValue(true); writer.WritePropertyName("command"); writer.WriteValue(value.Request?.Method); if (value.Result != null) From 4908f44779de86048fd8ac1ec5511fd3a4ee073c Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Tue, 10 Sep 2019 23:21:31 -0700 Subject: [PATCH 14/20] JsonRpcServer.Dispose() works now --- src/JsonRpc/InputHandler.cs | 88 ++++++++++++++++++--------------- src/JsonRpc/OutputHandler.cs | 8 ++- src/JsonRpc/ProcessScheduler.cs | 2 +- 3 files changed, 55 insertions(+), 43 deletions(-) diff --git a/src/JsonRpc/InputHandler.cs b/src/JsonRpc/InputHandler.cs index 3b9d68544..313946e21 100644 --- a/src/JsonRpc/InputHandler.cs +++ b/src/JsonRpc/InputHandler.cs @@ -72,52 +72,59 @@ private void ProcessInputStream() // content is encoded in UTF-8 while (true) { - if (_inputThread == null) return; - - var buffer = new byte[300]; - var current = _input.Read(buffer, 0, MinBuffer); - if (current == 0) return; // no more _input - while (current < MinBuffer || - buffer[current - 4] != CR || buffer[current - 3] != LF || - buffer[current - 2] != CR || buffer[current - 1] != LF) - { - var n = _input.Read(buffer, current, 1); - if (n == 0) return; // no more _input, mitigates endless loop here. - current += n; - } + try { + if (_inputThread == null) return; + + var buffer = new byte[300]; + var current = _input.Read(buffer, 0, MinBuffer); + if (current == 0) return; // no more _input + while (current < MinBuffer || + buffer[current - 4] != CR || buffer[current - 3] != LF || + buffer[current - 2] != CR || buffer[current - 1] != LF) + { + var n = _input.Read(buffer, current, 1); + if (n == 0) return; // no more _input, mitigates endless loop here. + current += n; + } - var headersContent = System.Text.Encoding.ASCII.GetString(buffer, 0, current); - var headers = headersContent.Split(HeaderKeys, StringSplitOptions.RemoveEmptyEntries); - long length = 0; - for (var i = 1; i < headers.Length; i += 2) - { - // starting at i = 1 instead of 0 won't throw, if we have uneven headers' length - var header = headers[i - 1]; - var value = headers[i].Trim(); - if (header.Equals("Content-Length", StringComparison.OrdinalIgnoreCase)) + var headersContent = System.Text.Encoding.ASCII.GetString(buffer, 0, current); + var headers = headersContent.Split(HeaderKeys, StringSplitOptions.RemoveEmptyEntries); + long length = 0; + for (var i = 1; i < headers.Length; i += 2) { - length = 0; - long.TryParse(value, out length); + // starting at i = 1 instead of 0 won't throw, if we have uneven headers' length + var header = headers[i - 1]; + var value = headers[i].Trim(); + if (header.Equals("Content-Length", StringComparison.OrdinalIgnoreCase)) + { + length = 0; + long.TryParse(value, out length); + } } - } - if (length == 0 || length >= int.MaxValue) - { - HandleRequest(string.Empty); - } - else - { - var requestBuffer = new byte[length]; - var received = 0; - while (received < length) + if (length == 0 || length >= int.MaxValue) + { + HandleRequest(string.Empty); + } + else { - var n = _input.Read(requestBuffer, received, requestBuffer.Length - received); - if (n == 0) return; // no more _input - received += n; + var requestBuffer = new byte[length]; + var received = 0; + while (received < length) + { + var n = _input.Read(requestBuffer, received, requestBuffer.Length - received); + if (n == 0) return; // no more _input + received += n; + } + // TODO sometimes: encoding should be based on the respective header (including the wrong "utf8" value) + var payload = System.Text.Encoding.UTF8.GetString(requestBuffer); + HandleRequest(payload); } - // TODO sometimes: encoding should be based on the respective header (including the wrong "utf8" value) - var payload = System.Text.Encoding.UTF8.GetString(requestBuffer); - HandleRequest(payload); + } + catch (IOException) + { + _logger.LogError("Input stream has been closed."); + break; } } } @@ -232,6 +239,7 @@ public void Dispose() _outputHandler.Dispose(); _inputThread = null; _scheduler.Dispose(); + _input?.Dispose(); } } } diff --git a/src/JsonRpc/OutputHandler.cs b/src/JsonRpc/OutputHandler.cs index 4b27c999f..a0ddc2c1b 100644 --- a/src/JsonRpc/OutputHandler.cs +++ b/src/JsonRpc/OutputHandler.cs @@ -23,6 +23,7 @@ public OutputHandler(Stream output, ISerializer serializer) _serializer = serializer; _queue = new BlockingCollection(); _cancel = new CancellationTokenSource(); + _outputIsFinished = new TaskCompletionSource(); _thread = new Thread(ProcessOutputQueue) { IsBackground = true, Name = "ProcessOutputQueue" }; } @@ -41,7 +42,7 @@ private void ProcessOutputQueue() var token = _cancel.Token; try { - while (true) + while (!token.IsCancellationRequested) { if (_queue.TryTake(out var value, Timeout.Infinite, token)) { @@ -59,7 +60,10 @@ private void ProcessOutputQueue() { ms.Write(headerBytes, 0, headerBytes.Length); ms.Write(contentBytes, 0, contentBytes.Length); - _output.Write(ms.ToArray(), 0, (int)ms.Position); + if(!token.IsCancellationRequested) + { + _output.Write(ms.ToArray(), 0, (int)ms.Position); + } } } } diff --git a/src/JsonRpc/ProcessScheduler.cs b/src/JsonRpc/ProcessScheduler.cs index c71a81822..7ad98c52d 100644 --- a/src/JsonRpc/ProcessScheduler.cs +++ b/src/JsonRpc/ProcessScheduler.cs @@ -68,7 +68,7 @@ private void ProcessRequestQueue() var waitables = new List(); try { - while (true) + while (!token.IsCancellationRequested) { if (_queue.TryTake(out var item, Timeout.Infinite, token)) { From 4605713c98e740afeeafffa1c60b3fc1769b0820 Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Wed, 11 Sep 2019 13:28:44 -0700 Subject: [PATCH 15/20] additional changes for disposable --- src/JsonRpc/InputHandler.cs | 2 +- src/JsonRpc/OutputHandler.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/JsonRpc/InputHandler.cs b/src/JsonRpc/InputHandler.cs index 313946e21..9e3137bdd 100644 --- a/src/JsonRpc/InputHandler.cs +++ b/src/JsonRpc/InputHandler.cs @@ -236,9 +236,9 @@ private void HandleRequest(string request) public void Dispose() { + _scheduler.Dispose(); _outputHandler.Dispose(); _inputThread = null; - _scheduler.Dispose(); _input?.Dispose(); } } diff --git a/src/JsonRpc/OutputHandler.cs b/src/JsonRpc/OutputHandler.cs index a0ddc2c1b..9575cce55 100644 --- a/src/JsonRpc/OutputHandler.cs +++ b/src/JsonRpc/OutputHandler.cs @@ -71,12 +71,12 @@ private void ProcessOutputQueue() catch (OperationCanceledException ex) { if (ex.CancellationToken != token) - _outputIsFinished.SetException(ex); + _outputIsFinished.TrySetException(ex); // else ignore. Exceptions: OperationCanceledException - The CancellationToken has been canceled. } catch (Exception e) { - _outputIsFinished.SetException(e); + _outputIsFinished.TrySetException(e); } } From 712779ff00f353476f6050d4b3abdce5b6ceeb47 Mon Sep 17 00:00:00 2001 From: Tyler James Leonhardt Date: Fri, 13 Sep 2019 18:09:24 -0700 Subject: [PATCH 16/20] switch null to new JObject so it can still be parsed into the right type --- src/JsonRpc/DapReciever.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/JsonRpc/DapReciever.cs b/src/JsonRpc/DapReciever.cs index 8c9e097f9..59d205386 100644 --- a/src/JsonRpc/DapReciever.cs +++ b/src/JsonRpc/DapReciever.cs @@ -57,7 +57,7 @@ protected virtual Renor GetRenor(JToken @object) { return new InvalidRequest(null, "No command given"); } - return new Request(sequence, command.Value(), request.TryGetValue("arguments", out var body) ? body : null); + return new Request(sequence, command.Value(), request.TryGetValue("arguments", out var body) ? body : new JObject()); } if (messageType == "response") { From ad627ee1bd1a9029d5686464f2544151bb2bbe47 Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Mon, 23 Sep 2019 18:00:51 -0700 Subject: [PATCH 17/20] fix up WriteJson for DAP error handling --- .../DebugAdapterConverters/DapRpcErrorConverter.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/JsonRpc/Serialization/DebugAdapterConverters/DapRpcErrorConverter.cs b/src/JsonRpc/Serialization/DebugAdapterConverters/DapRpcErrorConverter.cs index 63617aeae..130e241fa 100644 --- a/src/JsonRpc/Serialization/DebugAdapterConverters/DapRpcErrorConverter.cs +++ b/src/JsonRpc/Serialization/DebugAdapterConverters/DapRpcErrorConverter.cs @@ -20,13 +20,17 @@ public override void WriteJson(JsonWriter writer, RpcError value, JsonSerializer writer.WriteStartObject(); writer.WritePropertyName("seq"); writer.WriteValue(_serializer.GetNextId()); + writer.WritePropertyName("type"); + writer.WriteValue("response"); if (value.Id != null) { writer.WritePropertyName("request_seq"); - writer.WriteValue(value.Id); + writer.WriteValue(long.Parse((string) value.Id)); } + writer.WritePropertyName("success"); + writer.WriteValue(false); writer.WritePropertyName("message"); - writer.WriteValue(value.Error.Message); + writer.WriteValue(value.Error.Data); writer.WriteEndObject(); } From a5e210a3478af3d3c0afa5c411d134eae9439e4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Bj=C3=B6rkstr=C3=B6m?= Date: Wed, 25 Sep 2019 00:01:21 +0300 Subject: [PATCH 18/20] Write request id when serializing --- src/JsonRpc/Serialization/Converters/ClientRequestConverter.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/JsonRpc/Serialization/Converters/ClientRequestConverter.cs b/src/JsonRpc/Serialization/Converters/ClientRequestConverter.cs index 5e602e2bd..992813c44 100644 --- a/src/JsonRpc/Serialization/Converters/ClientRequestConverter.cs +++ b/src/JsonRpc/Serialization/Converters/ClientRequestConverter.cs @@ -19,6 +19,8 @@ public override void WriteJson(JsonWriter writer, Request value, JsonSerializer writer.WriteStartObject(); writer.WritePropertyName("jsonrpc"); writer.WriteValue("2.0"); + writer.WritePropertyName("id"); + writer.WriteValue(value.Id); writer.WritePropertyName("method"); writer.WriteValue(value.Method); if (value.Params != null) From c7adb136a5603eb7af0d1c354b39d1cd1bc9b4fc Mon Sep 17 00:00:00 2001 From: Tyler Leonhardt Date: Tue, 24 Sep 2019 16:46:27 -0700 Subject: [PATCH 19/20] Fix tests --- .../Serialization/Converters/ErrorMessageConverter.cs | 2 +- .../DebugAdapterConverters/DapRpcErrorConverter.cs | 2 +- test/JsonRpc.Tests/DapOutputHandlerTests.cs | 8 ++++---- test/JsonRpc.Tests/OutputHandlerTests.cs | 5 ++--- .../Server/DebugAdapterSpecifictionRecieverTests.cs | 2 +- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/JsonRpc/Serialization/Converters/ErrorMessageConverter.cs b/src/JsonRpc/Serialization/Converters/ErrorMessageConverter.cs index 8eaa81d13..ba4ef61e5 100644 --- a/src/JsonRpc/Serialization/Converters/ErrorMessageConverter.cs +++ b/src/JsonRpc/Serialization/Converters/ErrorMessageConverter.cs @@ -14,7 +14,7 @@ public override void WriteJson(JsonWriter writer, ErrorMessage value, JsonSerial if (value.Data != null) { writer.WritePropertyName("data"); - writer.WriteValue(value.Data); + serializer.Serialize(writer, value.Data); } writer.WritePropertyName("message"); writer.WriteValue(value.Message); diff --git a/src/JsonRpc/Serialization/DebugAdapterConverters/DapRpcErrorConverter.cs b/src/JsonRpc/Serialization/DebugAdapterConverters/DapRpcErrorConverter.cs index 130e241fa..6fa00165f 100644 --- a/src/JsonRpc/Serialization/DebugAdapterConverters/DapRpcErrorConverter.cs +++ b/src/JsonRpc/Serialization/DebugAdapterConverters/DapRpcErrorConverter.cs @@ -25,7 +25,7 @@ public override void WriteJson(JsonWriter writer, RpcError value, JsonSerializer if (value.Id != null) { writer.WritePropertyName("request_seq"); - writer.WriteValue(long.Parse((string) value.Id)); + writer.WriteValue(value.Id); } writer.WritePropertyName("success"); writer.WriteValue(false); diff --git a/test/JsonRpc.Tests/DapOutputHandlerTests.cs b/test/JsonRpc.Tests/DapOutputHandlerTests.cs index c584bca0b..7d66a151a 100644 --- a/test/JsonRpc.Tests/DapOutputHandlerTests.cs +++ b/test/JsonRpc.Tests/DapOutputHandlerTests.cs @@ -55,7 +55,7 @@ public async Task ShouldSerializeResponses() handler.Send(value); await wait(); - const string send = "Content-Length: 73\r\n\r\n{\"seq\":0,\"type\":\"response\",\"request_seq\":1,\"command\":\"command\",\"body\":{}}"; + const string send = "Content-Length: 88\r\n\r\n{\"seq\":1,\"type\":\"response\",\"request_seq\":1,\"success\":true,\"command\":\"command\",\"body\":{}}"; received.Should().Be(send); var b = System.Text.Encoding.UTF8.GetBytes(send); w.Received().Write(Arg.Any(), 0, b.Length); // can't compare b here, because it is only value-equal and this test tests reference equality @@ -86,7 +86,7 @@ public async Task ShouldSerializeNotifications() handler.Send(value); await wait(); - const string send = "Content-Length: 51\r\n\r\n{\"seq\":0,\"type\":\"event\",\"event\":\"method\",\"body\":{}}"; + const string send = "Content-Length: 51\r\n\r\n{\"seq\":1,\"type\":\"event\",\"event\":\"method\",\"body\":{}}"; received.Should().Be(send); var b = System.Text.Encoding.UTF8.GetBytes(send); w.Received().Write(Arg.Any(), 0, b.Length); // can't compare b here, because it is only value-equal and this test tests reference equality @@ -139,14 +139,14 @@ public async Task ShouldSerializeErrors() cts.Cancel(); }); }); - var value = new RpcError(1, new ErrorMessage(1, "something", new object())); + var value = new RpcError(1, new ErrorMessage(1, "something", "data")); using (handler) { handler.Send(value); await wait(); - const string send = "Content-Length: 47\r\n\r\n{\"seq\":0,\"request_seq\":1,\"message\":\"something\"}"; + const string send = "Content-Length: 76\r\n\r\n{\"seq\":1,\"type\":\"response\",\"request_seq\":1,\"success\":false,\"message\":\"data\"}"; received.Should().Be(send); var b = System.Text.Encoding.UTF8.GetBytes(send); w.Received().Write(Arg.Any(), 0, b.Length); // can't compare b here, because it is only value-equal and this test tests reference equality diff --git a/test/JsonRpc.Tests/OutputHandlerTests.cs b/test/JsonRpc.Tests/OutputHandlerTests.cs index f430da9d5..b79bbc8dc 100644 --- a/test/JsonRpc.Tests/OutputHandlerTests.cs +++ b/test/JsonRpc.Tests/OutputHandlerTests.cs @@ -7,7 +7,6 @@ using OmniSharp.Extensions.JsonRpc; using OmniSharp.Extensions.JsonRpc.Client; using OmniSharp.Extensions.JsonRpc.Serialization; -using OmniSharp.Extensions.JsonRpc.Server; using OmniSharp.Extensions.JsonRpc.Server.Messages; using Xunit; @@ -118,7 +117,7 @@ public async Task ShouldSerializeRequests() handler.Send(value); await wait(); - const string send = "Content-Length: 47\r\n\r\n{\"jsonrpc\":\"2.0\",\"method\":\"method\",\"params\":{}}"; + const string send = "Content-Length: 54\r\n\r\n{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"method\",\"params\":{}}"; received.Should().Be(send); var b = System.Text.Encoding.UTF8.GetBytes(send); w.Received().Write(Arg.Any(), 0, b.Length); // can't compare b here, because it is only value-equal and this test tests reference equality @@ -146,7 +145,7 @@ public async Task ShouldSerializeErrors() handler.Send(value); await wait(); - const string send = "Content-Length: 75\r\n\r\n{\"jsonrpc\":\"2.0\",\"id\":1,\"error\":{\"code\":1,\"message\":\"something\",\"data\":{}}}"; + const string send = "Content-Length: 75\r\n\r\n{\"jsonrpc\":\"2.0\",\"id\":1,\"error\":{\"code\":1,\"data\":{},\"message\":\"something\"}}"; received.Should().Be(send); var b = System.Text.Encoding.UTF8.GetBytes(send); w.Received().Write(Arg.Any(), 0, b.Length); // can't compare b here, because it is only value-equal and this test tests reference equality diff --git a/test/JsonRpc.Tests/Server/DebugAdapterSpecifictionRecieverTests.cs b/test/JsonRpc.Tests/Server/DebugAdapterSpecifictionRecieverTests.cs index a6b7848ba..ae2ce7441 100644 --- a/test/JsonRpc.Tests/Server/DebugAdapterSpecifictionRecieverTests.cs +++ b/test/JsonRpc.Tests/Server/DebugAdapterSpecifictionRecieverTests.cs @@ -48,7 +48,7 @@ public override IEnumerable> GetValues() @"{""seq"": ""1"", ""type"": ""request"", ""command"": ""attach""}", new Renor[] { - new Request(1, "attach", null) + new Request(1, "attach", new JObject()) } ); From 8872c70ea70add43cf55fdd43f94f5e454e5c8cd Mon Sep 17 00:00:00 2001 From: David Driscoll Date: Tue, 24 Sep 2019 21:05:20 -0400 Subject: [PATCH 20/20] bump