diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 11f9d0a9e24..9579dec51cd 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -2668,21 +2668,18 @@ namespace ts { export function assertTypeIsNever(_: never): void { } - export interface CachedHost { + export interface CachedDirectoryStructureHost extends DirectoryStructureHost { addOrDeleteFileOrFolder(fileOrFolder: string, fileOrFolderPath: Path): void; addOrDeleteFile(fileName: string, filePath: Path, eventKind: FileWatcherEventKind): void; clearCache(): void; } - export interface CachedPartialSystem extends PartialSystem, CachedHost { - } - interface MutableFileSystemEntries { readonly files: string[]; readonly directories: string[]; } - export function createCachedPartialSystem(host: PartialSystem): CachedPartialSystem { + export function createCachedDirectoryStructureHost(host: DirectoryStructureHost): CachedDirectoryStructureHost { const cachedReadDirectoryResult = createMap(); const getCurrentDirectory = memoize(() => host.getCurrentDirectory()); const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames); diff --git a/src/compiler/resolutionCache.ts b/src/compiler/resolutionCache.ts index a320e754d85..814d5053341 100644 --- a/src/compiler/resolutionCache.ts +++ b/src/compiler/resolutionCache.ts @@ -42,7 +42,7 @@ namespace ts { onInvalidatedResolution(): void; watchTypeRootsDirectory(directory: string, cb: DirectoryWatcherCallback, flags: WatchDirectoryFlags): FileWatcher; onChangedAutomaticTypeDirectiveNames(): void; - getCachedPartialSystem?(): CachedPartialSystem; + getCachedDirectoryStructureHost?(): CachedDirectoryStructureHost; projectName?: string; getGlobalCache?(): string | undefined; writeLog(s: string): void; @@ -396,9 +396,9 @@ namespace ts { function createDirectoryWatcher(directory: string, dirPath: Path) { return resolutionHost.watchDirectoryOfFailedLookupLocation(directory, fileOrFolder => { const fileOrFolderPath = resolutionHost.toPath(fileOrFolder); - if (resolutionHost.getCachedPartialSystem) { + if (resolutionHost.getCachedDirectoryStructureHost) { // Since the file existance changed, update the sourceFiles cache - resolutionHost.getCachedPartialSystem().addOrDeleteFileOrFolder(fileOrFolder, fileOrFolderPath); + resolutionHost.getCachedDirectoryStructureHost().addOrDeleteFileOrFolder(fileOrFolder, fileOrFolderPath); } // If the files are added to project root or node_modules directory, always run through the invalidation process @@ -515,9 +515,9 @@ namespace ts { // Create new watch and recursive info return resolutionHost.watchTypeRootsDirectory(typeRoot, fileOrFolder => { const fileOrFolderPath = resolutionHost.toPath(fileOrFolder); - if (resolutionHost.getCachedPartialSystem) { + if (resolutionHost.getCachedDirectoryStructureHost) { // Since the file existance changed, update the sourceFiles cache - resolutionHost.getCachedPartialSystem().addOrDeleteFileOrFolder(fileOrFolder, fileOrFolderPath); + resolutionHost.getCachedDirectoryStructureHost().addOrDeleteFileOrFolder(fileOrFolder, fileOrFolderPath); } // For now just recompile diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index 5f3b8bd06d1..822de1eef52 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -33,7 +33,7 @@ namespace ts { /** * Partial interface of the System thats needed to support the caching of directory structure */ - export interface PartialSystem { + export interface DirectoryStructureHost { newLine: string; useCaseSensitiveFileNames: boolean; write(s: string): void; @@ -48,11 +48,8 @@ namespace ts { exit(exitCode?: number): void; } - export interface System extends PartialSystem { + export interface System extends DirectoryStructureHost { args: string[]; - newLine: string; - useCaseSensitiveFileNames: boolean; - write(s: string): void; getFileSize?(path: string): number; /** * @pollingInterval - this parameter is used in polling-based watchers and ignored in watchers that diff --git a/src/compiler/watch.ts b/src/compiler/watch.ts index 939e50ce2ab..2d1d6e8bf58 100644 --- a/src/compiler/watch.ts +++ b/src/compiler/watch.ts @@ -4,7 +4,7 @@ namespace ts { export type DiagnosticReporter = (diagnostic: Diagnostic) => void; - export type ParseConfigFile = (configFileName: string, optionsToExtend: CompilerOptions, system: PartialSystem, reportDiagnostic: DiagnosticReporter, reportWatchDiagnostic: DiagnosticReporter) => ParsedCommandLine; + export type ParseConfigFile = (configFileName: string, optionsToExtend: CompilerOptions, system: DirectoryStructureHost, reportDiagnostic: DiagnosticReporter, reportWatchDiagnostic: DiagnosticReporter) => ParsedCommandLine; export interface WatchingSystemHost { // FS system to use system: System; @@ -18,7 +18,7 @@ namespace ts { // Callbacks to do custom action before creating program and after creating program beforeCompile(compilerOptions: CompilerOptions): void; - afterCompile(host: PartialSystem, program: Program, builder: Builder): void; + afterCompile(host: DirectoryStructureHost, program: Program, builder: Builder): void; } const defaultFormatDiagnosticsHost: FormatDiagnosticsHost = sys ? { @@ -61,7 +61,7 @@ namespace ts { system.write(ts.formatDiagnosticsWithColorAndContext([diagnostic], host) + host.getNewLine()); } - export function parseConfigFile(configFileName: string, optionsToExtend: CompilerOptions, system: PartialSystem, reportDiagnostic: DiagnosticReporter, reportWatchDiagnostic: DiagnosticReporter): ParsedCommandLine { + export function parseConfigFile(configFileName: string, optionsToExtend: CompilerOptions, system: DirectoryStructureHost, reportDiagnostic: DiagnosticReporter, reportWatchDiagnostic: DiagnosticReporter): ParsedCommandLine { let configFileText: string; try { configFileText = system.readFile(configFileName); @@ -89,7 +89,7 @@ namespace ts { return configParseResult; } - function reportEmittedFiles(files: string[], system: PartialSystem): void { + function reportEmittedFiles(files: string[], system: DirectoryStructureHost): void { if (!files || files.length === 0) { return; } @@ -100,7 +100,7 @@ namespace ts { } } - export function handleEmitOutputAndReportErrors(system: PartialSystem, program: Program, + export function handleEmitOutputAndReportErrors(system: DirectoryStructureHost, program: Program, emittedFiles: string[], emitSkipped: boolean, diagnostics: Diagnostic[], reportDiagnostic: DiagnosticReporter ): ExitStatus { @@ -141,7 +141,7 @@ namespace ts { afterCompile: compileWatchedProgram, }; - function compileWatchedProgram(host: PartialSystem, program: Program, builder: Builder) { + function compileWatchedProgram(host: DirectoryStructureHost, program: Program, builder: Builder) { // First get and report any syntactic errors. let diagnostics = program.getSyntacticDiagnostics().slice(); let reportSemanticDiagnostics = false; @@ -256,14 +256,14 @@ namespace ts { watchingHost = watchingHost || createWatchingSystemHost(compilerOptions.pretty); const { system, parseConfigFile, reportDiagnostic, reportWatchDiagnostic, beforeCompile, afterCompile } = watchingHost; - const partialSystem = configFileName ? createCachedPartialSystem(system) : system; + const directoryStructureHost = configFileName ? createCachedDirectoryStructureHost(system) : system; if (configFileName) { watchFile(system, configFileName, scheduleProgramReload, writeLog); } - const getCurrentDirectory = memoize(() => partialSystem.getCurrentDirectory()); + const getCurrentDirectory = memoize(() => directoryStructureHost.getCurrentDirectory()); const realpath = system.realpath && ((path: string) => system.realpath(path)); - const getCachedPartialSystem = configFileName && (() => partialSystem as CachedPartialSystem); + const getCachedDirectoryStructureHost = configFileName && (() => directoryStructureHost as CachedDirectoryStructureHost); const getCanonicalFileName = createGetCanonicalFileName(system.useCaseSensitiveFileNames); let newLine = getNewLineCharacter(compilerOptions, system); @@ -294,7 +294,7 @@ namespace ts { getCompilationSettings: () => compilerOptions, watchDirectoryOfFailedLookupLocation: watchDirectory, watchTypeRootsDirectory: watchDirectory, - getCachedPartialSystem, + getCachedDirectoryStructureHost, onInvalidatedResolution: scheduleProgramUpdate, onChangedAutomaticTypeDirectiveNames, writeLog @@ -361,7 +361,7 @@ namespace ts { missingFilePathsRequestedForRelease = undefined; } - afterCompile(partialSystem, program, builder); + afterCompile(directoryStructureHost, program, builder); reportWatchDiagnostic(createCompilerDiagnostic(Diagnostics.Compilation_complete_Watching_for_file_changes)); } @@ -376,11 +376,11 @@ namespace ts { return !isString(hostSourceFileInfo); } - return partialSystem.fileExists(fileName); + return directoryStructureHost.fileExists(fileName); } function directoryExists(directoryName: string) { - return partialSystem.directoryExists(directoryName); + return directoryStructureHost.directoryExists(directoryName); } function readFile(fileName: string) { @@ -392,7 +392,7 @@ namespace ts { } function getDirectories(path: string) { - return partialSystem.getDirectories(path); + return directoryStructureHost.getDirectories(path); } function resolveModuleNames(moduleNames: string[], containingFile: string, reusedNames?: string[]) { @@ -541,7 +541,7 @@ namespace ts { writeLog(`Reloading config file: ${configFileName}`); needsReload = false; - const cachedHost = partialSystem as CachedPartialSystem; + const cachedHost = directoryStructureHost as CachedDirectoryStructureHost; cachedHost.clearCache(); const configParseResult = parseConfigFile(configFileName, optionsToExtendForConfigFile, cachedHost, reportDiagnostic, reportWatchDiagnostic); rootFileNames = configParseResult.fileNames; @@ -586,7 +586,7 @@ namespace ts { function updateCachedSystemWithFile(fileName: string, path: Path, eventKind: FileWatcherEventKind) { if (configFileName) { - (partialSystem as CachedPartialSystem).addOrDeleteFile(fileName, path, eventKind); + (directoryStructureHost as CachedDirectoryStructureHost).addOrDeleteFile(fileName, path, eventKind); } } @@ -639,7 +639,7 @@ namespace ts { const fileOrFolderPath = toPath(fileOrFolder); // Since the file existance changed, update the sourceFiles cache - (partialSystem as CachedPartialSystem).addOrDeleteFileOrFolder(fileOrFolder, fileOrFolderPath); + (directoryStructureHost as CachedDirectoryStructureHost).addOrDeleteFileOrFolder(fileOrFolder, fileOrFolderPath); removeSourceFile(fileOrFolderPath); // If the the added or created file or folder is not supported file name, ignore the file @@ -651,7 +651,7 @@ namespace ts { // Reload is pending, do the reload if (!needsReload) { - const result = getFileNamesFromConfigSpecs(configFileSpecs, getDirectoryPath(configFileName), compilerOptions, partialSystem); + const result = getFileNamesFromConfigSpecs(configFileSpecs, getDirectoryPath(configFileName), compilerOptions, directoryStructureHost); if (!configFileSpecs.filesSpecs && result.fileNames.length === 0) { reportDiagnostic(getErrorForNoInputFiles(configFileSpecs, configFileName)); } diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index b0d9e2ccf04..c93098c32c2 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -755,7 +755,7 @@ namespace ts.server { directory, fileOrFolder => { const fileOrFolderPath = this.toPath(fileOrFolder); - project.getCachedPartialSystem().addOrDeleteFileOrFolder(fileOrFolder, fileOrFolderPath); + project.getCachedDirectoryStructureHost().addOrDeleteFileOrFolder(fileOrFolder, fileOrFolderPath); const configFilename = project.getConfigFilePath(); // If the the added or created file or folder is not supported file name, ignore the file @@ -768,7 +768,7 @@ namespace ts.server { // Reload is pending, do the reload if (!project.pendingReload) { const configFileSpecs = project.configFileSpecs; - const result = getFileNamesFromConfigSpecs(configFileSpecs, getDirectoryPath(configFilename), project.getCompilationSettings(), project.getCachedPartialSystem(), this.hostConfiguration.extraFileExtensions); + const result = getFileNamesFromConfigSpecs(configFileSpecs, getDirectoryPath(configFilename), project.getCompilationSettings(), project.getCachedDirectoryStructureHost(), this.hostConfiguration.extraFileExtensions); project.updateErrorOnNoInputFiles(result.fileNames.length !== 0); this.updateNonInferredProjectFiles(project, result.fileNames, fileNamePropertyReader); this.delayUpdateProjectGraphAndInferredProjectsRefresh(project); @@ -1292,7 +1292,7 @@ namespace ts.server { return findProjectByName(projectFileName, this.externalProjects); } - private convertConfigFileContentToProjectOptions(configFilename: string, cachedPartialSystem: CachedPartialSystem) { + private convertConfigFileContentToProjectOptions(configFilename: string, cachedDirectoryStructureHost: CachedDirectoryStructureHost) { configFilename = normalizePath(configFilename); const configFileContent = this.host.readFile(configFilename); @@ -1304,7 +1304,7 @@ namespace ts.server { const errors = result.parseDiagnostics; const parsedCommandLine = parseJsonSourceFileConfigFileContent( result, - cachedPartialSystem, + cachedDirectoryStructureHost, getDirectoryPath(configFilename), /*existingOptions*/ {}, configFilename, @@ -1429,8 +1429,8 @@ namespace ts.server { } private createConfiguredProject(configFileName: NormalizedPath) { - const cachedPartialSystem = createCachedPartialSystem(this.host); - const { projectOptions, configFileErrors, configFileSpecs } = this.convertConfigFileContentToProjectOptions(configFileName, cachedPartialSystem); + const cachedDirectoryStructureHost = createCachedDirectoryStructureHost(this.host); + const { projectOptions, configFileErrors, configFileSpecs } = this.convertConfigFileContentToProjectOptions(configFileName, cachedDirectoryStructureHost); this.logger.info(`Opened configuration file ${configFileName}`); const languageServiceEnabled = !this.exceededTotalSizeLimitForNonTsFiles(configFileName, projectOptions.compilerOptions, projectOptions.files, fileNamePropertyReader); const project = new ConfiguredProject( @@ -1441,7 +1441,7 @@ namespace ts.server { projectOptions.compilerOptions, languageServiceEnabled, projectOptions.compileOnSave === undefined ? false : projectOptions.compileOnSave, - cachedPartialSystem); + cachedDirectoryStructureHost); project.configFileSpecs = configFileSpecs; // TODO: We probably should also watch the configFiles that are extended @@ -1488,7 +1488,7 @@ namespace ts.server { else { const scriptKind = propertyReader.getScriptKind(f); const hasMixedContent = propertyReader.hasMixedContent(f, this.hostConfiguration.extraFileExtensions); - scriptInfo = this.getOrCreateScriptInfoNotOpenedByClientForNormalizedPath(normalizedPath, scriptKind, hasMixedContent, project.partialSystem); + scriptInfo = this.getOrCreateScriptInfoNotOpenedByClientForNormalizedPath(normalizedPath, scriptKind, hasMixedContent, project.directoryStructureHost); path = scriptInfo.path; // If this script info is not already a root add it if (!project.isRoot(scriptInfo)) { @@ -1539,7 +1539,7 @@ namespace ts.server { /* @internal */ reloadConfiguredProject(project: ConfiguredProject) { // At this point, there is no reason to not have configFile in the host - const host = project.getCachedPartialSystem(); + const host = project.getCachedDirectoryStructureHost(); // Clear the cache since we are reloading the project from disk host.clearCache(); @@ -1637,7 +1637,7 @@ namespace ts.server { } /*@internal*/ - getOrCreateScriptInfoNotOpenedByClient(uncheckedFileName: string, hostToQueryFileExistsOn: PartialSystem) { + getOrCreateScriptInfoNotOpenedByClient(uncheckedFileName: string, hostToQueryFileExistsOn: DirectoryStructureHost) { return this.getOrCreateScriptInfoNotOpenedByClientForNormalizedPath( toNormalizedPath(uncheckedFileName), /*scriptKind*/ undefined, /*hasMixedContent*/ undefined, hostToQueryFileExistsOn @@ -1669,15 +1669,15 @@ namespace ts.server { } } - getOrCreateScriptInfoNotOpenedByClientForNormalizedPath(fileName: NormalizedPath, scriptKind?: ScriptKind, hasMixedContent?: boolean, hostToQueryFileExistsOn?: PartialSystem) { + getOrCreateScriptInfoNotOpenedByClientForNormalizedPath(fileName: NormalizedPath, scriptKind?: ScriptKind, hasMixedContent?: boolean, hostToQueryFileExistsOn?: DirectoryStructureHost) { return this.getOrCreateScriptInfoForNormalizedPath(fileName, /*openedByClient*/ false, /*fileContent*/ undefined, scriptKind, hasMixedContent, hostToQueryFileExistsOn); } - getOrCreateScriptInfoOpenedByClientForNormalizedPath(fileName: NormalizedPath, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean, hostToQueryFileExistsOn?: PartialSystem) { + getOrCreateScriptInfoOpenedByClientForNormalizedPath(fileName: NormalizedPath, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean, hostToQueryFileExistsOn?: DirectoryStructureHost) { return this.getOrCreateScriptInfoForNormalizedPath(fileName, /*openedByClient*/ true, fileContent, scriptKind, hasMixedContent, hostToQueryFileExistsOn); } - getOrCreateScriptInfoForNormalizedPath(fileName: NormalizedPath, openedByClient: boolean, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean, hostToQueryFileExistsOn?: PartialSystem) { + getOrCreateScriptInfoForNormalizedPath(fileName: NormalizedPath, openedByClient: boolean, fileContent?: string, scriptKind?: ScriptKind, hasMixedContent?: boolean, hostToQueryFileExistsOn?: DirectoryStructureHost) { Debug.assert(fileContent === undefined || openedByClient, "ScriptInfo needs to be opened by client to be able to set its user defined content"); const path = normalizedPathToPath(fileName, this.currentDirectory, this.toCanonicalFileName); let info = this.getScriptInfoForPath(path); diff --git a/src/server/project.ts b/src/server/project.ts index a094054c821..746e6bf3fbe 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -201,7 +201,7 @@ namespace ts.server { languageServiceEnabled: boolean, private compilerOptions: CompilerOptions, public compileOnSaveEnabled: boolean, - /*@internal*/public partialSystem: PartialSystem) { + /*@internal*/public directoryStructureHost: DirectoryStructureHost) { if (!this.compilerOptions) { this.compilerOptions = getDefaultCompilerOptions(); @@ -236,7 +236,7 @@ namespace ts.server { } getNewLine() { - return this.partialSystem.newLine; + return this.directoryStructureHost.newLine; } getProjectVersion() { @@ -263,7 +263,7 @@ namespace ts.server { } private getScriptInfoLSHost(fileName: string) { - const scriptInfo = this.projectService.getOrCreateScriptInfoNotOpenedByClient(fileName, this.partialSystem); + const scriptInfo = this.projectService.getOrCreateScriptInfoNotOpenedByClient(fileName, this.directoryStructureHost); if (scriptInfo) { const existingValue = this.rootFilesMap.get(scriptInfo.path); if (existingValue !== undefined && existingValue !== scriptInfo) { @@ -298,7 +298,7 @@ namespace ts.server { } getCurrentDirectory(): string { - return this.partialSystem.getCurrentDirectory(); + return this.directoryStructureHost.getCurrentDirectory(); } getDefaultLibFileName() { @@ -307,22 +307,22 @@ namespace ts.server { } useCaseSensitiveFileNames() { - return this.partialSystem.useCaseSensitiveFileNames; + return this.directoryStructureHost.useCaseSensitiveFileNames; } readDirectory(path: string, extensions?: ReadonlyArray, exclude?: ReadonlyArray, include?: ReadonlyArray, depth?: number): string[] { - return this.partialSystem.readDirectory(path, extensions, exclude, include, depth); + return this.directoryStructureHost.readDirectory(path, extensions, exclude, include, depth); } readFile(fileName: string): string | undefined { - return this.partialSystem.readFile(fileName); + return this.directoryStructureHost.readFile(fileName); } fileExists(file: string): boolean { // As an optimization, don't hit the disks for files we already know don't exist // (because we're watching for their creation). const path = this.toPath(file); - return !this.isWatchedMissingFile(path) && this.partialSystem.fileExists(file); + return !this.isWatchedMissingFile(path) && this.directoryStructureHost.fileExists(file); } resolveModuleNames(moduleNames: string[], containingFile: string, reusedNames?: string[]): ResolvedModuleFull[] { @@ -334,11 +334,11 @@ namespace ts.server { } directoryExists(path: string): boolean { - return this.partialSystem.directoryExists(path); + return this.directoryStructureHost.directoryExists(path); } getDirectories(path: string): string[] { - return this.partialSystem.getDirectories(path); + return this.directoryStructureHost.getDirectories(path); } /*@internal*/ @@ -518,7 +518,7 @@ namespace ts.server { this.resolutionCache.clear(); this.resolutionCache = undefined; this.cachedUnresolvedImportsPerFile = undefined; - this.partialSystem = undefined; + this.directoryStructureHost = undefined; // Clean up file watchers waiting for missing files if (this.missingFilesMap) { @@ -835,7 +835,7 @@ namespace ts.server { // by the LSHost for files in the program when the program is retrieved above but // the program doesn't contain external files so this must be done explicitly. inserted => { - const scriptInfo = this.projectService.getOrCreateScriptInfoNotOpenedByClient(inserted, this.partialSystem); + const scriptInfo = this.projectService.getOrCreateScriptInfoNotOpenedByClient(inserted, this.directoryStructureHost); scriptInfo.attachToProject(this); }, removed => this.detachScriptInfoFromProject(removed) @@ -859,7 +859,7 @@ namespace ts.server { missingFilePath, (fileName, eventKind) => { if (this.projectKind === ProjectKind.Configured) { - (this.partialSystem as CachedPartialSystem).addOrDeleteFile(fileName, missingFilePath, eventKind); + (this.directoryStructureHost as CachedDirectoryStructureHost).addOrDeleteFile(fileName, missingFilePath, eventKind); } if (eventKind === FileWatcherEventKind.Created && this.missingFilesMap.has(missingFilePath)) { @@ -882,7 +882,7 @@ namespace ts.server { getScriptInfoForNormalizedPath(fileName: NormalizedPath) { const scriptInfo = this.projectService.getOrCreateScriptInfoNotOpenedByClientForNormalizedPath( - fileName, /*scriptKind*/ undefined, /*hasMixedContent*/ undefined, this.partialSystem + fileName, /*scriptKind*/ undefined, /*hasMixedContent*/ undefined, this.directoryStructureHost ); if (scriptInfo && !scriptInfo.isAttached(this)) { return Errors.ThrowProjectDoesNotContainDocument(fileName, this); @@ -1134,8 +1134,8 @@ namespace ts.server { compilerOptions: CompilerOptions, languageServiceEnabled: boolean, public compileOnSaveEnabled: boolean, - cachedPartialSystem: PartialSystem) { - super(configFileName, ProjectKind.Configured, projectService, documentRegistry, hasExplicitListOfFiles, languageServiceEnabled, compilerOptions, compileOnSaveEnabled, cachedPartialSystem); + cachedDirectoryStructureHost: CachedDirectoryStructureHost) { + super(configFileName, ProjectKind.Configured, projectService, documentRegistry, hasExplicitListOfFiles, languageServiceEnabled, compilerOptions, compileOnSaveEnabled, cachedDirectoryStructureHost); this.canonicalConfigFilePath = asNormalizedPath(projectService.toCanonicalFileName(configFileName)); this.enablePlugins(); this.resolutionCache.setRootDirectory(getDirectoryPath(configFileName)); @@ -1155,8 +1155,8 @@ namespace ts.server { } /*@internal*/ - getCachedPartialSystem() { - return this.partialSystem as CachedPartialSystem; + getCachedDirectoryStructureHost() { + return this.directoryStructureHost as CachedDirectoryStructureHost; } getConfigFilePath() { @@ -1342,7 +1342,7 @@ namespace ts.server { } getEffectiveTypeRoots() { - return getEffectiveTypeRoots(this.getCompilationSettings(), this.partialSystem) || []; + return getEffectiveTypeRoots(this.getCompilationSettings(), this.directoryStructureHost) || []; } /*@internal*/ diff --git a/src/server/scriptInfo.ts b/src/server/scriptInfo.ts index e1e05b36f2d..3971b29fe7e 100644 --- a/src/server/scriptInfo.ts +++ b/src/server/scriptInfo.ts @@ -292,7 +292,7 @@ namespace ts.server { detachAllProjects() { for (const p of this.containingProjects) { if (p.projectKind === ProjectKind.Configured) { - (p.partialSystem as CachedPartialSystem).addOrDeleteFile(this.fileName, this.path, FileWatcherEventKind.Deleted); + (p.directoryStructureHost as CachedDirectoryStructureHost).addOrDeleteFile(this.fileName, this.path, FileWatcherEventKind.Deleted); } const isInfoRoot = p.isRoot(this); // detach is unnecessary since we'll clean the list of containing projects anyways