anchor.diff:        return new Future.error(e, st);
       }
     }
  +
  +  /// Ensure that the Analysis engine completes all remaining work. If a
  +  /// timeout is supplied, try to throw an exception if the time is
  +  /// exceeded. This may not happen if a single call to performAnalysisTask
  +  /// takes a long time.
  +  void _ensureAnalysisDone(AnalysisContext context, [Duration timeout]) {
  +    Stopwatch sw = new Stopwatch()..start();
  +
  +    AnalysisResult result = context.performAnalysisTask();
  +    while (result.hasMoreWork) {
  +      if (timeout != null && sw.elapsed > timeout) {
  +        throw new TimeoutException(
  +            "_ensureAnalysisDone exceeeded allowed time");
  +      }
  +      result = context.performAnalysisTask();
  +    }
  +  }
  +
  +
   
     Future<Map<String, String>> dartdoc(String source, int offset) {
       try {
  
positive.code:       sourcesList.forEach((s) => changeSet.removedSource(s));
        _resolver.clear();
        _context.applyChanges(changeSet);
        _context.performAnalysisTask();
  
        return new Future.value(new AnalysisResults(
            issues, packageImports.toList(), resolvedImports));
  
negative.code:       ChangeSet changeSet = new ChangeSet();
        sourcesList.forEach((s) => changeSet.addedSource(s));
        _context.applyChanges(changeSet);
        _ensureAnalysisDone(_context, _MAX_ANALYSIS_DURATION);
  
        List<AnalysisErrorInfo> errorInfos = [];
        sourcesList.forEach((s) {
  