fix(language-service): do not crash when hovering over a label definitions (#17974)
Fixes: #17972
This commit is contained in:
parent
ae27af7399
commit
3b2d2c467a
|
@ -68,7 +68,7 @@ export function locateSymbol(info: TemplateInfo): SymbolInfo|undefined {
|
|||
}
|
||||
},
|
||||
visitReference(ast) {
|
||||
symbol = info.template.query.getTypeSymbol(tokenReference(ast.value));
|
||||
symbol = ast.value && info.template.query.getTypeSymbol(tokenReference(ast.value));
|
||||
span = spanOf(ast);
|
||||
},
|
||||
visitVariable(ast) {},
|
||||
|
|
|
@ -68,6 +68,16 @@ describe('hover', () => {
|
|||
'property name of TestComponent');
|
||||
});
|
||||
|
||||
it('should be able to ignore a reference declaration', () => {
|
||||
addCode(
|
||||
` @Component({template: '<div #«chart»></div>'}) export class MyComponent { }`,
|
||||
fileName => {
|
||||
const markers = mockHost.getReferenceMarkers(fileName) !;
|
||||
const hover = ngService.getHoverAt(fileName, markers.references.chart[0].start);
|
||||
expect(hover).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
function hover(code: string, hoverText: string) {
|
||||
addCode(code, fileName => {
|
||||
let tests = 0;
|
||||
|
|
Loading…
Reference in New Issue