private async Task <IOutliningManager> GetOutlineManagerAsync(Text.Editor.IWpfTextView textView, CancellationToken cancellationToken) { await TestServices.JoinableTaskFactory.SwitchToMainThreadAsync(); var outliningService = await TestServices.Shell.GetComponentModelServiceAsync <IOutliningManagerService>(cancellationToken); return(outliningService.GetOutliningManager(textView)); }
public async Task <ICollapsible[]> GetOutlineRegionsAsync(Text.Editor.IWpfTextView textView, CancellationToken cancellationToken) { var span = new SnapshotSpan(textView.TextSnapshot, 0, textView.TextSnapshot.Length); var manager = await GetOutlineManagerAsync(textView, cancellationToken); var outlines = manager.GetAllRegions(span); return(outlines .OrderBy(s => s.Extent.GetStartPoint(textView.TextSnapshot)) .ToArray()); }