internal static IEnumerable <TagSpan> ProcessOutliningTags(PythonAst ast, ITextSnapshot snapshot) { var walker = new OutliningWalker(snapshot); ast.Walk(walker); return(walker.TagSpans); }
internal static IEnumerable <TagSpan> ProcessOutliningTags(PythonAst ast, ITextSnapshot snapshot) { var walker = new OutliningWalker(snapshot); ast.Walk(walker); return(walker.TagSpans .GroupBy(s => s.Span.Start.GetContainingLine().LineNumber) .Select(ss => ss.OrderBy(s => s.Span.End.GetContainingLine().LineNumber - ss.Key).Last())); }
private void SnapshotOutlineTest(string fileContents, params ExpectedTag[] expected) { var snapshot = new MockTextSnapshot(new MockTextBuffer(fileContents), fileContents); var ast = Parser.CreateParser(new TextSnapshotToTextReader(snapshot), PythonLanguageVersion.V34).ParseFile(); var walker = new OutliningWalker(ast); ast.Walk(walker); var protoTags = walker.GetTags(); var tags = protoTags.Select(x => OutliningTaggerProvider.OutliningTagger.GetTagSpan( x.Span.Start.ToSnapshotPoint(snapshot), x.Span.End.ToSnapshotPoint(snapshot) ) ); VerifyTags(snapshot, tags, expected); }