feat(language-service): support multiple symbol definitions (#34782)

In Angular, symbol can have multiple definitions (e.g. a two-way
binding). This commit adds support for for multiple definitions for a
queried location in a template.

PR Close #34782
This commit is contained in:
Ayaz Hafiz
2020-01-14 18:54:40 -08:00
committed by Andrew Kushnir
parent 48f8ca5483
commit 1ea04ffc05
5 changed files with 199 additions and 154 deletions

View File

@ -148,8 +148,14 @@ export function getExpressionSymbol(
},
visitPropertyWrite(ast) {
const receiverType = getType(ast.receiver);
const {start} = ast.span;
symbol = receiverType && receiverType.members().get(ast.name);
span = ast.span;
// A PropertyWrite span includes both the LHS (name) and the RHS (value) of the write. In this
// visit, only the name is relevant.
// prop=$event
// ^^^^ name
// ^^^^^^ value; visited separately as a nested AST
span = {start, end: start + ast.name.length};
},
visitQuote(ast) {},
visitSafeMethodCall(ast) {