Skip to content

Commit 424ba46

Browse files
Updated to latest dap spec
1 parent dfd75b7 commit 424ba46

39 files changed

+1324
-300
lines changed

debug-adapter-protocol.sha.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
-- This is the last commit we caught up with https://github.com/microsoft/debug-adapter-protocol/commits/gh-pages
2+
lastSha: fd7d38013c9e13e92c0ca4dfa83048d355cb057d
3+
4+
https://github.com/microsoft/debug-adapter-protocol/compare/fd7d38013c9e13e92c0ca4dfa83048d355cb057d..gh-pages

src/Dap.Client/DebugAdapterClientOptions.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using Newtonsoft.Json.Linq;
55
using OmniSharp.Extensions.DebugAdapter.Protocol;
66
using OmniSharp.Extensions.DebugAdapter.Protocol.Client;
7+
using OmniSharp.Extensions.DebugAdapter.Protocol.Models;
78
using OmniSharp.Extensions.DebugAdapter.Protocol.Requests;
89
using OmniSharp.Extensions.DebugAdapter.Shared;
910
using OmniSharp.Extensions.JsonRpc;
@@ -24,12 +25,13 @@ public DebugAdapterClientOptions()
2425
public string? Locale { get; set; }
2526
public bool LinesStartAt1 { get; set; }
2627
public bool ColumnsStartAt1 { get; set; }
27-
public string? PathFormat { get; set; }
28+
public PathFormat? PathFormat { get; set; }
2829
public bool SupportsVariableType { get; set; }
2930
public bool SupportsVariablePaging { get; set; }
3031
public bool SupportsRunInTerminalRequest { get; set; }
3132
public bool SupportsMemoryReferences { get; set; }
3233
public bool SupportsProgressReporting { get; set; }
34+
public bool SupportsInvalidatedEvent { get; set; }
3335

3436
IDebugAdapterClientRegistry IJsonRpcHandlerRegistry<IDebugAdapterClientRegistry>.AddHandler(string method, IJsonRpcHandler handler, JsonRpcHandlerOptions? options) =>
3537
AddHandler(method, handler, options);

src/Dap.Protocol/Events/EventNames.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ public static class EventNames
44
{
55
public const string Initialized = "initialized";
66
public const string Stopped = "stopped";
7+
public const string Invalidated = "invalidated";
78
public const string Continued = "continued";
89
public const string Exited = "exited";
910
public const string Terminated = "terminated";

src/Dap.Protocol/Feature/Events/BreakpointFeature.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,12 +92,21 @@ public record BreakpointEvent : IRequest
9292
/// The reason for the event.
9393
/// Values: 'changed', 'new', 'removed', etc.
9494
/// </summary>
95-
public string Reason { get; init; }
95+
public BreakpointEventReason Reason { get; init; }
9696

9797
/// <summary>
9898
/// The 'id' attribute is used to find the target breakpoint and the other attributes are used as the new values.
9999
/// </summary>
100100
public Breakpoint Breakpoint { get; init; }
101101
}
102+
103+
104+
[StringEnum]
105+
public readonly partial struct BreakpointEventReason
106+
{
107+
public static readonly BreakpointEventReason Changed = new BreakpointEventReason("changed");
108+
public static readonly BreakpointEventReason New = new BreakpointEventReason("new");
109+
public static readonly BreakpointEventReason Removed = new BreakpointEventReason("removed");
110+
}
102111
}
103112
}

