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

Updated documentation for compressEmptyLines values

上级 83d491a1
...@@ -32,10 +32,15 @@ internal class AccessorDeclarationStructureProvider : AbstractSyntaxNodeStructur ...@@ -32,10 +32,15 @@ internal class AccessorDeclarationStructureProvider : AbstractSyntaxNodeStructur
SyntaxNodeOrToken current = accessorDeclaration; SyntaxNodeOrToken current = accessorDeclaration;
var nextSibling = current.GetNextSibling(); 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( spans.AddIfNotNull(CSharpStructureHelpers.CreateBlockSpan(
accessorDeclaration, accessorDeclaration,
accessorDeclaration.Keyword, accessorDeclaration.Keyword,
compressEmptyLines: !nextSibling.IsNode || nextSibling.AsNode() is AccessorDeclarationSyntax, compressEmptyLines: compressEmptyLines,
autoCollapse: true, autoCollapse: true,
type: BlockTypes.Member, type: BlockTypes.Member,
isCollapsible: true)); isCollapsible: true));
......
...@@ -32,10 +32,13 @@ internal class ConstructorDeclarationStructureProvider : AbstractSyntaxNodeStruc ...@@ -32,10 +32,13 @@ internal class ConstructorDeclarationStructureProvider : AbstractSyntaxNodeStruc
SyntaxNodeOrToken current = constructorDeclaration; SyntaxNodeOrToken current = constructorDeclaration;
var nextSibling = current.GetNextSibling(); 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( spans.AddIfNotNull(CSharpStructureHelpers.CreateBlockSpan(
constructorDeclaration, constructorDeclaration,
constructorDeclaration.ParameterList.GetLastToken(includeZeroWidth: true), constructorDeclaration.ParameterList.GetLastToken(includeZeroWidth: true),
compressEmptyLines: !nextSibling.IsNode || nextSibling.IsKind(SyntaxKind.ConstructorDeclaration), compressEmptyLines: compressEmptyLines,
autoCollapse: true, autoCollapse: true,
type: BlockTypes.Member, type: BlockTypes.Member,
isCollapsible: true)); isCollapsible: true));
......
...@@ -32,10 +32,13 @@ internal class ConversionOperatorDeclarationStructureProvider : AbstractSyntaxNo ...@@ -32,10 +32,13 @@ internal class ConversionOperatorDeclarationStructureProvider : AbstractSyntaxNo
SyntaxNodeOrToken current = operatorDeclaration; SyntaxNodeOrToken current = operatorDeclaration;
var nextSibling = current.GetNextSibling(); 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( spans.AddIfNotNull(CSharpStructureHelpers.CreateBlockSpan(
operatorDeclaration, operatorDeclaration,
operatorDeclaration.ParameterList.GetLastToken(includeZeroWidth: true), operatorDeclaration.ParameterList.GetLastToken(includeZeroWidth: true),
compressEmptyLines: !nextSibling.IsNode || nextSibling.IsKind(SyntaxKind.ConversionOperatorDeclaration), compressEmptyLines: compressEmptyLines,
autoCollapse: true, autoCollapse: true,
type: BlockTypes.Member, type: BlockTypes.Member,
isCollapsible: true)); isCollapsible: true));
......
...@@ -27,10 +27,13 @@ internal class EnumDeclarationStructureProvider : AbstractSyntaxNodeStructurePro ...@@ -27,10 +27,13 @@ internal class EnumDeclarationStructureProvider : AbstractSyntaxNodeStructurePro
SyntaxNodeOrToken current = enumDeclaration; SyntaxNodeOrToken current = enumDeclaration;
var nextSibling = current.GetNextSibling(); 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( spans.AddIfNotNull(CSharpStructureHelpers.CreateBlockSpan(
enumDeclaration, enumDeclaration,
enumDeclaration.Identifier, enumDeclaration.Identifier,
compressEmptyLines: !nextSibling.IsNode || nextSibling.AsNode() is BaseTypeDeclarationSyntax, compressEmptyLines: compressEmptyLines,
autoCollapse: false, autoCollapse: false,
type: BlockTypes.Member, type: BlockTypes.Member,
isCollapsible: true)); isCollapsible: true));
......
...@@ -33,10 +33,15 @@ internal class EventDeclarationStructureProvider : AbstractSyntaxNodeStructurePr ...@@ -33,10 +33,15 @@ internal class EventDeclarationStructureProvider : AbstractSyntaxNodeStructurePr
SyntaxNodeOrToken current = eventDeclaration; SyntaxNodeOrToken current = eventDeclaration;
var nextSibling = current.GetNextSibling(); 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( spans.AddIfNotNull(CSharpStructureHelpers.CreateBlockSpan(
eventDeclaration, eventDeclaration,
eventDeclaration.Identifier, eventDeclaration.Identifier,
compressEmptyLines: !nextSibling.IsNode || nextSibling.IsKind(SyntaxKind.EventDeclaration) || nextSibling.IsKind(SyntaxKind.EventFieldDeclaration), compressEmptyLines: compressEmptyLines,
autoCollapse: true, autoCollapse: true,
type: BlockTypes.Member, type: BlockTypes.Member,
isCollapsible: true)); isCollapsible: true));
......
...@@ -33,10 +33,15 @@ internal class IndexerDeclarationStructureProvider : AbstractSyntaxNodeStructure ...@@ -33,10 +33,15 @@ internal class IndexerDeclarationStructureProvider : AbstractSyntaxNodeStructure
SyntaxNodeOrToken current = indexerDeclaration; SyntaxNodeOrToken current = indexerDeclaration;
var nextSibling = current.GetNextSibling(); 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( spans.AddIfNotNull(CSharpStructureHelpers.CreateBlockSpan(
indexerDeclaration, indexerDeclaration,
indexerDeclaration.ParameterList.GetLastToken(includeZeroWidth: true), indexerDeclaration.ParameterList.GetLastToken(includeZeroWidth: true),
compressEmptyLines: !nextSibling.IsNode || nextSibling.IsKind(SyntaxKind.IndexerDeclaration) || nextSibling.IsKind(SyntaxKind.PropertyDeclaration), compressEmptyLines: compressEmptyLines,
autoCollapse: true, autoCollapse: true,
type: BlockTypes.Member, type: BlockTypes.Member,
isCollapsible: true)); isCollapsible: true));
......
...@@ -32,10 +32,13 @@ internal class MethodDeclarationStructureProvider : AbstractSyntaxNodeStructureP ...@@ -32,10 +32,13 @@ internal class MethodDeclarationStructureProvider : AbstractSyntaxNodeStructureP
SyntaxNodeOrToken current = methodDeclaration; SyntaxNodeOrToken current = methodDeclaration;
var nextSibling = current.GetNextSibling(); 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( spans.AddIfNotNull(CSharpStructureHelpers.CreateBlockSpan(
methodDeclaration, methodDeclaration,
methodDeclaration.ParameterList.GetLastToken(includeZeroWidth: true), methodDeclaration.ParameterList.GetLastToken(includeZeroWidth: true),
compressEmptyLines: !nextSibling.IsNode || nextSibling.IsKind(SyntaxKind.MethodDeclaration), compressEmptyLines: compressEmptyLines,
autoCollapse: true, autoCollapse: true,
type: BlockTypes.Member, type: BlockTypes.Member,
isCollapsible: true)); isCollapsible: true));
......
...@@ -32,10 +32,13 @@ internal class OperatorDeclarationStructureProvider : AbstractSyntaxNodeStructur ...@@ -32,10 +32,13 @@ internal class OperatorDeclarationStructureProvider : AbstractSyntaxNodeStructur
SyntaxNodeOrToken current = operatorDeclaration; SyntaxNodeOrToken current = operatorDeclaration;
var nextSibling = current.GetNextSibling(); 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( spans.AddIfNotNull(CSharpStructureHelpers.CreateBlockSpan(
operatorDeclaration, operatorDeclaration,
operatorDeclaration.ParameterList.GetLastToken(includeZeroWidth: true), operatorDeclaration.ParameterList.GetLastToken(includeZeroWidth: true),
compressEmptyLines: !nextSibling.IsNode || nextSibling.IsKind(SyntaxKind.OperatorDeclaration), compressEmptyLines: compressEmptyLines,
autoCollapse: true, autoCollapse: true,
type: BlockTypes.Member, type: BlockTypes.Member,
isCollapsible: true)); isCollapsible: true));
......
...@@ -32,10 +32,15 @@ internal class PropertyDeclarationStructureProvider : AbstractSyntaxNodeStructur ...@@ -32,10 +32,15 @@ internal class PropertyDeclarationStructureProvider : AbstractSyntaxNodeStructur
SyntaxNodeOrToken current = propertyDeclaration; SyntaxNodeOrToken current = propertyDeclaration;
var nextSibling = current.GetNextSibling(); 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( spans.AddIfNotNull(CSharpStructureHelpers.CreateBlockSpan(
propertyDeclaration, propertyDeclaration,
propertyDeclaration.Identifier, propertyDeclaration.Identifier,
compressEmptyLines: !nextSibling.IsNode || nextSibling.IsKind(SyntaxKind.PropertyDeclaration) || nextSibling.IsKind(SyntaxKind.IndexerDeclaration), compressEmptyLines: compressEmptyLines,
autoCollapse: true, autoCollapse: true,
type: BlockTypes.Member, type: BlockTypes.Member,
isCollapsible: true)); isCollapsible: true));
......
...@@ -31,10 +31,16 @@ internal class TypeDeclarationStructureProvider : AbstractSyntaxNodeStructurePro ...@@ -31,10 +31,16 @@ internal class TypeDeclarationStructureProvider : AbstractSyntaxNodeStructurePro
SyntaxNodeOrToken current = typeDeclaration; SyntaxNodeOrToken current = typeDeclaration;
var nextSibling = current.GetNextSibling(); 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( spans.AddIfNotNull(CSharpStructureHelpers.CreateBlockSpan(
typeDeclaration, typeDeclaration,
lastToken, lastToken,
compressEmptyLines: !nextSibling.IsNode || nextSibling.AsNode() is BaseTypeDeclarationSyntax, compressEmptyLines: compressEmptyLines,
autoCollapse: false, autoCollapse: false,
type: BlockTypes.Type, type: BlockTypes.Type,
isCollapsible: true)); isCollapsible: true));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册