diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 8b77dcb953b..c413cedd5d1 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -79,6 +79,8 @@ namespace ts { case SyntaxKind.Block: case SyntaxKind.ModuleBlock: case SyntaxKind.CaseBlock: + case SyntaxKind.NamedImports: + case SyntaxKind.NamedExports: return nodeEndsWith(n, SyntaxKind.CloseBraceToken, sourceFile); case SyntaxKind.CatchClause: return isCompletedNode((n).block, sourceFile); @@ -181,6 +183,10 @@ namespace ts { case SyntaxKind.TemplateSpan: return nodeIsPresent((n).literal); + case SyntaxKind.ExportDeclaration: + case SyntaxKind.ImportDeclaration: + return nodeIsPresent((n).moduleSpecifier); + case SyntaxKind.PrefixUnaryExpression: return isCompletedNode((n).operand, sourceFile); case SyntaxKind.BinaryExpression: diff --git a/tests/cases/fourslash/formatNamedExportImport.ts b/tests/cases/fourslash/formatNamedExportImport.ts index 2e22c54ae3b..18f2f19577a 100644 --- a/tests/cases/fourslash/formatNamedExportImport.ts +++ b/tests/cases/fourslash/formatNamedExportImport.ts @@ -23,6 +23,10 @@ ////export/*formatOnEnter*/{/*formatOnEnterOpenBrace*/ /////*differentLineIndent*/x/*differentLineAutoformat*/ ////} from "abc" +//// +////export { +/////*incompleteExportDeclIndent*/ +/////*incompleteExportDeclIndent2*/ format.selection("selectionStart", "selectionEnd"); @@ -68,4 +72,10 @@ goTo.marker("differentLineIndent"); verify.indentationIs(4); edit.insertLine(''); goTo.marker("differentLineAutoformat"); -verify.currentLineContentIs(" x"); \ No newline at end of file +verify.currentLineContentIs(" x"); + +goTo.marker("incompleteExportDeclIndent") +verify.indentationIs(4); +edit.insert("} from"); +goTo.marker("incompleteExportDeclIndent2"); +verify.indentationIs(4); \ No newline at end of file