src/Dap.Protocol/Feature/Events/CapabilitiesFeature.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,16 @@ public record Capabilities
221221
/// </summary>
222222
[Optional]
223223
public bool SupportsInstructionBreakpoints { get; set; }
224+
225+
/// <summary>
226+
/// The debug adapter supports 'filterOptions' as an argument on the
227+
/// 'setExceptionBreakpoints' request.
228+
/// </summary>
229+
[Optional]
230+
public bool SupportsExceptionFilterOptions { get; set; }
224231
}
225232
}
233+
226234
namespace Events
227235
{
228236
[Parallel]
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Diagnostics;
4+
using System.Linq;
5+
using System.Reflection;
6+
using System.Threading;
7+
using System.Threading.Tasks;
8+
using MediatR;
9+
using Newtonsoft.Json;
10+
using OmniSharp.Extensions.DebugAdapter.Protocol.Models;
11+
using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization;
12+
using OmniSharp.Extensions.JsonRpc;
13+
using OmniSharp.Extensions.JsonRpc.Generation;
14+
using OmniSharp.Extensions.JsonRpc.Serialization.Converters;
15+
16+
// ReSharper disable once CheckNamespace
17+
namespace OmniSharp.Extensions.DebugAdapter.Protocol
18+
{
19+
namespace Events
20+
{
21+
[Parallel]
22+
[Method(EventNames.Invalidated, Direction.ServerToClient)]
23+
[
24+
GenerateHandler,
25+
GenerateHandlerMethods,
26+
GenerateRequestMethods
27+
]
28+
public record InvalidatedEvent : IRequest
29+
{
30+
/// <summary>
31+
/// Optional set of logical areas that got invalidated. This property has a
32+
/// hint characteristic: a client can only be expected to make a 'best
33+
/// effort' in honouring the areas but there are no guarantees. If this
34+
/// property is missing, empty, or if values are not understand the client
35+
/// should assume a single value 'all'.
36+
/// </summary>
37+
[Optional]
38+
public Container<InvalidatedAreas>? Areas { get; init; }
39+
40+
/// <summary>
41+
/// If specified, the client only needs to refetch data related to this
42+
/// thread.
43+
/// </summary>
44+
[Optional]
45+
public int? ThreadId { get; init; }
46+
47+
/// <summary>
48+
/// If specified, the client only needs to refetch data related to this stack
49+
/// frame (and the 'threadId' is ignored).
50+
/// </summary>
51+
[Optional]
52+
public int? StackFrameId { get; init; }
53+
}
54+
}
55+
}

src/Dap.Protocol/Feature/Events/LoadedSourceFeature.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,12 @@ public record LoadedSourceEvent : IRequest
3232
public Source Source { get; init; }
3333
}
3434

35-
[JsonConverter(typeof(StringEnumConverter))]
36-
public enum LoadedSourceReason
35+
[StringEnum]
36+
public readonly partial struct LoadedSourceReason
3737
{
38-
New, Changed, Removed
38+
public static readonly LoadedSourceReason Changed = new LoadedSourceReason("changed");
39+
public static readonly LoadedSourceReason New = new LoadedSourceReason("new");
40+
public static readonly LoadedSourceReason Removed = new LoadedSourceReason("removed");
3941
}
4042
}
4143
}

src/Dap.Protocol/Feature/Events/ModuleFeature.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,12 @@ public record ModuleEvent : IRequest
3232
public Module Module { get; init; }
3333
}
3434

35-
[JsonConverter(typeof(StringEnumConverter))]
36-
public enum ModuleEventReason
35+
[StringEnum]
36+
public readonly partial struct ModuleEventReason
3737
{
38-
New, Changed, Removed
38+
public static readonly ModuleEventReason Changed = new ModuleEventReason("changed");
39+
public static readonly ModuleEventReason New = new ModuleEventReason("new");
40+
public static readonly ModuleEventReason Removed = new ModuleEventReason("removed");
3941
}
4042
}
4143
}

src/Dap.Protocol/Feature/Events/OutputFeature.cs

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,39 @@ public record OutputEvent : IRequest
2626
/// Values: 'console', 'stdout', 'stderr', 'telemetry', etc.
2727
/// </summary>
2828
[Optional]
29-
public string? Category { get; init; }
29+
public OutputEventCategory Category { get; init; } = OutputEventCategory.Console;
3030

3131
/// <summary>
3232
/// The output to report.
3333
/// </summary>
3434
public string Output { get; init; }
3535

3636
/// <summary>
37-
/// 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.
37+
/// Support for keeping an output log organized by grouping related messages.
38+
/// Values:
39+
/// 'start': Start a new group in expanded mode. Subsequent output events are
40+
/// members of the group and should be shown indented.
41+
/// The 'output' attribute becomes the name of the group and is not indented.
42+
/// 'startCollapsed': Start a new group in collapsed mode. Subsequent output
43+
/// events are members of the group and should be shown indented (as soon as
44+
/// the group is expanded).
45+
/// The 'output' attribute becomes the name of the group and is not indented.
46+
/// 'end': End the current group and decreases the indentation of subsequent
47+
/// output events.
48+
/// A non empty 'output' attribute is shown as the unindented end of the
49+
/// group.
50+
/// etc.
3851
/// </summary>
3952
[Optional]
53+
public OutputEventGroup Group { get; set; }
54+
55+
/// <summary>
56+
/// If an attribute 'variablesReference' exists and its value is > 0, the
57+
/// output contains objects which can be retrieved by passing
58+
/// 'variablesReference' to the 'variables' request. The value should be less
59+
/// than or equal to 2147483647 (2^31-1).
60+
/// </summary>
61+
[Optional]
4062
public long? VariablesReference { get; init; }
4163

