typescript 5.7.0-dev.20240918 → 5.7.0-dev.20240920

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/typescript.js CHANGED
@@ -239,7 +239,6 @@ __export(typescript_exports, {
239
239
  buildOverload: () => buildOverload,
240
240
  bundlerModuleNameResolver: () => bundlerModuleNameResolver,
241
241
  canBeConvertedToAsync: () => canBeConvertedToAsync,
242
- canEmitTsBuildInfo: () => canEmitTsBuildInfo,
243
242
  canHaveDecorators: () => canHaveDecorators,
244
243
  canHaveExportModifier: () => canHaveExportModifier,
245
244
  canHaveFlowNode: () => canHaveFlowNode,
@@ -1690,6 +1689,7 @@ __export(typescript_exports, {
1690
1689
  isSimpleInlineableExpression: () => isSimpleInlineableExpression,
1691
1690
  isSimpleParameterList: () => isSimpleParameterList,
1692
1691
  isSingleOrDoubleQuote: () => isSingleOrDoubleQuote,
1692
+ isSolutionConfig: () => isSolutionConfig,
1693
1693
  isSourceElement: () => isSourceElement,
1694
1694
  isSourceFile: () => isSourceFile,
1695
1695
  isSourceFileFromLibrary: () => isSourceFileFromLibrary,
@@ -1835,6 +1835,7 @@ __export(typescript_exports, {
1835
1835
  matchPatternOrExact: () => matchPatternOrExact,
1836
1836
  matchedText: () => matchedText,
1837
1837
  matchesExclude: () => matchesExclude,
1838
+ matchesExcludeWorker: () => matchesExcludeWorker,
1838
1839
  maxBy: () => maxBy,
1839
1840
  maybeBind: () => maybeBind,
1840
1841
  maybeSetLocalizedDiagnosticMessages: () => maybeSetLocalizedDiagnosticMessages,
@@ -2269,7 +2270,7 @@ module.exports = __toCommonJS(typescript_exports);
2269
2270
 
2270
2271
  // src/compiler/corePublic.ts
2271
2272
  var versionMajorMinor = "5.7";
2272
- var version = `${versionMajorMinor}.0-dev.20240918`;
2273
+ var version = `${versionMajorMinor}.0-dev.20240920`;
2273
2274
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2274
2275
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2275
2276
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -10295,7 +10296,6 @@ var Diagnostics = {
10295
10296
  Option_0_1_has_been_removed_Please_remove_it_from_your_configuration: diag(5108, 1 /* Error */, "Option_0_1_has_been_removed_Please_remove_it_from_your_configuration_5108", "Option '{0}={1}' has been removed. Please remove it from your configuration."),
10296
10297
  Option_moduleResolution_must_be_set_to_0_or_left_unspecified_when_option_module_is_set_to_1: diag(5109, 1 /* Error */, "Option_moduleResolution_must_be_set_to_0_or_left_unspecified_when_option_module_is_set_to_1_5109", "Option 'moduleResolution' must be set to '{0}' (or left unspecified) when option 'module' is set to '{1}'."),
10297
10298
  Option_module_must_be_set_to_0_when_option_moduleResolution_is_set_to_1: diag(5110, 1 /* Error */, "Option_module_must_be_set_to_0_when_option_moduleResolution_is_set_to_1_5110", "Option 'module' must be set to '{0}' when option 'moduleResolution' is set to '{1}'."),
10298
- Option_tsBuildInfoFile_cannot_be_specified_without_specifying_option_incremental_or_composite_or_if_not_running_tsc_b: diag(5111, 1 /* Error */, "Option_tsBuildInfoFile_cannot_be_specified_without_specifying_option_incremental_or_composite_or_if__5111", "Option 'tsBuildInfoFile' cannot be specified without specifying option 'incremental' or 'composite' or if not running 'tsc -b'."),
10299
10299
  Generates_a_sourcemap_for_each_corresponding_d_ts_file: diag(6e3, 3 /* Message */, "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000", "Generates a sourcemap for each corresponding '.d.ts' file."),
10300
10300
  Concatenate_and_emit_output_to_single_file: diag(6001, 3 /* Message */, "Concatenate_and_emit_output_to_single_file_6001", "Concatenate and emit output to single file."),
10301
10301
  Generates_corresponding_d_ts_file: diag(6002, 3 /* Message */, "Generates_corresponding_d_ts_file_6002", "Generates corresponding '.d.ts' file."),
@@ -18696,7 +18696,9 @@ function tryGetImportFromModuleSpecifier(node) {
18696
18696
  false
18697
18697
  ) ? node.parent : void 0;
18698
18698
  case 201 /* LiteralType */:
18699
- Debug.assert(isStringLiteral(node));
18699
+ if (!isStringLiteral(node)) {
18700
+ break;
18701
+ }
18700
18702
  return tryCast(node.parent.parent, isImportTypeNode);
18701
18703
  default:
18702
18704
  return void 0;
@@ -42772,6 +42774,9 @@ function getErrorForNoInputFiles({ includeSpecs, excludeSpecs }, configFileName)
42772
42774
  function shouldReportNoInputFiles(fileNames, canJsonReportNoInutFiles, resolutionStack) {
42773
42775
  return fileNames.length === 0 && canJsonReportNoInutFiles && (!resolutionStack || resolutionStack.length === 0);
42774
42776
  }
42777
+ function isSolutionConfig(config) {
42778
+ return !config.fileNames.length && hasProperty(config.raw, "references");
42779
+ }
42775
42780
  function canJsonReportNoInputFiles(raw) {
42776
42781
  return !hasProperty(raw, "files") && !hasProperty(raw, "references");
42777
42782
  }
@@ -124930,15 +124935,22 @@ function forEachProjectReference(projectReferences, resolvedProjectReferences, c
124930
124935
  const result = cbRef(projectReferences2, parent2);
124931
124936
  if (result) return result;
124932
124937
  }
124933
- return forEach(resolvedProjectReferences2, (resolvedRef, index) => {
124934
- if (resolvedRef && (seenResolvedRefs == null ? void 0 : seenResolvedRefs.has(resolvedRef.sourceFile.path))) {
124935
- return void 0;
124938
+ let skipChildren;
124939
+ return forEach(
124940
+ resolvedProjectReferences2,
124941
+ (resolvedRef, index) => {
124942
+ if (resolvedRef && (seenResolvedRefs == null ? void 0 : seenResolvedRefs.has(resolvedRef.sourceFile.path))) {
124943
+ (skipChildren ?? (skipChildren = /* @__PURE__ */ new Set())).add(resolvedRef);
124944
+ return void 0;
124945
+ }
124946
+ const result = cbResolvedRef(resolvedRef, parent2, index);
124947
+ if (result || !resolvedRef) return result;
124948
+ (seenResolvedRefs || (seenResolvedRefs = /* @__PURE__ */ new Set())).add(resolvedRef.sourceFile.path);
124936
124949
  }
124937
- const result = cbResolvedRef(resolvedRef, parent2, index);
124938
- if (result || !resolvedRef) return result;
124939
- (seenResolvedRefs || (seenResolvedRefs = /* @__PURE__ */ new Set())).add(resolvedRef.sourceFile.path);
124940
- return worker(resolvedRef.commandLine.projectReferences, resolvedRef.references, resolvedRef);
124941
- });
124950
+ ) || forEach(
124951
+ resolvedProjectReferences2,
124952
+ (resolvedRef) => resolvedRef && !(skipChildren == null ? void 0 : skipChildren.has(resolvedRef)) ? worker(resolvedRef.commandLine.projectReferences, resolvedRef.references, resolvedRef) : void 0
124953
+ );
124942
124954
  }
124943
124955
  }
124944
124956
  var inferredTypesContainingFile = "__inferred type names__.ts";
@@ -125036,7 +125048,13 @@ function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion,
125036
125048
  if (oldResolvedRef.commandLine.options.configFile !== newParsedCommandLine.options.configFile) return false;
125037
125049
  if (!arrayIsEqualTo(oldResolvedRef.commandLine.fileNames, newParsedCommandLine.fileNames)) return false;
125038
125050
  (seenResolvedRefs || (seenResolvedRefs = [])).push(oldResolvedRef);
125039
- return !forEach(oldResolvedRef.references, (childResolvedRef, index) => !resolvedProjectReferenceUptoDate(childResolvedRef, oldResolvedRef.commandLine.projectReferences[index]));
125051
+ return !forEach(
125052
+ oldResolvedRef.references,
125053
+ (childResolvedRef, index) => !resolvedProjectReferenceUptoDate(
125054
+ childResolvedRef,
125055
+ oldResolvedRef.commandLine.projectReferences[index]
125056
+ )
125057
+ );
125040
125058
  }
125041
125059
  const refPath = resolveProjectReferencePath(oldRef);
125042
125060
  return !getParsedCommandLine(refPath);
@@ -127471,11 +127489,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
127471
127489
  }
127472
127490
  }
127473
127491
  const outputFile = options.outFile;
127474
- if (options.tsBuildInfoFile) {
127475
- if (!canEmitTsBuildInfo(options)) {
127476
- createDiagnosticForOptionName(Diagnostics.Option_tsBuildInfoFile_cannot_be_specified_without_specifying_option_incremental_or_composite_or_if_not_running_tsc_b, "tsBuildInfoFile");
127477
- }
127478
- } else if (options.incremental && !outputFile && !options.configFilePath) {
127492
+ if (!options.tsBuildInfoFile && options.incremental && !outputFile && !options.configFilePath) {
127479
127493
  programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified));
127480
127494
  }
127481
127495
  verifyDeprecatedCompilerOptions();
@@ -127983,7 +127997,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
127983
127997
  case 1 /* SourceFromProjectReference */:
127984
127998
  case 2 /* OutputFromProjectReference */:
127985
127999
  const referencedResolvedRef = Debug.checkDefined(resolvedProjectReferences == null ? void 0 : resolvedProjectReferences[reason.index]);
127986
- const referenceInfo = forEachProjectReference(projectReferences, resolvedProjectReferences, (resolvedRef, parent2, index2) => resolvedRef === referencedResolvedRef ? { sourceFile: (parent2 == null ? void 0 : parent2.sourceFile) || options.configFile, index: index2 } : void 0);
128000
+ const referenceInfo = forEachProjectReference(
128001
+ projectReferences,
128002
+ resolvedProjectReferences,
128003
+ (resolvedRef, parent2, index2) => resolvedRef === referencedResolvedRef ? { sourceFile: (parent2 == null ? void 0 : parent2.sourceFile) || options.configFile, index: index2 } : void 0
128004
+ );
127987
128005
  if (!referenceInfo) return void 0;
127988
128006
  const { sourceFile, index } = referenceInfo;
127989
128007
  const referencesSyntax = forEachTsConfigPropArray(sourceFile, "references", (property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0);
@@ -128018,27 +128036,31 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
128018
128036
  }
128019
128037
  function verifyProjectReferences() {
128020
128038
  const buildInfoPath = !options.suppressOutputPathCheck ? getTsBuildInfoEmitOutputFilePath(options) : void 0;
128021
- forEachProjectReference(projectReferences, resolvedProjectReferences, (resolvedRef, parent2, index) => {
128022
- const ref = (parent2 ? parent2.commandLine.projectReferences : projectReferences)[index];
128023
- const parentFile = parent2 && parent2.sourceFile;
128024
- verifyDeprecatedProjectReference(ref, parentFile, index);
128025
- if (!resolvedRef) {
128026
- createDiagnosticForReference(parentFile, index, Diagnostics.File_0_not_found, ref.path);
128027
- return;
128028
- }
128029
- const options2 = resolvedRef.commandLine.options;
128030
- if (!options2.composite || options2.noEmit) {
128031
- const inputs = parent2 ? parent2.commandLine.fileNames : rootNames;
128032
- if (inputs.length) {
128033
- if (!options2.composite) createDiagnosticForReference(parentFile, index, Diagnostics.Referenced_project_0_must_have_setting_composite_Colon_true, ref.path);
128034
- if (options2.noEmit) createDiagnosticForReference(parentFile, index, Diagnostics.Referenced_project_0_may_not_disable_emit, ref.path);
128039
+ forEachProjectReference(
128040
+ projectReferences,
128041
+ resolvedProjectReferences,
128042
+ (resolvedRef, parent2, index) => {
128043
+ const ref = (parent2 ? parent2.commandLine.projectReferences : projectReferences)[index];
128044
+ const parentFile = parent2 && parent2.sourceFile;
128045
+ verifyDeprecatedProjectReference(ref, parentFile, index);
128046
+ if (!resolvedRef) {
128047
+ createDiagnosticForReference(parentFile, index, Diagnostics.File_0_not_found, ref.path);
128048
+ return;
128049
+ }
128050
+ const options2 = resolvedRef.commandLine.options;
128051
+ if (!options2.composite || options2.noEmit) {
128052
+ const inputs = parent2 ? parent2.commandLine.fileNames : rootNames;
128053
+ if (inputs.length) {
128054
+ if (!options2.composite) createDiagnosticForReference(parentFile, index, Diagnostics.Referenced_project_0_must_have_setting_composite_Colon_true, ref.path);
128055
+ if (options2.noEmit) createDiagnosticForReference(parentFile, index, Diagnostics.Referenced_project_0_may_not_disable_emit, ref.path);
128056
+ }
128057
+ }
128058
+ if (!parent2 && buildInfoPath && buildInfoPath === getTsBuildInfoEmitOutputFilePath(options2)) {
128059
+ createDiagnosticForReference(parentFile, index, Diagnostics.Cannot_write_file_0_because_it_will_overwrite_tsbuildinfo_file_generated_by_referenced_project_1, buildInfoPath, ref.path);
128060
+ hasEmitBlockingDiagnostics.set(toPath3(buildInfoPath), true);
128035
128061
  }
128036
128062
  }
128037
- if (!parent2 && buildInfoPath && buildInfoPath === getTsBuildInfoEmitOutputFilePath(options2)) {
128038
- createDiagnosticForReference(parentFile, index, Diagnostics.Cannot_write_file_0_because_it_will_overwrite_tsbuildinfo_file_generated_by_referenced_project_1, buildInfoPath, ref.path);
128039
- hasEmitBlockingDiagnostics.set(toPath3(buildInfoPath), true);
128040
- }
128041
- });
128063
+ );
128042
128064
  }
128043
128065
  function createDiagnosticForOptionPathKeyValue(key, valueIndex, message, ...args) {
128044
128066
  let needCompilerDiagnostic = true;
@@ -132679,7 +132701,13 @@ function createWatchProgram(host) {
132679
132701
  Debug.assert(configFileName);
132680
132702
  updateLevel = 0 /* Update */;
132681
132703
  rootFileNames = getFileNamesFromConfigSpecs(compilerOptions.configFile.configFileSpecs, getNormalizedAbsolutePath(getDirectoryPath(configFileName), currentDirectory), compilerOptions, parseConfigFileHost, extraFileExtensions);
132682
- if (updateErrorForNoInputFiles(rootFileNames, getNormalizedAbsolutePath(configFileName, currentDirectory), compilerOptions.configFile.configFileSpecs, configFileParsingDiagnostics, canConfigFileJsonReportNoInputFiles)) {
132704
+ if (updateErrorForNoInputFiles(
132705
+ rootFileNames,
132706
+ getNormalizedAbsolutePath(configFileName, currentDirectory),
132707
+ compilerOptions.configFile.configFileSpecs,
132708
+ configFileParsingDiagnostics,
132709
+ canConfigFileJsonReportNoInputFiles
132710
+ )) {
132683
132711
  hasChangedConfigFileParsingErrors = true;
132684
132712
  }
132685
132713
  synchronizeProgram();
@@ -133666,7 +133694,13 @@ function getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue) {
133666
133694
  watchPackageJsonFiles(state, project, projectPath, config);
133667
133695
  } else if (updateLevel === 1 /* RootNamesAndUpdate */) {
133668
133696
  config.fileNames = getFileNamesFromConfigSpecs(config.options.configFile.configFileSpecs, getDirectoryPath(project), config.options, state.parseConfigFileHost);
133669
- updateErrorForNoInputFiles(config.fileNames, project, config.options.configFile.configFileSpecs, config.errors, canJsonReportNoInputFiles(config.raw));
133697
+ updateErrorForNoInputFiles(
133698
+ config.fileNames,
133699
+ project,
133700
+ config.options.configFile.configFileSpecs,
133701
+ config.errors,
133702
+ canJsonReportNoInputFiles(config.raw)
133703
+ );
133670
133704
  watchInputFiles(state, project, projectPath, config);
133671
133705
  watchPackageJsonFiles(state, project, projectPath, config);
133672
133706
  }
@@ -133847,11 +133881,7 @@ function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime,
133847
133881
  }
133848
133882
  function getUpToDateStatusWorker(state, project, resolvedPath) {
133849
133883
  var _a, _b, _c, _d, _e;
133850
- if (!project.fileNames.length && !canJsonReportNoInputFiles(project.raw)) {
133851
- return {
133852
- type: 16 /* ContainerOnly */
133853
- };
133854
- }
133884
+ if (isSolutionConfig(project)) return { type: 16 /* ContainerOnly */ };
133855
133885
  let referenceStatuses;
133856
133886
  const force = !!state.options.force;
133857
133887
  if (project.projectReferences) {
@@ -180547,7 +180577,6 @@ __export(ts_exports2, {
180547
180577
  buildOverload: () => buildOverload,
180548
180578
  bundlerModuleNameResolver: () => bundlerModuleNameResolver,
180549
180579
  canBeConvertedToAsync: () => canBeConvertedToAsync,
180550
- canEmitTsBuildInfo: () => canEmitTsBuildInfo,
180551
180580
  canHaveDecorators: () => canHaveDecorators,
180552
180581
  canHaveExportModifier: () => canHaveExportModifier,
180553
180582
  canHaveFlowNode: () => canHaveFlowNode,
@@ -181998,6 +182027,7 @@ __export(ts_exports2, {
181998
182027
  isSimpleInlineableExpression: () => isSimpleInlineableExpression,
181999
182028
  isSimpleParameterList: () => isSimpleParameterList,
182000
182029
  isSingleOrDoubleQuote: () => isSingleOrDoubleQuote,
182030
+ isSolutionConfig: () => isSolutionConfig,
182001
182031
  isSourceElement: () => isSourceElement,
182002
182032
  isSourceFile: () => isSourceFile,
182003
182033
  isSourceFileFromLibrary: () => isSourceFileFromLibrary,
@@ -182143,6 +182173,7 @@ __export(ts_exports2, {
182143
182173
  matchPatternOrExact: () => matchPatternOrExact,
182144
182174
  matchedText: () => matchedText,
182145
182175
  matchesExclude: () => matchesExclude,
182176
+ matchesExcludeWorker: () => matchesExcludeWorker,
182146
182177
  maxBy: () => maxBy,
182147
182178
  maybeBind: () => maybeBind,
182148
182179
  maybeSetLocalizedDiagnosticMessages: () => maybeSetLocalizedDiagnosticMessages,
@@ -182772,6 +182803,8 @@ __export(ts_server_exports3, {
182772
182803
  nullCancellationToken: () => nullCancellationToken,
182773
182804
  nullTypingsInstaller: () => nullTypingsInstaller,
182774
182805
  protocol: () => ts_server_protocol_exports,
182806
+ scriptInfoIsContainedByBackgroundProject: () => scriptInfoIsContainedByBackgroundProject,
182807
+ scriptInfoIsContainedByDeferredClosedProject: () => scriptInfoIsContainedByDeferredClosedProject,
182775
182808
  stringifyIndented: () => stringifyIndented,
182776
182809
  toEvent: () => toEvent,
182777
182810
  toNormalizedPath: () => toNormalizedPath,
@@ -184008,13 +184041,6 @@ var ScriptInfo = class {
184008
184041
  isOrphan() {
184009
184042
  return this.deferredDelete || !forEach(this.containingProjects, (p) => !p.isOrphan());
184010
184043
  }
184011
- /** @internal */
184012
- isContainedByBackgroundProject() {
184013
- return some(
184014
- this.containingProjects,
184015
- isBackgroundProject
184016
- );
184017
- }
184018
184044
  /**
184019
184045
  * @param line 1 based index
184020
184046
  */
@@ -184052,6 +184078,18 @@ function failIfInvalidLocation(location) {
184052
184078
  Debug.assert(location.line > 0, `Expected line to be non-${location.line === 0 ? "zero" : "negative"}`);
184053
184079
  Debug.assert(location.offset > 0, `Expected offset to be non-${location.offset === 0 ? "zero" : "negative"}`);
184054
184080
  }
184081
+ function scriptInfoIsContainedByBackgroundProject(info) {
184082
+ return some(
184083
+ info.containingProjects,
184084
+ isBackgroundProject
184085
+ );
184086
+ }
184087
+ function scriptInfoIsContainedByDeferredClosedProject(info) {
184088
+ return some(
184089
+ info.containingProjects,
184090
+ isProjectDeferredClose
184091
+ );
184092
+ }
184055
184093
 
184056
184094
  // src/server/project.ts
184057
184095
  var ProjectKind = /* @__PURE__ */ ((ProjectKind2) => {
@@ -184205,7 +184243,8 @@ var Project2 = class _Project {
184205
184243
  * @internal
184206
184244
  */
184207
184245
  this.projectStateVersion = 0;
184208
- this.isInitialLoadPending = returnFalse;
184246
+ /** @internal */
184247
+ this.initialLoadPending = false;
184209
184248
  /** @internal */
184210
184249
  this.dirty = false;
184211
184250
  /** @internal */
@@ -185398,7 +185437,7 @@ var Project2 = class _Project {
185398
185437
  );
185399
185438
  }
185400
185439
  filesToStringWorker(writeProjectFileNames, writeFileExplaination, writeFileVersionAndText) {
185401
- if (this.isInitialLoadPending()) return " Files (0) InitialLoadPending\n";
185440
+ if (this.initialLoadPending) return " Files (0) InitialLoadPending\n";
185402
185441
  if (!this.program) return " Files (0) NoProgram\n";
185403
185442
  const sourceFiles = this.program.getSourceFiles();
185404
185443
  let strBuilder = ` Files (${sourceFiles.length})
@@ -185485,7 +185524,7 @@ var Project2 = class _Project {
185485
185524
  fileName,
185486
185525
  isSourceOfProjectReferenceRedirect
185487
185526
  })) : (files) => arrayFrom(files.keys());
185488
- if (!this.isInitialLoadPending()) {
185527
+ if (!this.initialLoadPending) {
185489
185528
  updateProjectIfDirty(this);
185490
185529
  }
185491
185530
  const info = {
@@ -186224,9 +186263,7 @@ var ConfiguredProject2 = class extends Project2 {
186224
186263
  /** @internal */
186225
186264
  this.openFileWatchTriggered = /* @__PURE__ */ new Map();
186226
186265
  /** @internal */
186227
- this.canConfigFileJsonReportNoInputFiles = false;
186228
- /** @internal */
186229
- this.isInitialLoadPending = returnTrue;
186266
+ this.initialLoadPending = true;
186230
186267
  /** @internal */
186231
186268
  this.sendLoadingProjectFinish = false;
186232
186269
  this.pendingUpdateLevel = 2 /* Full */;
@@ -186246,7 +186283,7 @@ var ConfiguredProject2 = class extends Project2 {
186246
186283
  }
186247
186284
  /** @internal */
186248
186285
  getParsedCommandLine(fileName) {
186249
- const configFileName = asNormalizedPath(normalizePath(fileName));
186286
+ const configFileName = toNormalizedPath(fileName);
186250
186287
  const canonicalConfigFilePath = asNormalizedPath(this.projectService.toCanonicalFileName(configFileName));
186251
186288
  let configFileExistenceInfo = this.projectService.configFileExistenceInfoCache.get(canonicalConfigFilePath);
186252
186289
  if (!configFileExistenceInfo) {
@@ -186260,7 +186297,7 @@ var ConfiguredProject2 = class extends Project2 {
186260
186297
  }
186261
186298
  /** @internal */
186262
186299
  onReleaseParsedCommandLine(fileName) {
186263
- this.releaseParsedConfig(asNormalizedPath(this.projectService.toCanonicalFileName(asNormalizedPath(normalizePath(fileName)))));
186300
+ this.releaseParsedConfig(asNormalizedPath(this.projectService.toCanonicalFileName(toNormalizedPath(fileName))));
186264
186301
  }
186265
186302
  releaseParsedConfig(canonicalConfigFilePath) {
186266
186303
  this.projectService.stopWatchingWildCards(canonicalConfigFilePath, this);
@@ -186273,7 +186310,7 @@ var ConfiguredProject2 = class extends Project2 {
186273
186310
  updateGraph() {
186274
186311
  if (this.deferredClose) return false;
186275
186312
  const isDirty = this.dirty;
186276
- this.isInitialLoadPending = returnFalse;
186313
+ this.initialLoadPending = false;
186277
186314
  const updateLevel = this.pendingUpdateLevel;
186278
186315
  this.pendingUpdateLevel = 0 /* Update */;
186279
186316
  let result;
@@ -186325,7 +186362,7 @@ var ConfiguredProject2 = class extends Project2 {
186325
186362
  }
186326
186363
  /** @internal */
186327
186364
  setPotentialProjectReference(canonicalConfigPath) {
186328
- Debug.assert(this.isInitialLoadPending());
186365
+ Debug.assert(this.initialLoadPending);
186329
186366
  (this.potentialProjectReferences || (this.potentialProjectReferences = /* @__PURE__ */ new Set())).add(canonicalConfigPath);
186330
186367
  }
186331
186368
  /** @internal */
@@ -186389,10 +186426,6 @@ var ConfiguredProject2 = class extends Project2 {
186389
186426
  super.markAsDirty();
186390
186427
  }
186391
186428
  /** @internal */
186392
- isSolution() {
186393
- return this.getRootFilesMap().size === 0 && !this.canConfigFileJsonReportNoInputFiles;
186394
- }
186395
- /** @internal */
186396
186429
  isOrphan() {
186397
186430
  return !!this.deferredClose;
186398
186431
  }
@@ -186400,8 +186433,15 @@ var ConfiguredProject2 = class extends Project2 {
186400
186433
  return getEffectiveTypeRoots(this.getCompilationSettings(), this) || [];
186401
186434
  }
186402
186435
  /** @internal */
186403
- updateErrorOnNoInputFiles(fileNames) {
186404
- updateErrorForNoInputFiles(fileNames, this.getConfigFilePath(), this.getCompilerOptions().configFile.configFileSpecs, this.projectErrors, this.canConfigFileJsonReportNoInputFiles);
186436
+ updateErrorOnNoInputFiles(parsedCommandLine) {
186437
+ this.parsedCommandLine = parsedCommandLine;
186438
+ updateErrorForNoInputFiles(
186439
+ parsedCommandLine.fileNames,
186440
+ this.getConfigFilePath(),
186441
+ this.getCompilerOptions().configFile.configFileSpecs,
186442
+ this.projectErrors,
186443
+ canJsonReportNoInputFiles(parsedCommandLine.raw)
186444
+ );
186405
186445
  }
186406
186446
  };
186407
186447
  var ExternalProject = class extends Project2 {
@@ -186622,8 +186662,23 @@ var nullTypingsInstaller = {
186622
186662
  };
186623
186663
  var noopConfigFileWatcher = { close: noop };
186624
186664
  function getConfigFileNameFromCache(info, cache) {
186625
- if (!cache || isAncestorConfigFileInfo(info)) return void 0;
186626
- return cache.get(info.path);
186665
+ if (!cache) return void 0;
186666
+ const configFileForOpenFile = cache.get(info.path);
186667
+ if (configFileForOpenFile === void 0) return void 0;
186668
+ if (!isAncestorConfigFileInfo(info)) {
186669
+ return isString(configFileForOpenFile) || !configFileForOpenFile ? configFileForOpenFile : (
186670
+ // direct result
186671
+ configFileForOpenFile.get(
186672
+ /*key*/
186673
+ false
186674
+ )
186675
+ );
186676
+ } else {
186677
+ return configFileForOpenFile && !isString(configFileForOpenFile) ? (
186678
+ // Map with fileName as key
186679
+ configFileForOpenFile.get(info.fileName)
186680
+ ) : void 0;
186681
+ }
186627
186682
  }
186628
186683
  function isOpenScriptInfo(infoOrFileNameOrConfig) {
186629
186684
  return !!infoOrFileNameOrConfig.containingProjects;
@@ -186632,125 +186687,159 @@ function isAncestorConfigFileInfo(infoOrFileNameOrConfig) {
186632
186687
  return !!infoOrFileNameOrConfig.configFileInfo;
186633
186688
  }
186634
186689
  var ConfiguredProjectLoadKind = /* @__PURE__ */ ((ConfiguredProjectLoadKind2) => {
186635
- ConfiguredProjectLoadKind2[ConfiguredProjectLoadKind2["Find"] = 0] = "Find";
186636
- ConfiguredProjectLoadKind2[ConfiguredProjectLoadKind2["Create"] = 1] = "Create";
186637
- ConfiguredProjectLoadKind2[ConfiguredProjectLoadKind2["Reload"] = 2] = "Reload";
186690
+ ConfiguredProjectLoadKind2[ConfiguredProjectLoadKind2["FindOptimized"] = 0] = "FindOptimized";
186691
+ ConfiguredProjectLoadKind2[ConfiguredProjectLoadKind2["Find"] = 1] = "Find";
186692
+ ConfiguredProjectLoadKind2[ConfiguredProjectLoadKind2["CreateReplayOptimized"] = 2] = "CreateReplayOptimized";
186693
+ ConfiguredProjectLoadKind2[ConfiguredProjectLoadKind2["CreateReplay"] = 3] = "CreateReplay";
186694
+ ConfiguredProjectLoadKind2[ConfiguredProjectLoadKind2["CreateOptimized"] = 4] = "CreateOptimized";
186695
+ ConfiguredProjectLoadKind2[ConfiguredProjectLoadKind2["Create"] = 5] = "Create";
186696
+ ConfiguredProjectLoadKind2[ConfiguredProjectLoadKind2["ReloadOptimized"] = 6] = "ReloadOptimized";
186697
+ ConfiguredProjectLoadKind2[ConfiguredProjectLoadKind2["Reload"] = 7] = "Reload";
186638
186698
  return ConfiguredProjectLoadKind2;
186639
186699
  })(ConfiguredProjectLoadKind || {});
186640
- function forEachAncestorProject(info, project, cb, kind, reason, allowDeferredClosed, reloadedProjects, delayReloadedConfiguredProjects) {
186700
+ function toConfiguredProjectLoadOptimized(kind) {
186701
+ return kind - 1;
186702
+ }
186703
+ function forEachAncestorProjectLoad(info, project, cb, kind, reason, allowDeferredClosed, reloadedProjects, searchOnlyPotentialSolution, delayReloadedConfiguredProjects) {
186704
+ var _a;
186641
186705
  while (true) {
186642
- if (!project.isInitialLoadPending() && (!project.getCompilerOptions().composite || project.getCompilerOptions().disableSolutionSearching)) return;
186643
- const configFileName = project.projectService.getConfigFileNameForFile({
186644
- fileName: project.getConfigFilePath(),
186645
- path: info.path,
186646
- configFileInfo: true
186647
- }, kind === 0 /* Find */);
186706
+ if (project.parsedCommandLine && (searchOnlyPotentialSolution && !project.parsedCommandLine.options.composite || // Currently disableSolutionSearching is shared for finding solution/project when
186707
+ // - loading solution for find all references
186708
+ // - trying to find default project
186709
+ project.parsedCommandLine.options.disableSolutionSearching)) return;
186710
+ const configFileName = project.projectService.getConfigFileNameForFile(
186711
+ {
186712
+ fileName: project.getConfigFilePath(),
186713
+ path: info.path,
186714
+ configFileInfo: true,
186715
+ isForDefaultProject: !searchOnlyPotentialSolution
186716
+ },
186717
+ kind <= 3 /* CreateReplay */
186718
+ );
186648
186719
  if (!configFileName) return;
186649
186720
  const ancestor = project.projectService.findCreateOrReloadConfiguredProject(
186650
186721
  configFileName,
186651
186722
  kind,
186652
186723
  reason,
186653
186724
  allowDeferredClosed,
186654
- /*triggerFile*/
186655
- void 0,
186725
+ !searchOnlyPotentialSolution ? info.fileName : void 0,
186726
+ // Config Diag event for project if its for default project
186656
186727
  reloadedProjects,
186657
- /*delayLoad*/
186658
- true,
186728
+ searchOnlyPotentialSolution,
186729
+ // Delay load if we are searching for solution
186659
186730
  delayReloadedConfiguredProjects
186660
186731
  );
186661
186732
  if (!ancestor) return;
186662
- if (ancestor.project.isInitialLoadPending() && project.getCompilerOptions().composite) {
186733
+ if (!ancestor.project.parsedCommandLine && ((_a = project.parsedCommandLine) == null ? void 0 : _a.options.composite)) {
186663
186734
  ancestor.project.setPotentialProjectReference(project.canonicalConfigFilePath);
186664
186735
  }
186665
- const result = cb(ancestor.project);
186736
+ const result = cb(ancestor);
186666
186737
  if (result) return result;
186667
186738
  project = ancestor.project;
186668
186739
  }
186669
186740
  }
186670
- function forEachResolvedProjectReferenceProject(project, fileName, cb, kind, reason, allowDeferredClosed, triggerFile, reloadedProjects) {
186671
- var _a;
186672
- const resolvedRefs = (_a = project.getCurrentProgram()) == null ? void 0 : _a.getResolvedProjectReferences();
186673
- if (!resolvedRefs) return void 0;
186674
- const possibleDefaultRef = fileName ? project.getResolvedProjectReferenceToRedirect(fileName) : void 0;
186675
- if (possibleDefaultRef) {
186676
- const configFileName = toNormalizedPath(possibleDefaultRef.sourceFile.fileName);
186677
- const child = project.projectService.findConfiguredProjectByProjectName(
186678
- configFileName,
186679
- allowDeferredClosed
186680
- );
186681
- if (child) {
186682
- const result = callbackWithProjectFoundUsingFind(child);
186683
- if (result) return result;
186684
- } else if (kind !== 0 /* Find */) {
186685
- const result = forEachResolvedProjectReferenceProjectWorker(
186686
- resolvedRefs,
186687
- project.getCompilerOptions(),
186688
- (ref, loadKind) => possibleDefaultRef === ref ? callback(ref, loadKind) : void 0,
186689
- kind,
186690
- project.projectService
186691
- );
186692
- if (result) return result;
186741
+ function forEachResolvedProjectReferenceProjectLoad(project, parentConfig, cb, kind, reason, allowDeferredClosed, reloadedProjects, seenResolvedRefs) {
186742
+ const loadKind = parentConfig.options.disableReferencedProjectLoad ? 0 /* FindOptimized */ : kind;
186743
+ let children;
186744
+ return forEach(
186745
+ parentConfig.projectReferences,
186746
+ (ref) => {
186747
+ var _a;
186748
+ const childConfigName = toNormalizedPath(resolveProjectReferencePath(ref));
186749
+ const childCanonicalConfigPath = asNormalizedPath(project.projectService.toCanonicalFileName(childConfigName));
186750
+ const seenValue = seenResolvedRefs == null ? void 0 : seenResolvedRefs.get(childCanonicalConfigPath);
186751
+ if (seenValue !== void 0 && seenValue >= loadKind) return void 0;
186752
+ const configFileExistenceInfo = project.projectService.configFileExistenceInfoCache.get(childCanonicalConfigPath);
186753
+ let childConfig = loadKind === 0 /* FindOptimized */ ? (configFileExistenceInfo == null ? void 0 : configFileExistenceInfo.exists) || ((_a = project.resolvedChildConfigs) == null ? void 0 : _a.has(childCanonicalConfigPath)) ? configFileExistenceInfo.config.parsedCommandLine : void 0 : project.getParsedCommandLine(childConfigName);
186754
+ if (childConfig && loadKind !== kind && loadKind > 2 /* CreateReplayOptimized */) {
186755
+ childConfig = project.getParsedCommandLine(childConfigName);
186756
+ }
186757
+ if (!childConfig) return void 0;
186758
+ const childProject = project.projectService.findConfiguredProjectByProjectName(childConfigName, allowDeferredClosed);
186759
+ if (loadKind === 2 /* CreateReplayOptimized */ && !configFileExistenceInfo && !childProject) return void 0;
186760
+ switch (loadKind) {
186761
+ case 6 /* ReloadOptimized */:
186762
+ if (childProject) childProject.projectService.reloadConfiguredProjectOptimized(childProject, reason, reloadedProjects);
186763
+ // falls through
186764
+ case 4 /* CreateOptimized */:
186765
+ (project.resolvedChildConfigs ?? (project.resolvedChildConfigs = /* @__PURE__ */ new Set())).add(childCanonicalConfigPath);
186766
+ // falls through
186767
+ case 2 /* CreateReplayOptimized */:
186768
+ case 0 /* FindOptimized */:
186769
+ if (childProject || loadKind !== 0 /* FindOptimized */) {
186770
+ const result = cb(
186771
+ configFileExistenceInfo ?? project.projectService.configFileExistenceInfoCache.get(childCanonicalConfigPath),
186772
+ childProject,
186773
+ childConfigName,
186774
+ reason,
186775
+ project,
186776
+ childCanonicalConfigPath
186777
+ );
186778
+ if (result) return result;
186779
+ }
186780
+ break;
186781
+ default:
186782
+ Debug.assertNever(loadKind);
186783
+ }
186784
+ (seenResolvedRefs ?? (seenResolvedRefs = /* @__PURE__ */ new Map())).set(childCanonicalConfigPath, loadKind);
186785
+ (children ?? (children = [])).push(childConfig);
186693
186786
  }
186694
- }
186695
- return forEachResolvedProjectReferenceProjectWorker(
186696
- resolvedRefs,
186697
- project.getCompilerOptions(),
186698
- (ref, loadKind) => possibleDefaultRef !== ref ? callback(ref, loadKind) : void 0,
186699
- kind,
186700
- project.projectService
186701
- );
186702
- function callback(ref, loadKind) {
186703
- const result = project.projectService.findCreateOrReloadConfiguredProject(
186704
- toNormalizedPath(ref.sourceFile.fileName),
186787
+ ) || forEach(
186788
+ children,
186789
+ (childConfig) => childConfig.projectReferences && forEachResolvedProjectReferenceProjectLoad(
186790
+ project,
186791
+ childConfig,
186792
+ cb,
186705
186793
  loadKind,
186706
186794
  reason,
186707
186795
  allowDeferredClosed,
186708
- triggerFile,
186709
- reloadedProjects
186710
- );
186711
- return result && (loadKind === kind ? cb(result.project, result.sentConfigFileDiag) : callbackWithProjectFoundUsingFind(result.project));
186712
- }
186713
- function callbackWithProjectFoundUsingFind(child) {
186714
- let sentConfigFileDiag = false;
186715
- switch (kind) {
186716
- case 1 /* Create */:
186717
- sentConfigFileDiag = updateConfiguredProject(child, triggerFile);
186718
- break;
186719
- case 2 /* Reload */:
186720
- sentConfigFileDiag = child.projectService.reloadConfiguredProjectClearingSemanticCache(child, reason, reloadedProjects);
186721
- break;
186722
- case 0 /* Find */:
186723
- break;
186724
- default:
186725
- Debug.assertNever(kind);
186726
- }
186727
- const result = cb(child, sentConfigFileDiag);
186728
- if (result) return result;
186729
- }
186796
+ reloadedProjects,
186797
+ seenResolvedRefs
186798
+ )
186799
+ );
186730
186800
  }
186731
- function forEachResolvedProjectReferenceProjectWorker(resolvedProjectReferences, parentOptions, cb, kind, projectService, seenResolvedRefs) {
186732
- const loadKind = parentOptions.disableReferencedProjectLoad ? 0 /* Find */ : kind;
186733
- return forEach(resolvedProjectReferences, (ref) => {
186734
- if (!ref) return void 0;
186735
- const configFileName = toNormalizedPath(ref.sourceFile.fileName);
186736
- const canonicalPath = projectService.toCanonicalFileName(configFileName);
186737
- const seenValue = seenResolvedRefs == null ? void 0 : seenResolvedRefs.get(canonicalPath);
186738
- if (seenValue !== void 0 && seenValue >= loadKind) {
186739
- return void 0;
186740
- }
186741
- const result = cb(ref, loadKind);
186742
- if (result) {
186743
- return result;
186744
- }
186745
- (seenResolvedRefs || (seenResolvedRefs = /* @__PURE__ */ new Map())).set(canonicalPath, loadKind);
186746
- return ref.references && forEachResolvedProjectReferenceProjectWorker(ref.references, ref.commandLine.options, cb, loadKind, projectService, seenResolvedRefs);
186747
- });
186801
+ function updateProjectFoundUsingFind(project, kind, triggerFile, reason, reloadedProjects) {
186802
+ let sentConfigFileDiag = false;
186803
+ let configFileExistenceInfo;
186804
+ switch (kind) {
186805
+ case 2 /* CreateReplayOptimized */:
186806
+ case 3 /* CreateReplay */:
186807
+ if (useConfigFileExistenceInfoForOptimizedLoading(project)) {
186808
+ configFileExistenceInfo = project.projectService.configFileExistenceInfoCache.get(project.canonicalConfigFilePath);
186809
+ }
186810
+ break;
186811
+ case 4 /* CreateOptimized */:
186812
+ configFileExistenceInfo = configFileExistenceInfoForOptimizedLoading(project);
186813
+ if (configFileExistenceInfo) break;
186814
+ // falls through
186815
+ case 5 /* Create */:
186816
+ sentConfigFileDiag = updateConfiguredProject(project, triggerFile);
186817
+ break;
186818
+ case 6 /* ReloadOptimized */:
186819
+ project.projectService.reloadConfiguredProjectOptimized(project, reason, reloadedProjects);
186820
+ configFileExistenceInfo = configFileExistenceInfoForOptimizedLoading(project);
186821
+ if (configFileExistenceInfo) break;
186822
+ // falls through
186823
+ case 7 /* Reload */:
186824
+ sentConfigFileDiag = project.projectService.reloadConfiguredProjectClearingSemanticCache(
186825
+ project,
186826
+ reason,
186827
+ reloadedProjects
186828
+ );
186829
+ break;
186830
+ case 0 /* FindOptimized */:
186831
+ case 1 /* Find */:
186832
+ break;
186833
+ default:
186834
+ Debug.assertNever(kind);
186835
+ }
186836
+ return { project, sentConfigFileDiag, configFileExistenceInfo, reason };
186748
186837
  }
186749
186838
  function forEachPotentialProjectReference(project, cb) {
186750
- return project.potentialProjectReferences && forEachKey(project.potentialProjectReferences, cb);
186839
+ return project.initialLoadPending ? (project.potentialProjectReferences && forEachKey(project.potentialProjectReferences, cb)) ?? (project.resolvedChildConfigs && forEachKey(project.resolvedChildConfigs, cb)) : void 0;
186751
186840
  }
186752
186841
  function forEachAnyProjectReferenceKind(project, cb, cbProjectRef, cbPotentialProjectRef) {
186753
- return project.getCurrentProgram() ? project.forEachResolvedProjectReference(cb) : project.isInitialLoadPending() ? forEachPotentialProjectReference(project, cbPotentialProjectRef) : forEach(project.getProjectReferences(), cbProjectRef);
186842
+ return project.getCurrentProgram() ? project.forEachResolvedProjectReference(cb) : project.initialLoadPending ? forEachPotentialProjectReference(project, cbPotentialProjectRef) : forEach(project.getProjectReferences(), cbProjectRef);
186754
186843
  }
186755
186844
  function callbackRefProject(project, cb, refPath) {
186756
186845
  const refProject = refPath && project.projectService.configuredProjects.get(refPath);
@@ -186800,6 +186889,27 @@ function updateConfiguredProject(project, triggerFile) {
186800
186889
  }
186801
186890
  return false;
186802
186891
  }
186892
+ function configFileExistenceInfoForOptimizedLoading(project) {
186893
+ const configFileName = toNormalizedPath(project.getConfigFilePath());
186894
+ const configFileExistenceInfo = project.projectService.ensureParsedConfigUptoDate(
186895
+ configFileName,
186896
+ project.canonicalConfigFilePath,
186897
+ project.projectService.configFileExistenceInfoCache.get(project.canonicalConfigFilePath),
186898
+ project
186899
+ );
186900
+ const parsedCommandLine = configFileExistenceInfo.config.parsedCommandLine;
186901
+ project.parsedCommandLine = parsedCommandLine;
186902
+ project.resolvedChildConfigs = void 0;
186903
+ project.updateReferences(parsedCommandLine.projectReferences);
186904
+ if (useConfigFileExistenceInfoForOptimizedLoading(project)) return configFileExistenceInfo;
186905
+ }
186906
+ function useConfigFileExistenceInfoForOptimizedLoading(project) {
186907
+ return !!project.parsedCommandLine && (!!project.parsedCommandLine.options.composite || // If solution, no need to load it to determine if file belongs to it
186908
+ !!isSolutionConfig(project.parsedCommandLine));
186909
+ }
186910
+ function configFileExistenceInfoForOptimizedReplay(project) {
186911
+ return useConfigFileExistenceInfoForOptimizedLoading(project) ? project.projectService.configFileExistenceInfoCache.get(project.canonicalConfigFilePath) : void 0;
186912
+ }
186803
186913
  function fileOpenReason(info) {
186804
186914
  return `Creating possible configured project for ${info.fileName} to open`;
186805
186915
  }
@@ -187325,7 +187435,7 @@ var _ProjectService = class _ProjectService {
187325
187435
  if ((_a = this.pendingOpenFileProjectUpdates) == null ? void 0 : _a.delete(scriptInfo.path)) {
187326
187436
  this.tryFindDefaultConfiguredProjectAndLoadAncestorsForOpenScriptInfo(
187327
187437
  scriptInfo,
187328
- 1 /* Create */
187438
+ 5 /* Create */
187329
187439
  );
187330
187440
  if (scriptInfo.isOrphan()) {
187331
187441
  this.assignOrphanScriptInfoToInferredProject(scriptInfo, this.openFiles.get(scriptInfo.path));
@@ -187540,22 +187650,35 @@ var _ProjectService = class _ProjectService {
187540
187650
  if (!(configFileExistenceInfo == null ? void 0 : configFileExistenceInfo.config)) return false;
187541
187651
  let scheduledAnyProjectUpdate = false;
187542
187652
  configFileExistenceInfo.config.updateLevel = 2 /* Full */;
187653
+ configFileExistenceInfo.config.cachedDirectoryStructureHost.clearCache();
187543
187654
  configFileExistenceInfo.config.projects.forEach((_watchWildcardDirectories, projectCanonicalPath) => {
187544
- var _a;
187655
+ var _a, _b, _c;
187545
187656
  const project = this.getConfiguredProjectByCanonicalConfigFilePath(projectCanonicalPath);
187546
187657
  if (!project) return;
187547
187658
  scheduledAnyProjectUpdate = true;
187548
187659
  if (projectCanonicalPath === canonicalConfigFilePath) {
187549
- if (project.isInitialLoadPending()) return;
187660
+ if (project.initialLoadPending) return;
187550
187661
  project.pendingUpdateLevel = 2 /* Full */;
187551
187662
  project.pendingUpdateReason = loadReason;
187552
187663
  this.delayUpdateProjectGraph(project);
187553
187664
  project.markAutoImportProviderAsDirty();
187554
187665
  } else {
187666
+ if (project.initialLoadPending) {
187667
+ (_b = (_a = this.configFileExistenceInfoCache.get(projectCanonicalPath)) == null ? void 0 : _a.openFilesImpactedByConfigFile) == null ? void 0 : _b.forEach((path2) => {
187668
+ var _a2;
187669
+ if (!((_a2 = this.pendingOpenFileProjectUpdates) == null ? void 0 : _a2.has(path2))) {
187670
+ (this.pendingOpenFileProjectUpdates ?? (this.pendingOpenFileProjectUpdates = /* @__PURE__ */ new Map())).set(
187671
+ path2,
187672
+ this.configFileForOpenFiles.get(path2)
187673
+ );
187674
+ }
187675
+ });
187676
+ return;
187677
+ }
187555
187678
  const path = this.toPath(canonicalConfigFilePath);
187556
187679
  project.resolutionCache.removeResolutionsFromProjectReferenceRedirects(path);
187557
187680
  this.delayUpdateProjectGraph(project);
187558
- if (this.getHostPreferences().includeCompletionsForModuleExports && find((_a = project.getCurrentProgram()) == null ? void 0 : _a.getResolvedProjectReferences(), (ref) => (ref == null ? void 0 : ref.sourceFile.path) === path)) {
187681
+ if (this.getHostPreferences().includeCompletionsForModuleExports && find((_c = project.getCurrentProgram()) == null ? void 0 : _c.getResolvedProjectReferences(), (ref) => (ref == null ? void 0 : ref.sourceFile.path) === path)) {
187559
187682
  project.markAutoImportProviderAsDirty();
187560
187683
  }
187561
187684
  }
@@ -187580,7 +187703,6 @@ var _ProjectService = class _ProjectService {
187580
187703
  canonicalConfigFilePath,
187581
187704
  "Change in config file detected"
187582
187705
  );
187583
- const updatedProjects = new Set(project ? [project] : void 0);
187584
187706
  this.openFiles.forEach((_projectRootPath, path) => {
187585
187707
  var _a, _b;
187586
187708
  const configFileForOpenFile = this.configFileForOpenFiles.get(path);
@@ -187593,16 +187715,9 @@ var _ProjectService = class _ProjectService {
187593
187715
  false
187594
187716
  );
187595
187717
  if (!newConfigFileNameForInfo) return;
187596
- const projectForInfo = this.findConfiguredProjectByProjectName(newConfigFileNameForInfo) ?? this.createConfiguredProject(
187597
- newConfigFileNameForInfo,
187598
- `Change in config file ${configFileName} detected, ${fileOpenReason(info)}`
187599
- );
187600
187718
  if (!((_b = this.pendingOpenFileProjectUpdates) == null ? void 0 : _b.has(path))) {
187601
187719
  (this.pendingOpenFileProjectUpdates ?? (this.pendingOpenFileProjectUpdates = /* @__PURE__ */ new Map())).set(path, configFileForOpenFile);
187602
187720
  }
187603
- if (tryAddToSet(updatedProjects, projectForInfo) && projectForInfo.isInitialLoadPending()) {
187604
- this.delayUpdateProjectGraph(projectForInfo);
187605
- }
187606
187721
  });
187607
187722
  this.delayEnsureProjectForOpenFiles();
187608
187723
  }
@@ -187774,7 +187889,7 @@ var _ProjectService = class _ProjectService {
187774
187889
  configFileExists(configFileName, canonicalConfigFilePath, info) {
187775
187890
  const configFileExistenceInfo = this.configFileExistenceInfoCache.get(canonicalConfigFilePath);
187776
187891
  let openFilesImpactedByConfigFile;
187777
- if (this.openFiles.has(info.path) && !isAncestorConfigFileInfo(info)) {
187892
+ if (this.openFiles.has(info.path) && (!isAncestorConfigFileInfo(info) || info.isForDefaultProject)) {
187778
187893
  if (configFileExistenceInfo) (configFileExistenceInfo.openFilesImpactedByConfigFile ?? (configFileExistenceInfo.openFilesImpactedByConfigFile = /* @__PURE__ */ new Set())).add(info.path);
187779
187894
  else (openFilesImpactedByConfigFile = /* @__PURE__ */ new Set()).add(info.path);
187780
187895
  }
@@ -187796,6 +187911,9 @@ var _ProjectService = class _ProjectService {
187796
187911
  forProject
187797
187912
  );
187798
187913
  }
187914
+ this.ensureConfigFileWatcherForProject(configFileExistenceInfo, forProject);
187915
+ }
187916
+ ensureConfigFileWatcherForProject(configFileExistenceInfo, forProject) {
187799
187917
  const projects = configFileExistenceInfo.config.projects;
187800
187918
  projects.set(forProject.canonicalConfigFilePath, projects.get(forProject.canonicalConfigFilePath) || false);
187801
187919
  }
@@ -187901,34 +188019,48 @@ var _ProjectService = class _ProjectService {
187901
188019
  let searchPath = asNormalizedPath(getDirectoryPath(info.fileName));
187902
188020
  const isSearchPathInProjectRoot = () => containsPath(projectRootPath, searchPath, this.currentDirectory, !this.host.useCaseSensitiveFileNames);
187903
188021
  const anySearchPathOk = !projectRootPath || !isSearchPathInProjectRoot();
187904
- let searchInDirectory = !isAncestorConfigFileInfo(info);
188022
+ let searchTsconfig = true;
188023
+ let searchJsconfig = true;
188024
+ if (isAncestorConfigFileInfo(info)) {
188025
+ if (endsWith(info.fileName, "tsconfig.json")) searchTsconfig = false;
188026
+ else searchTsconfig = searchJsconfig = false;
188027
+ }
187905
188028
  do {
187906
- if (searchInDirectory) {
187907
- const canonicalSearchPath = normalizedPathToPath(searchPath, this.currentDirectory, this.toCanonicalFileName);
188029
+ const canonicalSearchPath = normalizedPathToPath(searchPath, this.currentDirectory, this.toCanonicalFileName);
188030
+ if (searchTsconfig) {
187908
188031
  const tsconfigFileName = asNormalizedPath(combinePaths(searchPath, "tsconfig.json"));
187909
- let result = action(combinePaths(canonicalSearchPath, "tsconfig.json"), tsconfigFileName);
188032
+ const result = action(combinePaths(canonicalSearchPath, "tsconfig.json"), tsconfigFileName);
187910
188033
  if (result) return tsconfigFileName;
188034
+ }
188035
+ if (searchJsconfig) {
187911
188036
  const jsconfigFileName = asNormalizedPath(combinePaths(searchPath, "jsconfig.json"));
187912
- result = action(combinePaths(canonicalSearchPath, "jsconfig.json"), jsconfigFileName);
188037
+ const result = action(combinePaths(canonicalSearchPath, "jsconfig.json"), jsconfigFileName);
187913
188038
  if (result) return jsconfigFileName;
187914
- if (isNodeModulesDirectory(canonicalSearchPath)) {
187915
- break;
187916
- }
188039
+ }
188040
+ if (isNodeModulesDirectory(canonicalSearchPath)) {
188041
+ break;
187917
188042
  }
187918
188043
  const parentPath = asNormalizedPath(getDirectoryPath(searchPath));
187919
188044
  if (parentPath === searchPath) break;
187920
188045
  searchPath = parentPath;
187921
- searchInDirectory = true;
188046
+ searchTsconfig = searchJsconfig = true;
187922
188047
  } while (anySearchPathOk || isSearchPathInProjectRoot());
187923
188048
  return void 0;
187924
188049
  }
187925
188050
  /** @internal */
187926
188051
  findDefaultConfiguredProject(info) {
187927
188052
  var _a;
187928
- return info.isScriptOpen() ? (_a = this.tryFindDefaultConfiguredProjectForOpenScriptInfo(
188053
+ return (_a = this.findDefaultConfiguredProjectWorker(
188054
+ info,
188055
+ 1 /* Find */
188056
+ )) == null ? void 0 : _a.defaultProject;
188057
+ }
188058
+ /** @internal */
188059
+ findDefaultConfiguredProjectWorker(info, kind) {
188060
+ return info.isScriptOpen() ? this.tryFindDefaultConfiguredProjectForOpenScriptInfo(
187929
188061
  info,
187930
- 0 /* Find */
187931
- )) == null ? void 0 : _a.defaultProject : void 0;
188062
+ kind
188063
+ ) : void 0;
187932
188064
  }
187933
188065
  /** Get cached configFileName for scriptInfo or ancestor of open script info */
187934
188066
  getConfigFileNameForFileFromCache(info, lookInPendingFilesForValue) {
@@ -187941,8 +188073,19 @@ var _ProjectService = class _ProjectService {
187941
188073
  /** Caches the configFilename for script info or ancestor of open script info */
187942
188074
  setConfigFileNameForFileInCache(info, configFileName) {
187943
188075
  if (!this.openFiles.has(info.path)) return;
187944
- if (isAncestorConfigFileInfo(info)) return;
187945
- this.configFileForOpenFiles.set(info.path, configFileName || false);
188076
+ const config = configFileName || false;
188077
+ if (!isAncestorConfigFileInfo(info)) {
188078
+ this.configFileForOpenFiles.set(info.path, config);
188079
+ } else {
188080
+ let configFileForOpenFile = this.configFileForOpenFiles.get(info.path);
188081
+ if (!configFileForOpenFile || isString(configFileForOpenFile)) {
188082
+ this.configFileForOpenFiles.set(
188083
+ info.path,
188084
+ configFileForOpenFile = (/* @__PURE__ */ new Map()).set(false, configFileForOpenFile)
188085
+ );
188086
+ }
188087
+ configFileForOpenFile.set(info.fileName, config);
188088
+ }
187946
188089
  }
187947
188090
  /**
187948
188091
  * This function tries to search for a tsconfig.json for the given file.
@@ -188125,7 +188268,7 @@ var _ProjectService = class _ProjectService {
188125
188268
  var _a, _b;
188126
188269
  (_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Session, "loadConfiguredProject", { configFilePath: project.canonicalConfigFilePath });
188127
188270
  this.sendProjectLoadingStartEvent(project, reason);
188128
- const configFilename = asNormalizedPath(normalizePath(project.getConfigFilePath()));
188271
+ const configFilename = toNormalizedPath(project.getConfigFilePath());
188129
188272
  const configFileExistenceInfo = this.ensureParsedConfigUptoDate(
188130
188273
  configFilename,
188131
188274
  project.canonicalConfigFilePath,
@@ -188143,7 +188286,7 @@ var _ProjectService = class _ProjectService {
188143
188286
  configHasExcludeProperty: parsedCommandLine.raw.exclude !== void 0
188144
188287
  };
188145
188288
  }
188146
- project.canConfigFileJsonReportNoInputFiles = canJsonReportNoInputFiles(parsedCommandLine.raw);
188289
+ project.parsedCommandLine = parsedCommandLine;
188147
188290
  project.setProjectErrors(parsedCommandLine.options.configFile.parseDiagnostics);
188148
188291
  project.updateReferences(parsedCommandLine.projectReferences);
188149
188292
  const lastFileExceededProgramSize = this.getFilenameForExceededTotalSizeLimitForNonTsFiles(project.canonicalConfigFilePath, compilerOptions, parsedCommandLine.fileNames, fileNamePropertyReader);
@@ -188165,12 +188308,19 @@ var _ProjectService = class _ProjectService {
188165
188308
  ensureParsedConfigUptoDate(configFilename, canonicalConfigFilePath, configFileExistenceInfo, forProject) {
188166
188309
  var _a, _b, _c;
188167
188310
  if (configFileExistenceInfo.config) {
188168
- if (!configFileExistenceInfo.config.updateLevel) return configFileExistenceInfo;
188169
188311
  if (configFileExistenceInfo.config.updateLevel === 1 /* RootNamesAndUpdate */) {
188170
188312
  this.reloadFileNamesOfParsedConfig(configFilename, configFileExistenceInfo.config);
188313
+ }
188314
+ if (!configFileExistenceInfo.config.updateLevel) {
188315
+ this.ensureConfigFileWatcherForProject(configFileExistenceInfo, forProject);
188171
188316
  return configFileExistenceInfo;
188172
188317
  }
188173
188318
  }
188319
+ if (!configFileExistenceInfo.exists && configFileExistenceInfo.config) {
188320
+ configFileExistenceInfo.config.updateLevel = void 0;
188321
+ this.ensureConfigFileWatcherForProject(configFileExistenceInfo, forProject);
188322
+ return configFileExistenceInfo;
188323
+ }
188174
188324
  const cachedDirectoryStructureHost = ((_a = configFileExistenceInfo.config) == null ? void 0 : _a.cachedDirectoryStructureHost) || createCachedDirectoryStructureHost(this.host, this.host.getCurrentDirectory(), this.host.useCaseSensitiveFileNames);
188175
188325
  const configFileContent = tryReadFile(configFilename, (fileName) => this.host.readFile(fileName));
188176
188326
  const configFile = parseJsonText(configFilename, isString(configFileContent) ? configFileContent : "");
@@ -188365,14 +188515,18 @@ var _ProjectService = class _ProjectService {
188365
188515
  * @internal
188366
188516
  */
188367
188517
  reloadFileNamesOfConfiguredProject(project) {
188368
- const fileNames = this.reloadFileNamesOfParsedConfig(project.getConfigFilePath(), this.configFileExistenceInfoCache.get(project.canonicalConfigFilePath).config);
188369
- project.updateErrorOnNoInputFiles(fileNames);
188370
- this.updateNonInferredProjectFiles(project, fileNames.concat(project.getExternalFiles(1 /* RootNamesAndUpdate */)), fileNamePropertyReader);
188518
+ const config = this.reloadFileNamesOfParsedConfig(project.getConfigFilePath(), this.configFileExistenceInfoCache.get(project.canonicalConfigFilePath).config);
188519
+ project.updateErrorOnNoInputFiles(config);
188520
+ this.updateNonInferredProjectFiles(
188521
+ project,
188522
+ config.fileNames.concat(project.getExternalFiles(1 /* RootNamesAndUpdate */)),
188523
+ fileNamePropertyReader
188524
+ );
188371
188525
  project.markAsDirty();
188372
188526
  return project.updateGraph();
188373
188527
  }
188374
188528
  reloadFileNamesOfParsedConfig(configFileName, config) {
188375
- if (config.updateLevel === void 0) return config.parsedCommandLine.fileNames;
188529
+ if (config.updateLevel === void 0) return config.parsedCommandLine;
188376
188530
  Debug.assert(config.updateLevel === 1 /* RootNamesAndUpdate */);
188377
188531
  const configFileSpecs = config.parsedCommandLine.options.configFile.configFileSpecs;
188378
188532
  const fileNames = getFileNamesFromConfigSpecs(
@@ -188383,30 +188537,42 @@ var _ProjectService = class _ProjectService {
188383
188537
  this.hostConfiguration.extraFileExtensions
188384
188538
  );
188385
188539
  config.parsedCommandLine = { ...config.parsedCommandLine, fileNames };
188386
- return fileNames;
188540
+ config.updateLevel = void 0;
188541
+ return config.parsedCommandLine;
188387
188542
  }
188388
188543
  /** @internal */
188389
188544
  setFileNamesOfAutoImportProviderOrAuxillaryProject(project, fileNames) {
188390
188545
  this.updateNonInferredProjectFiles(project, fileNames, fileNamePropertyReader);
188391
188546
  }
188392
188547
  /** @internal */
188548
+ reloadConfiguredProjectOptimized(project, reason, reloadedProjects) {
188549
+ if (reloadedProjects.has(project)) return;
188550
+ reloadedProjects.set(project, 6 /* ReloadOptimized */);
188551
+ if (!project.initialLoadPending) {
188552
+ this.setProjectForReload(project, 2 /* Full */, reason);
188553
+ }
188554
+ }
188555
+ /** @internal */
188393
188556
  reloadConfiguredProjectClearingSemanticCache(project, reason, reloadedProjects) {
188394
- if (!tryAddToSet(reloadedProjects, project)) return false;
188557
+ if (reloadedProjects.get(project) === 7 /* Reload */) return false;
188558
+ reloadedProjects.set(project, 7 /* Reload */);
188395
188559
  this.clearSemanticCache(project);
188396
188560
  this.reloadConfiguredProject(project, reloadReason(reason));
188397
188561
  return true;
188398
188562
  }
188563
+ setProjectForReload(project, updateLevel, reason) {
188564
+ if (updateLevel === 2 /* Full */) this.clearSemanticCache(project);
188565
+ project.pendingUpdateReason = reason && reloadReason(reason);
188566
+ project.pendingUpdateLevel = updateLevel;
188567
+ }
188399
188568
  /**
188400
188569
  * Read the config file of the project again by clearing the cache and update the project graph
188401
188570
  *
188402
188571
  * @internal
188403
188572
  */
188404
188573
  reloadConfiguredProject(project, reason) {
188405
- project.isInitialLoadPending = returnFalse;
188406
- project.pendingUpdateReason = void 0;
188407
- project.pendingUpdateLevel = 0 /* Update */;
188408
- const host = project.getCachedDirectoryStructureHost();
188409
- host.clearCache();
188574
+ project.initialLoadPending = false;
188575
+ this.setProjectForReload(project, 0 /* Update */);
188410
188576
  this.loadConfiguredProject(project, reason);
188411
188577
  updateWithTriggerFile(
188412
188578
  project,
@@ -189052,25 +189218,23 @@ Dynamic files must always be opened with service's current directory or service
189052
189218
  this.pendingOpenFileProjectUpdates = void 0;
189053
189219
  this.pendingEnsureProjectForOpenFiles = false;
189054
189220
  this.configFileExistenceInfoCache.forEach((info) => {
189055
- if (info.config) info.config.updateLevel = 2 /* Full */;
189221
+ if (info.config) {
189222
+ info.config.updateLevel = 2 /* Full */;
189223
+ info.config.cachedDirectoryStructureHost.clearCache();
189224
+ }
189056
189225
  });
189057
189226
  this.configFileForOpenFiles.clear();
189058
189227
  this.externalProjects.forEach((project) => {
189059
189228
  this.clearSemanticCache(project);
189060
189229
  project.updateGraph();
189061
189230
  });
189062
- const reloadedConfiguredProjects = /* @__PURE__ */ new Set();
189231
+ const reloadedConfiguredProjects = /* @__PURE__ */ new Map();
189063
189232
  const delayReloadedConfiguredProjects = /* @__PURE__ */ new Set();
189064
189233
  this.externalProjectToConfiguredProjectMap.forEach((projects, externalProjectName) => {
189065
189234
  const reason = `Reloading configured project in external project: ${externalProjectName}`;
189066
189235
  projects.forEach((project) => {
189067
189236
  if (this.getHostPreferences().lazyConfiguredProjectsFromExternalProject) {
189068
- if (!project.isInitialLoadPending()) {
189069
- this.clearSemanticCache(project);
189070
- project.pendingUpdateLevel = 2 /* Full */;
189071
- project.pendingUpdateReason = reloadReason(reason);
189072
- }
189073
- delayReloadedConfiguredProjects.add(project);
189237
+ this.reloadConfiguredProjectOptimized(project, reason, reloadedConfiguredProjects);
189074
189238
  } else {
189075
189239
  this.reloadConfiguredProjectClearingSemanticCache(
189076
189240
  project,
@@ -189085,12 +189249,12 @@ Dynamic files must always be opened with service's current directory or service
189085
189249
  if (find(info.containingProjects, isExternalProject)) return;
189086
189250
  this.tryFindDefaultConfiguredProjectAndLoadAncestorsForOpenScriptInfo(
189087
189251
  info,
189088
- 2 /* Reload */,
189252
+ 7 /* Reload */,
189089
189253
  reloadedConfiguredProjects,
189090
189254
  delayReloadedConfiguredProjects
189091
189255
  );
189092
189256
  });
189093
- delayReloadedConfiguredProjects.forEach((p) => reloadedConfiguredProjects.add(p));
189257
+ delayReloadedConfiguredProjects.forEach((p) => reloadedConfiguredProjects.set(p, 7 /* Reload */));
189094
189258
  this.inferredProjects.forEach((project) => this.clearSemanticCache(project));
189095
189259
  this.ensureProjectForOpenFiles();
189096
189260
  this.cleanupProjectsAndScriptInfos(
@@ -189132,7 +189296,7 @@ Dynamic files must always be opened with service's current directory or service
189132
189296
  pendingOpenFileProjectUpdates == null ? void 0 : pendingOpenFileProjectUpdates.forEach(
189133
189297
  (_config, path) => this.tryFindDefaultConfiguredProjectAndLoadAncestorsForOpenScriptInfo(
189134
189298
  this.getScriptInfoForPath(path),
189135
- 1 /* Create */
189299
+ 5 /* Create */
189136
189300
  )
189137
189301
  );
189138
189302
  this.openFiles.forEach((projectRootPath, path) => {
@@ -189188,23 +189352,18 @@ Dynamic files must always be opened with service's current directory or service
189188
189352
  }
189189
189353
  configuredProject = this.createConfiguredProject(configFileName, `Creating project for original file: ${originalFileInfo.fileName}${location !== originalLocation ? " for location: " + location.fileName : ""}`);
189190
189354
  }
189191
- updateProjectIfDirty(configuredProject);
189192
- const projectContainsOriginalInfo = (project2) => {
189193
- const info = this.getScriptInfo(fileName);
189194
- return info && project2.containsScriptInfo(info) && !project2.isSourceOfProjectReferenceRedirect(info.path);
189195
- };
189196
- if (configuredProject.isSolution() || !projectContainsOriginalInfo(configuredProject)) {
189197
- configuredProject = forEachResolvedProjectReferenceProject(
189355
+ const result = this.tryFindDefaultConfiguredProjectForOpenScriptInfoOrClosedFileInfo(
189356
+ originalFileInfo,
189357
+ 5 /* Create */,
189358
+ updateProjectFoundUsingFind(
189198
189359
  configuredProject,
189199
- fileName,
189200
- (child) => projectContainsOriginalInfo(child) ? child : void 0,
189201
- 1 /* Create */,
189202
- `Creating project referenced in solution ${configuredProject.projectName} to find possible configured project for original file: ${originalFileInfo.fileName}${location !== originalLocation ? " for location: " + location.fileName : ""}`
189203
- );
189204
- if (!configuredProject) return void 0;
189205
- if (configuredProject === project) return originalLocation;
189206
- }
189207
- addOriginalConfiguredProject(configuredProject);
189360
+ 4 /* CreateOptimized */
189361
+ ),
189362
+ (project2) => `Creating project referenced in solution ${project2.projectName} to find possible configured project for original file: ${originalFileInfo.fileName}${location !== originalLocation ? " for location: " + location.fileName : ""}`
189363
+ );
189364
+ if (!result.defaultProject) return void 0;
189365
+ if (result.defaultProject === project) return originalLocation;
189366
+ addOriginalConfiguredProject(result.defaultProject);
189208
189367
  const originalScriptInfo = this.getScriptInfo(fileName);
189209
189368
  if (!originalScriptInfo || !originalScriptInfo.containingProjects.length) return void 0;
189210
189369
  originalScriptInfo.containingProjects.forEach((project2) => {
@@ -189253,7 +189412,7 @@ Dynamic files must always be opened with service's current directory or service
189253
189412
  if (!project && this.serverMode === 0 /* Semantic */) {
189254
189413
  const result = this.tryFindDefaultConfiguredProjectAndLoadAncestorsForOpenScriptInfo(
189255
189414
  info,
189256
- 1 /* Create */
189415
+ 5 /* Create */
189257
189416
  );
189258
189417
  if (result) {
189259
189418
  retainProjects = result.seenProjects;
@@ -189266,8 +189425,8 @@ Dynamic files must always be opened with service's current directory or service
189266
189425
  }
189267
189426
  info.containingProjects.forEach(updateProjectIfDirty);
189268
189427
  if (info.isOrphan()) {
189269
- retainProjects == null ? void 0 : retainProjects.forEach((project2) => {
189270
- if (!sentConfigDiag.has(project2)) this.sendConfigFileDiagEvent(
189428
+ retainProjects == null ? void 0 : retainProjects.forEach((kind, project2) => {
189429
+ if (kind !== 4 /* CreateOptimized */ && !sentConfigDiag.has(project2)) this.sendConfigFileDiagEvent(
189271
189430
  project2,
189272
189431
  info.fileName,
189273
189432
  /*force*/
@@ -189287,30 +189446,49 @@ Dynamic files must always be opened with service's current directory or service
189287
189446
  * - Reload - if the project doesnt exist, it creates one. If not delayLoad, the project is reloaded clearing semantic cache
189288
189447
  * @internal
189289
189448
  */
189290
- findCreateOrReloadConfiguredProject(configFileName, kind, reason, allowDeferredClosed, triggerFile, reloadedProjects, delayLoad, delayReloadedConfiguredProjects) {
189291
- let project = this.findConfiguredProjectByProjectName(configFileName, allowDeferredClosed);
189449
+ findCreateOrReloadConfiguredProject(configFileName, kind, reason, allowDeferredClosed, triggerFile, reloadedProjects, delayLoad, delayReloadedConfiguredProjects, projectForConfigFile) {
189450
+ let project = projectForConfigFile ?? this.findConfiguredProjectByProjectName(configFileName, allowDeferredClosed);
189292
189451
  let sentConfigFileDiag = false;
189452
+ let configFileExistenceInfo;
189293
189453
  switch (kind) {
189294
- case 0 /* Find */:
189454
+ case 0 /* FindOptimized */:
189455
+ case 1 /* Find */:
189456
+ case 3 /* CreateReplay */:
189457
+ if (!project) return;
189458
+ break;
189459
+ case 2 /* CreateReplayOptimized */:
189295
189460
  if (!project) return;
189461
+ configFileExistenceInfo = configFileExistenceInfoForOptimizedReplay(project);
189296
189462
  break;
189297
- case 1 /* Create */:
189463
+ case 4 /* CreateOptimized */:
189464
+ case 5 /* Create */:
189298
189465
  project ?? (project = this.createConfiguredProject(configFileName, reason));
189299
- sentConfigFileDiag = !delayLoad && updateConfiguredProject(project, triggerFile);
189466
+ if (!delayLoad) {
189467
+ ({ sentConfigFileDiag, configFileExistenceInfo } = updateProjectFoundUsingFind(
189468
+ project,
189469
+ kind,
189470
+ triggerFile
189471
+ ));
189472
+ }
189300
189473
  break;
189301
- case 2 /* Reload */:
189474
+ case 6 /* ReloadOptimized */:
189475
+ project ?? (project = this.createConfiguredProject(configFileName, reloadReason(reason)));
189476
+ project.projectService.reloadConfiguredProjectOptimized(project, reason, reloadedProjects);
189477
+ configFileExistenceInfo = configFileExistenceInfoForOptimizedLoading(project);
189478
+ if (configFileExistenceInfo) break;
189479
+ // falls through
189480
+ case 7 /* Reload */:
189302
189481
  project ?? (project = this.createConfiguredProject(configFileName, reloadReason(reason)));
189303
189482
  sentConfigFileDiag = !delayReloadedConfiguredProjects && this.reloadConfiguredProjectClearingSemanticCache(project, reason, reloadedProjects);
189304
189483
  if (delayReloadedConfiguredProjects && !delayReloadedConfiguredProjects.has(project) && !reloadedProjects.has(project)) {
189305
- project.pendingUpdateLevel = 2 /* Full */;
189306
- project.pendingUpdateReason = reloadReason(reason);
189484
+ this.setProjectForReload(project, 2 /* Full */, reason);
189307
189485
  delayReloadedConfiguredProjects.add(project);
189308
189486
  }
189309
189487
  break;
189310
189488
  default:
189311
189489
  Debug.assertNever(kind);
189312
189490
  }
189313
- return { project, sentConfigFileDiag };
189491
+ return { project, sentConfigFileDiag, configFileExistenceInfo, reason };
189314
189492
  }
189315
189493
  /**
189316
189494
  * Finds the default configured project for given info
@@ -189318,54 +189496,167 @@ Dynamic files must always be opened with service's current directory or service
189318
189496
  * The search happens for all tsconfigs till projectRootPath
189319
189497
  */
189320
189498
  tryFindDefaultConfiguredProjectForOpenScriptInfo(info, kind, allowDeferredClosed, reloadedProjects) {
189321
- const configFileName = this.getConfigFileNameForFile(info, kind === 0 /* Find */);
189499
+ const configFileName = this.getConfigFileNameForFile(info, kind <= 3 /* CreateReplay */);
189322
189500
  if (!configFileName) return;
189501
+ const optimizedKind = toConfiguredProjectLoadOptimized(kind);
189323
189502
  const result = this.findCreateOrReloadConfiguredProject(
189324
189503
  configFileName,
189325
- kind,
189504
+ optimizedKind,
189326
189505
  fileOpenReason(info),
189327
189506
  allowDeferredClosed,
189328
189507
  info.fileName,
189329
189508
  reloadedProjects
189330
189509
  );
189331
- if (!result) return;
189332
- const seenProjects = /* @__PURE__ */ new Set();
189333
- const sentConfigDiag = new Set(result.sentConfigFileDiag ? [result.project] : void 0);
189510
+ return result && this.tryFindDefaultConfiguredProjectForOpenScriptInfoOrClosedFileInfo(
189511
+ info,
189512
+ kind,
189513
+ result,
189514
+ (project) => `Creating project referenced in solution ${project.projectName} to find possible configured project for ${info.fileName} to open`,
189515
+ allowDeferredClosed,
189516
+ reloadedProjects
189517
+ );
189518
+ }
189519
+ isMatchedByConfig(configFileName, config, info) {
189520
+ if (config.fileNames.some((rootName) => this.toPath(rootName) === info.path)) return true;
189521
+ if (isSupportedSourceFileName(
189522
+ info.fileName,
189523
+ config.options,
189524
+ this.hostConfiguration.extraFileExtensions
189525
+ )) return false;
189526
+ const { validatedFilesSpec, validatedIncludeSpecs, validatedExcludeSpecs } = config.options.configFile.configFileSpecs;
189527
+ const basePath = toNormalizedPath(getNormalizedAbsolutePath(getDirectoryPath(configFileName), this.currentDirectory));
189528
+ if (validatedFilesSpec == null ? void 0 : validatedFilesSpec.some((fileSpec) => this.toPath(getNormalizedAbsolutePath(fileSpec, basePath)) === info.path)) return true;
189529
+ if (!(validatedIncludeSpecs == null ? void 0 : validatedIncludeSpecs.length)) return false;
189530
+ if (matchesExcludeWorker(
189531
+ info.fileName,
189532
+ validatedExcludeSpecs,
189533
+ this.host.useCaseSensitiveFileNames,
189534
+ this.currentDirectory,
189535
+ basePath
189536
+ )) return false;
189537
+ return validatedIncludeSpecs == null ? void 0 : validatedIncludeSpecs.some((includeSpec) => {
189538
+ const pattern = getPatternFromSpec(includeSpec, basePath, "files");
189539
+ return !!pattern && getRegexFromPattern(`(${pattern})$`, this.host.useCaseSensitiveFileNames).test(info.fileName);
189540
+ });
189541
+ }
189542
+ tryFindDefaultConfiguredProjectForOpenScriptInfoOrClosedFileInfo(info, kind, initialConfigResult, referencedProjectReason, allowDeferredClosed, reloadedProjects) {
189543
+ const infoIsOpenScriptInfo = isOpenScriptInfo(info);
189544
+ const optimizedKind = toConfiguredProjectLoadOptimized(kind);
189545
+ const seenProjects = /* @__PURE__ */ new Map();
189546
+ let seenConfigs;
189547
+ const sentConfigDiag = /* @__PURE__ */ new Set();
189334
189548
  let defaultProject;
189335
189549
  let possiblyDefault;
189336
- tryFindDefaultConfiguredProject(result.project);
189550
+ let tsconfigOfDefault;
189551
+ let tsconfigOfPossiblyDefault;
189552
+ tryFindDefaultConfiguredProject(initialConfigResult);
189337
189553
  return {
189338
189554
  defaultProject: defaultProject ?? possiblyDefault,
189555
+ tsconfigProject: tsconfigOfDefault ?? tsconfigOfPossiblyDefault,
189339
189556
  sentConfigDiag,
189340
- seenProjects
189557
+ seenProjects,
189558
+ seenConfigs
189341
189559
  };
189342
- function tryFindDefaultConfiguredProject(project) {
189343
- return isDefaultProject(project) ? defaultProject : tryFindDefaultConfiguredProjectFromReferences(project);
189560
+ function tryFindDefaultConfiguredProject(result) {
189561
+ return isDefaultProjectOptimized(result, result.project) ?? tryFindDefaultConfiguredProjectFromReferences(result.project) ?? tryFindDefaultConfiguredProjectFromAncestor(result.project);
189344
189562
  }
189345
- function isDefaultProject(project) {
189346
- if (!tryAddToSet(seenProjects, project)) return;
189347
- const projectWithInfo = project.containsScriptInfo(info);
189348
- if (projectWithInfo && !project.isSourceOfProjectReferenceRedirect(info.path)) return defaultProject = project;
189349
- possiblyDefault ?? (possiblyDefault = projectWithInfo ? project : void 0);
189350
- }
189351
- function tryFindDefaultConfiguredProjectFromReferences(project) {
189352
- return forEachResolvedProjectReferenceProject(
189563
+ function isDefaultConfigFileExistenceInfo(configFileExistenceInfo, project, childConfigName, reason, tsconfigProject, canonicalConfigFilePath) {
189564
+ if (project) {
189565
+ if (seenProjects.has(project)) return;
189566
+ seenProjects.set(project, optimizedKind);
189567
+ } else {
189568
+ if (seenConfigs == null ? void 0 : seenConfigs.has(canonicalConfigFilePath)) return;
189569
+ (seenConfigs ?? (seenConfigs = /* @__PURE__ */ new Set())).add(canonicalConfigFilePath);
189570
+ }
189571
+ if (!tsconfigProject.projectService.isMatchedByConfig(
189572
+ childConfigName,
189573
+ configFileExistenceInfo.config.parsedCommandLine,
189574
+ info
189575
+ )) {
189576
+ if (tsconfigProject.languageServiceEnabled) {
189577
+ tsconfigProject.projectService.watchWildcards(
189578
+ childConfigName,
189579
+ configFileExistenceInfo,
189580
+ tsconfigProject
189581
+ );
189582
+ }
189583
+ return;
189584
+ }
189585
+ const result = project ? updateProjectFoundUsingFind(
189353
189586
  project,
189354
- info.path,
189355
- (child, sentConfigFileDiag) => {
189356
- if (sentConfigFileDiag) sentConfigDiag.add(child);
189357
- return isDefaultProject(child);
189358
- },
189359
189587
  kind,
189360
- `Creating project referenced in solution ${project.projectName} to find possible configured project for ${info.fileName} to open`,
189588
+ info.fileName,
189589
+ reason,
189590
+ reloadedProjects
189591
+ ) : tsconfigProject.projectService.findCreateOrReloadConfiguredProject(
189592
+ childConfigName,
189593
+ kind,
189594
+ reason,
189361
189595
  allowDeferredClosed,
189362
189596
  info.fileName,
189363
189597
  reloadedProjects
189364
189598
  );
189599
+ if (!result) {
189600
+ Debug.assert(kind === 3 /* CreateReplay */);
189601
+ return void 0;
189602
+ }
189603
+ seenProjects.set(result.project, optimizedKind);
189604
+ if (result.sentConfigFileDiag) sentConfigDiag.add(result.project);
189605
+ return isDefaultProject(result.project, tsconfigProject);
189606
+ }
189607
+ function isDefaultProject(project, tsconfigProject) {
189608
+ if (seenProjects.get(project) === kind) return;
189609
+ seenProjects.set(project, kind);
189610
+ const scriptInfo = infoIsOpenScriptInfo ? info : project.projectService.getScriptInfo(info.fileName);
189611
+ const projectWithInfo = scriptInfo && project.containsScriptInfo(scriptInfo);
189612
+ if (projectWithInfo && !project.isSourceOfProjectReferenceRedirect(scriptInfo.path)) {
189613
+ tsconfigOfDefault = tsconfigProject;
189614
+ return defaultProject = project;
189615
+ }
189616
+ if (!possiblyDefault && infoIsOpenScriptInfo && projectWithInfo) {
189617
+ tsconfigOfPossiblyDefault = tsconfigProject;
189618
+ possiblyDefault = project;
189619
+ }
189620
+ }
189621
+ function isDefaultProjectOptimized(result, tsconfigProject) {
189622
+ if (result.sentConfigFileDiag) sentConfigDiag.add(result.project);
189623
+ return result.configFileExistenceInfo ? isDefaultConfigFileExistenceInfo(
189624
+ result.configFileExistenceInfo,
189625
+ result.project,
189626
+ toNormalizedPath(result.project.getConfigFilePath()),
189627
+ result.reason,
189628
+ result.project,
189629
+ result.project.canonicalConfigFilePath
189630
+ ) : isDefaultProject(result.project, tsconfigProject);
189631
+ }
189632
+ function tryFindDefaultConfiguredProjectFromReferences(project) {
189633
+ return project.parsedCommandLine && forEachResolvedProjectReferenceProjectLoad(
189634
+ project,
189635
+ project.parsedCommandLine,
189636
+ isDefaultConfigFileExistenceInfo,
189637
+ optimizedKind,
189638
+ referencedProjectReason(project),
189639
+ allowDeferredClosed,
189640
+ reloadedProjects
189641
+ );
189642
+ }
189643
+ function tryFindDefaultConfiguredProjectFromAncestor(project) {
189644
+ return infoIsOpenScriptInfo ? forEachAncestorProjectLoad(
189645
+ // If not in referenced projects, try ancestors and its references
189646
+ info,
189647
+ project,
189648
+ tryFindDefaultConfiguredProject,
189649
+ optimizedKind,
189650
+ `Creating possible configured project for ${info.fileName} to open`,
189651
+ allowDeferredClosed,
189652
+ reloadedProjects,
189653
+ /*searchOnlyPotentialSolution*/
189654
+ false
189655
+ ) : void 0;
189365
189656
  }
189366
189657
  }
189367
189658
  tryFindDefaultConfiguredProjectAndLoadAncestorsForOpenScriptInfo(info, kind, reloadedProjects, delayReloadedConfiguredProjects) {
189368
- const allowDeferredClosed = kind === 0 /* Find */;
189659
+ const allowDeferredClosed = kind === 1 /* Find */;
189369
189660
  const result = this.tryFindDefaultConfiguredProjectForOpenScriptInfo(
189370
189661
  info,
189371
189662
  kind,
@@ -189373,18 +189664,20 @@ Dynamic files must always be opened with service's current directory or service
189373
189664
  reloadedProjects
189374
189665
  );
189375
189666
  if (!result) return;
189376
- const { defaultProject, seenProjects } = result;
189667
+ const { defaultProject, tsconfigProject, seenProjects } = result;
189377
189668
  if (defaultProject) {
189378
- forEachAncestorProject(
189669
+ forEachAncestorProjectLoad(
189379
189670
  info,
189380
- defaultProject,
189671
+ tsconfigProject,
189381
189672
  (ancestor) => {
189382
- seenProjects.add(ancestor);
189673
+ seenProjects.set(ancestor.project, kind);
189383
189674
  },
189384
189675
  kind,
189385
189676
  `Creating project possibly referencing default composite project ${defaultProject.getProjectName()} of open file ${info.fileName}`,
189386
189677
  allowDeferredClosed,
189387
189678
  reloadedProjects,
189679
+ /*searchOnlyPotentialSolution*/
189680
+ true,
189388
189681
  delayReloadedConfiguredProjects
189389
189682
  );
189390
189683
  }
@@ -189393,7 +189686,7 @@ Dynamic files must always be opened with service's current directory or service
189393
189686
  /** @internal */
189394
189687
  loadAncestorProjectTree(forProjects) {
189395
189688
  forProjects ?? (forProjects = new Set(
189396
- mapDefinedIterator(this.configuredProjects.entries(), ([key, project]) => !project.isInitialLoadPending() ? key : void 0)
189689
+ mapDefinedIterator(this.configuredProjects.entries(), ([key, project]) => !project.initialLoadPending ? key : void 0)
189397
189690
  ));
189398
189691
  const seenProjects = /* @__PURE__ */ new Set();
189399
189692
  const currentConfiguredProjects = arrayFrom(this.configuredProjects.values());
@@ -189499,7 +189792,7 @@ Dynamic files must always be opened with service's current directory or service
189499
189792
  );
189500
189793
  }
189501
189794
  };
189502
- toRetainConfiguredProjects == null ? void 0 : toRetainConfiguredProjects.forEach(retainConfiguredProject);
189795
+ toRetainConfiguredProjects == null ? void 0 : toRetainConfiguredProjects.forEach((_, project) => retainConfiguredProject(project));
189503
189796
  if (!toRemoveConfiguredProjects.size) return toRemoveConfiguredProjects;
189504
189797
  this.inferredProjects.forEach(markOriginalProjectsAsUsed);
189505
189798
  this.externalProjects.forEach(markOriginalProjectsAsUsed);
@@ -189515,10 +189808,10 @@ Dynamic files must always be opened with service's current directory or service
189515
189808
  if (find(info.containingProjects, isExternalProject)) return;
189516
189809
  const result = this.tryFindDefaultConfiguredProjectAndLoadAncestorsForOpenScriptInfo(
189517
189810
  info,
189518
- 0 /* Find */
189811
+ 1 /* Find */
189519
189812
  );
189520
189813
  if (result == null ? void 0 : result.defaultProject) {
189521
- result == null ? void 0 : result.seenProjects.forEach(retainConfiguredProject);
189814
+ result == null ? void 0 : result.seenProjects.forEach((_, project) => retainConfiguredProject(project));
189522
189815
  if (!toRemoveConfiguredProjects.size) return toRemoveConfiguredProjects;
189523
189816
  }
189524
189817
  });
@@ -189549,7 +189842,7 @@ Dynamic files must always be opened with service's current directory or service
189549
189842
  const toRemoveScriptInfos = new Map(this.filenameToScriptInfo);
189550
189843
  this.filenameToScriptInfo.forEach((info) => {
189551
189844
  if (info.deferredDelete) return;
189552
- if (!info.isScriptOpen() && info.isOrphan() && !info.isContainedByBackgroundProject()) {
189845
+ if (!info.isScriptOpen() && info.isOrphan() && !scriptInfoIsContainedByDeferredClosedProject(info) && !scriptInfoIsContainedByBackgroundProject(info)) {
189553
189846
  if (!info.sourceMapFilePath) return;
189554
189847
  let sourceInfos;
189555
189848
  if (isString(info.sourceMapFilePath)) {
@@ -189667,10 +189960,14 @@ Dynamic files must always be opened with service's current directory or service
189667
189960
  existingOpenScriptInfos,
189668
189961
  (existing, index) => !existing && openScriptInfos[index] && !openScriptInfos[index].isDynamic ? this.tryInvokeWildCardDirectories(openScriptInfos[index]) : void 0
189669
189962
  );
189670
- openScriptInfos == null ? void 0 : openScriptInfos.forEach((info) => {
189671
- var _a;
189672
- return (_a = this.assignProjectToOpenedScriptInfo(info).retainProjects) == null ? void 0 : _a.forEach((p) => (retainProjects ?? (retainProjects = /* @__PURE__ */ new Set())).add(p));
189673
- });
189963
+ openScriptInfos == null ? void 0 : openScriptInfos.forEach(
189964
+ (info) => {
189965
+ var _a;
189966
+ return (_a = this.assignProjectToOpenedScriptInfo(info).retainProjects) == null ? void 0 : _a.forEach(
189967
+ (kind, p) => (retainProjects ?? (retainProjects = /* @__PURE__ */ new Map())).set(p, kind)
189968
+ );
189969
+ }
189970
+ );
189674
189971
  if (assignOrphanScriptInfosToInferredProject) {
189675
189972
  this.assignOrphanScriptInfosToInferredProject();
189676
189973
  }
@@ -190511,8 +190808,13 @@ function getRenameLocationsWorker(projects, defaultProject, initialLocation, fin
190511
190808
  projects,
190512
190809
  defaultProject,
190513
190810
  initialLocation,
190514
- /*isForRename*/
190515
- true,
190811
+ getDefinitionLocation(
190812
+ defaultProject,
190813
+ initialLocation,
190814
+ /*isForRename*/
190815
+ true
190816
+ ),
190817
+ mapDefinitionInProject,
190516
190818
  (project, position) => project.getLanguageService().findRenameLocations(position.fileName, position.pos, findInStrings, findInComments, preferences),
190517
190819
  (renameLocation, cb) => cb(documentSpanLocation(renameLocation))
190518
190820
  );
@@ -190549,8 +190851,13 @@ function getReferencesWorker(projects, defaultProject, initialLocation, useCaseS
190549
190851
  projects,
190550
190852
  defaultProject,
190551
190853
  initialLocation,
190552
- /*isForRename*/
190553
- false,
190854
+ getDefinitionLocation(
190855
+ defaultProject,
190856
+ initialLocation,
190857
+ /*isForRename*/
190858
+ false
190859
+ ),
190860
+ mapDefinitionInProject,
190554
190861
  (project, position) => {
190555
190862
  logger.info(`Finding references to ${position.fileName} position ${position.pos} in project ${project.getProjectName()}`);
190556
190863
  return project.getLanguageService().findReferences(position.fileName, position.pos);
@@ -190645,7 +190952,7 @@ function forEachProjectInProjects(projects, path, cb) {
190645
190952
  });
190646
190953
  }
190647
190954
  }
190648
- function getPerProjectReferences(projects, defaultProject, initialLocation, isForRename, getResultsForPosition, forPositionInResult) {
190955
+ function getPerProjectReferences(projects, defaultProject, initialLocation, defaultDefinition, mapDefinitionInProject2, getResultsForPosition, forPositionInResult) {
190649
190956
  const resultsMap = /* @__PURE__ */ new Map();
190650
190957
  const queue = createQueue();
190651
190958
  queue.enqueue({ project: defaultProject, location: initialLocation });
@@ -190655,7 +190962,6 @@ function getPerProjectReferences(projects, defaultProject, initialLocation, isFo
190655
190962
  });
190656
190963
  const projectService = defaultProject.projectService;
190657
190964
  const cancellationToken = defaultProject.getCancellationToken();
190658
- const defaultDefinition = getDefinitionLocation(defaultProject, initialLocation, isForRename);
190659
190965
  const getGeneratedDefinition = memoize(
190660
190966
  () => defaultProject.isSourceOfProjectReferenceRedirect(defaultDefinition.fileName) ? defaultDefinition : defaultProject.getLanguageService().getSourceMapper().tryGetGeneratedPosition(defaultDefinition)
190661
190967
  );
@@ -190683,7 +190989,7 @@ function getPerProjectReferences(projects, defaultProject, initialLocation, isFo
190683
190989
  projectService.forEachEnabledProject((project) => {
190684
190990
  if (cancellationToken.isCancellationRequested()) return;
190685
190991
  if (resultsMap.has(project)) return;
190686
- const location = mapDefinitionInProject(defaultDefinition, project, getGeneratedDefinition, getSourceDefinition);
190992
+ const location = mapDefinitionInProject2(defaultDefinition, project, getGeneratedDefinition, getSourceDefinition);
190687
190993
  if (location) {
190688
190994
  queue.enqueue({ project, location });
190689
190995
  }
@@ -190696,7 +191002,7 @@ function getPerProjectReferences(projects, defaultProject, initialLocation, isFo
190696
191002
  return resultsMap;
190697
191003
  function searchPosition(project, location) {
190698
191004
  const projectResults = getResultsForPosition(project, location);
190699
- if (!projectResults) return void 0;
191005
+ if (!projectResults || !forPositionInResult) return projectResults;
190700
191006
  for (const result of projectResults) {
190701
191007
  forPositionInResult(result, (position) => {
190702
191008
  const originalLocation = projectService.getOriginalLocationEnsuringConfiguredProject(project, position);
@@ -190722,10 +191028,14 @@ function getPerProjectReferences(projects, defaultProject, initialLocation, isFo
190722
191028
  return projectResults;
190723
191029
  }
190724
191030
  }
190725
- function mapDefinitionInProject(definition, project, getGeneratedDefinition, getSourceDefinition) {
191031
+ function mapDefinitionInProjectIfFileInProject(definition, project) {
190726
191032
  if (project.containsFile(toNormalizedPath(definition.fileName)) && !isLocationProjectReferenceRedirect(project, definition)) {
190727
191033
  return definition;
190728
191034
  }
191035
+ }
191036
+ function mapDefinitionInProject(definition, project, getGeneratedDefinition, getSourceDefinition) {
191037
+ const result = mapDefinitionInProjectIfFileInProject(definition, project);
191038
+ if (result) return result;
190729
191039
  const generatedDefinition = getGeneratedDefinition();
190730
191040
  if (generatedDefinition && project.containsFile(toNormalizedPath(generatedDefinition.fileName))) return generatedDefinition;
190731
191041
  const sourceDefinition = getSourceDefinition();
@@ -192418,11 +192728,12 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
192418
192728
  args.file,
192419
192729
  args.projectFileName,
192420
192730
  args.needFileNameList,
192731
+ args.needDefaultConfiguredProjectInfo,
192421
192732
  /*excludeConfigFiles*/
192422
192733
  false
192423
192734
  );
192424
192735
  }
192425
- getProjectInfoWorker(uncheckedFileName, projectFileName, needFileNameList, excludeConfigFiles) {
192736
+ getProjectInfoWorker(uncheckedFileName, projectFileName, needFileNameList, needDefaultConfiguredProjectInfo, excludeConfigFiles) {
192426
192737
  const { project } = this.getFileAndProjectWorker(uncheckedFileName, projectFileName);
192427
192738
  updateProjectIfDirty(project);
192428
192739
  const projectInfo = {
@@ -192432,10 +192743,38 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
192432
192743
  /*excludeFilesFromExternalLibraries*/
192433
192744
  false,
192434
192745
  excludeConfigFiles
192435
- ) : void 0
192746
+ ) : void 0,
192747
+ configuredProjectInfo: needDefaultConfiguredProjectInfo ? this.getDefaultConfiguredProjectInfo(uncheckedFileName) : void 0
192436
192748
  };
192437
192749
  return projectInfo;
192438
192750
  }
192751
+ getDefaultConfiguredProjectInfo(uncheckedFileName) {
192752
+ var _a;
192753
+ const info = this.projectService.getScriptInfo(uncheckedFileName);
192754
+ if (!info) return;
192755
+ const result = this.projectService.findDefaultConfiguredProjectWorker(
192756
+ info,
192757
+ 3 /* CreateReplay */
192758
+ );
192759
+ if (!result) return void 0;
192760
+ let notMatchedByConfig;
192761
+ let notInProject;
192762
+ result.seenProjects.forEach((kind, project) => {
192763
+ if (project !== result.defaultProject) {
192764
+ if (kind !== 3 /* CreateReplay */) {
192765
+ (notMatchedByConfig ?? (notMatchedByConfig = [])).push(toNormalizedPath(project.getConfigFilePath()));
192766
+ } else {
192767
+ (notInProject ?? (notInProject = [])).push(toNormalizedPath(project.getConfigFilePath()));
192768
+ }
192769
+ }
192770
+ });
192771
+ (_a = result.seenConfigs) == null ? void 0 : _a.forEach((config) => (notMatchedByConfig ?? (notMatchedByConfig = [])).push(config));
192772
+ return {
192773
+ notMatchedByConfig,
192774
+ notInProject,
192775
+ defaultProject: result.defaultProject && toNormalizedPath(result.defaultProject.getConfigFilePath())
192776
+ };
192777
+ }
192439
192778
  getRenameInfo(args) {
192440
192779
  const { file, project } = this.getFileAndProject(args);
192441
192780
  const position = this.getPositionInFile(args, file);
@@ -192552,27 +192891,35 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
192552
192891
  }
192553
192892
  getFileReferences(args, simplifiedResult) {
192554
192893
  const projects = this.getProjects(args);
192555
- const fileName = args.file;
192556
- const preferences = this.getPreferences(toNormalizedPath(fileName));
192557
- const references = [];
192558
- const seen = createDocumentSpanSet(this.host.useCaseSensitiveFileNames);
192559
- forEachProjectInProjects(
192894
+ const fileName = toNormalizedPath(args.file);
192895
+ const preferences = this.getPreferences(fileName);
192896
+ const initialLocation = { fileName, pos: 0 };
192897
+ const perProjectResults = getPerProjectReferences(
192560
192898
  projects,
192561
- /*path*/
192562
- void 0,
192899
+ this.getDefaultProject(args),
192900
+ initialLocation,
192901
+ initialLocation,
192902
+ mapDefinitionInProjectIfFileInProject,
192563
192903
  (project) => {
192564
- if (project.getCancellationToken().isCancellationRequested()) return;
192565
- const projectOutputs = project.getLanguageService().getFileReferences(fileName);
192566
- if (projectOutputs) {
192567
- for (const referenceEntry of projectOutputs) {
192568
- if (!seen.has(referenceEntry)) {
192569
- references.push(referenceEntry);
192570
- seen.add(referenceEntry);
192571
- }
192572
- }
192573
- }
192904
+ this.logger.info(`Finding references to file ${fileName} in project ${project.getProjectName()}`);
192905
+ return project.getLanguageService().getFileReferences(fileName);
192574
192906
  }
192575
192907
  );
192908
+ let references;
192909
+ if (isArray(perProjectResults)) {
192910
+ references = perProjectResults;
192911
+ } else {
192912
+ references = [];
192913
+ const seen = createDocumentSpanSet(this.host.useCaseSensitiveFileNames);
192914
+ perProjectResults.forEach((projectOutputs) => {
192915
+ for (const referenceEntry of projectOutputs) {
192916
+ if (!seen.has(referenceEntry)) {
192917
+ references.push(referenceEntry);
192918
+ seen.add(referenceEntry);
192919
+ }
192920
+ }
192921
+ });
192922
+ }
192576
192923
  if (!simplifiedResult) return references;
192577
192924
  const refs = references.map((entry) => referenceEntryToReferencesResponseItem(this.projectService, entry, preferences));
192578
192925
  return {
@@ -193330,16 +193677,14 @@ ${e.message}`;
193330
193677
  void 0,
193331
193678
  /*needFileNameList*/
193332
193679
  true,
193680
+ /*needDefaultConfiguredProjectInfo*/
193681
+ void 0,
193333
193682
  /*excludeConfigFiles*/
193334
193683
  true
193335
193684
  );
193336
- if (languageServiceDisabled) {
193337
- return;
193338
- }
193685
+ if (languageServiceDisabled) return;
193339
193686
  const fileNamesInProject = fileNames.filter((value) => !value.includes("lib.d.ts"));
193340
- if (fileNamesInProject.length === 0) {
193341
- return;
193342
- }
193687
+ if (fileNamesInProject.length === 0) return;
193343
193688
  const highPriorityFiles = [];
193344
193689
  const mediumPriorityFiles = [];
193345
193690
  const lowPriorityFiles = [];
@@ -194716,6 +195061,8 @@ __export(ts_server_exports4, {
194716
195061
  nullCancellationToken: () => nullCancellationToken,
194717
195062
  nullTypingsInstaller: () => nullTypingsInstaller,
194718
195063
  protocol: () => ts_server_protocol_exports,
195064
+ scriptInfoIsContainedByBackgroundProject: () => scriptInfoIsContainedByBackgroundProject,
195065
+ scriptInfoIsContainedByDeferredClosedProject: () => scriptInfoIsContainedByDeferredClosedProject,
194719
195066
  stringifyIndented: () => stringifyIndented,
194720
195067
  toEvent: () => toEvent,
194721
195068
  toNormalizedPath: () => toNormalizedPath,
@@ -194946,7 +195293,6 @@ if (typeof console !== "undefined") {
194946
195293
  buildOverload,
194947
195294
  bundlerModuleNameResolver,
194948
195295
  canBeConvertedToAsync,
194949
- canEmitTsBuildInfo,
194950
195296
  canHaveDecorators,
194951
195297
  canHaveExportModifier,
194952
195298
  canHaveFlowNode,
@@ -196397,6 +196743,7 @@ if (typeof console !== "undefined") {
196397
196743
  isSimpleInlineableExpression,
196398
196744
  isSimpleParameterList,
196399
196745
  isSingleOrDoubleQuote,
196746
+ isSolutionConfig,
196400
196747
  isSourceElement,
196401
196748
  isSourceFile,
196402
196749
  isSourceFileFromLibrary,
@@ -196542,6 +196889,7 @@ if (typeof console !== "undefined") {
196542
196889
  matchPatternOrExact,
196543
196890
  matchedText,
196544
196891
  matchesExclude,
196892
+ matchesExcludeWorker,
196545
196893
  maxBy,
196546
196894
  maybeBind,
196547
196895
  maybeSetLocalizedDiagnosticMessages,