typescript 5.7.0-dev.20240917 → 5.7.0-dev.20240919

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