4264
/// <summary>
@@ -63,5 +85,22 @@ public record OutputEvent : IRequest
6385
[Optional]
6486
public JToken? Data { get; init; }
6587
}
88+
89+
[StringEnum]
90+
public readonly partial struct OutputEventCategory
91+
{
92+
public static readonly OutputEventCategory Console = new OutputEventCategory("console");
93+
public static readonly OutputEventCategory StandardOutput = new OutputEventCategory("stdout");
94+
public static readonly OutputEventCategory StandardError = new OutputEventCategory("stderr");
95+
public static readonly OutputEventCategory Telemetry = new OutputEventCategory("telemetry");
96+
}
97+
98+
[StringEnum]
99+
public readonly partial struct OutputEventGroup
100+
{
101+
public static readonly OutputEventGroup Start = new OutputEventGroup("start");
102+
public static readonly OutputEventGroup StartCollapsed = new OutputEventGroup("startCollapsed");
103+
public static readonly OutputEventGroup End = new OutputEventGroup("end");
104+
}
66105
}
67106
}

src/Dap.Protocol/Feature/Events/ProcessFeature.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,12 @@ public record ProcessEvent : IRequest
5454
public long? PointerSize { get; init; }
5555
}
5656

57-
[JsonConverter(typeof(StringEnumConverter))]
58-
public enum ProcessEventStartMethod
57+
[StringEnum]
58+
public readonly partial struct ProcessEventStartMethod
5959
{
60-
Launch, Attach, AttachForSuspendedLaunch
60+
public static readonly ProcessEventStartMethod Launch = new ProcessEventStartMethod("launch");
61+
public static readonly ProcessEventStartMethod Attach = new ProcessEventStartMethod("attach");
62+
public static readonly ProcessEventStartMethod AttachForSuspendedLaunch = new ProcessEventStartMethod("attachForSuspendedLaunch");
6163
}
6264
}
6365
}

src/Dap.Protocol/Feature/Events/StoppedFeature.cs

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
1-
using System.Threading;
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Diagnostics;
4+
using System.Linq;
5+
using System.Reflection;
6+
using System.Threading;
27
using System.Threading.Tasks;
38
using MediatR;
9+
using Newtonsoft.Json;
410
using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization;
511
using OmniSharp.Extensions.JsonRpc;
612
using OmniSharp.Extensions.JsonRpc.Generation;
13+
using OmniSharp.Extensions.JsonRpc.Serialization.Converters;
714

815
// ReSharper disable once CheckNamespace
916
namespace OmniSharp.Extensions.DebugAdapter.Protocol
@@ -24,7 +31,7 @@ public record StoppedEvent : IRequest
2431
/// For backward compatibility this string is shown in the UI if the 'description' attribute is missing (but it must not be translated).
2532
/// Values: 'step', 'breakpoint', 'exception', 'pause', 'entry', 'goto', 'function breakpoint', 'data breakpoint', etc.
2633
/// </summary>
27-
public string Reason { get; init; }
34+
public StoppedEventReason Reason { get; init; }
2835

2936
/// <summary>
3037
/// The full reason for the event, e.g. 'Paused on exception'. This string is shown in the UI as is and must be translated.
@@ -58,5 +65,19 @@ public record StoppedEvent : IRequest
5865
[Optional]
5966
public bool AllThreadsStopped { get; init; }
6067
}
68+
69+
[StringEnum]
70+
public readonly partial struct StoppedEventReason
71+
{
72+
public static readonly StoppedEventReason Step = new StoppedEventReason("step");
73+
public static readonly StoppedEventReason Breakpoint = new StoppedEventReason("breakpoint");
74+
public static readonly StoppedEventReason Exception = new StoppedEventReason("exception");
75+
public static readonly StoppedEventReason Pause = new StoppedEventReason("pause");
76+
public static readonly StoppedEventReason Entry = new StoppedEventReason("entry");
77+
public static readonly StoppedEventReason Goto = new StoppedEventReason("goto");
78+
public static readonly StoppedEventReason FunctionBreakpoint = new StoppedEventReason("function breakpoint");
79+
public static readonly StoppedEventReason DataBreakpoint = new StoppedEventReason("data breakpoint");
80+
public static readonly StoppedEventReason InstructionBreakpoint = new StoppedEventReason("instruction breakpoint");
81+
}
6182
}
6283
}

