提交 74539152 编写于 作者: C CyrusNajmabadi

Expose helpers for updating BlockSpans.

上级 b0de0cd9
......@@ -69,6 +69,13 @@ public override async Task ProvideBlockStructureAsync(BlockStructureContext cont
BlockSpanCollector.CollectBlockSpans(
context.Document, syntaxRoot, _nodeProviderMap, _triviaProviderMap, spans, context.CancellationToken);
UpdateAndAddSpans(context, spans);
spans.Free();
}
internal static void UpdateAndAddSpans(BlockStructureContext context, ArrayBuilder<BlockSpan> spans)
{
var options = context.Document.Project.Solution.Workspace.Options;
var language = context.Document.Project.Language;
......@@ -90,11 +97,9 @@ public override async Task ProvideBlockStructureAsync(BlockStructureContext cont
showOutliningForCommentsAndPreprocessorRegions);
context.AddBlockSpan(updatedSpan);
}
spans.Free();
}
private BlockSpan UpdateBlockSpan(BlockSpan blockSpan,
internal static BlockSpan UpdateBlockSpan(BlockSpan blockSpan,
bool showIndentGuidesForCodeLevelConstructs,
bool showIndentGuidesForDeclarationLevelConstructs,
bool showIndentGuidesForCommentsAndPreprocessorRegions,
......@@ -141,12 +146,12 @@ public override async Task ProvideBlockStructureAsync(BlockStructureContext cont
return blockSpan.With(type: type, isCollapsible: isCollapsible);
}
private static bool IsCommentOrPreprocessorRegion(string type)
internal static bool IsCommentOrPreprocessorRegion(string type)
{
return type == BlockTypes.Comment || type == BlockTypes.PreprocessorRegion;
}
protected bool IsCodeLevelConstruct(string type)
internal static bool IsCodeLevelConstruct(string type)
{
switch (type)
{
......@@ -167,7 +172,7 @@ protected bool IsCodeLevelConstruct(string type)
return false;
}
protected bool IsDeclarationLevelConstruct(string type)
internal static bool IsDeclarationLevelConstruct(string type)
{
return !IsCodeLevelConstruct(type) && !IsCommentOrPreprocessorRegion(type);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册