use of org.rstudio.studio.client.common.debugging.model.FunctionState in project rstudio by rstudio.
the class BreakpointManager method setBreakpoint.
public Breakpoint setBreakpoint(final String path, final String functionName, int lineNumber, final boolean immediately) {
// create the new breakpoint and arguments for the server call
final Breakpoint breakpoint = addBreakpoint(Breakpoint.create(currentBreakpointId_++, path, functionName, lineNumber, immediately ? Breakpoint.STATE_PROCESSING : Breakpoint.STATE_INACTIVE, Breakpoint.TYPE_FUNCTION));
notifyServer(breakpoint, true, false);
// expectations. Process it when the function is no longer executing.
if (activeFunctions_.contains(new FileFunction(breakpoint))) {
breakpoint.setPendingDebugCompletion(true);
markInactiveBreakpoint(breakpoint);
} else {
server_.getFunctionState(functionName, path, lineNumber, new ServerRequestCallback<FunctionState>() {
@Override
public void onResponseReceived(FunctionState state) {
if (state.isPackageFunction()) {
breakpoint.markAsPackageBreakpoint(state.getPackageName());
}
// stop processing now
if (!immediately)
return;
// the breakpoint now
if (state.getSyncState()) {
prepareAndSetFunctionBreakpoints(new FileFunction(breakpoint));
} else // otherwise, save an inactive breakpoint--we'll revisit the
// marker the next time the file is sourced or the package is
// rebuilt
{
markInactiveBreakpoint(breakpoint);
}
}
@Override
public void onError(ServerError error) {
// if we can't figure out whether the function is in sync,
// leave it inactive for now
markInactiveBreakpoint(breakpoint);
}
});
}
breakpointStateDirty_ = true;
return breakpoint;
}
Aggregations