From b1c83033007657b32d8ee777130357447700feed Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Thu, 8 Oct 2015 14:55:11 -0700 Subject: [PATCH] Fix case for completion on the line after a self-closing element --- src/services/services.ts | 15 ++++++++++----- tests/cases/fourslash/tsxCompletion9.ts | 6 ++++++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/services/services.ts b/src/services/services.ts index 3eb5ec319ad..0fd76eff61f 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -3322,11 +3322,16 @@ namespace ts { return true; } - return contextToken.kind === SyntaxKind.GreaterThanToken && - contextToken.parent && - (contextToken.parent.kind === SyntaxKind.JsxOpeningElement || - contextToken.parent.kind === SyntaxKind.JsxSelfClosingElement || - contextToken.parent.kind === SyntaxKind.JsxClosingElement); + if (contextToken.kind === SyntaxKind.GreaterThanToken && contextToken.parent) { + if (contextToken.parent.kind === SyntaxKind.JsxOpeningElement) { + return true; + } + + if (contextToken.parent.kind === SyntaxKind.JsxClosingElement || contextToken.parent.kind === SyntaxKind.JsxSelfClosingElement) { + return contextToken.parent.parent && contextToken.parent.parent.kind === SyntaxKind.JsxElement; + } + } + return false; } function isNewIdentifierDefinitionLocation(previousToken: Node): boolean { diff --git a/tests/cases/fourslash/tsxCompletion9.ts b/tests/cases/fourslash/tsxCompletion9.ts index dbb6c46293b..12542cc6b5b 100644 --- a/tests/cases/fourslash/tsxCompletion9.ts +++ b/tests/cases/fourslash/tsxCompletion9.ts @@ -11,8 +11,14 @@ //// var x2 =
/*4*/
/*5*/ world /*6*/
; //// var x3 =
/*7*/
/*8*/world/*9*/
; //// var x4 =
/*10*/
; +////
+//// /*end*/ +//// for (var i = 1; i <= 10; i++) { goTo.marker(i + ''); verify.completionListIsEmpty(); } + +goTo.marker('end'); +verify.not.completionListIsEmpty();