From b6ea2f955a90f7e2e45278af040dceb452d7b0e5 Mon Sep 17 00:00:00 2001 From: uniqueiniquity Date: Tue, 31 Oct 2017 14:52:15 -0700 Subject: [PATCH] Refactor test and annotate object literal --- src/services/formatting/formatting.ts | 2 +- tests/cases/fourslash/indentationInJsx3.ts | 28 ++++++++-------------- 2 files changed, 11 insertions(+), 19 deletions(-) diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index 18f463b9fa..fdd70cda46 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -715,7 +715,7 @@ namespace ts.formatting { processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta); if (child.kind === SyntaxKind.JsxText) { - const range = { pos: child.getStart(), end: child.getEnd() }; + const range: TextRange = { pos: child.getStart(), end: child.getEnd() }; indentMultilineCommentOrJsxText(range, childIndentation.indentation, /*firstLineIsIndented*/ true, /*indentFinalLine*/ false); } diff --git a/tests/cases/fourslash/indentationInJsx3.ts b/tests/cases/fourslash/indentationInJsx3.ts index 3c75356a12..1c93cbc24b 100644 --- a/tests/cases/fourslash/indentationInJsx3.ts +++ b/tests/cases/fourslash/indentationInJsx3.ts @@ -4,28 +4,20 @@ ////function foo () { //// return ( ////
-////hello -////goodbye +/////*0*/hello +/////*1*/goodbye ////
//// ) ////} -goTo.position(21); -verify.textAtCaretIs("return"); -goTo.position(38); -verify.textAtCaretIs("
"); -goTo.position(44); -verify.textAtCaretIs("hello"); -goTo.position(50); -verify.textAtCaretIs("goodbye"); +goTo.marker('0'); +verify.currentLineContentIs("hello"); +goTo.marker('1'); +verify.currentLineContentIs("goodbye"); format.document(); -goTo.position(21); -verify.textAtCaretIs("return"); -goTo.position(38); -verify.textAtCaretIs("
"); -goTo.position(56); -verify.textAtCaretIs("hello"); -goTo.position(74); -verify.textAtCaretIs("goodbye"); \ No newline at end of file +goTo.marker('0'); +verify.currentLineContentIs(" hello"); +goTo.marker('1'); +verify.currentLineContentIs(" goodbye"); \ No newline at end of file