Skip to content

Commit 22ebd1f

Browse files
Support: Debug Adapter Protocol (#157)
Support: Debug Adapter Protocol +semver: minor
1 parent 2b06e03 commit 22ebd1f

File tree

246 files changed

+6257
-338
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

246 files changed

+6257
-338
lines changed

LSP.sln

+31-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Microsoft Visual Studio Solution File, Format Version 12.00
1+
Microsoft Visual Studio Solution File, Format Version 12.00
22
# Visual Studio Version 16
33
VisualStudioVersion = 16.0.29025.244
44
MinimumVisualStudioVersion = 10.0.40219.1
@@ -50,6 +50,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
5050
cake.config = cake.config
5151
EndProjectSection
5252
EndProject
53+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dap.Protocol", "src\Dap.Protocol\Dap.Protocol.csproj", "{F2C9D555-118E-442B-A953-9A7B58A53F33}"
54+
EndProject
55+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dap.Server", "src\Dap.Server\Dap.Server.csproj", "{E1A9123B-A236-4240-8C82-A61BD85C3BF4}"
56+
EndProject
5357
Global
5458
GlobalSection(SolutionConfigurationPlatforms) = preSolution
5559
Debug|Any CPU = Debug|Any CPU
@@ -156,6 +160,30 @@ Global
156160
{E540868F-438E-4F7F-BBB7-010D6CB18A57}.Release|x64.Build.0 = Release|Any CPU
157161
{E540868F-438E-4F7F-BBB7-010D6CB18A57}.Release|x86.ActiveCfg = Release|Any CPU
158162
{E540868F-438E-4F7F-BBB7-010D6CB18A57}.Release|x86.Build.0 = Release|Any CPU
163+
{F2C9D555-118E-442B-A953-9A7B58A53F33}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
164+
{F2C9D555-118E-442B-A953-9A7B58A53F33}.Debug|Any CPU.Build.0 = Debug|Any CPU
165+
{F2C9D555-118E-442B-A953-9A7B58A53F33}.Debug|x64.ActiveCfg = Debug|Any CPU
166+
{F2C9D555-118E-442B-A953-9A7B58A53F33}.Debug|x64.Build.0 = Debug|Any CPU
167+
{F2C9D555-118E-442B-A953-9A7B58A53F33}.Debug|x86.ActiveCfg = Debug|Any CPU
168+
{F2C9D555-118E-442B-A953-9A7B58A53F33}.Debug|x86.Build.0 = Debug|Any CPU
169+
{F2C9D555-118E-442B-A953-9A7B58A53F33}.Release|Any CPU.ActiveCfg = Release|Any CPU
170+
{F2C9D555-118E-442B-A953-9A7B58A53F33}.Release|Any CPU.Build.0 = Release|Any CPU
171+
{F2C9D555-118E-442B-A953-9A7B58A53F33}.Release|x64.ActiveCfg = Release|Any CPU
172+
{F2C9D555-118E-442B-A953-9A7B58A53F33}.Release|x64.Build.0 = Release|Any CPU
173+
{F2C9D555-118E-442B-A953-9A7B58A53F33}.Release|x86.ActiveCfg = Release|Any CPU
174+
{F2C9D555-118E-442B-A953-9A7B58A53F33}.Release|x86.Build.0 = Release|Any CPU
175+
{E1A9123B-A236-4240-8C82-A61BD85C3BF4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
176+
{E1A9123B-A236-4240-8C82-A61BD85C3BF4}.Debug|Any CPU.Build.0 = Debug|Any CPU
177+
{E1A9123B-A236-4240-8C82-A61BD85C3BF4}.Debug|x64.ActiveCfg = Debug|Any CPU
178+
{E1A9123B-A236-4240-8C82-A61BD85C3BF4}.Debug|x64.Build.0 = Debug|Any CPU
179+
{E1A9123B-A236-4240-8C82-A61BD85C3BF4}.Debug|x86.ActiveCfg = Debug|Any CPU
180+
{E1A9123B-A236-4240-8C82-A61BD85C3BF4}.Debug|x86.Build.0 = Debug|Any CPU
181+
{E1A9123B-A236-4240-8C82-A61BD85C3BF4}.Release|Any CPU.ActiveCfg = Release|Any CPU
182+
{E1A9123B-A236-4240-8C82-A61BD85C3BF4}.Release|Any CPU.Build.0 = Release|Any CPU
183+
{E1A9123B-A236-4240-8C82-A61BD85C3BF4}.Release|x64.ActiveCfg = Release|Any CPU
184+
{E1A9123B-A236-4240-8C82-A61BD85C3BF4}.Release|x64.Build.0 = Release|Any CPU
185+
{E1A9123B-A236-4240-8C82-A61BD85C3BF4}.Release|x86.ActiveCfg = Release|Any CPU
186+
{E1A9123B-A236-4240-8C82-A61BD85C3BF4}.Release|x86.Build.0 = Release|Any CPU
159187
EndGlobalSection
160188
GlobalSection(SolutionProperties) = preSolution
161189
HideSolutionNode = FALSE
@@ -169,6 +197,8 @@ Global
169197
{97437BE1-2EC3-4F6B-AC75-C3E099040A07} = {2F323ED5-EBF8-45E1-B9D3-C014561B3DDA}
170198
{92B331E9-5225-428D-AE82-37F5F46156A3} = {D764E024-3D3F-4112-B932-2DB722A1BACC}
171199
{E540868F-438E-4F7F-BBB7-010D6CB18A57} = {D764E024-3D3F-4112-B932-2DB722A1BACC}
200+
{F2C9D555-118E-442B-A953-9A7B58A53F33} = {D764E024-3D3F-4112-B932-2DB722A1BACC}
201+
{E1A9123B-A236-4240-8C82-A61BD85C3BF4} = {D764E024-3D3F-4112-B932-2DB722A1BACC}
172202
EndGlobalSection
173203
GlobalSection(ExtensibilityGlobals) = postSolution
174204
SolutionGuid = {D38DD0EC-D095-4BCD-B8AF-2D788AF3B9AE}

src/Dap.Protocol/Dap.Protocol.csproj

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFrameworks>netstandard2.0</TargetFrameworks>
5+
<PlatformTarget>AnyCPU</PlatformTarget>
6+
<AssemblyName>OmniSharp.Extensions.DebugAdapter</AssemblyName>
7+
<RootNamespace>OmniSharp.Extensions.DebugAdapter.Protocol</RootNamespace>
8+
<PackageDescription>Debug Adapter Protocol models, classes, interfaces and helper methods</PackageDescription>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<ProjectReference Include="..\JsonRpc\JsonRpc.csproj" />
13+
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute">
14+
<_Parameter1>OmniSharp.Extensions.LanguageServer, PublicKey=0024000004800000940000000602000000240000525341310004000001000100391db875e68eb4bfef49ce14313b9e13f2cd3cc89eb273bbe6c11a55044c7d4f566cf092e1c77ef9e7c75b1496ae7f95d925938f5a01793dd8d9f99ae0a7595779b71b971287d7d7b5960d052078d14f5ce1a85ea5c9fb2f59ac735ff7bc215cab469b7c3486006860bad6f4c3b5204ea2f28dd4e1d05e2cca462cfd593b9f9f</_Parameter1>
15+
</AssemblyAttribute>
16+
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute">
17+
<_Parameter1>OmniSharp.Extensions.LanguageClient, PublicKey=0024000004800000940000000602000000240000525341310004000001000100391db875e68eb4bfef49ce14313b9e13f2cd3cc89eb273bbe6c11a55044c7d4f566cf092e1c77ef9e7c75b1496ae7f95d925938f5a01793dd8d9f99ae0a7595779b71b971287d7d7b5960d052078d14f5ce1a85ea5c9fb2f59ac735ff7bc215cab469b7c3486006860bad6f4c3b5204ea2f28dd4e1d05e2cca462cfd593b9f9f</_Parameter1>
18+
</AssemblyAttribute>
19+
</ItemGroup>
20+
21+
</Project>
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using OmniSharp.Extensions.DebugAdapter.Protocol.Models;
2+
using OmniSharp.Extensions.Embedded.MediatR;
3+
4+
namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events
5+
{
6+
public class BreakpointEvent : IRequest
7+
{
8+
/// <summary>
9+
/// The reason for the event.
10+
/// Values: 'changed', 'new', 'removed', etc.
11+
/// </summary>
12+
public string Reason { get; set; }
13+
14+
/// <summary>
15+
/// The 'id' attribute is used to find the target breakpoint and the other attributes are used as the new values.
16+
/// </summary>
17+
public Breakpoint Breakpoint { get; set; }
18+
}
19+
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Threading;
3+
using System.Threading.Tasks;
4+
using OmniSharp.Extensions.DebugAdapter.Protocol.Requests;
5+
using OmniSharp.Extensions.Embedded.MediatR;
6+
using OmniSharp.Extensions.JsonRpc;
7+
8+
namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events
9+
{
10+
public static class BreakpointExtensions
11+
{
12+
public static void SendBreakpoint(this IDebugClient mediator, BreakpointEvent @event)
13+
{
14+
mediator.SendNotification(EventNames.Breakpoint, @event);
15+
}
16+
}
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using OmniSharp.Extensions.DebugAdapter.Protocol.Models;
2+
using OmniSharp.Extensions.Embedded.MediatR;
3+
4+
namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events
5+
{
6+
public class CapabilitiesEvent : IRequest
7+
{
8+
9+
/// <summary>
10+
/// The set of updated capabilities.
11+
/// </summary>
12+
public Capabilities Capabilities { get; set; }
13+
}
14+
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Threading;
3+
using System.Threading.Tasks;
4+
using OmniSharp.Extensions.DebugAdapter.Protocol.Requests;
5+
using OmniSharp.Extensions.Embedded.MediatR;
6+
using OmniSharp.Extensions.JsonRpc;
7+
8+
namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events
9+
{
10+
public static class CapabilitiesExtensions
11+
{
12+
public static void SendCapabilities(this IDebugClient mediator, CapabilitiesEvent @event)
13+
{
14+
mediator.SendNotification(EventNames.Capabilities, @event);
15+
}
16+
}
17+
}
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization;
2+
using OmniSharp.Extensions.Embedded.MediatR;
3+
4+
namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events
5+
{
6+
public class ContinuedEvent : IRequest
7+
{
8+
/// <summary>
9+
/// The thread which was continued.
10+
/// </summary>
11+
public long ThreadId { get; set; }
12+
13+
/// <summary>
14+
/// If 'allThreadsContinued' is true, a debug adapter can announce that all threads have continued.
15+
/// </summary>
16+
[Optional] public bool? AllThreadsContinued { get; set; }
17+
}
18+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Threading;
3+
using System.Threading.Tasks;
4+
using OmniSharp.Extensions.DebugAdapter.Protocol.Requests;
5+
using OmniSharp.Extensions.Embedded.MediatR;
6+
using OmniSharp.Extensions.JsonRpc;
7+
8+
namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events
9+
{
10+
public static class ContinuedExtensions
11+
{
12+
public static void SendContinued(this IDebugClient mediator, ContinuedEvent @event)
13+
{
14+
mediator.SendNotification(EventNames.Continued, @event);
15+
}
16+
}
17+
}

src/Dap.Protocol/Events/EventNames.cs

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
using System.Threading;
5+
6+
namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events
7+
{
8+
public static class EventNames
9+
{
10+
public const string Initialized = "initialized";
11+
public const string Stopped = "stopped";
12+
public const string Continued = "continued";
13+
public const string Exited = "exited";
14+
public const string Terminated = "terminated";
15+
public const string Thread = "thread";
16+
public const string Output = "output";
17+
public const string Breakpoint = "breakpoint";
18+
public const string Module = "module";
19+
public const string LoadedSource = "loadedSource";
20+
public const string Process = "process";
21+
public const string Capabilities = "capabilities";
22+
}
23+
}
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using OmniSharp.Extensions.Embedded.MediatR;
2+
3+
namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events
4+
{
5+
public class ExitedEvent : IRequest
6+
{
7+
8+
/// <summary>
9+
/// The exit code returned from the debuggee.
10+
/// </summary>
11+
public long ExitCode { get; set; }
12+
}
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Threading;
3+
using System.Threading.Tasks;
4+
using OmniSharp.Extensions.DebugAdapter.Protocol.Requests;
5+
using OmniSharp.Extensions.Embedded.MediatR;
6+
using OmniSharp.Extensions.JsonRpc;
7+
8+
namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events
9+
{
10+
public static class ExitedExtensions
11+
{
12+
public static void SendExited(this IDebugClient mediator, ExitedEvent @event)
13+
{
14+
mediator.SendNotification(EventNames.Exited, @event);
15+
}
16+
}
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
using OmniSharp.Extensions.Embedded.MediatR;
2+
3+
namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events
4+
{
5+
public class InitializedEvent : IRequest
6+
{
7+
}
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Threading;
3+
using System.Threading.Tasks;
4+
using OmniSharp.Extensions.DebugAdapter.Protocol.Requests;
5+
using OmniSharp.Extensions.Embedded.MediatR;
6+
using OmniSharp.Extensions.JsonRpc;
7+
8+
namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events
9+
{
10+
public static class InitializedExtensions
11+
{
12+
public static void SendInitialized(this IDebugClient mediator, InitializedEvent @event)
13+
{
14+
mediator.SendNotification(EventNames.Initialized, @event);
15+
}
16+
}
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using OmniSharp.Extensions.DebugAdapter.Protocol.Models;
2+
using OmniSharp.Extensions.Embedded.MediatR;
3+
4+
namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events
5+
{
6+
public class LoadedSourceEvent : IRequest
7+
{
8+
9+
/// <summary>
10+
/// The reason for the event.
11+
/// </summary>
12+
public LoadedSourceReason Reason { get; set; }
13+
14+
/// <summary>
15+
/// The new, changed, or removed source.
16+
/// </summary>
17+
public Source Source { get; set; }
18+
}
19+
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Threading;
3+
using System.Threading.Tasks;
4+
using OmniSharp.Extensions.DebugAdapter.Protocol.Requests;
5+
using OmniSharp.Extensions.Embedded.MediatR;
6+
using OmniSharp.Extensions.JsonRpc;
7+
8+
namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events
9+
{
10+
public static class LoadedSourceExtensions
11+
{
12+
public static void SendLoadedSource(this IDebugClient mediator, LoadedSourceEvent @event)
13+
{
14+
mediator.SendNotification(EventNames.LoadedSource, @event);
15+
}
16+
}
17+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using Newtonsoft.Json;
2+
using Newtonsoft.Json.Converters;
3+
4+
namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events
5+
{
6+
[JsonConverter(typeof(StringEnumConverter))]
7+
public enum LoadedSourceReason
8+
{
9+
New, Changed, Removed
10+
}
11+
}
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
using OmniSharp.Extensions.DebugAdapter.Protocol.Models;
2+
using OmniSharp.Extensions.Embedded.MediatR;
3+
4+
namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events
5+
{
6+
public class ModuleEvent : IRequest
7+
{
8+
9+
/// <summary>
10+
/// The reason for the event.
11+
/// </summary>
12+
public ModuleEventReason Reason { get; set; }
13+
14+
/// <summary>
15+
/// The new, changed, or removed module. In case of 'removed' only the module id is used.
16+
/// </summary>
17+
public Module Module { get; set; }
18+
}
19+
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
using Newtonsoft.Json;
2+
using Newtonsoft.Json.Converters;
3+
4+
namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events
5+
{
6+
[JsonConverter(typeof(StringEnumConverter))]
7+
public enum ModuleEventReason
8+
{
9+
New, Changed, Removed
10+
}
11+
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System;
2+
using System.Threading;
3+
using System.Threading.Tasks;
4+
using OmniSharp.Extensions.DebugAdapter.Protocol.Requests;
5+
using OmniSharp.Extensions.Embedded.MediatR;
6+
using OmniSharp.Extensions.JsonRpc;
7+
8+
namespace OmniSharp.Extensions.DebugAdapter.Protocol.Events
9+
{
10+
public static class ModuleExtensions
11+
{
12+
public static void SendModule(this IDebugClient mediator, ModuleEvent @event)
13+
{
14+
mediator.SendNotification(EventNames.Module, @event);
15+
}
16+
}
17+
}

0 commit comments

Comments
 (0)