@@ -1988,36 +1988,17 @@ namespace ts.Completions {
19881988
19891989 /**
19901990 * Get the name to be display in completion from a given symbol.
1991- *
1992- * @return undefined if the name is of external module
19931991 */
19941992 function getCompletionEntryDisplayNameForSymbol ( symbol : Symbol , target : ScriptTarget , performCharacterChecks : boolean , allowStringLiteral : boolean , origin : SymbolOriginInfo | undefined ) : string | undefined {
19951993 const name = getSymbolName ( symbol , origin , target ) ;
1996- if ( ! name ) return undefined ;
1997-
1998- // First check of the displayName is not external module; if it is an external module, it is not valid entry
1999- if ( symbol . flags & SymbolFlags . Namespace ) {
2000- const firstCharCode = name . charCodeAt ( 0 ) ;
2001- if ( isSingleOrDoubleQuote ( firstCharCode ) ) {
2002- // If the symbol is external module, don't show it in the completion list
2003- // (i.e declare module "http" { const x; } | // <= request completion here, "http" should not be there)
2004- return undefined ;
2005- }
2006- }
2007-
2008- // If the symbol is for a member of an object type and is the internal name of an ES
2009- // symbol, it is not a valid entry. Internal names for ES symbols start with "__@"
2010- if ( symbol . flags & SymbolFlags . ClassMember ) {
2011- const escapedName = symbol . escapedName as string ;
2012- if ( escapedName . length >= 3 &&
2013- escapedName . charCodeAt ( 0 ) === CharacterCodes . _ &&
2014- escapedName . charCodeAt ( 1 ) === CharacterCodes . _ &&
2015- escapedName . charCodeAt ( 2 ) === CharacterCodes . at ) {
2016- return undefined ;
2017- }
2018- }
2019-
2020- return getCompletionEntryDisplayName ( name , target , performCharacterChecks , allowStringLiteral ) ;
1994+ return name === undefined
1995+ // If the symbol is external module, don't show it in the completion list
1996+ // (i.e declare module "http" { const x; } | // <= request completion here, "http" should not be there)
1997+ || symbol . flags & SymbolFlags . Module && startsWithQuote ( name )
1998+ // If the symbol is the internal name of an ES symbol, it is not a valid entry. Internal names for ES symbols start with "__@"
1999+ || isKnownSymbol ( symbol )
2000+ ? undefined
2001+ : getCompletionEntryDisplayName ( name , target , performCharacterChecks , allowStringLiteral ) ;
20212002 }
20222003
20232004 /**
0 commit comments