From 19ef6b67c5df52690514c2a9a3ee253d69c77934 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Mon, 28 Mar 2022 11:10:47 -0700 Subject: [PATCH] Fix refactoring mistake --- src/services/formatting/formatting.ts | 2 +- .../{server => }/formatOnTypeOpenCurlyWithBraceCompletion.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename tests/cases/fourslash/{server => }/formatOnTypeOpenCurlyWithBraceCompletion.ts (79%) diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index 8060145ef026f..5a9948cd35f72 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -445,7 +445,7 @@ namespace ts.formatting { undefined; if (tokenInfo) { - const parent = findPrecedingToken(tokenInfo.end, sourceFile, enclosingNode) || previousParent!; + const parent = findPrecedingToken(tokenInfo.end, sourceFile, enclosingNode)?.parent || previousParent!; processPair( tokenInfo, sourceFile.getLineAndCharacterOfPosition(tokenInfo.pos).line, diff --git a/tests/cases/fourslash/server/formatOnTypeOpenCurlyWithBraceCompletion.ts b/tests/cases/fourslash/formatOnTypeOpenCurlyWithBraceCompletion.ts similarity index 79% rename from tests/cases/fourslash/server/formatOnTypeOpenCurlyWithBraceCompletion.ts rename to tests/cases/fourslash/formatOnTypeOpenCurlyWithBraceCompletion.ts index dceda9e98fcb0..b303b1ea62d6d 100644 --- a/tests/cases/fourslash/server/formatOnTypeOpenCurlyWithBraceCompletion.ts +++ b/tests/cases/fourslash/formatOnTypeOpenCurlyWithBraceCompletion.ts @@ -1,4 +1,4 @@ -/// +/// //// if (foo) { //// if (bar) {/**/}