1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | import { HtmlParser, NgAnalyzedModules, ParseTreeResult, ResourceLoader } from '@angular/compiler';
|
10 | import * as tss from 'typescript/lib/tsserverlibrary';
|
11 | import { AstResult, Declaration, LanguageServiceHost, TemplateSource } from './types';
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 | export declare class DummyHtmlParser extends HtmlParser {
|
19 | parse(): ParseTreeResult;
|
20 | }
|
21 |
|
22 |
|
23 |
|
24 | export declare class DummyResourceLoader extends ResourceLoader {
|
25 | get(_url: string): Promise<string>;
|
26 | }
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 | export declare class TypeScriptServiceHost implements LanguageServiceHost {
|
36 | readonly tsLsHost: tss.LanguageServiceHost;
|
37 | readonly tsLS: tss.LanguageService;
|
38 | private readonly summaryResolver;
|
39 | private readonly reflectorHost;
|
40 | private readonly staticSymbolResolver;
|
41 | private readonly staticSymbolCache;
|
42 | |
43 |
|
44 |
|
45 |
|
46 |
|
47 | private readonly fileToComponent;
|
48 | private readonly collectedErrors;
|
49 | private readonly fileVersions;
|
50 | private readonly urlResolver;
|
51 | private lastProgram;
|
52 | private analyzedModules;
|
53 | constructor(tsLsHost: tss.LanguageServiceHost, tsLS: tss.LanguageService);
|
54 | private _resolver;
|
55 | /**
|
56 | * Return the singleton instance of the MetadataResolver.
|
57 | */
|
58 | private get resolver();
|
59 | /**
|
60 | * Return the singleton instance of the StaticReflector hosted in the
|
61 | * MetadataResolver.
|
62 | */
|
63 | private get reflector();
|
64 | /**
|
65 | * Return all known external templates.
|
66 | */
|
67 | getExternalTemplates(): ts.server.NormalizedPath[];
|
68 | /**
|
69 | * Checks whether the program has changed and returns all analyzed modules.
|
70 | * If program has changed, invalidate all caches and update fileToComponent
|
71 | * and templateReferences.
|
72 | * In addition to returning information about NgModules, this method plays the
|
73 | * same role as 'synchronizeHostData' in tsserver.
|
74 | */
|
75 | getAnalyzedModules(): NgAnalyzedModules;
|
76 | /**
|
77 | * Checks whether the program has changed, and invalidate static symbols in
|
78 | * the source files that have changed.
|
79 | * Returns true if modules are up-to-date, false otherwise.
|
80 | * This should only be called by getAnalyzedModules().
|
81 | */
|
82 | private upToDate;
|
83 | /**
|
84 | * Find all templates in the specified `file`.
|
85 | * @param fileName TS or HTML file
|
86 | */
|
87 | getTemplates(fileName: string): TemplateSource[];
|
88 | /**
|
89 | * Return metadata about all class declarations in the file that are Angular
|
90 | * directives. Potential matches are `@NgModule`, `@Component`, `@Directive`,
|
91 | * `@Pipes`, etc. class declarations.
|
92 | *
|
93 | * @param fileName TS file
|
94 | */
|
95 | getDeclarations(fileName: string): Declaration[];
|
96 | getSourceFile(fileName: string): tss.SourceFile | undefined;
|
97 | get program(): tss.Program;
|
98 | /**
|
99 | * Return the TemplateSource if `node` is a template node.
|
100 | *
|
101 | * For example,
|
102 | *
|
103 | * @Component({
|
104 | * template: '<div></div>' <-- template node
|
105 | * })
|
106 | * class AppComponent {}
|
107 | * ^---- class declaration node
|
108 | *
|
109 | * @param node Potential template node
|
110 | */
|
111 | private getInternalTemplate;
|
112 | |
113 |
|
114 |
|
115 |
|
116 | private getExternalTemplate;
|
117 | private collectError;
|
118 | private getCollectedErrors;
|
119 | |
120 |
|
121 |
|
122 |
|
123 |
|
124 | getTemplateAstAtPosition(fileName: string, position: number): AstResult | undefined;
|
125 | |
126 |
|
127 |
|
128 |
|
129 |
|
130 | private getModuleMetadataForDirective;
|
131 | |
132 |
|
133 |
|
134 |
|
135 | getTemplateAst(template: TemplateSource): AstResult | undefined;
|
136 | |
137 |
|
138 |
|
139 |
|
140 |
|
141 | log(msg: string): void;
|
142 | |
143 |
|
144 |
|
145 |
|
146 |
|
147 | error(msg: string): void;
|
148 | |
149 |
|
150 |
|
151 |
|
152 |
|
153 | debug(msg: string): void;
|
154 | }
|