diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index f02520b24fd..6077e76ed04 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -14576,7 +14576,7 @@ namespace ts { return false; } - function getSymbolsInScope(location: Node, meaning: SymbolFlags, includeAllGlobalSymbols: boolean): Symbol[] { + function getSymbolsInScope(location: Node, meaning: SymbolFlags, includeGlobalSymbols: boolean): Symbol[] { const symbols: SymbolTable = {}; let memberFlags: NodeFlags = 0; @@ -14639,7 +14639,7 @@ namespace ts { location = location.parent; } - if (includeAllGlobalSymbols) { + if (includeGlobalSymbols) { copySymbols(globals, meaning); } } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index eb93ceee093..9cec9dda241 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1717,7 +1717,7 @@ namespace ts { getBaseTypes(type: InterfaceType): ObjectType[]; getReturnTypeOfSignature(signature: Signature): Type; - getSymbolsInScope(location: Node, meaning: SymbolFlags, includeAllGlobalSymbols: boolean): Symbol[]; + getSymbolsInScope(location: Node, meaning: SymbolFlags, includeGlobalSymbols: boolean): Symbol[]; getSymbolAtLocation(node: Node): Symbol; getShorthandAssignmentValueSymbol(location: Node): Symbol; getTypeAtLocation(node: Node): Type; diff --git a/src/services/services.ts b/src/services/services.ts index 7e12a521a4d..552af68ce40 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -3114,9 +3114,11 @@ namespace ts { } else if (isRightOfOpenTag) { let tagSymbols = typeChecker.getJsxIntrinsicTagNames(); - // If the currect cursor is inside JSX opening tag, the only meaningful completions are those of JSX.IntrinsicElements or users defined React.Component - // If the services can't find those symbols, then show nothing instead of including all the global symbols in the completion list. - if (tryGetGlobalSymbols(/*includeAllGlobalSymbols*/false)) { + // In this case, we are handling completion list inside JSX opening tag. For example: + // !!(s.flags & SymbolFlags.Value))); } else { @@ -3140,7 +3142,7 @@ namespace ts { // For JavaScript or TypeScript, if we're not after a dot, then just try to get the // global symbols in scope. These results should be valid for either language as // the set of symbols that can be referenced from this location. - if (!tryGetGlobalSymbols(/*includeAllGlobalSymbols*/true)) { + if (!tryGetGlobalSymbols(/*includeGlobalSymbols*/ true)) { return undefined; } } @@ -3200,7 +3202,7 @@ namespace ts { } } - function tryGetGlobalSymbols(includeAllGlobalSymbols: boolean): boolean { + function tryGetGlobalSymbols(includeGlobalSymbols: boolean): boolean { let objectLikeContainer: ObjectLiteralExpression | BindingPattern; let namedImportsOrExports: NamedImportsOrExports; let jsxContainer: JsxOpeningLikeElement; @@ -3271,7 +3273,7 @@ namespace ts { /// TODO filter meaning based on the current context let symbolMeanings = SymbolFlags.Type | SymbolFlags.Value | SymbolFlags.Namespace | SymbolFlags.Alias; - symbols = typeChecker.getSymbolsInScope(scopeNode, symbolMeanings, includeAllGlobalSymbols); + symbols = typeChecker.getSymbolsInScope(scopeNode, symbolMeanings, includeGlobalSymbols); return true; }