feat(language-service): add quick info for inline templates in ivy (#39060)

Adds implementation for `getQuickInfoAtPosition` to the Ivy Language
Service, which now returns `ts.QuickInfo` for inline templates.

PR Close #39060
This commit is contained in:
Andrew Scott
2020-09-28 11:26:07 -07:00
committed by Joey Perrott
parent 4fe673d518
commit 904adb72d2
12 changed files with 892 additions and 26 deletions

View File

@ -16,6 +16,8 @@ import {TypeCheckShimGenerator} from '@angular/compiler-cli/src/ngtsc/typecheck'
import {OptimizeFor, TypeCheckingProgramStrategy} from '@angular/compiler-cli/src/ngtsc/typecheck/api';
import * as ts from 'typescript/lib/tsserverlibrary';
import {QuickInfoBuilder} from './quick_info';
export class LanguageService {
private options: CompilerOptions;
private lastKnownProgram: ts.Program|null = null;
@ -45,6 +47,12 @@ export class LanguageService {
throw new Error('Ivy LS currently does not support external template');
}
getQuickInfoAtPosition(fileName: string, position: number): ts.QuickInfo|undefined {
const program = this.strategy.getProgram();
const compiler = this.createCompiler(program);
return new QuickInfoBuilder(this.tsLS, compiler).get(fileName, position);
}
private createCompiler(program: ts.Program): NgCompiler {
return new NgCompiler(
this.adapter,