@@ -264,7 +264,7 @@ namespace ts.formatting {
264
264
this . SpaceBeforeOpenBraceInFunction = new Rule ( RuleDescriptor . create2 ( this . FunctionOpenBraceLeftTokenRange , SyntaxKind . OpenBraceToken ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsFunctionDeclContext , Rules . IsBeforeBlockContext , Rules . IsNotFormatOnEnter , Rules . IsSameLineTokenOrBeforeMultilineBlockContext ) , RuleAction . Space ) , RuleFlags . CanDeleteNewLines ) ;
265
265
266
266
// Place a space before open brace in a TypeScript declaration that has braces as children (class, module, enum, etc)
267
- this . TypeScriptOpenBraceLeftTokenRange = Shared . TokenRange . FromTokens ( [ SyntaxKind . Identifier , SyntaxKind . MultiLineCommentTrivia , SyntaxKind . ClassKeyword ] ) ;
267
+ this . TypeScriptOpenBraceLeftTokenRange = Shared . TokenRange . FromTokens ( [ SyntaxKind . Identifier , SyntaxKind . MultiLineCommentTrivia , SyntaxKind . ClassKeyword , SyntaxKind . ExportKeyword , SyntaxKind . ImportKeyword ] ) ;
268
268
this . SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new Rule ( RuleDescriptor . create2 ( this . TypeScriptOpenBraceLeftTokenRange , SyntaxKind . OpenBraceToken ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsTypeScriptDeclWithBlockContext , Rules . IsNotFormatOnEnter , Rules . IsSameLineTokenOrBeforeMultilineBlockContext ) , RuleAction . Space ) , RuleFlags . CanDeleteNewLines ) ;
269
269
270
270
// Place a space before open brace in a control flow construct
@@ -338,8 +338,8 @@ namespace ts.formatting {
338
338
this . NoSpaceAfterModuleImport = new Rule ( RuleDescriptor . create2 ( Shared . TokenRange . FromTokens ( [ SyntaxKind . ModuleKeyword , SyntaxKind . RequireKeyword ] ) , SyntaxKind . OpenParenToken ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsNonJsxSameLineTokenContext ) , RuleAction . Delete ) ) ;
339
339
340
340
// Add a space around certain TypeScript keywords
341
- this . SpaceAfterCertainTypeScriptKeywords = new Rule ( RuleDescriptor . create4 ( Shared . TokenRange . FromTokens ( [ SyntaxKind . AbstractKeyword , SyntaxKind . ClassKeyword , SyntaxKind . DeclareKeyword , SyntaxKind . DefaultKeyword , SyntaxKind . EnumKeyword , SyntaxKind . ExportKeyword , SyntaxKind . ExtendsKeyword , SyntaxKind . GetKeyword , SyntaxKind . ImplementsKeyword , SyntaxKind . ImportKeyword , SyntaxKind . InterfaceKeyword , SyntaxKind . ModuleKeyword , SyntaxKind . NamespaceKeyword , SyntaxKind . PrivateKeyword , SyntaxKind . PublicKeyword , SyntaxKind . ProtectedKeyword , SyntaxKind . SetKeyword , SyntaxKind . StaticKeyword , SyntaxKind . TypeKeyword ] ) , Shared . TokenRange . Any ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsNonJsxSameLineTokenContext ) , RuleAction . Space ) ) ;
342
- this . SpaceBeforeCertainTypeScriptKeywords = new Rule ( RuleDescriptor . create4 ( Shared . TokenRange . Any , Shared . TokenRange . FromTokens ( [ SyntaxKind . ExtendsKeyword , SyntaxKind . ImplementsKeyword ] ) ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsNonJsxSameLineTokenContext ) , RuleAction . Space ) ) ;
341
+ this . SpaceAfterCertainTypeScriptKeywords = new Rule ( RuleDescriptor . create4 ( Shared . TokenRange . FromTokens ( [ SyntaxKind . AbstractKeyword , SyntaxKind . ClassKeyword , SyntaxKind . DeclareKeyword , SyntaxKind . DefaultKeyword , SyntaxKind . EnumKeyword , SyntaxKind . ExportKeyword , SyntaxKind . ExtendsKeyword , SyntaxKind . GetKeyword , SyntaxKind . ImplementsKeyword , SyntaxKind . ImportKeyword , SyntaxKind . InterfaceKeyword , SyntaxKind . ModuleKeyword , SyntaxKind . NamespaceKeyword , SyntaxKind . PrivateKeyword , SyntaxKind . PublicKeyword , SyntaxKind . ProtectedKeyword , SyntaxKind . SetKeyword , SyntaxKind . StaticKeyword , SyntaxKind . TypeKeyword , SyntaxKind . FromKeyword ] ) , Shared . TokenRange . Any ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsNonJsxSameLineTokenContext ) , RuleAction . Space ) ) ;
342
+ this . SpaceBeforeCertainTypeScriptKeywords = new Rule ( RuleDescriptor . create4 ( Shared . TokenRange . Any , Shared . TokenRange . FromTokens ( [ SyntaxKind . ExtendsKeyword , SyntaxKind . ImplementsKeyword , SyntaxKind . FromKeyword ] ) ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsNonJsxSameLineTokenContext ) , RuleAction . Space ) ) ;
343
343
344
344
// Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" {
345
345
this . SpaceAfterModuleName = new Rule ( RuleDescriptor . create1 ( SyntaxKind . StringLiteral , SyntaxKind . OpenBraceToken ) , RuleOperation . create2 ( new RuleOperationContext ( Rules . IsModuleDeclContext ) , RuleAction . Space ) ) ;
@@ -514,6 +514,8 @@ namespace ts.formatting {
514
514
case SyntaxKind . BinaryExpression :
515
515
case SyntaxKind . ConditionalExpression :
516
516
case SyntaxKind . AsExpression :
517
+ case SyntaxKind . ExportSpecifier :
518
+ case SyntaxKind . ImportSpecifier :
517
519
case SyntaxKind . TypePredicate :
518
520
case SyntaxKind . UnionType :
519
521
case SyntaxKind . IntersectionType :
@@ -650,6 +652,10 @@ namespace ts.formatting {
650
652
case SyntaxKind . EnumDeclaration :
651
653
case SyntaxKind . TypeLiteral :
652
654
case SyntaxKind . ModuleDeclaration :
655
+ case SyntaxKind . ExportDeclaration :
656
+ case SyntaxKind . NamedExports :
657
+ case SyntaxKind . ImportDeclaration :
658
+ case SyntaxKind . NamedImports :
653
659
return true ;
654
660
}
655
661
0 commit comments