diff --git a/packages/language-service/src/locate_symbol.ts b/packages/language-service/src/locate_symbol.ts index d9e497b5f1..9dd47837bf 100644 --- a/packages/language-service/src/locate_symbol.ts +++ b/packages/language-service/src/locate_symbol.ts @@ -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) {}, diff --git a/packages/language-service/test/hover_spec.ts b/packages/language-service/test/hover_spec.ts index 3cada95ae2..b07ecb79c5 100644 --- a/packages/language-service/test/hover_spec.ts +++ b/packages/language-service/test/hover_spec.ts @@ -68,6 +68,16 @@ describe('hover', () => { 'property name of TestComponent'); }); + it('should be able to ignore a reference declaration', () => { + addCode( + ` @Component({template: '
'}) 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;