Adding JSXExpression check for isGlobalCompletion and associated tests

This commit is contained in:
Jason Ramsay
2016-10-18 14:04:21 -07:00
parent a69fc67986
commit dba03377b8
2 changed files with 11 additions and 1 deletions

View File

@@ -1082,6 +1082,7 @@ namespace ts.Completions {
isGlobalCompletion =
scopeNode.kind === SyntaxKind.SourceFile ||
scopeNode.kind === SyntaxKind.TemplateExpression ||
scopeNode.kind === SyntaxKind.JsxExpression ||
isStatement(scopeNode);
}

View File

@@ -33,6 +33,7 @@
////const y = <div /*12*/ />; // no globals in jsx attribute found
////const z = <div =/*13*/ />; // no globals in jsx attribute with syntax error
////const x = `/*14*/ ${/*15*/}`; // globals only in template expression
////var user = </*16*/User name=/*17*/{ /*18*/window.isLoggedIn ? window.name : '/*19*/'} />; // globals only in JSX expression (but not in JSX expression strings)
goTo.marker("1");
verify.completionListIsGlobal(false);
goTo.marker("2");
@@ -62,4 +63,12 @@ verify.completionListIsGlobal(false);
goTo.marker("14");
verify.completionListIsGlobal(false);
goTo.marker("15");
verify.completionListIsGlobal(true);
verify.completionListIsGlobal(true);
goTo.marker("16");
verify.completionListIsGlobal(false);
goTo.marker("17");
verify.completionListIsGlobal(false);
goTo.marker("18");
verify.completionListIsGlobal(true);
goTo.marker("19");
verify.completionListIsGlobal(false);