diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 74670352c34..d3e087434d9 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -571,7 +571,11 @@ namespace ts { export interface Identifier extends PrimaryExpression { kind: SyntaxKind.Identifier; - text: string; // Text of identifier (with escapes converted to characters) + /** + * Text of identifier (with escapes converted to characters). + * If the identifier begins with two underscores, this will begin with three. + */ + text: string; originalKeywordKind?: SyntaxKind; // Original syntaxKind which get set so that we can report an error later /*@internal*/ autoGenerateKind?: GeneratedIdentifierKind; // Specifies whether to auto-generate the text for an identifier. /*@internal*/ autoGenerateId?: number; // Ensures unique generated identifiers get unique names, but clones get the same name. diff --git a/src/services/findAllReferences.ts b/src/services/findAllReferences.ts index 2363f59a774..395c282f6d5 100644 --- a/src/services/findAllReferences.ts +++ b/src/services/findAllReferences.ts @@ -694,7 +694,7 @@ namespace ts.FindAllReferences.Core { // Compare the length so we filter out strict superstrings of the symbol we are looking for switch (node && node.kind) { case SyntaxKind.Identifier: - return (node as Identifier).text.length === searchSymbolName.length; + return unescapeIdentifier((node as Identifier).text).length === searchSymbolName.length; case SyntaxKind.StringLiteral: return (isLiteralNameOfPropertyDeclarationOrIndexAccess(node) || isNameOfExternalModuleImportOrDeclaration(node)) &&