|
|
|
@@ -52,10 +52,6 @@ namespace ts.formatting {
|
|
|
|
|
public SpaceBeforeCloseBrace: Rule;
|
|
|
|
|
public NoSpaceBetweenEmptyBraceBrackets: Rule;
|
|
|
|
|
|
|
|
|
|
// No space after { and before } in JSX expression
|
|
|
|
|
public NoSpaceAfterOpenBraceInJsxExpression: Rule;
|
|
|
|
|
public NoSpaceBeforeCloseBraceInJsxExpression: Rule;
|
|
|
|
|
|
|
|
|
|
// Insert new line after { and before } in multi-line contexts.
|
|
|
|
|
public NewLineAfterOpenBraceInBlockContext: Rule;
|
|
|
|
|
|
|
|
|
@@ -229,6 +225,12 @@ namespace ts.formatting {
|
|
|
|
|
public NoSpaceBeforeTemplateMiddleAndTail: Rule;
|
|
|
|
|
public SpaceBeforeTemplateMiddleAndTail: Rule;
|
|
|
|
|
|
|
|
|
|
// No space after { and before } in JSX expression
|
|
|
|
|
public NoSpaceAfterOpenBraceInJsxExpression: Rule;
|
|
|
|
|
public SpaceAfterOpenBraceInJsxExpression: Rule;
|
|
|
|
|
public NoSpaceBeforeCloseBraceInJsxExpression: Rule;
|
|
|
|
|
public SpaceBeforeCloseBraceInJsxExpression: Rule;
|
|
|
|
|
|
|
|
|
|
constructor() {
|
|
|
|
|
///
|
|
|
|
|
/// Common Rules
|
|
|
|
@@ -280,10 +282,6 @@ namespace ts.formatting {
|
|
|
|
|
this.SpaceBeforeCloseBrace = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSingleLineBlockContext), RuleAction.Space));
|
|
|
|
|
this.NoSpaceBetweenEmptyBraceBrackets = new Rule(RuleDescriptor.create1(SyntaxKind.OpenBraceToken, SyntaxKind.CloseBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.IsObjectContext), RuleAction.Delete));
|
|
|
|
|
|
|
|
|
|
// No space after { and before } in JSX expression
|
|
|
|
|
this.NoSpaceAfterOpenBraceInJsxExpression = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBraceToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.isJsxExpressionContext), RuleAction.Delete));
|
|
|
|
|
this.NoSpaceBeforeCloseBraceInJsxExpression = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.isJsxExpressionContext), RuleAction.Delete));
|
|
|
|
|
|
|
|
|
|
// Insert new line after { and before } in multi-line contexts.
|
|
|
|
|
this.NewLineAfterOpenBraceInBlockContext = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBraceToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsMultilineBlockContext), RuleAction.NewLine));
|
|
|
|
|
|
|
|
|
@@ -403,7 +401,6 @@ namespace ts.formatting {
|
|
|
|
|
this.SpaceAfterSubtractWhenFollowedByUnaryMinus, this.SpaceAfterSubtractWhenFollowedByPredecrement,
|
|
|
|
|
this.NoSpaceAfterCloseBrace,
|
|
|
|
|
this.SpaceAfterOpenBrace, this.SpaceBeforeCloseBrace, this.NewLineBeforeCloseBraceInBlockContext,
|
|
|
|
|
this.NoSpaceAfterOpenBraceInJsxExpression, this.NoSpaceBeforeCloseBraceInJsxExpression,
|
|
|
|
|
this.SpaceAfterCloseBrace, this.SpaceBetweenCloseBraceAndElse, this.SpaceBetweenCloseBraceAndWhile, this.NoSpaceBetweenEmptyBraceBrackets,
|
|
|
|
|
this.NoSpaceBetweenFunctionKeywordAndStar, this.SpaceAfterStarInGeneratorDeclaration,
|
|
|
|
|
this.SpaceAfterFunctionInFuncDecl, this.NewLineAfterOpenBraceInBlockContext, this.SpaceAfterGetSetInMember,
|
|
|
|
@@ -500,6 +497,12 @@ namespace ts.formatting {
|
|
|
|
|
this.NoSpaceBeforeTemplateMiddleAndTail = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.FromTokens([SyntaxKind.TemplateMiddle, SyntaxKind.TemplateTail])), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Delete));
|
|
|
|
|
this.SpaceBeforeTemplateMiddleAndTail = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.FromTokens([SyntaxKind.TemplateMiddle, SyntaxKind.TemplateTail])), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext), RuleAction.Space));
|
|
|
|
|
|
|
|
|
|
// No space after { and before } in JSX expression
|
|
|
|
|
this.NoSpaceAfterOpenBraceInJsxExpression = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBraceToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.isJsxExpressionContext), RuleAction.Delete));
|
|
|
|
|
this.SpaceAfterOpenBraceInJsxExpression = new Rule(RuleDescriptor.create3(SyntaxKind.OpenBraceToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.isJsxExpressionContext), RuleAction.Space));
|
|
|
|
|
this.NoSpaceBeforeCloseBraceInJsxExpression = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.isJsxExpressionContext), RuleAction.Delete));
|
|
|
|
|
this.SpaceBeforeCloseBraceInJsxExpression = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.CloseBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsNonJsxSameLineTokenContext, Rules.isJsxExpressionContext), RuleAction.Space));
|
|
|
|
|
|
|
|
|
|
// Insert space after function keyword for anonymous functions
|
|
|
|
|
this.SpaceAfterAnonymousFunctionKeyword = new Rule(RuleDescriptor.create1(SyntaxKind.FunctionKeyword, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsFunctionDeclContext), RuleAction.Space));
|
|
|
|
|
this.NoSpaceAfterAnonymousFunctionKeyword = new Rule(RuleDescriptor.create1(SyntaxKind.FunctionKeyword, SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsFunctionDeclContext), RuleAction.Delete));
|
|
|
|
|