fix(language-service): ignore hover of symbols not in the TypeScript program (#17969)

Fixes: #17965
This commit is contained in:
Chuck Jazdzewski
2017-07-07 09:47:28 -06:00
committed by Jason Aden
parent cb16e9c747
commit 227dbbcfba
3 changed files with 112 additions and 4 deletions

View File

@ -322,7 +322,7 @@ export interface SymbolQuery {
/**
* Return the type symbol for the given static symbol.
*/
getTypeSymbol(type: StaticSymbol): Symbol;
getTypeSymbol(type: StaticSymbol): Symbol|undefined;
/**
* Return the members that are in the context of a type's template reference.

View File

@ -159,10 +159,10 @@ class TypeScriptSymbolQuery implements SymbolQuery {
}
}
getTypeSymbol(type: StaticSymbol): Symbol {
getTypeSymbol(type: StaticSymbol): Symbol|undefined {
const context: TypeContext = {node: this.source, program: this.program, checker: this.checker};
const typeSymbol = findClassSymbolInContext(type, context) !;
return new SymbolWrapper(typeSymbol, context);
const typeSymbol = findClassSymbolInContext(type, context);
return typeSymbol && new SymbolWrapper(typeSymbol, context);
}
createSymbolTable(symbols: SymbolDeclaration[]): SymbolTable {