提交 ed31687c 编写于 作者: C CyrusNajmabadi

Move helpers.

上级 0c8a7fcd
......@@ -45,5 +45,58 @@ internal static class BlockTypes
// Expressions
public const string AnonymousMethod = nameof(AnonymousMethod);
public const string Xml = nameof(Xml);
internal static bool IsCommentOrPreprocessorRegion(string type)
{
switch (type)
{
case BlockTypes.Comment:
case BlockTypes.PreprocessorRegion:
return true;
}
return false;
}
internal static bool IsExpressionLevelConstruct(string type)
{
switch (type)
{
case BlockTypes.AnonymousMethod:
case BlockTypes.Xml:
return true;
}
return false;
}
internal static bool IsStatementLevelConstruct(string type)
{
switch (type)
{
case BlockTypes.Case:
case BlockTypes.Conditional:
case BlockTypes.LocalFunction:
case BlockTypes.Lock:
case BlockTypes.Loop:
case BlockTypes.TryCatchFinally:
case BlockTypes.Using:
case BlockTypes.Standalone:
case BlockTypes.Switch:
return true;
}
return false;
}
internal static bool IsCodeLevelConstruct(string type)
{
return IsExpressionLevelConstruct(type) || IsStatementLevelConstruct(type);
}
internal static bool IsDeclarationLevelConstruct(string type)
{
return !IsCodeLevelConstruct(type) && !IsCommentOrPreprocessorRegion(type);
}
}
}
\ No newline at end of file
......@@ -108,9 +108,9 @@ internal static void UpdateAndAddSpans(BlockStructureContext context, ArrayBuild
{
var type = blockSpan.Type;
var isTopLevel = IsDeclarationLevelConstruct(type);
var isMemberLevel = IsCodeLevelConstruct(type);
var isComment = IsCommentOrPreprocessorRegion(type);
var isTopLevel = BlockTypes.IsDeclarationLevelConstruct(type);
var isMemberLevel = BlockTypes.IsCodeLevelConstruct(type);
var isComment = BlockTypes.IsCommentOrPreprocessorRegion(type);
if (!showIndentGuidesForDeclarationLevelConstructs && isTopLevel)
{
......@@ -144,36 +144,5 @@ internal static void UpdateAndAddSpans(BlockStructureContext context, ArrayBuild
return blockSpan.With(type: type, isCollapsible: isCollapsible);
}
internal static bool IsCommentOrPreprocessorRegion(string type)
{
return type == BlockTypes.Comment || type == BlockTypes.PreprocessorRegion;
}
internal static bool IsCodeLevelConstruct(string type)
{
switch (type)
{
case BlockTypes.Case:
case BlockTypes.Conditional:
case BlockTypes.LocalFunction:
case BlockTypes.Lock:
case BlockTypes.Loop:
case BlockTypes.TryCatchFinally:
case BlockTypes.Using:
case BlockTypes.Standalone:
case BlockTypes.Switch:
case BlockTypes.AnonymousMethod:
case BlockTypes.Xml:
return true;
}
return false;
}
internal static bool IsDeclarationLevelConstruct(string type)
{
return !IsCodeLevelConstruct(type) && !IsCommentOrPreprocessorRegion(type);
}
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册