diff --git a/packages/language-service/ivy/quick_info.ts b/packages/language-service/ivy/quick_info.ts index cab76ba08e..9673e0e54e 100644 --- a/packages/language-service/ivy/quick_info.ts +++ b/packages/language-service/ivy/quick_info.ts @@ -143,9 +143,14 @@ export class QuickInfoBuilder { ts.QuickInfo { const kind = dir.isComponent ? QuickInfoKind.COMPONENT : QuickInfoKind.DIRECTIVE; const documentation = this.getDocumentationFromTypeDefAtLocation(dir.shimLocation); + let containerName: string|undefined; + if (ts.isClassDeclaration(dir.tsSymbol.valueDeclaration) && dir.ngModule !== null) { + containerName = dir.ngModule.name.getText(); + } + return createQuickInfo( - this.typeChecker.typeToString(dir.tsType), kind, getTextSpanOfNode(node), - undefined /* containerName */, undefined, documentation); + this.typeChecker.typeToString(dir.tsType), kind, getTextSpanOfNode(node), containerName, + undefined, documentation); } private getDocumentationFromTypeDefAtLocation(shimLocation: ShimLocation): diff --git a/packages/language-service/ivy/test/quick_info_spec.ts b/packages/language-service/ivy/test/quick_info_spec.ts index ac262b78cd..15f5cc8e2a 100644 --- a/packages/language-service/ivy/test/quick_info_spec.ts +++ b/packages/language-service/ivy/test/quick_info_spec.ts @@ -47,9 +47,7 @@ describe('quick info', () => { expectQuickInfo({ templateOverride: `
`, expectedSpanText: 'string-model', - // TODO(atscott): Find a way to include the module - // expectedDisplayParts: '(directive) AppModule.StringModel' - expectedDisplayString: '(directive) StringModel' + expectedDisplayString: '(directive) AppModule.StringModel' }); }); @@ -57,9 +55,7 @@ describe('quick info', () => { const {documentation} = expectQuickInfo({ templateOverride: `