src/Dap.Protocol/Feature/Events/ThreadFeature.cs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
1-
using System.Threading;
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Diagnostics;
4+
using System.Linq;
5+
using System.Reflection;
6+
using System.Threading;
27
using System.Threading.Tasks;
38
using MediatR;
9+
using Newtonsoft.Json;
10+
using OmniSharp.Extensions.DebugAdapter.Protocol.Serialization;
411
using OmniSharp.Extensions.JsonRpc;
512
using OmniSharp.Extensions.JsonRpc.Generation;
13+
using OmniSharp.Extensions.JsonRpc.Serialization.Converters;
614

715
// ReSharper disable once CheckNamespace
816
namespace OmniSharp.Extensions.DebugAdapter.Protocol
@@ -22,12 +30,19 @@ public record ThreadEvent : IRequest
2230
/// The reason for the event.
2331
/// Values: 'started', 'exited', etc.
2432
/// </summary>
25-
public string Reason { get; init; }
33+
public ThreadEventReason Reason { get; init; }
2634

2735
/// <summary>
2836
/// The identifier of the thread.
2937
/// </summary>
3038
public long ThreadId { get; init; }
3139
}
40+
41+
[StringEnum]
42+
public readonly partial struct ThreadEventReason
43+
{
44+
public static readonly ThreadEventReason Started = new ThreadEventReason("started");
45+
public static readonly ThreadEventReason Exited = new ThreadEventReason("exited");
46+
}
3247
}
3348
}

src/Dap.Protocol/Feature/Requests/DisassembleFeature.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public record DisassembledInstruction
8585
public string Instruction { get; init; }
8686

8787
/// <summary>
88-
/// Name of the symbol that correponds with the location of this instruction, if any.
88+
/// Name of the symbol that corresponds with the location of this instruction, if any.
8989
/// </summary>
9090
[Optional]
9191
public string? Symbol { get; init; }

src/Dap.Protocol/Feature/Requests/EvaluateFeature.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public record EvaluateArguments : IRequest<EvaluateResponse>
4040
/// etc.
4141
/// </summary>
4242
[Optional]
43-
public string? Context { get; init; }
43+
public EvaluateArgumentsContext? Context { get; init; }
4444

4545
/// <summary>
4646
/// Specifies details on how to format the Evaluate result.
@@ -49,6 +49,15 @@ public record EvaluateArguments : IRequest<EvaluateResponse>
4949
public ValueFormat? Format { get; init; }
5050
}
5151

52+
[StringEnum]
53+
public readonly partial struct EvaluateArgumentsContext
54+
{
55+
public static EvaluateArgumentsContext Watch { get; } = new EvaluateArgumentsContext("watch");
56+
public static EvaluateArgumentsContext Repl { get; } = new EvaluateArgumentsContext("repl");
57+
public static EvaluateArgumentsContext Hover { get; } = new EvaluateArgumentsContext("hover");
58+
public static EvaluateArgumentsContext Clipboard { get; } = new EvaluateArgumentsContext("clipboard");
59+
}
60+
5261
public record EvaluateResponse
5362
{
5463
/// <summary>

src/Dap.Protocol/Feature/Requests/InitializeRequestFeature.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public record InitializeRequestArguments : IRequest<InitializeResponse>, IInitia
6363
/// Values: 'path', 'uri', etc.
6464
/// </summary>
6565
[Optional]
66-
public string? PathFormat { get; set; }
66+
public PathFormat? PathFormat { get; set; }
6767

6868
/// <summary>
6969
/// Client supports the optional type attribute for variables.
@@ -94,6 +94,12 @@ public record InitializeRequestArguments : IRequest<InitializeResponse>, IInitia
9494
/// </summary>
9595
[Optional]
9696
public bool SupportsProgressReporting { get; set; }
97+
98+
/// <summary>
99+
/// Client supports the invalidated event.
100+
/// </summary>
101+
[Optional]
102+
public bool SupportsInvalidatedEvent { get; set; }
97103
}
98104

99105
public record InitializeResponse : Capabilities

0 commit comments

Comments
 (0)