MCPcopy Index your code
hub / github.com/angular/angular / LSParseConfigHost

Class LSParseConfigHost

packages/language-service/src/adapters.ts:162–212  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

160 * than those on the adapter.
161 */
162export class LSParseConfigHost implements ConfigurationHost {
163 constructor(private readonly serverHost: ts.server.ServerHost) {}
164 exists(path: AbsoluteFsPath): boolean {
165 return this.serverHost.fileExists(path) || this.serverHost.directoryExists(path);
166 }
167 readFile(path: AbsoluteFsPath): string {
168 const content = this.serverHost.readFile(path);
169 if (content === undefined) {
170 console.error(`LanguageServiceFS#readFile called on unavailable file ${path}`);
171 return '';
172 }
173 return content;
174 }
175 lstat(path: AbsoluteFsPath): FileStats {
176 return {
177 isFile: () => {
178 return this.serverHost.fileExists(path);
179 },
180 isDirectory: () => {
181 return this.serverHost.directoryExists(path);
182 },
183 isSymbolicLink: () => {
184 throw new Error(`LanguageServiceFS#lstat#isSymbolicLink not implemented`);
185 },
186 };
187 }
188 readdir(path: AbsoluteFsPath): PathSegment[] {
189 return this.serverHost.readDirectory(
190 path,
191 undefined,
192 undefined,
193 undefined,
194 /* depth */ 1,
195 ) as PathSegment[];
196 }
197 pwd(): AbsoluteFsPath {
198 return this.serverHost.getCurrentDirectory() as AbsoluteFsPath;
199 }
200 extname(path: AbsoluteFsPath | PathSegment): string {
201 return p.extname(path);
202 }
203 resolve(...paths: string[]): AbsoluteFsPath {
204 return p.resolve(...paths) as AbsoluteFsPath;
205 }
206 dirname<T extends PathString>(file: T): T {
207 return p.dirname(file) as T;
208 }
209 join<T extends PathString>(basePath: T, ...paths: string[]): T {
210 return p.join(basePath, ...paths) as T;
211 }
212}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…