Ejemplo n.º 1
0
        public async Task <IList <OutliningSpan> > GetOutliningSpansAsync(Document document, CancellationToken cancellationToken)
        {
            try
            {
                var syntaxDocument = await SyntacticDocument.CreateAsync(document, cancellationToken).ConfigureAwait(false);

                // change this to shared pool once RI
                var regions = new List <OutliningSpan>();
                RegionCollector.CollectOutliningSpans(syntaxDocument, _nodeOutlinerMap, _triviaOutlinerMap, regions, cancellationToken);

                return(regions);
            }
            catch (Exception e) when(FatalError.ReportUnlessCanceled(e))
            {
                throw ExceptionUtilities.Unreachable;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Keep in sync with <see cref="GetOutliningSpansAsync"/>
        /// </summary>
        public IList <OutliningSpan> GetOutliningSpans(
            Document document, CancellationToken cancellationToken)
        {
            try
            {
                var syntaxRoot = document.GetSyntaxRootSynchronously(cancellationToken);

                // change this to shared pool once RI
                var regions = new List <OutliningSpan>();
                RegionCollector.CollectOutliningSpans(document, syntaxRoot, _nodeOutlinerMap, _triviaOutlinerMap, regions, cancellationToken);
                return(regions);
            }
            catch (Exception e) when(FatalError.ReportUnlessCanceled(e))
            {
                throw ExceptionUtilities.Unreachable;
            }
        }