Merge pull request #19401 from Microsoft/fix19349
Remove escaped names of well known symbols from string completions
This commit is contained in:
commit
91c37f72d3
|
@ -1839,6 +1839,18 @@ namespace ts.Completions {
|
|||
}
|
||||
}
|
||||
|
||||
// If the symbol is for a member of an object type and is the internal name of an ES
|
||||
// symbol, it is not a valid entry. Internal names for ES symbols start with "__@"
|
||||
if (symbol.flags & SymbolFlags.ClassMember) {
|
||||
const escapedName = symbol.escapedName as string;
|
||||
if (escapedName.length >= 3 &&
|
||||
escapedName.charCodeAt(0) === CharacterCodes._ &&
|
||||
escapedName.charCodeAt(1) === CharacterCodes._ &&
|
||||
escapedName.charCodeAt(2) === CharacterCodes.at) {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
return getCompletionEntryDisplayName(name, target, performCharacterChecks, allowStringLiteral);
|
||||
}
|
||||
|
||||
|
|
14
tests/cases/fourslash/completionForStringLiteral13.ts
Normal file
14
tests/cases/fourslash/completionForStringLiteral13.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
/// <reference path='fourslash.ts'/>
|
||||
|
||||
////interface SymbolConstructor {
|
||||
//// readonly species: symbol;
|
||||
////}
|
||||
////var Symbol: SymbolConstructor;
|
||||
////interface PromiseConstructor {
|
||||
//// [Symbol.species]: PromiseConstructor;
|
||||
////}
|
||||
////var Promise: PromiseConstructor;
|
||||
////Promise["/*1*/"];
|
||||
|
||||
goTo.marker('1');
|
||||
verify.not.completionListContains("__@species");
|
Loading…
Reference in a new issue