private static string GetStructureTagType(BlockSpanType type) { switch (type) { case BlockSpanType.Namespace: return(PredefinedStructureTagTypes.Namespace); case BlockSpanType.Type: return(PredefinedStructureTagTypes.Type); case BlockSpanType.Member: return(PredefinedStructureTagTypes.Member); case BlockSpanType.Conditional: return(PredefinedStructureTagTypes.Conditional); case BlockSpanType.Loop: return(PredefinedStructureTagTypes.Loop); case BlockSpanType.PreprocessorRegion: return(PredefinedStructureTagTypes.PreprocessorRegion); default: throw new ArgumentOutOfRangeException(nameof(type)); } }
private void CreateTag( BlockSpanType type, SyntaxToken startToken, SyntaxToken endToken, SyntaxToken hintStartToken, SyntaxToken hintEndToken, bool isImplementation) { if (startToken == null || !startToken.FileSpan.IsInRootFile || endToken == null || !endToken.FileSpan.IsInRootFile) { return; } var textSpan = new TextSpan(startToken.FileSpan.Span.End, endToken.FileSpan.Span.End - startToken.FileSpan.Span.End); var lineSpan = _sourceText.Lines.GetLinePositionSpan(textSpan); var isCollapsible = lineSpan.Start.Line != lineSpan.End.Line; _results.Add(new BlockSpan( type, isCollapsible, textSpan, TextSpan.FromBounds(hintStartToken.FileSpan.Span.Start, hintEndToken.FileSpan.Span.End), "...", isImplementation, false)); }
public BlockSpan( BlockSpanType type, bool isCollapsible, TextSpan textSpan, TextSpan hintSpan, string bannerText, bool autoCollapse, bool isDefaultCollapsed) { Type = type; TextSpan = textSpan; BannerText = bannerText; HintSpan = hintSpan; AutoCollapse = autoCollapse; IsDefaultCollapsed = isDefaultCollapsed; IsCollapsible = isCollapsible; }