|
14 | 14 | using VSCodeDebug;
|
15 | 15 | using MonoDevelop.Debugger.Soft.Unity;
|
16 | 16 | using MonoDevelop.Unity.Debugger;
|
| 17 | +using Newtonsoft.Json.Linq; |
| 18 | +using Breakpoint = Mono.Debugging.Client.Breakpoint; |
17 | 19 |
|
18 | 20 | namespace UnityDebug
|
19 | 21 | {
|
@@ -177,7 +179,7 @@ public override void Initialize(Response response, dynamic args)
|
177 | 179 | supportsFunctionBreakpoints = false,
|
178 | 180 |
|
179 | 181 | // This debug adapter doesn't support conditional breakpoints.
|
180 |
| - supportsConditionalBreakpoints = false, |
| 182 | + supportsConditionalBreakpoints = true, |
181 | 183 |
|
182 | 184 | // This debug adapter does support a side effect free evaluate request for data hovers.
|
183 | 185 | supportsEvaluateForHovers = true,
|
@@ -490,10 +492,18 @@ public override void SetBreakpoints(Response response, dynamic args)
|
490 | 492 | }
|
491 | 493 |
|
492 | 494 | var breakpoints = new List<VSCodeDebug.Breakpoint>();
|
493 |
| - foreach (var l in clientLines) { |
| 495 | + foreach (var l in clientLines) |
| 496 | + { |
494 | 497 | breakpoints.Add(new VSCodeDebug.Breakpoint(true, l));
|
495 | 498 | }
|
496 | 499 |
|
| 500 | + SourceBreakpoint[] breaks = getBreakpoints(args, "breakpoints"); |
| 501 | + foreach (Breakpoint breakpoint in _session.Breakpoints) |
| 502 | + { |
| 503 | + var sourceBreakpoint = breaks.First(bp => bp.line == breakpoint.Line); |
| 504 | + breakpoint.ConditionExpression = sourceBreakpoint.condition; |
| 505 | + } |
| 506 | + |
497 | 507 | SendResponse(response, new SetBreakpointsResponseBody(breakpoints));
|
498 | 508 | }
|
499 | 509 |
|
@@ -912,6 +922,13 @@ private static string getString(dynamic args, string property, string dflt = nul
|
912 | 922 | }
|
913 | 923 | return s;
|
914 | 924 | }
|
| 925 | + |
| 926 | + static SourceBreakpoint[] getBreakpoints(dynamic args, string property) |
| 927 | + { |
| 928 | + JArray jsonBreakpoints = args[property]; |
| 929 | + var breakpoints = jsonBreakpoints.ToObject<SourceBreakpoint[]>(); |
| 930 | + return breakpoints ?? new SourceBreakpoint[0]; |
| 931 | + } |
915 | 932 |
|
916 | 933 | private void DebuggerKill()
|
917 | 934 | {
|
|
0 commit comments