Merge pull request #19401 from Microsoft/fix19349

Remove escaped names of well known symbols from string completions
This commit is contained in:
Ron Buckton 2017-10-30 12:37:13 -07:00 committed by GitHub
commit 91c37f72d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 0 deletions

View file

@ -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);
}

View 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");