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