Skip to content

Commit 8cd8f86

Browse files
committed
remove type operation rules, add types instead
1 parent 44009fa commit 8cd8f86

1 file changed

Lines changed: 2 additions & 14 deletions

File tree

src/services/formatting/rules.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -219,12 +219,6 @@ namespace ts.formatting {
219219
// Tagged template string
220220
public SpaceBetweenTagAndTemplateString: Rule;
221221

222-
// Type operation
223-
public SpaceBeforeBar: Rule;
224-
public SpaceAfterBar: Rule;
225-
public SpaceBeforeAmpersand: Rule;
226-
public SpaceAfterAmpersand: Rule;
227-
228222
constructor() {
229223
///
230224
/// Common Rules
@@ -383,12 +377,6 @@ namespace ts.formatting {
383377
// template string
384378
this.SpaceBetweenTagAndTemplateString = new Rule(RuleDescriptor.create3(SyntaxKind.Identifier, Shared.TokenRange.FromTokens([SyntaxKind.NoSubstitutionTemplateLiteral, SyntaxKind.TemplateHead])), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
385379

386-
// type operation
387-
this.SpaceBeforeBar = new Rule(RuleDescriptor.create3(SyntaxKind.BarToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
388-
this.SpaceAfterBar = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.BarToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
389-
this.SpaceBeforeAmpersand = new Rule(RuleDescriptor.create3(SyntaxKind.AmpersandToken, Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
390-
this.SpaceAfterAmpersand = new Rule(RuleDescriptor.create2(Shared.TokenRange.Any, SyntaxKind.AmpersandToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
391-
392380
// These rules are higher in priority than user-configurable rules.
393381
this.HighPriorityCommonRules =
394382
[
@@ -417,8 +405,6 @@ namespace ts.formatting {
417405
this.SpaceAfterVoidOperator,
418406
this.SpaceBetweenAsyncAndFunctionKeyword,
419407
this.SpaceBetweenTagAndTemplateString,
420-
this.SpaceBeforeBar, this.SpaceAfterBar,
421-
this.SpaceBeforeAmpersand, this.SpaceAfterAmpersand,
422408

423409
// TypeScript-specific rules
424410
this.NoSpaceAfterConstructor, this.NoSpaceAfterModuleImport,
@@ -522,6 +508,8 @@ namespace ts.formatting {
522508
case SyntaxKind.ConditionalExpression:
523509
case SyntaxKind.AsExpression:
524510
case SyntaxKind.TypePredicate:
511+
case SyntaxKind.UnionType:
512+
case SyntaxKind.IntersectionType:
525513
return true;
526514

527515
// equals in binding elements: function foo([[x, y] = [1, 2]])

0 commit comments

Comments
 (0)