UNPKG

1.99 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8/// <amd-module name="@angular/language-service/api" />
9/**
10 * @module
11 * @description
12 * Entry point for all public APIs of the language service package.
13 */
14import * as ts from 'typescript';
15export interface PluginConfig {
16 /**
17 * If true, return only Angular results. Otherwise, return Angular + TypeScript
18 * results.
19 */
20 angularOnly: boolean;
21 /**
22 * If true, return factory function for Ivy LS during plugin initialization.
23 * Otherwise return factory function for View Engine LS.
24 */
25 ivy: boolean;
26 /**
27 * If true, enable `strictTemplates` in Angular compiler options regardless
28 * of its value in tsconfig.json.
29 */
30 forceStrictTemplates?: true;
31}
32export declare type GetTcbResponse = {
33 /**
34 * The filename of the SourceFile this typecheck block belongs to.
35 * The filename is entirely opaque and unstable, useful only for debugging
36 * purposes.
37 */
38 fileName: string;
39 /** The content of the SourceFile this typecheck block belongs to. */
40 content: string;
41 /**
42 * Spans over node(s) in the typecheck block corresponding to the
43 * TS code generated for template node under the current cursor position.
44 *
45 * When the cursor position is over a source for which there is no generated
46 * code, `selections` is empty.
47 */
48 selections: ts.TextSpan[];
49};
50/**
51 * `NgLanguageService` describes an instance of an Angular language service,
52 * whose API surface is a strict superset of TypeScript's language service.
53 */
54export interface NgLanguageService extends ts.LanguageService {
55 getTcb(fileName: string, position: number): GetTcbResponse | undefined;
56}
57export declare function isNgLanguageService(ls: ts.LanguageService | NgLanguageService): ls is NgLanguageService;