feat(language-service): Add getTypeDefinitionAtPosition (go to type definition) (#39145)

This commit adds the implementation for providing "go to type definition"
functionality in the Ivy Language Service.

PR Close #39145
This commit is contained in:
Andrew Scott
2020-10-02 13:54:18 -07:00
committed by atscott
parent bf717b1a31
commit a84976fdfc
13 changed files with 579 additions and 102 deletions

View File

@ -13,7 +13,7 @@ import * as ts from 'typescript';
import {createQuickInfo, SYMBOL_PUNC, SYMBOL_SPACE, SYMBOL_TEXT} from '../common/quick_info';
import {findNodeAtPosition} from './hybrid_visitor';
import {filterAliasImports, getDirectiveMatches, getDirectiveMatchesForAttribute, getTemplateInfoAtPosition, getTextSpanOfNode} from './utils';
import {filterAliasImports, getDirectiveMatchesForAttribute, getDirectiveMatchesForElementTag, getTemplateInfoAtPosition, getTextSpanOfNode} from './utils';
/**
* The type of Angular directive. Used for QuickInfo in template.
@ -94,7 +94,7 @@ export class QuickInfoBuilder {
private getQuickInfoForElementSymbol(symbol: ElementSymbol): ts.QuickInfo {
const {templateNode} = symbol;
const matches = getDirectiveMatches(symbol.directives, templateNode.name);
const matches = getDirectiveMatchesForElementTag(templateNode, symbol.directives);
if (matches.size > 0) {
return this.getQuickInfoForDirectiveSymbol(matches.values().next().value, templateNode);
}