From 66924a371842f13bcfd54f0313352313886b89dd Mon Sep 17 00:00:00 2001 From: SaschaNaz Date: Thu, 3 Sep 2015 20:01:39 +0900 Subject: [PATCH] format open brace in export/import decl --- src/services/formatting/rules.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index 99090dd0a0e..62a91f3e3c8 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -262,7 +262,7 @@ namespace ts.formatting { 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); // Place a space before open brace in a TypeScript declaration that has braces as children (class, module, enum, etc) - this.TypeScriptOpenBraceLeftTokenRange = Shared.TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.MultiLineCommentTrivia]); + this.TypeScriptOpenBraceLeftTokenRange = Shared.TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.MultiLineCommentTrivia, SyntaxKind.ExportKeyword, SyntaxKind.ImportKeyword]); this.SpaceBeforeOpenBraceInTypeScriptDeclWithBlock = new Rule(RuleDescriptor.create2(this.TypeScriptOpenBraceLeftTokenRange, SyntaxKind.OpenBraceToken), RuleOperation.create2(new RuleOperationContext(Rules.IsTypeScriptDeclWithBlockContext, Rules.IsNotFormatOnEnter, Rules.IsSameLineTokenOrBeforeMultilineBlockContext), RuleAction.Space), RuleFlags.CanDeleteNewLines); // Place a space before open brace in a control flow construct @@ -606,8 +606,6 @@ namespace ts.formatting { case SyntaxKind.CaseBlock: case SyntaxKind.ObjectLiteralExpression: case SyntaxKind.ModuleBlock: - case SyntaxKind.NamedExports: - case SyntaxKind.NamedImports: return true; } @@ -652,6 +650,10 @@ namespace ts.formatting { case SyntaxKind.EnumDeclaration: case SyntaxKind.TypeLiteral: case SyntaxKind.ModuleDeclaration: + case SyntaxKind.ExportDeclaration: + case SyntaxKind.NamedExports: + case SyntaxKind.ImportDeclaration: + case SyntaxKind.NamedImports: return true; }