Skip to content

Commit 1bf7eca

Browse files
author
Yui T
committed
Find all reference for short-hand property assignment
1 parent 7e39622 commit 1bf7eca

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/services/services.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4061,6 +4061,14 @@ module ts {
40614061
if (referenceSymbol && isRelatableToSearchSet(searchSymbols, referenceSymbol, referenceLocation)) {
40624062
result.push(getReferenceEntryFromNode(referenceLocation));
40634063
}
4064+
// TODO (yuisu): Comment
4065+
else if (referenceSymbol && referenceSymbol.declarations[0].kind === SyntaxKind.ShortHandPropertyAssignment) {
4066+
var referenceSymbolDeclName = referenceSymbol.declarations[0].name;
4067+
if (searchSymbols.indexOf(typeInfoResolver.resolveEntityNameForShortHandPropertyAssignment(referenceSymbolDeclName)) >= 0 &&
4068+
!(<SymbolLinks>referenceSymbol).target) {
4069+
result.push(getReferenceEntryFromNode(referenceSymbolDeclName));
4070+
}
4071+
}
40644072
});
40654073
}
40664074

@@ -4227,6 +4235,8 @@ module ts {
42274235
forEach(getPropertySymbolsFromContextualType(location), contextualSymbol => {
42284236
result.push.apply(result, typeInfoResolver.getRootSymbols(contextualSymbol));
42294237
});
4238+
4239+
// Add the symbol in the case of short-hand property assignment
42304240
if (location.kind === SyntaxKind.Identifier && location.parent.kind === SyntaxKind.ShortHandPropertyAssignment) {
42314241
result.push(typeInfoResolver.resolveEntityNameForShortHandPropertyAssignment(location));
42324242
}

0 commit comments

Comments
 (0)