private Task <ICommandResponse <ContinueToLocationCommand> > ContinueToLocationCommand(ContinueToLocationCommand arg) { this.BreakOn = GetClosetBreakPoint( this.ScriptsById[arg.Location.ScriptId], arg.Location.LineNumber, arg.Location.ColumnNumber); Continue(); return(Task.FromResult <ICommandResponse <ContinueToLocationCommand> >(new ContinueToLocationCommandResponse())); }
private BreakableScriptPoint GetClosetBreakPoint(ScriptInfo script, long lineNumber, long?columnNumber) { BreakableScriptPoint closestBreakpoint = null; var closestLineDistance = long.MaxValue; var closestColumnDistance = long.MaxValue; foreach (var breakPoint in script.BreakableScriptPoint.Values) { var currentLineDistance = Math.Abs(breakPoint.Info.lineNumber - lineNumber); var currentColumnDistance = columnNumber.HasValue ? Math.Abs(breakPoint.Info.columnNumber - columnNumber.Value) : breakPoint.Info.columnNumber; if (currentLineDistance < closestLineDistance || (currentLineDistance == closestLineDistance && currentColumnDistance < closestColumnDistance)) { closestBreakpoint = breakPoint; closestLineDistance = currentLineDistance; closestColumnDistance = currentColumnDistance; } } return(closestBreakpoint); }
private Task <ICommandResponse <StepOverCommand> > StepOverCommand(StepOverCommand arg) { this.BreakOn = BreakableScriptPoint.Any; Continue(); return(Task.FromResult <ICommandResponse <StepOverCommand> >(new StepOverCommandResponse())); }
private Task <ICommandResponse <PauseCommand> > PauseCommand(PauseCommand arg) { this.BreakOn = BreakableScriptPoint.Any; return(Task.FromResult <ICommandResponse <PauseCommand> >(new PauseCommandResponse())); }