Skip to content

Commit 91c37f7

Browse files
authored
Merge pull request microsoft#19401 from Microsoft/fix19349
Remove escaped names of well known symbols from string completions
2 parents f0da3d7 + a0412da commit 91c37f7

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

src/services/completions.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1839,6 +1839,18 @@ namespace ts.Completions {
18391839
}
18401840
}
18411841

1842+
// If the symbol is for a member of an object type and is the internal name of an ES
1843+
// symbol, it is not a valid entry. Internal names for ES symbols start with "__@"
1844+
if (symbol.flags & SymbolFlags.ClassMember) {
1845+
const escapedName = symbol.escapedName as string;
1846+
if (escapedName.length >= 3 &&
1847+
escapedName.charCodeAt(0) === CharacterCodes._ &&
1848+
escapedName.charCodeAt(1) === CharacterCodes._ &&
1849+
escapedName.charCodeAt(2) === CharacterCodes.at) {
1850+
return undefined;
1851+
}
1852+
}
1853+
18421854
return getCompletionEntryDisplayName(name, target, performCharacterChecks, allowStringLiteral);
18431855
}
18441856

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/// <reference path='fourslash.ts'/>
2+
3+
////interface SymbolConstructor {
4+
//// readonly species: symbol;
5+
////}
6+
////var Symbol: SymbolConstructor;
7+
////interface PromiseConstructor {
8+
//// [Symbol.species]: PromiseConstructor;
9+
////}
10+
////var Promise: PromiseConstructor;
11+
////Promise["/*1*/"];
12+
13+
goTo.marker('1');
14+
verify.not.completionListContains("__@species");

0 commit comments

Comments
 (0)