Skip to content

Commit 9f1100c

Browse files
committed
PR cleanup
1 parent a31ce78 commit 9f1100c

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

src/compiler/utilities.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -385,12 +385,6 @@ namespace ts {
385385
return (identifier.length >= 2 && identifier.charCodeAt(0) === CharacterCodes._ && identifier.charCodeAt(1) === CharacterCodes._ ? "_" + identifier : identifier) as __String;
386386
}
387387

388-
export function isEscapedNameOfWellKnownSymbol(escapedName: __String) {
389-
return (escapedName as string).charCodeAt(0) === CharacterCodes._ &&
390-
(escapedName as string).charCodeAt(1) === CharacterCodes._ &&
391-
(escapedName as string).charCodeAt(2) === CharacterCodes.at;
392-
}
393-
394388
/**
395389
* @deprecated Use `id.escapedText` to get the escaped text of an Identifier.
396390
* @param identifier The identifier to escape

src/services/completions.ts

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -167,17 +167,15 @@ namespace ts.Completions {
167167
const uniqueNames = createMap<true>();
168168
if (symbols) {
169169
for (const symbol of symbols) {
170-
if (!isEscapedNameOfWellKnownSymbol(symbol.escapedName)) {
171-
const entry = createCompletionEntry(symbol, location, performCharacterChecks, typeChecker, target, allowStringLiteral);
172-
if (entry) {
173-
const id = entry.name;
174-
if (!uniqueNames.has(id)) {
175-
if (symbolToOriginInfoMap && symbolToOriginInfoMap[getUniqueSymbolId(symbol, typeChecker)]) {
176-
entry.hasAction = true;
177-
}
178-
entries.push(entry);
179-
uniqueNames.set(id, true);
170+
const entry = createCompletionEntry(symbol, location, performCharacterChecks, typeChecker, target, allowStringLiteral);
171+
if (entry) {
172+
const id = entry.name;
173+
if (!uniqueNames.has(id)) {
174+
if (symbolToOriginInfoMap && symbolToOriginInfoMap[getUniqueSymbolId(symbol, typeChecker)]) {
175+
entry.hasAction = true;
180176
}
177+
entries.push(entry);
178+
uniqueNames.set(id, true);
181179
}
182180
}
183181
}
@@ -1778,6 +1776,18 @@ namespace ts.Completions {
17781776
}
17791777
}
17801778

1779+
// If the symbol is for a member of an object type and is the internal name of an ES
1780+
// symbol, it is not a valid entry. Internal names for ES symbols start with "__@"
1781+
if (symbol.flags & SymbolFlags.ClassMember) {
1782+
const escapedName = symbol.escapedName as string;
1783+
if (escapedName.length >= 3 &&
1784+
escapedName.charCodeAt(0) === CharacterCodes._ &&
1785+
escapedName.charCodeAt(1) === CharacterCodes._ &&
1786+
escapedName.charCodeAt(2) === CharacterCodes.at) {
1787+
return undefined;
1788+
}
1789+
}
1790+
17811791
return getCompletionEntryDisplayName(name, target, performCharacterChecks, allowStringLiteral);
17821792
}
17831793

0 commit comments

Comments
 (0)