public void SetResponse(Response response, dynamic body = null) { if (body != null) { response.SetBody(body); } }
public void SendResponse(Response response, dynamic body = null) { if (body != null) { response.SetBody(body); } SendMessage(response); }
void SendResponse(string command, int seq, dynamic body) { var response = new Response(command, seq); if (body != null) { response.SetBody(body); } toVSCode.SendMessage(response); }
public override void SetBreakpoints(Response response, dynamic args) { string path = null; if (args.source != null) { string p = (string)args.source.path; if (p != null && p.Trim().Length > 0) { path = p; } } if (path == null) { SendErrorResponse(response, 3010, "setBreakpoints: property 'source' is empty or misformed", null, false, true); return; } path = ConvertClientPathToDebugger(path); if (!HasMonoExtension(path)) { // we only support breakpoints in files mono can handle SendResponse(response, new SetBreakpointsResponseBody()); return; } var clientLines = args.lines.ToObject <int[]>(); HashSet <int> lin = new HashSet <int>(); for (int i = 0; i < clientLines.Length; i++) { lin.Add(ConvertClientLineToDebugger(clientLines[i])); } // find all breakpoints for the given path and remember their id and line number var bpts = new List <Tuple <int, int> >(); foreach (var be in Debugger.Breakpoints) { var bp = be.Value as Mono.Debugging.Client.Breakpoint; if (bp != null && bp.FileName == path) { bpts.Add(new Tuple <int, int>((int)be.Key, (int)bp.Line)); } } HashSet <int> lin2 = new HashSet <int>(); foreach (var bpt in bpts) { if (lin.Contains(bpt.Item2)) { lin2.Add(bpt.Item2); } else { // Console.WriteLine("cleared bpt #{0} for line {1}", bpt.Item1, bpt.Item2); BreakEvent b; if (Debugger.Breakpoints.TryGetValue(bpt.Item1, out b)) { Debugger.Breakpoints.Remove(bpt.Item1); Debugger.BreakEvents.Remove(b); } } } for (int i = 0; i < clientLines.Length; i++) { var l = ConvertClientLineToDebugger(clientLines[i]); if (!lin2.Contains(l)) { var id = Debugger.GetBreakpointId(); Debugger.Breakpoints.Add(id, Debugger.BreakEvents.Add(path, l)); // Console.WriteLine("added bpt #{0} for line {1}", id, l); } } var breakpoints = new List <Breakpoint>(); foreach (var l in clientLines) { breakpoints.Add(new Breakpoint(true, l)); } response.SetBody(new SetBreakpointsResponseBody(breakpoints)); }
public override void SetBreakpoints(Response response, dynamic args) { string path = null; if (args.source != null) { string p = (string)args.source.path; if (p != null && p.Trim().Length > 0) { path = p; } } if (path == null) { SendErrorResponse(response, 3010, "setBreakpoints: property 'source' is empty or misformed", null, false, true); return; } path = ConvertClientPathToDebugger(path); if (!HasMonoExtension(path)) { // we only support breakpoints in files mono can handle SendResponse(response, new SetBreakpointsResponseBody()); return; } var clientLines = args.lines.ToObject<int[]>(); HashSet<int> lin = new HashSet<int>(); for (int i = 0; i < clientLines.Length; i++) { lin.Add(ConvertClientLineToDebugger(clientLines[i])); } // find all breakpoints for the given path and remember their id and line number var bpts = new List<Tuple<int, int>>(); foreach (var be in Debugger.Breakpoints) { var bp = be.Value as Mono.Debugging.Client.Breakpoint; if (bp != null && bp.FileName == path) { bpts.Add(new Tuple<int,int>((int)be.Key, (int)bp.Line)); } } HashSet<int> lin2 = new HashSet<int>(); foreach (var bpt in bpts) { if (lin.Contains(bpt.Item2)) { lin2.Add(bpt.Item2); } else { // Console.WriteLine("cleared bpt #{0} for line {1}", bpt.Item1, bpt.Item2); BreakEvent b; if (Debugger.Breakpoints.TryGetValue(bpt.Item1, out b)) { Debugger.Breakpoints.Remove(bpt.Item1); Debugger.BreakEvents.Remove(b); } } } for (int i = 0; i < clientLines.Length; i++) { var l = ConvertClientLineToDebugger(clientLines[i]); if (!lin2.Contains(l)) { var id = Debugger.GetBreakpointId(); Debugger.Breakpoints.Add(id, Debugger.BreakEvents.Add(path, l)); // Console.WriteLine("added bpt #{0} for line {1}", id, l); } } var breakpoints = new List<Breakpoint>(); foreach (var l in clientLines) { breakpoints.Add(new Breakpoint(true, l)); } response.SetBody(new SetBreakpointsResponseBody(breakpoints)); }
public override void StackTrace(Response response, dynamic arguments) { List <StackFrame> frames = new List <StackFrame>(); response.SetBody(new StackTraceResponseBody(frames, frames.Count)); }