Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Commit 4ce73bc

Browse files
committed
Rename ProjectManager.localFs to inMemoryFs
1 parent f422bc2 commit 4ce73bc

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/project-manager.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export class ProjectManager implements Disposable {
5555
/**
5656
* Local side of file content provider which keeps cache of fetched files
5757
*/
58-
private localFs: InMemoryFileSystem;
58+
private inMemoryFs: InMemoryFileSystem;
5959

6060
/**
6161
* File system updater that takes care of updating the in-memory file system
@@ -115,7 +115,7 @@ export class ProjectManager implements Disposable {
115115
) {
116116
this.rootPath = toUnixPath(rootPath);
117117
this.updater = updater;
118-
this.localFs = inMemoryFileSystem;
118+
this.inMemoryFs = inMemoryFileSystem;
119119
this.versions = new Map<string, number>();
120120
this.strict = strict;
121121
this.traceModuleResolution = traceModuleResolution || false;
@@ -138,7 +138,7 @@ export class ProjectManager implements Disposable {
138138
include: { js: ['**/*.js', '**/*.jsx'], ts: ['**/*.ts', '**/*.tsx'] }[configType]
139139
};
140140
const config = new ProjectConfiguration(
141-
this.localFs,
141+
this.inMemoryFs,
142142
documentRegistry,
143143
trimmedRootPath,
144144
this.versions,
@@ -167,7 +167,7 @@ export class ProjectManager implements Disposable {
167167
const configType = this.getConfigurationType(filePath);
168168
const configs = this.configs[configType];
169169
configs.set(dir, new ProjectConfiguration(
170-
this.localFs,
170+
this.inMemoryFs,
171171
documentRegistry,
172172
dir,
173173
this.versions,
@@ -202,15 +202,15 @@ export class ProjectManager implements Disposable {
202202
* @return local side of file content provider which keeps cached copies of fethed files
203203
*/
204204
getFs(): InMemoryFileSystem {
205-
return this.localFs;
205+
return this.inMemoryFs;
206206
}
207207

208208
/**
209209
* @param filePath file path (both absolute or relative file paths are accepted)
210210
* @return true if there is a fetched file with a given path
211211
*/
212212
hasFile(filePath: string) {
213-
return this.localFs.fileExists(filePath);
213+
return this.inMemoryFs.fileExists(filePath);
214214
}
215215

216216
/**
@@ -236,7 +236,7 @@ export class ProjectManager implements Disposable {
236236
await this.updater.ensureStructure();
237237
// Ensure content of all all global .d.ts, [tj]sconfig.json, package.json files
238238
await Promise.all(
239-
iterate(this.localFs.uris())
239+
iterate(this.inMemoryFs.uris())
240240
.filter(uri => isGlobalTSFile(uri) || isConfigFile(uri) || isPackageJsonFile(uri))
241241
.map(uri => this.updater.ensure(uri))
242242
);
@@ -278,7 +278,7 @@ export class ProjectManager implements Disposable {
278278
this.ensuredOwnFiles = (async () => {
279279
await this.updater.ensureStructure(span);
280280
await Promise.all(
281-
iterate(this.localFs.uris())
281+
iterate(this.inMemoryFs.uris())
282282
.filter(uri => !uri.includes('/node_modules/') && isJSTSFile(uri) || isConfigFile(uri) || isPackageJsonFile(uri))
283283
.map(uri => this.updater.ensure(uri))
284284
);
@@ -303,7 +303,7 @@ export class ProjectManager implements Disposable {
303303
this.ensuredAllFiles = (async () => {
304304
await this.updater.ensureStructure(span);
305305
await Promise.all(
306-
iterate(this.localFs.uris())
306+
iterate(this.inMemoryFs.uris())
307307
.filter(uri => isJSTSFile(uri) || isConfigFile(uri) || isPackageJsonFile(uri))
308308
.map(uri => this.updater.ensure(uri))
309309
);
@@ -386,7 +386,7 @@ export class ProjectManager implements Disposable {
386386
.mergeMap(() => {
387387
const config = this.getConfiguration(filePath);
388388
config.ensureBasicFiles(span);
389-
const contents = this.localFs.getContent(uri);
389+
const contents = this.inMemoryFs.getContent(uri);
390390
const info = ts.preProcessFile(contents, true, true);
391391
const compilerOpt = config.getHost().getCompilationSettings();
392392
// TODO remove platform-specific behavior here, the host OS is not coupled to the client OS
@@ -395,7 +395,7 @@ export class ProjectManager implements Disposable {
395395
return Observable.merge(
396396
// References with `import`
397397
Observable.from(info.importedFiles)
398-
.map(importedFile => ts.resolveModuleName(importedFile.fileName, toUnixPath(filePath), compilerOpt, this.localFs))
398+
.map(importedFile => ts.resolveModuleName(importedFile.fileName, toUnixPath(filePath), compilerOpt, this.inMemoryFs))
399399
// false means we didn't find a file defining the module. It
400400
// could still exist as an ambient module, which is why we
401401
// fetch global*.d.ts files.
@@ -418,7 +418,7 @@ export class ProjectManager implements Disposable {
418418
typeReferenceDirective.fileName,
419419
filePath,
420420
compilerOpt,
421-
this.localFs
421+
this.inMemoryFs
422422
)
423423
)
424424
.filter(resolved => !!(resolved && resolved.resolvedTypeReferenceDirective && resolved.resolvedTypeReferenceDirective.resolvedFileName))
@@ -513,7 +513,7 @@ export class ProjectManager implements Disposable {
513513
*/
514514
didClose(uri: string, span = new Span()) {
515515
const filePath = uri2path(uri);
516-
this.localFs.didClose(uri);
516+
this.inMemoryFs.didClose(uri);
517517
let version = this.versions.get(uri) || 0;
518518
this.versions.set(uri, ++version);
519519
const config = this.getConfigurationIfExists(filePath);
@@ -531,7 +531,7 @@ export class ProjectManager implements Disposable {
531531
*/
532532
didChange(uri: string, text: string, span = new Span()) {
533533
const filePath = uri2path(uri);
534-
this.localFs.didChange(uri, text);
534+
this.inMemoryFs.didChange(uri, text);
535535
let version = this.versions.get(uri) || 0;
536536
this.versions.set(uri, ++version);
537537
const config = this.getConfigurationIfExists(filePath);
@@ -548,7 +548,7 @@ export class ProjectManager implements Disposable {
548548
* @param uri file's URI
549549
*/
550550
didSave(uri: string) {
551-
this.localFs.didSave(uri);
551+
this.inMemoryFs.didSave(uri);
552552
}
553553

554554
/**

0 commit comments

Comments
 (0)