public IEnumerable <ITagSpan <IClassificationTag> > GetTags(NormalizedSnapshotSpanCollection spans) { if (spans.Count == 0) { return(Enumerable.Empty <ITagSpan <IClassificationTag> >()); } if (this.cache == null || this.cache.Snapshot != spans[0].Snapshot) { var task = RoslynDocument.Resolve(theBuffer, spans[0].Snapshot); task.Wait(); if (task.IsFaulted) { return(Enumerable.Empty <ITagSpan <IClassificationTag> >()); } cache = task.Result; } return(FindBracketSpans(this.cache, spans)); }
public IEnumerable <ITagSpan <IClassificationTag> > GetTags(NormalizedSnapshotSpanCollection spans) { if (spans.Count == 0) { return(Enumerable.Empty <ITagSpan <IClassificationTag> >()); } if (this.cache == null || this.cache.Snapshot != spans[0].Snapshot) { // this makes me feel dirty, but otherwise it will not // work reliably, as TryGetSemanticModel() often will return false // should make this into a completely async process somehow var task = RoslynDocument.Resolve(theBuffer, spans[0].Snapshot); task.Wait(); if (task.IsFaulted) { // TODO: report this to someone. return(Enumerable.Empty <ITagSpan <IClassificationTag> >()); } cache = task.Result; } return(GetTagsImpl(this.cache, spans)); }