()
| 164997 | return sourceFile; |
| 164998 | } |
| 164999 | function synchronizeHostData() { |
| 165000 | var _a, _b, _c; |
| 165001 | ts.Debug.assert(languageServiceMode !== ts.LanguageServiceMode.Syntactic); |
| 165002 | // perform fast check if host supports it |
| 165003 | if (host.getProjectVersion) { |
| 165004 | var hostProjectVersion = host.getProjectVersion(); |
| 165005 | if (hostProjectVersion) { |
| 165006 | if (lastProjectVersion === hostProjectVersion && !((_a = host.hasChangedAutomaticTypeDirectiveNames) === null || _a === void 0 ? void 0 : _a.call(host))) { |
| 165007 | return; |
| 165008 | } |
| 165009 | lastProjectVersion = hostProjectVersion; |
| 165010 | } |
| 165011 | } |
| 165012 | var typeRootsVersion = host.getTypeRootsVersion ? host.getTypeRootsVersion() : 0; |
| 165013 | if (lastTypesRootVersion !== typeRootsVersion) { |
| 165014 | log("TypeRoots version has changed; provide new program"); |
| 165015 | program = undefined; // TODO: GH#18217 |
| 165016 | lastTypesRootVersion = typeRootsVersion; |
| 165017 | } |
| 165018 | // Get a fresh cache of the host information |
| 165019 | var hostCache = new HostCache(host, getCanonicalFileName); |
| 165020 | var rootFileNames = hostCache.getRootFileNames(); |
| 165021 | var newSettings = host.getCompilationSettings() || getDefaultCompilerOptions(); |
| 165022 | var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse; |
| 165023 | var hasChangedAutomaticTypeDirectiveNames = ts.maybeBind(host, host.hasChangedAutomaticTypeDirectiveNames); |
| 165024 | var projectReferences = (_b = host.getProjectReferences) === null || _b === void 0 ? void 0 : _b.call(host); |
| 165025 | var parsedCommandLines; |
| 165026 | var parseConfigHost = { |
| 165027 | useCaseSensitiveFileNames: useCaseSensitiveFileNames, |
| 165028 | fileExists: fileExists, |
| 165029 | readFile: readFile, |
| 165030 | readDirectory: readDirectory, |
| 165031 | trace: ts.maybeBind(host, host.trace), |
| 165032 | getCurrentDirectory: function () { return currentDirectory; }, |
| 165033 | onUnRecoverableConfigFileDiagnostic: ts.noop, |
| 165034 | }; |
| 165035 | // If the program is already up-to-date, we can reuse it |
| 165036 | if (ts.isProgramUptoDate(program, rootFileNames, newSettings, function (_path, fileName) { return host.getScriptVersion(fileName); }, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) { |
| 165037 | return; |
| 165038 | } |
| 165039 | // IMPORTANT - It is critical from this moment onward that we do not check |
| 165040 | // cancellation tokens. We are about to mutate source files from a previous program |
| 165041 | // instance. If we cancel midway through, we may end up in an inconsistent state where |
| 165042 | // the program points to old source files that have been invalidated because of |
| 165043 | // incremental parsing. |
| 165044 | // Now create a new compiler |
| 165045 | var compilerHost = { |
| 165046 | getSourceFile: getOrCreateSourceFile, |
| 165047 | getSourceFileByPath: getOrCreateSourceFileByPath, |
| 165048 | getCancellationToken: function () { return cancellationToken; }, |
| 165049 | getCanonicalFileName: getCanonicalFileName, |
| 165050 | useCaseSensitiveFileNames: function () { return useCaseSensitiveFileNames; }, |
| 165051 | getNewLine: function () { return ts.getNewLineCharacter(newSettings, function () { return ts.getNewLineOrDefaultFromHost(host); }); }, |
| 165052 | getDefaultLibFileName: function (options) { return host.getDefaultLibFileName(options); }, |
| 165053 | writeFile: ts.noop, |
| 165054 | getCurrentDirectory: function () { return currentDirectory; }, |
| 165055 | fileExists: fileExists, |
| 165056 | readFile: readFile, |
no test coverage detected
searching dependent graphs…