提交 6a2b5381 编写于 作者: S Sam Harwell

Updated documentation for compressEmptyLines values

上级 83d491a1
......@@ -32,10 +32,15 @@ internal class AccessorDeclarationStructureProvider : AbstractSyntaxNodeStructur
SyntaxNodeOrToken current = accessorDeclaration;
var nextSibling = current.GetNextSibling();
// Check IsNode to compress blank lines after this node if it is the last child of the parent.
//
// All accessor kinds are grouped together.
var compressEmptyLines = !nextSibling.IsNode || nextSibling.AsNode() is AccessorDeclarationSyntax;
spans.AddIfNotNull(CSharpStructureHelpers.CreateBlockSpan(
accessorDeclaration,
accessorDeclaration.Keyword,
compressEmptyLines: !nextSibling.IsNode || nextSibling.AsNode() is AccessorDeclarationSyntax,
compressEmptyLines: compressEmptyLines,
autoCollapse: true,
type: BlockTypes.Member,
isCollapsible: true));
......
......@@ -32,10 +32,13 @@ internal class ConstructorDeclarationStructureProvider : AbstractSyntaxNodeStruc
SyntaxNodeOrToken current = constructorDeclaration;
var nextSibling = current.GetNextSibling();
// Check IsNode to compress blank lines after this node if it is the last child of the parent.
var compressEmptyLines = !nextSibling.IsNode || nextSibling.IsKind(SyntaxKind.ConstructorDeclaration);
spans.AddIfNotNull(CSharpStructureHelpers.CreateBlockSpan(
constructorDeclaration,
constructorDeclaration.ParameterList.GetLastToken(includeZeroWidth: true),
compressEmptyLines: !nextSibling.IsNode || nextSibling.IsKind(SyntaxKind.ConstructorDeclaration),
compressEmptyLines: compressEmptyLines,
autoCollapse: true,
type: BlockTypes.Member,
isCollapsible: true));
......
......@@ -32,10 +32,13 @@ internal class ConversionOperatorDeclarationStructureProvider : AbstractSyntaxNo
SyntaxNodeOrToken current = operatorDeclaration;
var nextSibling = current.GetNextSibling();
// Check IsNode to compress blank lines after this node if it is the last child of the parent.
var compressEmptyLines = !nextSibling.IsNode || nextSibling.IsKind(SyntaxKind.ConversionOperatorDeclaration);
spans.AddIfNotNull(CSharpStructureHelpers.CreateBlockSpan(
operatorDeclaration,
operatorDeclaration.ParameterList.GetLastToken(includeZeroWidth: true),
compressEmptyLines: !nextSibling.IsNode || nextSibling.IsKind(SyntaxKind.ConversionOperatorDeclaration),
compressEmptyLines: compressEmptyLines,
autoCollapse: true,
type: BlockTypes.Member,
isCollapsible: true));
......
......@@ -27,10 +27,13 @@ internal class EnumDeclarationStructureProvider : AbstractSyntaxNodeStructurePro
SyntaxNodeOrToken current = enumDeclaration;
var nextSibling = current.GetNextSibling();
// Check IsNode to compress blank lines after this node if it is the last child of the parent.
var compressEmptyLines = !nextSibling.IsNode || nextSibling.AsNode() is BaseTypeDeclarationSyntax;
spans.AddIfNotNull(CSharpStructureHelpers.CreateBlockSpan(
enumDeclaration,
enumDeclaration.Identifier,
compressEmptyLines: !nextSibling.IsNode || nextSibling.AsNode() is BaseTypeDeclarationSyntax,
compressEmptyLines: compressEmptyLines,
autoCollapse: false,
type: BlockTypes.Member,
isCollapsible: true));
......
......@@ -33,10 +33,15 @@ internal class EventDeclarationStructureProvider : AbstractSyntaxNodeStructurePr
SyntaxNodeOrToken current = eventDeclaration;
var nextSibling = current.GetNextSibling();
// Check IsNode to compress blank lines after this node if it is the last child of the parent.
//
// Full events are grouped together with event field definitions.
var compressEmptyLines = !nextSibling.IsNode || nextSibling.IsKind(SyntaxKind.EventDeclaration) || nextSibling.IsKind(SyntaxKind.EventFieldDeclaration);
spans.AddIfNotNull(CSharpStructureHelpers.CreateBlockSpan(
eventDeclaration,
eventDeclaration.Identifier,
compressEmptyLines: !nextSibling.IsNode || nextSibling.IsKind(SyntaxKind.EventDeclaration) || nextSibling.IsKind(SyntaxKind.EventFieldDeclaration),
compressEmptyLines: compressEmptyLines,
autoCollapse: true,
type: BlockTypes.Member,
isCollapsible: true));
......
......@@ -33,10 +33,15 @@ internal class IndexerDeclarationStructureProvider : AbstractSyntaxNodeStructure
SyntaxNodeOrToken current = indexerDeclaration;
var nextSibling = current.GetNextSibling();
// Check IsNode to compress blank lines after this node if it is the last child of the parent.
//
// Indexers are grouped together with properties.
var compressEmptyLines = !nextSibling.IsNode || nextSibling.IsKind(SyntaxKind.IndexerDeclaration) || nextSibling.IsKind(SyntaxKind.PropertyDeclaration);
spans.AddIfNotNull(CSharpStructureHelpers.CreateBlockSpan(
indexerDeclaration,
indexerDeclaration.ParameterList.GetLastToken(includeZeroWidth: true),
compressEmptyLines: !nextSibling.IsNode || nextSibling.IsKind(SyntaxKind.IndexerDeclaration) || nextSibling.IsKind(SyntaxKind.PropertyDeclaration),
compressEmptyLines: compressEmptyLines,
autoCollapse: true,
type: BlockTypes.Member,
isCollapsible: true));
......
......@@ -32,10 +32,13 @@ internal class MethodDeclarationStructureProvider : AbstractSyntaxNodeStructureP
SyntaxNodeOrToken current = methodDeclaration;
var nextSibling = current.GetNextSibling();
// Check IsNode to compress blank lines after this node if it is the last child of the parent.
var compressEmptyLines = !nextSibling.IsNode || nextSibling.IsKind(SyntaxKind.MethodDeclaration);
spans.AddIfNotNull(CSharpStructureHelpers.CreateBlockSpan(
methodDeclaration,
methodDeclaration.ParameterList.GetLastToken(includeZeroWidth: true),
compressEmptyLines: !nextSibling.IsNode || nextSibling.IsKind(SyntaxKind.MethodDeclaration),
compressEmptyLines: compressEmptyLines,
autoCollapse: true,
type: BlockTypes.Member,
isCollapsible: true));
......
......@@ -32,10 +32,13 @@ internal class OperatorDeclarationStructureProvider : AbstractSyntaxNodeStructur
SyntaxNodeOrToken current = operatorDeclaration;
var nextSibling = current.GetNextSibling();
// Check IsNode to compress blank lines after this node if it is the last child of the parent.
var compressEmptyLines = !nextSibling.IsNode || nextSibling.IsKind(SyntaxKind.OperatorDeclaration);
spans.AddIfNotNull(CSharpStructureHelpers.CreateBlockSpan(
operatorDeclaration,
operatorDeclaration.ParameterList.GetLastToken(includeZeroWidth: true),
compressEmptyLines: !nextSibling.IsNode || nextSibling.IsKind(SyntaxKind.OperatorDeclaration),
compressEmptyLines: compressEmptyLines,
autoCollapse: true,
type: BlockTypes.Member,
isCollapsible: true));
......
......@@ -32,10 +32,15 @@ internal class PropertyDeclarationStructureProvider : AbstractSyntaxNodeStructur
SyntaxNodeOrToken current = propertyDeclaration;
var nextSibling = current.GetNextSibling();
// Check IsNode to compress blank lines after this node if it is the last child of the parent.
//
// Properties are grouped together with indexers.
var compressEmptyLines = !nextSibling.IsNode || nextSibling.IsKind(SyntaxKind.PropertyDeclaration) || nextSibling.IsKind(SyntaxKind.IndexerDeclaration);
spans.AddIfNotNull(CSharpStructureHelpers.CreateBlockSpan(
propertyDeclaration,
propertyDeclaration.Identifier,
compressEmptyLines: !nextSibling.IsNode || nextSibling.IsKind(SyntaxKind.PropertyDeclaration) || nextSibling.IsKind(SyntaxKind.IndexerDeclaration),
compressEmptyLines: compressEmptyLines,
autoCollapse: true,
type: BlockTypes.Member,
isCollapsible: true));
......
......@@ -31,10 +31,16 @@ internal class TypeDeclarationStructureProvider : AbstractSyntaxNodeStructurePro
SyntaxNodeOrToken current = typeDeclaration;
var nextSibling = current.GetNextSibling();
// Check IsNode to compress blank lines after this node if it is the last child of the parent.
//
// Collapse to Definitions doesn't collapse type nodes, but a Toggle All Outlining would collapse groups
// of types to the compressed form of not showing blank lines. All kinds of types are grouped together.
var compressEmptyLines = !nextSibling.IsNode || nextSibling.AsNode() is BaseTypeDeclarationSyntax;
spans.AddIfNotNull(CSharpStructureHelpers.CreateBlockSpan(
typeDeclaration,
lastToken,
compressEmptyLines: !nextSibling.IsNode || nextSibling.AsNode() is BaseTypeDeclarationSyntax,
compressEmptyLines: compressEmptyLines,
autoCollapse: false,
type: BlockTypes.Type,
isCollapsible: true));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册