@typescript-deploys/pr-build 5.6.0-pr-59689-2 → 5.7.0-pr-59688-4

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
@@ -1688,6 +1688,7 @@ __export(typescript_exports, {
1688
1688
  isSimpleInlineableExpression: () => isSimpleInlineableExpression,
1689
1689
  isSimpleParameterList: () => isSimpleParameterList,
1690
1690
  isSingleOrDoubleQuote: () => isSingleOrDoubleQuote,
1691
+ isSolutionConfig: () => isSolutionConfig,
1691
1692
  isSourceElement: () => isSourceElement,
1692
1693
  isSourceFile: () => isSourceFile,
1693
1694
  isSourceFileFromLibrary: () => isSourceFileFromLibrary,
@@ -1833,6 +1834,7 @@ __export(typescript_exports, {
1833
1834
  matchPatternOrExact: () => matchPatternOrExact,
1834
1835
  matchedText: () => matchedText,
1835
1836
  matchesExclude: () => matchesExclude,
1837
+ matchesExcludeWorker: () => matchesExcludeWorker,
1836
1838
  maxBy: () => maxBy,
1837
1839
  maybeBind: () => maybeBind,
1838
1840
  maybeSetLocalizedDiagnosticMessages: () => maybeSetLocalizedDiagnosticMessages,
@@ -2262,8 +2264,8 @@ __export(typescript_exports, {
2262
2264
  module.exports = __toCommonJS(typescript_exports);
2263
2265
 
2264
2266
  // src/compiler/corePublic.ts
2265
- var versionMajorMinor = "5.6";
2266
- var version = `${versionMajorMinor}.0-insiders.20240819`;
2267
+ var versionMajorMinor = "5.7";
2268
+ var version = `${versionMajorMinor}.0-insiders.20240820`;
2267
2269
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2268
2270
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2269
2271
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -21026,6 +21028,9 @@ function accessKind(node) {
21026
21028
  return node === parent2.objectAssignmentInitializer ? 0 /* Read */ : accessKind(parent2.parent);
21027
21029
  case 209 /* ArrayLiteralExpression */:
21028
21030
  return accessKind(parent2);
21031
+ case 249 /* ForInStatement */:
21032
+ case 250 /* ForOfStatement */:
21033
+ return node === parent2.initializer ? 1 /* Write */ : 0 /* Read */;
21029
21034
  default:
21030
21035
  return 0 /* Read */;
21031
21036
  }
@@ -42540,6 +42545,9 @@ function getErrorForNoInputFiles({ includeSpecs, excludeSpecs }, configFileName)
42540
42545
  function shouldReportNoInputFiles(fileNames, canJsonReportNoInutFiles, resolutionStack) {
42541
42546
  return fileNames.length === 0 && canJsonReportNoInutFiles && (!resolutionStack || resolutionStack.length === 0);
42542
42547
  }
42548
+ function isSolutionConfig(config) {
42549
+ return !config.fileNames.length && hasProperty(config.raw, "references");
42550
+ }
42543
42551
  function canJsonReportNoInputFiles(raw) {
42544
42552
  return !hasProperty(raw, "files") && !hasProperty(raw, "references");
42545
42553
  }
@@ -74394,6 +74402,12 @@ function createTypeChecker(host) {
74394
74402
  function getControlFlowContainer(node) {
74395
74403
  return findAncestor(node.parent, (node2) => isFunctionLike(node2) && !getImmediatelyInvokedFunctionExpression(node2) || node2.kind === 268 /* ModuleBlock */ || node2.kind === 307 /* SourceFile */ || node2.kind === 172 /* PropertyDeclaration */);
74396
74404
  }
74405
+ function isSymbolAssignedDefinitely(symbol) {
74406
+ if (symbol.lastAssignmentPos !== void 0) {
74407
+ return symbol.lastAssignmentPos < 0;
74408
+ }
74409
+ return isSymbolAssigned(symbol) && symbol.lastAssignmentPos !== void 0 && symbol.lastAssignmentPos < 0;
74410
+ }
74397
74411
  function isSymbolAssigned(symbol) {
74398
74412
  return !isPastLastAssignment(
74399
74413
  symbol,
@@ -74413,7 +74427,7 @@ function createTypeChecker(host) {
74413
74427
  markNodeAssignments(parent2);
74414
74428
  }
74415
74429
  }
74416
- return !symbol.lastAssignmentPos || location && symbol.lastAssignmentPos < location.pos;
74430
+ return !symbol.lastAssignmentPos || location && Math.abs(symbol.lastAssignmentPos) < location.pos;
74417
74431
  }
74418
74432
  function isSomeSymbolAssigned(rootDeclaration) {
74419
74433
  Debug.assert(isVariableDeclaration(rootDeclaration) || isParameter(rootDeclaration));
@@ -74434,12 +74448,19 @@ function createTypeChecker(host) {
74434
74448
  function markNodeAssignments(node) {
74435
74449
  switch (node.kind) {
74436
74450
  case 80 /* Identifier */:
74437
- if (isAssignmentTarget(node)) {
74451
+ const assigmentTarget = getAssignmentTargetKind(node);
74452
+ if (assigmentTarget !== 0 /* None */) {
74438
74453
  const symbol = getResolvedSymbol(node);
74439
- if (isParameterOrMutableLocalVariable(symbol) && symbol.lastAssignmentPos !== Number.MAX_VALUE) {
74440
- const referencingFunction = findAncestor(node, isFunctionOrSourceFile);
74441
- const declaringFunction = findAncestor(symbol.valueDeclaration, isFunctionOrSourceFile);
74442
- symbol.lastAssignmentPos = referencingFunction === declaringFunction ? extendAssignmentPosition(node, symbol.valueDeclaration) : Number.MAX_VALUE;
74454
+ const hasDefiniteAssignment = assigmentTarget === 1 /* Definite */ || symbol.lastAssignmentPos !== void 0 && symbol.lastAssignmentPos < 0;
74455
+ if (isParameterOrMutableLocalVariable(symbol)) {
74456
+ if (symbol.lastAssignmentPos === void 0 || Math.abs(symbol.lastAssignmentPos) !== Number.MAX_VALUE) {
74457
+ const referencingFunction = findAncestor(node, isFunctionOrSourceFile);
74458
+ const declaringFunction = findAncestor(symbol.valueDeclaration, isFunctionOrSourceFile);
74459
+ symbol.lastAssignmentPos = referencingFunction === declaringFunction ? extendAssignmentPosition(node, symbol.valueDeclaration) : Number.MAX_VALUE;
74460
+ }
74461
+ if (hasDefiniteAssignment && symbol.lastAssignmentPos > 0) {
74462
+ symbol.lastAssignmentPos *= -1;
74463
+ }
74443
74464
  }
74444
74465
  }
74445
74466
  return;
@@ -74456,7 +74477,8 @@ function createTypeChecker(host) {
74456
74477
  true
74457
74478
  );
74458
74479
  if (symbol && isParameterOrMutableLocalVariable(symbol)) {
74459
- symbol.lastAssignmentPos = Number.MAX_VALUE;
74480
+ const sign = symbol.lastAssignmentPos !== void 0 && symbol.lastAssignmentPos < 0 ? -1 : 1;
74481
+ symbol.lastAssignmentPos = sign * Number.MAX_VALUE;
74460
74482
  }
74461
74483
  }
74462
74484
  return;
@@ -75040,6 +75062,7 @@ function createTypeChecker(host) {
75040
75062
  }
75041
75063
  const localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
75042
75064
  let declaration = localOrExportSymbol.valueDeclaration;
75065
+ const immediateDeclaration = declaration;
75043
75066
  if (declaration && declaration.kind === 208 /* BindingElement */ && contains(contextualBindingPatterns, declaration.parent) && findAncestor(node, (parent2) => parent2 === declaration.parent)) {
75044
75067
  return nonInferrableAnyType;
75045
75068
  }
@@ -75085,7 +75108,8 @@ function createTypeChecker(host) {
75085
75108
  while (flowContainer !== declarationContainer && (flowContainer.kind === 218 /* FunctionExpression */ || flowContainer.kind === 219 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstantVariable(localOrExportSymbol) && type !== autoArrayType || isParameterOrMutableLocalVariable(localOrExportSymbol) && isPastLastAssignment(localOrExportSymbol, node))) {
75086
75109
  flowContainer = getControlFlowContainer(flowContainer);
75087
75110
  }
75088
- const assumeInitialized = isParameter2 || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 281 /* ExportSpecifier */) || node.parent.kind === 235 /* NonNullExpression */ || declaration.kind === 260 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 33554432 /* Ambient */;
75111
+ const isNeverInitialized = immediateDeclaration && isVariableDeclaration(immediateDeclaration) && !immediateDeclaration.initializer && !immediateDeclaration.exclamationToken && isMutableLocalVariableDeclaration(immediateDeclaration) && !isSymbolAssignedDefinitely(symbol);
75112
+ const assumeInitialized = isParameter2 || isAlias || isOuterVariable && !isNeverInitialized || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 281 /* ExportSpecifier */) || node.parent.kind === 235 /* NonNullExpression */ || declaration.kind === 260 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 33554432 /* Ambient */;
75089
75113
  const initialType = isAutomaticTypeInNonNull ? undefinedType : assumeInitialized ? isParameter2 ? removeOptionalityFromDeclaredType(type, declaration) : type : typeIsAutomatic ? undefinedType : getOptionalType(type);
75090
75114
  const flowType = isAutomaticTypeInNonNull ? getNonNullableType(getFlowTypeOfReference(node, type, initialType, flowContainer)) : getFlowTypeOfReference(node, type, initialType, flowContainer);
75091
75115
  if (!isEvolvingArrayOperationTarget(node) && (type === autoType || type === autoArrayType)) {
@@ -96271,7 +96295,7 @@ function transformTypeScript(context) {
96271
96295
  let currentNamespaceContainerName;
96272
96296
  let currentLexicalScope;
96273
96297
  let currentScopeFirstDeclarationsOfName;
96274
- let enabledSubstitutions;
96298
+ let enabledSubstitutions = 0 /* None */;
96275
96299
  let applicableSubstitutions;
96276
96300
  return transformSourceFileOrBundle;
96277
96301
  function transformSourceFileOrBundle(node) {
@@ -98079,7 +98103,7 @@ function transformClassFields(context) {
98079
98103
  const previousOnEmitNode = context.onEmitNode;
98080
98104
  context.onEmitNode = onEmitNode;
98081
98105
  let shouldTransformPrivateStaticElementsInFile = false;
98082
- let enabledSubstitutions;
98106
+ let enabledSubstitutions = 0 /* None */;
98083
98107
  let classAliases;
98084
98108
  let pendingExpressions;
98085
98109
  let pendingStatements;
@@ -103008,7 +103032,7 @@ function transformES2017(context) {
103008
103032
  const resolver = context.getEmitResolver();
103009
103033
  const compilerOptions = context.getCompilerOptions();
103010
103034
  const languageVersion = getEmitScriptTarget(compilerOptions);
103011
- let enabledSubstitutions;
103035
+ let enabledSubstitutions = 0 /* None */;
103012
103036
  let enclosingSuperContainerFlags = 0;
103013
103037
  let enclosingFunctionParameterNames;
103014
103038
  let capturedSuperProperties;
@@ -103883,7 +103907,7 @@ function transformES2018(context) {
103883
103907
  const previousOnSubstituteNode = context.onSubstituteNode;
103884
103908
  context.onSubstituteNode = onSubstituteNode;
103885
103909
  let exportedVariableStatement = false;
103886
- let enabledSubstitutions;
103910
+ let enabledSubstitutions = 0 /* None */;
103887
103911
  let enclosingFunctionFlags;
103888
103912
  let parametersWithPrecedingObjectRestOrSpread;
103889
103913
  let enclosingSuperContainerFlags = 0;
@@ -107018,7 +107042,7 @@ function transformES2015(context) {
107018
107042
  );
107019
107043
  }
107020
107044
  let convertedLoopState;
107021
- let enabledSubstitutions;
107045
+ let enabledSubstitutions = 0 /* None */;
107022
107046
  return chainBundle(context, transformSourceFile);
107023
107047
  function transformSourceFile(node) {
107024
107048
  if (node.isDeclarationFile) {
@@ -124519,15 +124543,22 @@ function forEachProjectReference(projectReferences, resolvedProjectReferences, c
124519
124543
  const result = cbRef(projectReferences2, parent2);
124520
124544
  if (result) return result;
124521
124545
  }
124522
- return forEach(resolvedProjectReferences2, (resolvedRef, index) => {
124523
- if (resolvedRef && (seenResolvedRefs == null ? void 0 : seenResolvedRefs.has(resolvedRef.sourceFile.path))) {
124524
- return void 0;
124546
+ let skipChildren;
124547
+ return forEach(
124548
+ resolvedProjectReferences2,
124549
+ (resolvedRef, index) => {
124550
+ if (resolvedRef && (seenResolvedRefs == null ? void 0 : seenResolvedRefs.has(resolvedRef.sourceFile.path))) {
124551
+ (skipChildren ?? (skipChildren = /* @__PURE__ */ new Set())).add(resolvedRef);
124552
+ return void 0;
124553
+ }
124554
+ const result = cbResolvedRef(resolvedRef, parent2, index);
124555
+ if (result || !resolvedRef) return result;
124556
+ (seenResolvedRefs || (seenResolvedRefs = /* @__PURE__ */ new Set())).add(resolvedRef.sourceFile.path);
124525
124557
  }
124526
- const result = cbResolvedRef(resolvedRef, parent2, index);
124527
- if (result || !resolvedRef) return result;
124528
- (seenResolvedRefs || (seenResolvedRefs = /* @__PURE__ */ new Set())).add(resolvedRef.sourceFile.path);
124529
- return worker(resolvedRef.commandLine.projectReferences, resolvedRef.references, resolvedRef);
124530
- });
124558
+ ) || forEach(
124559
+ resolvedProjectReferences2,
124560
+ (resolvedRef) => resolvedRef && !(skipChildren == null ? void 0 : skipChildren.has(resolvedRef)) ? worker(resolvedRef.commandLine.projectReferences, resolvedRef.references, resolvedRef) : void 0
124561
+ );
124531
124562
  }
124532
124563
  }
124533
124564
  var inferredTypesContainingFile = "__inferred type names__.ts";
@@ -124625,7 +124656,13 @@ function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion,
124625
124656
  if (oldResolvedRef.commandLine.options.configFile !== newParsedCommandLine.options.configFile) return false;
124626
124657
  if (!arrayIsEqualTo(oldResolvedRef.commandLine.fileNames, newParsedCommandLine.fileNames)) return false;
124627
124658
  (seenResolvedRefs || (seenResolvedRefs = [])).push(oldResolvedRef);
124628
- return !forEach(oldResolvedRef.references, (childResolvedRef, index) => !resolvedProjectReferenceUptoDate(childResolvedRef, oldResolvedRef.commandLine.projectReferences[index]));
124659
+ return !forEach(
124660
+ oldResolvedRef.references,
124661
+ (childResolvedRef, index) => !resolvedProjectReferenceUptoDate(
124662
+ childResolvedRef,
124663
+ oldResolvedRef.commandLine.projectReferences[index]
124664
+ )
124665
+ );
124629
124666
  }
124630
124667
  const refPath = resolveProjectReferencePath(oldRef);
124631
124668
  return !getParsedCommandLine(refPath);
@@ -127561,7 +127598,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
127561
127598
  case 1 /* SourceFromProjectReference */:
127562
127599
  case 2 /* OutputFromProjectReference */:
127563
127600
  const referencedResolvedRef = Debug.checkDefined(resolvedProjectReferences == null ? void 0 : resolvedProjectReferences[reason.index]);
127564
- const referenceInfo = forEachProjectReference(projectReferences, resolvedProjectReferences, (resolvedRef, parent2, index2) => resolvedRef === referencedResolvedRef ? { sourceFile: (parent2 == null ? void 0 : parent2.sourceFile) || options.configFile, index: index2 } : void 0);
127601
+ const referenceInfo = forEachProjectReference(
127602
+ projectReferences,
127603
+ resolvedProjectReferences,
127604
+ (resolvedRef, parent2, index2) => resolvedRef === referencedResolvedRef ? { sourceFile: (parent2 == null ? void 0 : parent2.sourceFile) || options.configFile, index: index2 } : void 0
127605
+ );
127565
127606
  if (!referenceInfo) return void 0;
127566
127607
  const { sourceFile, index } = referenceInfo;
127567
127608
  const referencesSyntax = forEachTsConfigPropArray(sourceFile, "references", (property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0);
@@ -127596,27 +127637,31 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
127596
127637
  }
127597
127638
  function verifyProjectReferences() {
127598
127639
  const buildInfoPath = !options.suppressOutputPathCheck ? getTsBuildInfoEmitOutputFilePath(options) : void 0;
127599
- forEachProjectReference(projectReferences, resolvedProjectReferences, (resolvedRef, parent2, index) => {
127600
- const ref = (parent2 ? parent2.commandLine.projectReferences : projectReferences)[index];
127601
- const parentFile = parent2 && parent2.sourceFile;
127602
- verifyDeprecatedProjectReference(ref, parentFile, index);
127603
- if (!resolvedRef) {
127604
- createDiagnosticForReference(parentFile, index, Diagnostics.File_0_not_found, ref.path);
127605
- return;
127606
- }
127607
- const options2 = resolvedRef.commandLine.options;
127608
- if (!options2.composite || options2.noEmit) {
127609
- const inputs = parent2 ? parent2.commandLine.fileNames : rootNames;
127610
- if (inputs.length) {
127611
- if (!options2.composite) createDiagnosticForReference(parentFile, index, Diagnostics.Referenced_project_0_must_have_setting_composite_Colon_true, ref.path);
127612
- if (options2.noEmit) createDiagnosticForReference(parentFile, index, Diagnostics.Referenced_project_0_may_not_disable_emit, ref.path);
127640
+ forEachProjectReference(
127641
+ projectReferences,
127642
+ resolvedProjectReferences,
127643
+ (resolvedRef, parent2, index) => {
127644
+ const ref = (parent2 ? parent2.commandLine.projectReferences : projectReferences)[index];
127645
+ const parentFile = parent2 && parent2.sourceFile;
127646
+ verifyDeprecatedProjectReference(ref, parentFile, index);
127647
+ if (!resolvedRef) {
127648
+ createDiagnosticForReference(parentFile, index, Diagnostics.File_0_not_found, ref.path);
127649
+ return;
127650
+ }
127651
+ const options2 = resolvedRef.commandLine.options;
127652
+ if (!options2.composite || options2.noEmit) {
127653
+ const inputs = parent2 ? parent2.commandLine.fileNames : rootNames;
127654
+ if (inputs.length) {
127655
+ if (!options2.composite) createDiagnosticForReference(parentFile, index, Diagnostics.Referenced_project_0_must_have_setting_composite_Colon_true, ref.path);
127656
+ if (options2.noEmit) createDiagnosticForReference(parentFile, index, Diagnostics.Referenced_project_0_may_not_disable_emit, ref.path);
127657
+ }
127658
+ }
127659
+ if (!parent2 && buildInfoPath && buildInfoPath === getTsBuildInfoEmitOutputFilePath(options2)) {
127660
+ createDiagnosticForReference(parentFile, index, Diagnostics.Cannot_write_file_0_because_it_will_overwrite_tsbuildinfo_file_generated_by_referenced_project_1, buildInfoPath, ref.path);
127661
+ hasEmitBlockingDiagnostics.set(toPath3(buildInfoPath), true);
127613
127662
  }
127614
127663
  }
127615
- if (!parent2 && buildInfoPath && buildInfoPath === getTsBuildInfoEmitOutputFilePath(options2)) {
127616
- createDiagnosticForReference(parentFile, index, Diagnostics.Cannot_write_file_0_because_it_will_overwrite_tsbuildinfo_file_generated_by_referenced_project_1, buildInfoPath, ref.path);
127617
- hasEmitBlockingDiagnostics.set(toPath3(buildInfoPath), true);
127618
- }
127619
- });
127664
+ );
127620
127665
  }
127621
127666
  function createDiagnosticForOptionPathKeyValue(key, valueIndex, message, ...args) {
127622
127667
  let needCompilerDiagnostic = true;
@@ -132239,7 +132284,13 @@ function createWatchProgram(host) {
132239
132284
  Debug.assert(configFileName);
132240
132285
  updateLevel = 0 /* Update */;
132241
132286
  rootFileNames = getFileNamesFromConfigSpecs(compilerOptions.configFile.configFileSpecs, getNormalizedAbsolutePath(getDirectoryPath(configFileName), currentDirectory), compilerOptions, parseConfigFileHost, extraFileExtensions);
132242
- if (updateErrorForNoInputFiles(rootFileNames, getNormalizedAbsolutePath(configFileName, currentDirectory), compilerOptions.configFile.configFileSpecs, configFileParsingDiagnostics, canConfigFileJsonReportNoInputFiles)) {
132287
+ if (updateErrorForNoInputFiles(
132288
+ rootFileNames,
132289
+ getNormalizedAbsolutePath(configFileName, currentDirectory),
132290
+ compilerOptions.configFile.configFileSpecs,
132291
+ configFileParsingDiagnostics,
132292
+ canConfigFileJsonReportNoInputFiles
132293
+ )) {
132243
132294
  hasChangedConfigFileParsingErrors = true;
132244
132295
  }
132245
132296
  synchronizeProgram();
@@ -133226,7 +133277,13 @@ function getNextInvalidatedProjectCreateInfo(state, buildOrder, reportQueue) {
133226
133277
  watchPackageJsonFiles(state, project, projectPath, config);
133227
133278
  } else if (updateLevel === 1 /* RootNamesAndUpdate */) {
133228
133279
  config.fileNames = getFileNamesFromConfigSpecs(config.options.configFile.configFileSpecs, getDirectoryPath(project), config.options, state.parseConfigFileHost);
133229
- updateErrorForNoInputFiles(config.fileNames, project, config.options.configFile.configFileSpecs, config.errors, canJsonReportNoInputFiles(config.raw));
133280
+ updateErrorForNoInputFiles(
133281
+ config.fileNames,
133282
+ project,
133283
+ config.options.configFile.configFileSpecs,
133284
+ config.errors,
133285
+ canJsonReportNoInputFiles(config.raw)
133286
+ );
133230
133287
  watchInputFiles(state, project, projectPath, config);
133231
133288
  watchPackageJsonFiles(state, project, projectPath, config);
133232
133289
  }
@@ -133407,11 +133464,7 @@ function checkConfigFileUpToDateStatus(state, configFile, oldestOutputFileTime,
133407
133464
  }
133408
133465
  function getUpToDateStatusWorker(state, project, resolvedPath) {
133409
133466
  var _a, _b, _c, _d, _e;
133410
- if (!project.fileNames.length && !canJsonReportNoInputFiles(project.raw)) {
133411
- return {
133412
- type: 16 /* ContainerOnly */
133413
- };
133414
- }
133467
+ if (isSolutionConfig(project)) return { type: 16 /* ContainerOnly */ };
133415
133468
  let referenceStatuses;
133416
133469
  const force = !!state.options.force;
133417
133470
  if (project.projectReferences) {
@@ -179541,13 +179594,13 @@ function pasteEditsProvider(targetFile, pastedText, pasteLocations, copiedFrom,
179541
179594
  function pasteEdits(targetFile, pastedText, pasteLocations, copiedFrom, host, preferences, formatContext, cancellationToken, changes) {
179542
179595
  let actualPastedText;
179543
179596
  if (pastedText.length !== pasteLocations.length) {
179544
- actualPastedText = pastedText.length === 1 ? pastedText : [pastedText.join("\n")];
179597
+ actualPastedText = pastedText.length === 1 ? pastedText[0] : pastedText.join(getNewLineOrDefaultFromHost(formatContext.host, formatContext.options));
179545
179598
  }
179546
179599
  const statements = [];
179547
179600
  let newText = targetFile.text;
179548
179601
  for (let i = pasteLocations.length - 1; i >= 0; i--) {
179549
179602
  const { pos, end } = pasteLocations[i];
179550
- newText = actualPastedText ? newText.slice(0, pos) + actualPastedText[0] + newText.slice(end) : newText.slice(0, pos) + pastedText[i] + newText.slice(end);
179603
+ newText = actualPastedText ? newText.slice(0, pos) + actualPastedText + newText.slice(end) : newText.slice(0, pos) + pastedText[i] + newText.slice(end);
179551
179604
  }
179552
179605
  let importAdder;
179553
179606
  Debug.checkDefined(host.runWithTemporaryFileUpdate).call(host, targetFile.fileName, newText, (updatedProgram, originalProgram, updatedFile) => {
@@ -179578,22 +179631,37 @@ function pasteEdits(targetFile, pastedText, pasteLocations, copiedFrom, host, pr
179578
179631
  preferences,
179579
179632
  formatContext
179580
179633
  };
179581
- forEachChild(updatedFile, function cb(node) {
179582
- if (isIdentifier(node) && !(originalProgram == null ? void 0 : originalProgram.getTypeChecker().resolveName(
179583
- node.text,
179584
- node,
179585
- -1 /* All */,
179586
- /*excludeGlobals*/
179587
- false
179588
- ))) {
179589
- importAdder.addImportForUnresolvedIdentifier(
179590
- context,
179634
+ let offset = 0;
179635
+ pasteLocations.forEach((location, i) => {
179636
+ const oldTextLength = location.end - location.pos;
179637
+ const textToBePasted = actualPastedText ?? pastedText[i];
179638
+ const startPos = location.pos + offset;
179639
+ const endPos = startPos + textToBePasted.length;
179640
+ const range = { pos: startPos, end: endPos };
179641
+ offset += textToBePasted.length - oldTextLength;
179642
+ const enclosingNode = findAncestor(
179643
+ getTokenAtPosition(context.sourceFile, range.pos),
179644
+ (ancestorNode) => rangeContainsRange(ancestorNode, range)
179645
+ );
179646
+ if (!enclosingNode) return;
179647
+ forEachChild(enclosingNode, function importUnresolvedIdentifiers(node) {
179648
+ const isImportCandidate = isIdentifier(node) && rangeContainsPosition(range, node.getStart(updatedFile)) && !(updatedProgram == null ? void 0 : updatedProgram.getTypeChecker().resolveName(
179649
+ node.text,
179591
179650
  node,
179592
- /*useAutoImportProvider*/
179593
- true
179594
- );
179595
- }
179596
- node.forEachChild(cb);
179651
+ -1 /* All */,
179652
+ /*excludeGlobals*/
179653
+ false
179654
+ ));
179655
+ if (isImportCandidate) {
179656
+ return importAdder.addImportForUnresolvedIdentifier(
179657
+ context,
179658
+ node,
179659
+ /*useAutoImportProvider*/
179660
+ true
179661
+ );
179662
+ }
179663
+ node.forEachChild(importUnresolvedIdentifiers);
179664
+ });
179597
179665
  });
179598
179666
  }
179599
179667
  importAdder.writeFixes(changes, getQuotePreference(copiedFrom ? copiedFrom.file : targetFile, preferences));
@@ -179605,7 +179673,7 @@ function pasteEdits(targetFile, pastedText, pasteLocations, copiedFrom, host, pr
179605
179673
  changes.replaceRangeWithText(
179606
179674
  targetFile,
179607
179675
  { pos: paste.pos, end: paste.end },
179608
- actualPastedText ? actualPastedText[0] : pastedText[i]
179676
+ actualPastedText ?? pastedText[i]
179609
179677
  );
179610
179678
  });
179611
179679
  }
@@ -181265,6 +181333,7 @@ __export(ts_exports2, {
181265
181333
  isSimpleInlineableExpression: () => isSimpleInlineableExpression,
181266
181334
  isSimpleParameterList: () => isSimpleParameterList,
181267
181335
  isSingleOrDoubleQuote: () => isSingleOrDoubleQuote,
181336
+ isSolutionConfig: () => isSolutionConfig,
181268
181337
  isSourceElement: () => isSourceElement,
181269
181338
  isSourceFile: () => isSourceFile,
181270
181339
  isSourceFileFromLibrary: () => isSourceFileFromLibrary,
@@ -181410,6 +181479,7 @@ __export(ts_exports2, {
181410
181479
  matchPatternOrExact: () => matchPatternOrExact,
181411
181480
  matchedText: () => matchedText,
181412
181481
  matchesExclude: () => matchesExclude,
181482
+ matchesExcludeWorker: () => matchesExcludeWorker,
181413
181483
  maxBy: () => maxBy,
181414
181484
  maybeBind: () => maybeBind,
181415
181485
  maybeSetLocalizedDiagnosticMessages: () => maybeSetLocalizedDiagnosticMessages,
@@ -182034,6 +182104,8 @@ __export(ts_server_exports3, {
182034
182104
  nullCancellationToken: () => nullCancellationToken,
182035
182105
  nullTypingsInstaller: () => nullTypingsInstaller,
182036
182106
  protocol: () => ts_server_protocol_exports,
182107
+ scriptInfoIsContainedByBackgroundProject: () => scriptInfoIsContainedByBackgroundProject,
182108
+ scriptInfoIsContainedByDeferredClosedProject: () => scriptInfoIsContainedByDeferredClosedProject,
182037
182109
  stringifyIndented: () => stringifyIndented,
182038
182110
  toEvent: () => toEvent,
182039
182111
  toNormalizedPath: () => toNormalizedPath,
@@ -183270,13 +183342,6 @@ var ScriptInfo = class {
183270
183342
  isOrphan() {
183271
183343
  return this.deferredDelete || !forEach(this.containingProjects, (p) => !p.isOrphan());
183272
183344
  }
183273
- /** @internal */
183274
- isContainedByBackgroundProject() {
183275
- return some(
183276
- this.containingProjects,
183277
- isBackgroundProject
183278
- );
183279
- }
183280
183345
  /**
183281
183346
  * @param line 1 based index
183282
183347
  */
@@ -183314,6 +183379,18 @@ function failIfInvalidLocation(location) {
183314
183379
  Debug.assert(location.line > 0, `Expected line to be non-${location.line === 0 ? "zero" : "negative"}`);
183315
183380
  Debug.assert(location.offset > 0, `Expected offset to be non-${location.offset === 0 ? "zero" : "negative"}`);
183316
183381
  }
183382
+ function scriptInfoIsContainedByBackgroundProject(info) {
183383
+ return some(
183384
+ info.containingProjects,
183385
+ isBackgroundProject
183386
+ );
183387
+ }
183388
+ function scriptInfoIsContainedByDeferredClosedProject(info) {
183389
+ return some(
183390
+ info.containingProjects,
183391
+ isProjectDeferredClose
183392
+ );
183393
+ }
183317
183394
 
183318
183395
  // src/server/project.ts
183319
183396
  var ProjectKind = /* @__PURE__ */ ((ProjectKind2) => {
@@ -183468,7 +183545,8 @@ var Project2 = class _Project {
183468
183545
  * @internal
183469
183546
  */
183470
183547
  this.projectStateVersion = 0;
183471
- this.isInitialLoadPending = returnFalse;
183548
+ /** @internal */
183549
+ this.initialLoadPending = false;
183472
183550
  /** @internal */
183473
183551
  this.dirty = false;
183474
183552
  /** @internal */
@@ -184666,7 +184744,7 @@ var Project2 = class _Project {
184666
184744
  );
184667
184745
  }
184668
184746
  filesToStringWorker(writeProjectFileNames, writeFileExplaination, writeFileVersionAndText) {
184669
- if (this.isInitialLoadPending()) return " Files (0) InitialLoadPending\n";
184747
+ if (this.initialLoadPending) return " Files (0) InitialLoadPending\n";
184670
184748
  if (!this.program) return " Files (0) NoProgram\n";
184671
184749
  const sourceFiles = this.program.getSourceFiles();
184672
184750
  let strBuilder = ` Files (${sourceFiles.length})
@@ -184753,7 +184831,7 @@ var Project2 = class _Project {
184753
184831
  fileName,
184754
184832
  isSourceOfProjectReferenceRedirect
184755
184833
  })) : (files) => arrayFrom(files.keys());
184756
- if (!this.isInitialLoadPending()) {
184834
+ if (!this.initialLoadPending) {
184757
184835
  updateProjectIfDirty(this);
184758
184836
  }
184759
184837
  const info = {
@@ -185491,9 +185569,7 @@ var ConfiguredProject2 = class extends Project2 {
185491
185569
  /** @internal */
185492
185570
  this.openFileWatchTriggered = /* @__PURE__ */ new Map();
185493
185571
  /** @internal */
185494
- this.canConfigFileJsonReportNoInputFiles = false;
185495
- /** @internal */
185496
- this.isInitialLoadPending = returnTrue;
185572
+ this.initialLoadPending = true;
185497
185573
  /** @internal */
185498
185574
  this.sendLoadingProjectFinish = false;
185499
185575
  this.pendingUpdateLevel = 2 /* Full */;
@@ -185513,7 +185589,7 @@ var ConfiguredProject2 = class extends Project2 {
185513
185589
  }
185514
185590
  /** @internal */
185515
185591
  getParsedCommandLine(fileName) {
185516
- const configFileName = asNormalizedPath(normalizePath(fileName));
185592
+ const configFileName = toNormalizedPath(fileName);
185517
185593
  const canonicalConfigFilePath = asNormalizedPath(this.projectService.toCanonicalFileName(configFileName));
185518
185594
  let configFileExistenceInfo = this.projectService.configFileExistenceInfoCache.get(canonicalConfigFilePath);
185519
185595
  if (!configFileExistenceInfo) {
@@ -185527,7 +185603,7 @@ var ConfiguredProject2 = class extends Project2 {
185527
185603
  }
185528
185604
  /** @internal */
185529
185605
  onReleaseParsedCommandLine(fileName) {
185530
- this.releaseParsedConfig(asNormalizedPath(this.projectService.toCanonicalFileName(asNormalizedPath(normalizePath(fileName)))));
185606
+ this.releaseParsedConfig(asNormalizedPath(this.projectService.toCanonicalFileName(toNormalizedPath(fileName))));
185531
185607
  }
185532
185608
  releaseParsedConfig(canonicalConfigFilePath) {
185533
185609
  this.projectService.stopWatchingWildCards(canonicalConfigFilePath, this);
@@ -185540,7 +185616,7 @@ var ConfiguredProject2 = class extends Project2 {
185540
185616
  updateGraph() {
185541
185617
  if (this.deferredClose) return false;
185542
185618
  const isDirty = this.dirty;
185543
- this.isInitialLoadPending = returnFalse;
185619
+ this.initialLoadPending = false;
185544
185620
  const updateLevel = this.pendingUpdateLevel;
185545
185621
  this.pendingUpdateLevel = 0 /* Update */;
185546
185622
  let result;
@@ -185592,7 +185668,7 @@ var ConfiguredProject2 = class extends Project2 {
185592
185668
  }
185593
185669
  /** @internal */
185594
185670
  setPotentialProjectReference(canonicalConfigPath) {
185595
- Debug.assert(this.isInitialLoadPending());
185671
+ Debug.assert(this.initialLoadPending);
185596
185672
  (this.potentialProjectReferences || (this.potentialProjectReferences = /* @__PURE__ */ new Set())).add(canonicalConfigPath);
185597
185673
  }
185598
185674
  /** @internal */
@@ -185656,10 +185732,6 @@ var ConfiguredProject2 = class extends Project2 {
185656
185732
  super.markAsDirty();
185657
185733
  }
185658
185734
  /** @internal */
185659
- isSolution() {
185660
- return this.getRootFilesMap().size === 0 && !this.canConfigFileJsonReportNoInputFiles;
185661
- }
185662
- /** @internal */
185663
185735
  isOrphan() {
185664
185736
  return !!this.deferredClose;
185665
185737
  }
@@ -185667,8 +185739,15 @@ var ConfiguredProject2 = class extends Project2 {
185667
185739
  return getEffectiveTypeRoots(this.getCompilationSettings(), this) || [];
185668
185740
  }
185669
185741
  /** @internal */
185670
- updateErrorOnNoInputFiles(fileNames) {
185671
- updateErrorForNoInputFiles(fileNames, this.getConfigFilePath(), this.getCompilerOptions().configFile.configFileSpecs, this.projectErrors, this.canConfigFileJsonReportNoInputFiles);
185742
+ updateErrorOnNoInputFiles(parsedCommandLine) {
185743
+ this.parsedCommandLine = parsedCommandLine;
185744
+ updateErrorForNoInputFiles(
185745
+ parsedCommandLine.fileNames,
185746
+ this.getConfigFilePath(),
185747
+ this.getCompilerOptions().configFile.configFileSpecs,
185748
+ this.projectErrors,
185749
+ canJsonReportNoInputFiles(parsedCommandLine.raw)
185750
+ );
185672
185751
  }
185673
185752
  };
185674
185753
  var ExternalProject = class extends Project2 {
@@ -185890,8 +185969,23 @@ var nullTypingsInstaller = {
185890
185969
  };
185891
185970
  var noopConfigFileWatcher = { close: noop };
185892
185971
  function getConfigFileNameFromCache(info, cache) {
185893
- if (!cache || isAncestorConfigFileInfo(info)) return void 0;
185894
- return cache.get(info.path);
185972
+ if (!cache) return void 0;
185973
+ const configFileForOpenFile = cache.get(info.path);
185974
+ if (configFileForOpenFile === void 0) return void 0;
185975
+ if (!isAncestorConfigFileInfo(info)) {
185976
+ return isString(configFileForOpenFile) || !configFileForOpenFile ? configFileForOpenFile : (
185977
+ // direct result
185978
+ configFileForOpenFile.get(
185979
+ /*key*/
185980
+ false
185981
+ )
185982
+ );
185983
+ } else {
185984
+ return configFileForOpenFile && !isString(configFileForOpenFile) ? (
185985
+ // Map with fileName as key
185986
+ configFileForOpenFile.get(info.fileName)
185987
+ ) : void 0;
185988
+ }
185895
185989
  }
185896
185990
  function isOpenScriptInfo(infoOrFileNameOrConfig) {
185897
185991
  return !!infoOrFileNameOrConfig.containingProjects;
@@ -185900,125 +185994,145 @@ function isAncestorConfigFileInfo(infoOrFileNameOrConfig) {
185900
185994
  return !!infoOrFileNameOrConfig.configFileInfo;
185901
185995
  }
185902
185996
  var ConfiguredProjectLoadKind = /* @__PURE__ */ ((ConfiguredProjectLoadKind2) => {
185903
- ConfiguredProjectLoadKind2[ConfiguredProjectLoadKind2["Find"] = 0] = "Find";
185904
- ConfiguredProjectLoadKind2[ConfiguredProjectLoadKind2["Create"] = 1] = "Create";
185905
- ConfiguredProjectLoadKind2[ConfiguredProjectLoadKind2["Reload"] = 2] = "Reload";
185997
+ ConfiguredProjectLoadKind2[ConfiguredProjectLoadKind2["FindOptimized"] = 0] = "FindOptimized";
185998
+ ConfiguredProjectLoadKind2[ConfiguredProjectLoadKind2["Find"] = 1] = "Find";
185999
+ ConfiguredProjectLoadKind2[ConfiguredProjectLoadKind2["CreateOptimized"] = 2] = "CreateOptimized";
186000
+ ConfiguredProjectLoadKind2[ConfiguredProjectLoadKind2["Create"] = 3] = "Create";
186001
+ ConfiguredProjectLoadKind2[ConfiguredProjectLoadKind2["ReloadOptimized"] = 4] = "ReloadOptimized";
186002
+ ConfiguredProjectLoadKind2[ConfiguredProjectLoadKind2["Reload"] = 5] = "Reload";
185906
186003
  return ConfiguredProjectLoadKind2;
185907
186004
  })(ConfiguredProjectLoadKind || {});
185908
- function forEachAncestorProject(info, project, cb, kind, reason, allowDeferredClosed, reloadedProjects, delayReloadedConfiguredProjects) {
186005
+ function toConfiguredProjectLoadOptimized(kind) {
186006
+ return kind - 1;
186007
+ }
186008
+ function forEachAncestorProjectLoad(info, project, cb, kind, reason, allowDeferredClosed, reloadedProjects, searchOnlyPotentialSolution, delayReloadedConfiguredProjects) {
186009
+ var _a;
185909
186010
  while (true) {
185910
- if (!project.isInitialLoadPending() && (!project.getCompilerOptions().composite || project.getCompilerOptions().disableSolutionSearching)) return;
185911
- const configFileName = project.projectService.getConfigFileNameForFile({
185912
- fileName: project.getConfigFilePath(),
185913
- path: info.path,
185914
- configFileInfo: true
185915
- }, kind === 0 /* Find */);
186011
+ if (project.parsedCommandLine && (searchOnlyPotentialSolution && !project.parsedCommandLine.options.composite || // Currently disableSolutionSearching is shared for finding solution/project when
186012
+ // - loading solution for find all references
186013
+ // - trying to find default project
186014
+ project.parsedCommandLine.options.disableSolutionSearching)) return;
186015
+ const configFileName = project.projectService.getConfigFileNameForFile(
186016
+ {
186017
+ fileName: project.getConfigFilePath(),
186018
+ path: info.path,
186019
+ configFileInfo: true,
186020
+ isForDefaultProject: !searchOnlyPotentialSolution
186021
+ },
186022
+ kind === 1 /* Find */ || kind === 0 /* FindOptimized */
186023
+ );
185916
186024
  if (!configFileName) return;
185917
186025
  const ancestor = project.projectService.findCreateOrReloadConfiguredProject(
185918
186026
  configFileName,
185919
186027
  kind,
185920
186028
  reason,
185921
186029
  allowDeferredClosed,
185922
- /*triggerFile*/
185923
- void 0,
186030
+ !searchOnlyPotentialSolution ? info.fileName : void 0,
186031
+ // Config Diag event for project if its for default project
185924
186032
  reloadedProjects,
185925
- /*delayLoad*/
185926
- true,
186033
+ searchOnlyPotentialSolution,
186034
+ // Delay load if we are searching for solution
185927
186035
  delayReloadedConfiguredProjects
185928
186036
  );
185929
186037
  if (!ancestor) return;
185930
- if (ancestor.project.isInitialLoadPending() && project.getCompilerOptions().composite) {
186038
+ if (!ancestor.project.parsedCommandLine && ((_a = project.parsedCommandLine) == null ? void 0 : _a.options.composite)) {
185931
186039
  ancestor.project.setPotentialProjectReference(project.canonicalConfigFilePath);
185932
186040
  }
185933
- const result = cb(ancestor.project);
186041
+ const result = cb(ancestor);
185934
186042
  if (result) return result;
185935
186043
  project = ancestor.project;
185936
186044
  }
185937
186045
  }
185938
- function forEachResolvedProjectReferenceProject(project, fileName, cb, kind, reason, allowDeferredClosed, triggerFile, reloadedProjects) {
185939
- var _a;
185940
- const resolvedRefs = (_a = project.getCurrentProgram()) == null ? void 0 : _a.getResolvedProjectReferences();
185941
- if (!resolvedRefs) return void 0;
185942
- const possibleDefaultRef = fileName ? project.getResolvedProjectReferenceToRedirect(fileName) : void 0;
185943
- if (possibleDefaultRef) {
185944
- const configFileName = toNormalizedPath(possibleDefaultRef.sourceFile.fileName);
185945
- const child = project.projectService.findConfiguredProjectByProjectName(
185946
- configFileName,
185947
- allowDeferredClosed
185948
- );
185949
- if (child) {
185950
- const result = callbackWithProjectFoundUsingFind(child);
185951
- if (result) return result;
185952
- } else if (kind !== 0 /* Find */) {
185953
- const result = forEachResolvedProjectReferenceProjectWorker(
185954
- resolvedRefs,
185955
- project.getCompilerOptions(),
185956
- (ref, loadKind) => possibleDefaultRef === ref ? callback(ref, loadKind) : void 0,
185957
- kind,
185958
- project.projectService
185959
- );
185960
- if (result) return result;
186046
+ function forEachResolvedProjectReferenceProjectLoad(project, parentConfig, cb, kind, reason, allowDeferredClosed, reloadedProjects, seenResolvedRefs) {
186047
+ const loadKind = parentConfig.options.disableReferencedProjectLoad ? 0 /* FindOptimized */ : kind;
186048
+ let children;
186049
+ return forEach(
186050
+ parentConfig.projectReferences,
186051
+ (ref) => {
186052
+ var _a;
186053
+ const childConfigName = toNormalizedPath(resolveProjectReferencePath(ref));
186054
+ const childCanonicalConfigPath = asNormalizedPath(project.projectService.toCanonicalFileName(childConfigName));
186055
+ const seenValue = seenResolvedRefs == null ? void 0 : seenResolvedRefs.get(childCanonicalConfigPath);
186056
+ if (seenValue !== void 0 && seenValue >= loadKind) return void 0;
186057
+ const configFileExistenceInfo = project.projectService.configFileExistenceInfoCache.get(childCanonicalConfigPath);
186058
+ 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);
186059
+ if (childConfig && loadKind !== kind) {
186060
+ childConfig = project.getParsedCommandLine(childConfigName);
186061
+ }
186062
+ if (!childConfig) return void 0;
186063
+ const childProject = project.projectService.findConfiguredProjectByProjectName(childConfigName, allowDeferredClosed);
186064
+ switch (loadKind) {
186065
+ case 4 /* ReloadOptimized */:
186066
+ if (childProject) childProject.projectService.reloadConfiguredProjectOptimized(childProject, reason, reloadedProjects);
186067
+ case 2 /* CreateOptimized */:
186068
+ (project.resolvedChildConfigs ?? (project.resolvedChildConfigs = /* @__PURE__ */ new Set())).add(childCanonicalConfigPath);
186069
+ case 0 /* FindOptimized */:
186070
+ if (childProject || loadKind !== 0 /* FindOptimized */) {
186071
+ const result = cb(
186072
+ configFileExistenceInfo ?? project.projectService.configFileExistenceInfoCache.get(childCanonicalConfigPath),
186073
+ childProject,
186074
+ childConfigName,
186075
+ reason,
186076
+ project,
186077
+ childCanonicalConfigPath
186078
+ );
186079
+ if (result) return result;
186080
+ }
186081
+ break;
186082
+ default:
186083
+ Debug.assertNever(loadKind);
186084
+ }
186085
+ (seenResolvedRefs ?? (seenResolvedRefs = /* @__PURE__ */ new Map())).set(childCanonicalConfigPath, loadKind);
186086
+ (children ?? (children = [])).push(childConfig);
185961
186087
  }
185962
- }
185963
- return forEachResolvedProjectReferenceProjectWorker(
185964
- resolvedRefs,
185965
- project.getCompilerOptions(),
185966
- (ref, loadKind) => possibleDefaultRef !== ref ? callback(ref, loadKind) : void 0,
185967
- kind,
185968
- project.projectService
185969
- );
185970
- function callback(ref, loadKind) {
185971
- const result = project.projectService.findCreateOrReloadConfiguredProject(
185972
- toNormalizedPath(ref.sourceFile.fileName),
186088
+ ) || forEach(
186089
+ children,
186090
+ (childConfig) => childConfig.projectReferences && forEachResolvedProjectReferenceProjectLoad(
186091
+ project,
186092
+ childConfig,
186093
+ cb,
185973
186094
  loadKind,
185974
186095
  reason,
185975
186096
  allowDeferredClosed,
185976
- triggerFile,
185977
- reloadedProjects
185978
- );
185979
- return result && (loadKind === kind ? cb(result.project, result.sentConfigFileDiag) : callbackWithProjectFoundUsingFind(result.project));
185980
- }
185981
- function callbackWithProjectFoundUsingFind(child) {
185982
- let sentConfigFileDiag = false;
185983
- switch (kind) {
185984
- case 1 /* Create */:
185985
- sentConfigFileDiag = updateConfiguredProject(child, triggerFile);
185986
- break;
185987
- case 2 /* Reload */:
185988
- sentConfigFileDiag = child.projectService.reloadConfiguredProjectClearingSemanticCache(child, reason, reloadedProjects);
185989
- break;
185990
- case 0 /* Find */:
185991
- break;
185992
- default:
185993
- Debug.assertNever(kind);
185994
- }
185995
- const result = cb(child, sentConfigFileDiag);
185996
- if (result) return result;
185997
- }
186097
+ reloadedProjects,
186098
+ seenResolvedRefs
186099
+ )
186100
+ );
185998
186101
  }
185999
- function forEachResolvedProjectReferenceProjectWorker(resolvedProjectReferences, parentOptions, cb, kind, projectService, seenResolvedRefs) {
186000
- const loadKind = parentOptions.disableReferencedProjectLoad ? 0 /* Find */ : kind;
186001
- return forEach(resolvedProjectReferences, (ref) => {
186002
- if (!ref) return void 0;
186003
- const configFileName = toNormalizedPath(ref.sourceFile.fileName);
186004
- const canonicalPath = projectService.toCanonicalFileName(configFileName);
186005
- const seenValue = seenResolvedRefs == null ? void 0 : seenResolvedRefs.get(canonicalPath);
186006
- if (seenValue !== void 0 && seenValue >= loadKind) {
186007
- return void 0;
186008
- }
186009
- const result = cb(ref, loadKind);
186010
- if (result) {
186011
- return result;
186012
- }
186013
- (seenResolvedRefs || (seenResolvedRefs = /* @__PURE__ */ new Map())).set(canonicalPath, loadKind);
186014
- return ref.references && forEachResolvedProjectReferenceProjectWorker(ref.references, ref.commandLine.options, cb, loadKind, projectService, seenResolvedRefs);
186015
- });
186102
+ function updateProjectFoundUsingFind(project, kind, triggerFile, reason, reloadedProjects) {
186103
+ let sentConfigFileDiag = false;
186104
+ let configFileExistenceInfo;
186105
+ switch (kind) {
186106
+ case 2 /* CreateOptimized */:
186107
+ configFileExistenceInfo = configFileExistenceInfoForOptimizedLoading(project);
186108
+ if (configFileExistenceInfo) break;
186109
+ case 3 /* Create */:
186110
+ sentConfigFileDiag = updateConfiguredProject(project, triggerFile);
186111
+ break;
186112
+ case 4 /* ReloadOptimized */:
186113
+ project.projectService.reloadConfiguredProjectOptimized(project, reason, reloadedProjects);
186114
+ configFileExistenceInfo = configFileExistenceInfoForOptimizedLoading(project);
186115
+ if (configFileExistenceInfo) break;
186116
+ case 5 /* Reload */:
186117
+ sentConfigFileDiag = project.projectService.reloadConfiguredProjectClearingSemanticCache(
186118
+ project,
186119
+ reason,
186120
+ reloadedProjects
186121
+ );
186122
+ break;
186123
+ case 0 /* FindOptimized */:
186124
+ case 1 /* Find */:
186125
+ break;
186126
+ default:
186127
+ Debug.assertNever(kind);
186128
+ }
186129
+ return { project, sentConfigFileDiag, configFileExistenceInfo, reason };
186016
186130
  }
186017
186131
  function forEachPotentialProjectReference(project, cb) {
186018
- return project.potentialProjectReferences && forEachKey(project.potentialProjectReferences, cb);
186132
+ return project.initialLoadPending ? (project.potentialProjectReferences && forEachKey(project.potentialProjectReferences, cb)) ?? (project.resolvedChildConfigs && forEachKey(project.resolvedChildConfigs, cb)) : void 0;
186019
186133
  }
186020
186134
  function forEachAnyProjectReferenceKind(project, cb, cbProjectRef, cbPotentialProjectRef) {
186021
- return project.getCurrentProgram() ? project.forEachResolvedProjectReference(cb) : project.isInitialLoadPending() ? forEachPotentialProjectReference(project, cbPotentialProjectRef) : forEach(project.getProjectReferences(), cbProjectRef);
186135
+ return project.getCurrentProgram() ? project.forEachResolvedProjectReference(cb) : project.initialLoadPending ? forEachPotentialProjectReference(project, cbPotentialProjectRef) : forEach(project.getProjectReferences(), cbProjectRef);
186022
186136
  }
186023
186137
  function callbackRefProject(project, cb, refPath) {
186024
186138
  const refProject = refPath && project.projectService.configuredProjects.get(refPath);
@@ -186068,6 +186182,21 @@ function updateConfiguredProject(project, triggerFile) {
186068
186182
  }
186069
186183
  return false;
186070
186184
  }
186185
+ function configFileExistenceInfoForOptimizedLoading(project) {
186186
+ const configFileName = toNormalizedPath(project.getConfigFilePath());
186187
+ const configFileExistenceInfo = project.projectService.ensureParsedConfigUptoDate(
186188
+ configFileName,
186189
+ project.canonicalConfigFilePath,
186190
+ project.projectService.configFileExistenceInfoCache.get(project.canonicalConfigFilePath),
186191
+ project
186192
+ );
186193
+ const parsedCommandLine = configFileExistenceInfo.config.parsedCommandLine;
186194
+ project.parsedCommandLine = parsedCommandLine;
186195
+ project.resolvedChildConfigs = void 0;
186196
+ project.updateReferences(parsedCommandLine.projectReferences);
186197
+ if (parsedCommandLine.options.composite) return configFileExistenceInfo;
186198
+ if (isSolutionConfig(parsedCommandLine)) return configFileExistenceInfo;
186199
+ }
186071
186200
  function fileOpenReason(info) {
186072
186201
  return `Creating possible configured project for ${info.fileName} to open`;
186073
186202
  }
@@ -186585,7 +186714,7 @@ var _ProjectService = class _ProjectService {
186585
186714
  if ((_a = this.pendingOpenFileProjectUpdates) == null ? void 0 : _a.delete(scriptInfo.path)) {
186586
186715
  this.tryFindDefaultConfiguredProjectAndLoadAncestorsForOpenScriptInfo(
186587
186716
  scriptInfo,
186588
- 1 /* Create */
186717
+ 3 /* Create */
186589
186718
  );
186590
186719
  if (scriptInfo.isOrphan()) {
186591
186720
  this.assignOrphanScriptInfoToInferredProject(scriptInfo, this.openFiles.get(scriptInfo.path));
@@ -186800,22 +186929,35 @@ var _ProjectService = class _ProjectService {
186800
186929
  if (!(configFileExistenceInfo == null ? void 0 : configFileExistenceInfo.config)) return false;
186801
186930
  let scheduledAnyProjectUpdate = false;
186802
186931
  configFileExistenceInfo.config.updateLevel = 2 /* Full */;
186932
+ configFileExistenceInfo.config.cachedDirectoryStructureHost.clearCache();
186803
186933
  configFileExistenceInfo.config.projects.forEach((_watchWildcardDirectories, projectCanonicalPath) => {
186804
- var _a;
186934
+ var _a, _b, _c;
186805
186935
  const project = this.getConfiguredProjectByCanonicalConfigFilePath(projectCanonicalPath);
186806
186936
  if (!project) return;
186807
186937
  scheduledAnyProjectUpdate = true;
186808
186938
  if (projectCanonicalPath === canonicalConfigFilePath) {
186809
- if (project.isInitialLoadPending()) return;
186939
+ if (project.initialLoadPending) return;
186810
186940
  project.pendingUpdateLevel = 2 /* Full */;
186811
186941
  project.pendingUpdateReason = loadReason;
186812
186942
  this.delayUpdateProjectGraph(project);
186813
186943
  project.markAutoImportProviderAsDirty();
186814
186944
  } else {
186945
+ if (project.initialLoadPending) {
186946
+ (_b = (_a = this.configFileExistenceInfoCache.get(projectCanonicalPath)) == null ? void 0 : _a.openFilesImpactedByConfigFile) == null ? void 0 : _b.forEach((path2) => {
186947
+ var _a2;
186948
+ if (!((_a2 = this.pendingOpenFileProjectUpdates) == null ? void 0 : _a2.has(path2))) {
186949
+ (this.pendingOpenFileProjectUpdates ?? (this.pendingOpenFileProjectUpdates = /* @__PURE__ */ new Map())).set(
186950
+ path2,
186951
+ this.configFileForOpenFiles.get(path2)
186952
+ );
186953
+ }
186954
+ });
186955
+ return;
186956
+ }
186815
186957
  const path = this.toPath(canonicalConfigFilePath);
186816
186958
  project.resolutionCache.removeResolutionsFromProjectReferenceRedirects(path);
186817
186959
  this.delayUpdateProjectGraph(project);
186818
- if (this.getHostPreferences().includeCompletionsForModuleExports && find((_a = project.getCurrentProgram()) == null ? void 0 : _a.getResolvedProjectReferences(), (ref) => (ref == null ? void 0 : ref.sourceFile.path) === path)) {
186960
+ if (this.getHostPreferences().includeCompletionsForModuleExports && find((_c = project.getCurrentProgram()) == null ? void 0 : _c.getResolvedProjectReferences(), (ref) => (ref == null ? void 0 : ref.sourceFile.path) === path)) {
186819
186961
  project.markAutoImportProviderAsDirty();
186820
186962
  }
186821
186963
  }
@@ -186840,7 +186982,6 @@ var _ProjectService = class _ProjectService {
186840
186982
  canonicalConfigFilePath,
186841
186983
  "Change in config file detected"
186842
186984
  );
186843
- const updatedProjects = new Set(project ? [project] : void 0);
186844
186985
  this.openFiles.forEach((_projectRootPath, path) => {
186845
186986
  var _a, _b;
186846
186987
  const configFileForOpenFile = this.configFileForOpenFiles.get(path);
@@ -186853,16 +186994,9 @@ var _ProjectService = class _ProjectService {
186853
186994
  false
186854
186995
  );
186855
186996
  if (!newConfigFileNameForInfo) return;
186856
- const projectForInfo = this.findConfiguredProjectByProjectName(newConfigFileNameForInfo) ?? this.createConfiguredProject(
186857
- newConfigFileNameForInfo,
186858
- `Change in config file ${configFileName} detected, ${fileOpenReason(info)}`
186859
- );
186860
186997
  if (!((_b = this.pendingOpenFileProjectUpdates) == null ? void 0 : _b.has(path))) {
186861
186998
  (this.pendingOpenFileProjectUpdates ?? (this.pendingOpenFileProjectUpdates = /* @__PURE__ */ new Map())).set(path, configFileForOpenFile);
186862
186999
  }
186863
- if (tryAddToSet(updatedProjects, projectForInfo) && projectForInfo.isInitialLoadPending()) {
186864
- this.delayUpdateProjectGraph(projectForInfo);
186865
- }
186866
187000
  });
186867
187001
  this.delayEnsureProjectForOpenFiles();
186868
187002
  }
@@ -187034,7 +187168,7 @@ var _ProjectService = class _ProjectService {
187034
187168
  configFileExists(configFileName, canonicalConfigFilePath, info) {
187035
187169
  const configFileExistenceInfo = this.configFileExistenceInfoCache.get(canonicalConfigFilePath);
187036
187170
  let openFilesImpactedByConfigFile;
187037
- if (this.openFiles.has(info.path) && !isAncestorConfigFileInfo(info)) {
187171
+ if (this.openFiles.has(info.path) && (!isAncestorConfigFileInfo(info) || info.isForDefaultProject)) {
187038
187172
  if (configFileExistenceInfo) (configFileExistenceInfo.openFilesImpactedByConfigFile ?? (configFileExistenceInfo.openFilesImpactedByConfigFile = /* @__PURE__ */ new Set())).add(info.path);
187039
187173
  else (openFilesImpactedByConfigFile = /* @__PURE__ */ new Set()).add(info.path);
187040
187174
  }
@@ -187056,6 +187190,9 @@ var _ProjectService = class _ProjectService {
187056
187190
  forProject
187057
187191
  );
187058
187192
  }
187193
+ this.ensureConfigFileWatcherForProject(configFileExistenceInfo, forProject);
187194
+ }
187195
+ ensureConfigFileWatcherForProject(configFileExistenceInfo, forProject) {
187059
187196
  const projects = configFileExistenceInfo.config.projects;
187060
187197
  projects.set(forProject.canonicalConfigFilePath, projects.get(forProject.canonicalConfigFilePath) || false);
187061
187198
  }
@@ -187161,24 +187298,31 @@ var _ProjectService = class _ProjectService {
187161
187298
  let searchPath = asNormalizedPath(getDirectoryPath(info.fileName));
187162
187299
  const isSearchPathInProjectRoot = () => containsPath(projectRootPath, searchPath, this.currentDirectory, !this.host.useCaseSensitiveFileNames);
187163
187300
  const anySearchPathOk = !projectRootPath || !isSearchPathInProjectRoot();
187164
- let searchInDirectory = !isAncestorConfigFileInfo(info);
187301
+ let searchTsconfig = true;
187302
+ let searchJsconfig = true;
187303
+ if (isAncestorConfigFileInfo(info)) {
187304
+ if (endsWith(info.fileName, "tsconfig.json")) searchTsconfig = false;
187305
+ else searchTsconfig = searchJsconfig = false;
187306
+ }
187165
187307
  do {
187166
- if (searchInDirectory) {
187167
- const canonicalSearchPath = normalizedPathToPath(searchPath, this.currentDirectory, this.toCanonicalFileName);
187308
+ const canonicalSearchPath = normalizedPathToPath(searchPath, this.currentDirectory, this.toCanonicalFileName);
187309
+ if (searchTsconfig) {
187168
187310
  const tsconfigFileName = asNormalizedPath(combinePaths(searchPath, "tsconfig.json"));
187169
- let result = action(combinePaths(canonicalSearchPath, "tsconfig.json"), tsconfigFileName);
187311
+ const result = action(combinePaths(canonicalSearchPath, "tsconfig.json"), tsconfigFileName);
187170
187312
  if (result) return tsconfigFileName;
187313
+ }
187314
+ if (searchJsconfig) {
187171
187315
  const jsconfigFileName = asNormalizedPath(combinePaths(searchPath, "jsconfig.json"));
187172
- result = action(combinePaths(canonicalSearchPath, "jsconfig.json"), jsconfigFileName);
187316
+ const result = action(combinePaths(canonicalSearchPath, "jsconfig.json"), jsconfigFileName);
187173
187317
  if (result) return jsconfigFileName;
187174
- if (isNodeModulesDirectory(canonicalSearchPath)) {
187175
- break;
187176
- }
187318
+ }
187319
+ if (isNodeModulesDirectory(canonicalSearchPath)) {
187320
+ break;
187177
187321
  }
187178
187322
  const parentPath = asNormalizedPath(getDirectoryPath(searchPath));
187179
187323
  if (parentPath === searchPath) break;
187180
187324
  searchPath = parentPath;
187181
- searchInDirectory = true;
187325
+ searchTsconfig = searchJsconfig = true;
187182
187326
  } while (anySearchPathOk || isSearchPathInProjectRoot());
187183
187327
  return void 0;
187184
187328
  }
@@ -187187,7 +187331,7 @@ var _ProjectService = class _ProjectService {
187187
187331
  var _a;
187188
187332
  return info.isScriptOpen() ? (_a = this.tryFindDefaultConfiguredProjectForOpenScriptInfo(
187189
187333
  info,
187190
- 0 /* Find */
187334
+ 1 /* Find */
187191
187335
  )) == null ? void 0 : _a.defaultProject : void 0;
187192
187336
  }
187193
187337
  /** Get cached configFileName for scriptInfo or ancestor of open script info */
@@ -187201,8 +187345,19 @@ var _ProjectService = class _ProjectService {
187201
187345
  /** Caches the configFilename for script info or ancestor of open script info */
187202
187346
  setConfigFileNameForFileInCache(info, configFileName) {
187203
187347
  if (!this.openFiles.has(info.path)) return;
187204
- if (isAncestorConfigFileInfo(info)) return;
187205
- this.configFileForOpenFiles.set(info.path, configFileName || false);
187348
+ const config = configFileName || false;
187349
+ if (!isAncestorConfigFileInfo(info)) {
187350
+ this.configFileForOpenFiles.set(info.path, config);
187351
+ } else {
187352
+ let configFileForOpenFile = this.configFileForOpenFiles.get(info.path);
187353
+ if (!configFileForOpenFile || isString(configFileForOpenFile)) {
187354
+ this.configFileForOpenFiles.set(
187355
+ info.path,
187356
+ configFileForOpenFile = (/* @__PURE__ */ new Map()).set(false, configFileForOpenFile)
187357
+ );
187358
+ }
187359
+ configFileForOpenFile.set(info.fileName, config);
187360
+ }
187206
187361
  }
187207
187362
  /**
187208
187363
  * This function tries to search for a tsconfig.json for the given file.
@@ -187388,7 +187543,7 @@ var _ProjectService = class _ProjectService {
187388
187543
  var _a, _b;
187389
187544
  (_a = tracing) == null ? void 0 : _a.push(tracing.Phase.Session, "loadConfiguredProject", { configFilePath: project.canonicalConfigFilePath });
187390
187545
  this.sendProjectLoadingStartEvent(project, reason);
187391
- const configFilename = asNormalizedPath(normalizePath(project.getConfigFilePath()));
187546
+ const configFilename = toNormalizedPath(project.getConfigFilePath());
187392
187547
  const configFileExistenceInfo = this.ensureParsedConfigUptoDate(
187393
187548
  configFilename,
187394
187549
  project.canonicalConfigFilePath,
@@ -187406,7 +187561,7 @@ var _ProjectService = class _ProjectService {
187406
187561
  configHasExcludeProperty: parsedCommandLine.raw.exclude !== void 0
187407
187562
  };
187408
187563
  }
187409
- project.canConfigFileJsonReportNoInputFiles = canJsonReportNoInputFiles(parsedCommandLine.raw);
187564
+ project.parsedCommandLine = parsedCommandLine;
187410
187565
  project.setProjectErrors(parsedCommandLine.options.configFile.parseDiagnostics);
187411
187566
  project.updateReferences(parsedCommandLine.projectReferences);
187412
187567
  const lastFileExceededProgramSize = this.getFilenameForExceededTotalSizeLimitForNonTsFiles(project.canonicalConfigFilePath, compilerOptions, parsedCommandLine.fileNames, fileNamePropertyReader);
@@ -187428,12 +187583,19 @@ var _ProjectService = class _ProjectService {
187428
187583
  ensureParsedConfigUptoDate(configFilename, canonicalConfigFilePath, configFileExistenceInfo, forProject) {
187429
187584
  var _a, _b, _c;
187430
187585
  if (configFileExistenceInfo.config) {
187431
- if (!configFileExistenceInfo.config.updateLevel) return configFileExistenceInfo;
187432
187586
  if (configFileExistenceInfo.config.updateLevel === 1 /* RootNamesAndUpdate */) {
187433
187587
  this.reloadFileNamesOfParsedConfig(configFilename, configFileExistenceInfo.config);
187588
+ }
187589
+ if (!configFileExistenceInfo.config.updateLevel) {
187590
+ this.ensureConfigFileWatcherForProject(configFileExistenceInfo, forProject);
187434
187591
  return configFileExistenceInfo;
187435
187592
  }
187436
187593
  }
187594
+ if (!configFileExistenceInfo.exists && configFileExistenceInfo.config) {
187595
+ configFileExistenceInfo.config.updateLevel = void 0;
187596
+ this.ensureConfigFileWatcherForProject(configFileExistenceInfo, forProject);
187597
+ return configFileExistenceInfo;
187598
+ }
187437
187599
  const cachedDirectoryStructureHost = ((_a = configFileExistenceInfo.config) == null ? void 0 : _a.cachedDirectoryStructureHost) || createCachedDirectoryStructureHost(this.host, this.host.getCurrentDirectory(), this.host.useCaseSensitiveFileNames);
187438
187600
  const configFileContent = tryReadFile(configFilename, (fileName) => this.host.readFile(fileName));
187439
187601
  const configFile = parseJsonText(configFilename, isString(configFileContent) ? configFileContent : "");
@@ -187628,14 +187790,18 @@ var _ProjectService = class _ProjectService {
187628
187790
  * @internal
187629
187791
  */
187630
187792
  reloadFileNamesOfConfiguredProject(project) {
187631
- const fileNames = this.reloadFileNamesOfParsedConfig(project.getConfigFilePath(), this.configFileExistenceInfoCache.get(project.canonicalConfigFilePath).config);
187632
- project.updateErrorOnNoInputFiles(fileNames);
187633
- this.updateNonInferredProjectFiles(project, fileNames.concat(project.getExternalFiles(1 /* RootNamesAndUpdate */)), fileNamePropertyReader);
187793
+ const config = this.reloadFileNamesOfParsedConfig(project.getConfigFilePath(), this.configFileExistenceInfoCache.get(project.canonicalConfigFilePath).config);
187794
+ project.updateErrorOnNoInputFiles(config);
187795
+ this.updateNonInferredProjectFiles(
187796
+ project,
187797
+ config.fileNames.concat(project.getExternalFiles(1 /* RootNamesAndUpdate */)),
187798
+ fileNamePropertyReader
187799
+ );
187634
187800
  project.markAsDirty();
187635
187801
  return project.updateGraph();
187636
187802
  }
187637
187803
  reloadFileNamesOfParsedConfig(configFileName, config) {
187638
- if (config.updateLevel === void 0) return config.parsedCommandLine.fileNames;
187804
+ if (config.updateLevel === void 0) return config.parsedCommandLine;
187639
187805
  Debug.assert(config.updateLevel === 1 /* RootNamesAndUpdate */);
187640
187806
  const configFileSpecs = config.parsedCommandLine.options.configFile.configFileSpecs;
187641
187807
  const fileNames = getFileNamesFromConfigSpecs(
@@ -187646,30 +187812,42 @@ var _ProjectService = class _ProjectService {
187646
187812
  this.hostConfiguration.extraFileExtensions
187647
187813
  );
187648
187814
  config.parsedCommandLine = { ...config.parsedCommandLine, fileNames };
187649
- return fileNames;
187815
+ config.updateLevel = void 0;
187816
+ return config.parsedCommandLine;
187650
187817
  }
187651
187818
  /** @internal */
187652
187819
  setFileNamesOfAutpImportProviderOrAuxillaryProject(project, fileNames) {
187653
187820
  this.updateNonInferredProjectFiles(project, fileNames, fileNamePropertyReader);
187654
187821
  }
187655
187822
  /** @internal */
187823
+ reloadConfiguredProjectOptimized(project, reason, reloadedProjects) {
187824
+ if (reloadedProjects.has(project)) return;
187825
+ reloadedProjects.set(project, 4 /* ReloadOptimized */);
187826
+ if (!project.initialLoadPending) {
187827
+ this.setProjectForReload(project, 2 /* Full */, reason);
187828
+ }
187829
+ }
187830
+ /** @internal */
187656
187831
  reloadConfiguredProjectClearingSemanticCache(project, reason, reloadedProjects) {
187657
- if (!tryAddToSet(reloadedProjects, project)) return false;
187832
+ if (reloadedProjects.get(project) === 5 /* Reload */) return false;
187833
+ reloadedProjects.set(project, 5 /* Reload */);
187658
187834
  this.clearSemanticCache(project);
187659
187835
  this.reloadConfiguredProject(project, reloadReason(reason));
187660
187836
  return true;
187661
187837
  }
187838
+ setProjectForReload(project, updateLevel, reason) {
187839
+ if (updateLevel === 2 /* Full */) this.clearSemanticCache(project);
187840
+ project.pendingUpdateReason = reason && reloadReason(reason);
187841
+ project.pendingUpdateLevel = updateLevel;
187842
+ }
187662
187843
  /**
187663
187844
  * Read the config file of the project again by clearing the cache and update the project graph
187664
187845
  *
187665
187846
  * @internal
187666
187847
  */
187667
187848
  reloadConfiguredProject(project, reason) {
187668
- project.isInitialLoadPending = returnFalse;
187669
- project.pendingUpdateReason = void 0;
187670
- project.pendingUpdateLevel = 0 /* Update */;
187671
- const host = project.getCachedDirectoryStructureHost();
187672
- host.clearCache();
187849
+ project.initialLoadPending = false;
187850
+ this.setProjectForReload(project, 0 /* Update */);
187673
187851
  this.loadConfiguredProject(project, reason);
187674
187852
  updateWithTriggerFile(
187675
187853
  project,
@@ -188300,25 +188478,23 @@ Dynamic files must always be opened with service's current directory or service
188300
188478
  this.pendingOpenFileProjectUpdates = void 0;
188301
188479
  this.pendingEnsureProjectForOpenFiles = false;
188302
188480
  this.configFileExistenceInfoCache.forEach((info) => {
188303
- if (info.config) info.config.updateLevel = 2 /* Full */;
188481
+ if (info.config) {
188482
+ info.config.updateLevel = 2 /* Full */;
188483
+ info.config.cachedDirectoryStructureHost.clearCache();
188484
+ }
188304
188485
  });
188305
188486
  this.configFileForOpenFiles.clear();
188306
188487
  this.externalProjects.forEach((project) => {
188307
188488
  this.clearSemanticCache(project);
188308
188489
  project.updateGraph();
188309
188490
  });
188310
- const reloadedConfiguredProjects = /* @__PURE__ */ new Set();
188491
+ const reloadedConfiguredProjects = /* @__PURE__ */ new Map();
188311
188492
  const delayReloadedConfiguredProjects = /* @__PURE__ */ new Set();
188312
188493
  this.externalProjectToConfiguredProjectMap.forEach((projects, externalProjectName) => {
188313
188494
  const reason = `Reloading configured project in external project: ${externalProjectName}`;
188314
188495
  projects.forEach((project) => {
188315
188496
  if (this.getHostPreferences().lazyConfiguredProjectsFromExternalProject) {
188316
- if (!project.isInitialLoadPending()) {
188317
- this.clearSemanticCache(project);
188318
- project.pendingUpdateLevel = 2 /* Full */;
188319
- project.pendingUpdateReason = reloadReason(reason);
188320
- }
188321
- delayReloadedConfiguredProjects.add(project);
188497
+ this.reloadConfiguredProjectOptimized(project, reason, reloadedConfiguredProjects);
188322
188498
  } else {
188323
188499
  this.reloadConfiguredProjectClearingSemanticCache(
188324
188500
  project,
@@ -188333,12 +188509,12 @@ Dynamic files must always be opened with service's current directory or service
188333
188509
  if (find(info.containingProjects, isExternalProject)) return;
188334
188510
  this.tryFindDefaultConfiguredProjectAndLoadAncestorsForOpenScriptInfo(
188335
188511
  info,
188336
- 2 /* Reload */,
188512
+ 5 /* Reload */,
188337
188513
  reloadedConfiguredProjects,
188338
188514
  delayReloadedConfiguredProjects
188339
188515
  );
188340
188516
  });
188341
- delayReloadedConfiguredProjects.forEach((p) => reloadedConfiguredProjects.add(p));
188517
+ delayReloadedConfiguredProjects.forEach((p) => reloadedConfiguredProjects.set(p, 5 /* Reload */));
188342
188518
  this.inferredProjects.forEach((project) => this.clearSemanticCache(project));
188343
188519
  this.ensureProjectForOpenFiles();
188344
188520
  this.cleanupProjectsAndScriptInfos(
@@ -188380,7 +188556,7 @@ Dynamic files must always be opened with service's current directory or service
188380
188556
  pendingOpenFileProjectUpdates == null ? void 0 : pendingOpenFileProjectUpdates.forEach(
188381
188557
  (_config, path) => this.tryFindDefaultConfiguredProjectAndLoadAncestorsForOpenScriptInfo(
188382
188558
  this.getScriptInfoForPath(path),
188383
- 1 /* Create */
188559
+ 3 /* Create */
188384
188560
  )
188385
188561
  );
188386
188562
  this.openFiles.forEach((projectRootPath, path) => {
@@ -188436,23 +188612,18 @@ Dynamic files must always be opened with service's current directory or service
188436
188612
  }
188437
188613
  configuredProject = this.createConfiguredProject(configFileName, `Creating project for original file: ${originalFileInfo.fileName}${location !== originalLocation ? " for location: " + location.fileName : ""}`);
188438
188614
  }
188439
- updateProjectIfDirty(configuredProject);
188440
- const projectContainsOriginalInfo = (project2) => {
188441
- const info = this.getScriptInfo(fileName);
188442
- return info && project2.containsScriptInfo(info) && !project2.isSourceOfProjectReferenceRedirect(info.path);
188443
- };
188444
- if (configuredProject.isSolution() || !projectContainsOriginalInfo(configuredProject)) {
188445
- configuredProject = forEachResolvedProjectReferenceProject(
188615
+ const result = this.tryFindDefaultConfiguredProjectForOpenScriptInfoOrClosedFileInfo(
188616
+ originalFileInfo,
188617
+ 3 /* Create */,
188618
+ updateProjectFoundUsingFind(
188446
188619
  configuredProject,
188447
- fileName,
188448
- (child) => projectContainsOriginalInfo(child) ? child : void 0,
188449
- 1 /* Create */,
188450
- `Creating project referenced in solution ${configuredProject.projectName} to find possible configured project for original file: ${originalFileInfo.fileName}${location !== originalLocation ? " for location: " + location.fileName : ""}`
188451
- );
188452
- if (!configuredProject) return void 0;
188453
- if (configuredProject === project) return originalLocation;
188454
- }
188455
- addOriginalConfiguredProject(configuredProject);
188620
+ 2 /* CreateOptimized */
188621
+ ),
188622
+ (project2) => `Creating project referenced in solution ${project2.projectName} to find possible configured project for original file: ${originalFileInfo.fileName}${location !== originalLocation ? " for location: " + location.fileName : ""}`
188623
+ );
188624
+ if (!result.defaultProject) return void 0;
188625
+ if (result.defaultProject === project) return originalLocation;
188626
+ addOriginalConfiguredProject(result.defaultProject);
188456
188627
  const originalScriptInfo = this.getScriptInfo(fileName);
188457
188628
  if (!originalScriptInfo || !originalScriptInfo.containingProjects.length) return void 0;
188458
188629
  originalScriptInfo.containingProjects.forEach((project2) => {
@@ -188501,7 +188672,7 @@ Dynamic files must always be opened with service's current directory or service
188501
188672
  if (!project && this.serverMode === 0 /* Semantic */) {
188502
188673
  const result = this.tryFindDefaultConfiguredProjectAndLoadAncestorsForOpenScriptInfo(
188503
188674
  info,
188504
- 1 /* Create */
188675
+ 3 /* Create */
188505
188676
  );
188506
188677
  if (result) {
188507
188678
  retainProjects = result.seenProjects;
@@ -188514,8 +188685,8 @@ Dynamic files must always be opened with service's current directory or service
188514
188685
  }
188515
188686
  info.containingProjects.forEach(updateProjectIfDirty);
188516
188687
  if (info.isOrphan()) {
188517
- retainProjects == null ? void 0 : retainProjects.forEach((project2) => {
188518
- if (!sentConfigDiag.has(project2)) this.sendConfigFileDiagEvent(
188688
+ retainProjects == null ? void 0 : retainProjects.forEach((kind, project2) => {
188689
+ if (kind !== 2 /* CreateOptimized */ && !sentConfigDiag.has(project2)) this.sendConfigFileDiagEvent(
188519
188690
  project2,
188520
188691
  info.fileName,
188521
188692
  /*force*/
@@ -188535,30 +188706,43 @@ Dynamic files must always be opened with service's current directory or service
188535
188706
  * - Reload - if the project doesnt exist, it creates one. If not delayLoad, the project is reloaded clearing semantic cache
188536
188707
  * @internal
188537
188708
  */
188538
- findCreateOrReloadConfiguredProject(configFileName, kind, reason, allowDeferredClosed, triggerFile, reloadedProjects, delayLoad, delayReloadedConfiguredProjects) {
188539
- let project = this.findConfiguredProjectByProjectName(configFileName, allowDeferredClosed);
188709
+ findCreateOrReloadConfiguredProject(configFileName, kind, reason, allowDeferredClosed, triggerFile, reloadedProjects, delayLoad, delayReloadedConfiguredProjects, projectForConfigFile) {
188710
+ let project = projectForConfigFile ?? this.findConfiguredProjectByProjectName(configFileName, allowDeferredClosed);
188540
188711
  let sentConfigFileDiag = false;
188712
+ let configFileExistenceInfo;
188541
188713
  switch (kind) {
188542
- case 0 /* Find */:
188714
+ case 0 /* FindOptimized */:
188715
+ case 1 /* Find */:
188543
188716
  if (!project) return;
188544
188717
  break;
188545
- case 1 /* Create */:
188718
+ case 2 /* CreateOptimized */:
188719
+ case 3 /* Create */:
188546
188720
  project ?? (project = this.createConfiguredProject(configFileName, reason));
188547
- sentConfigFileDiag = !delayLoad && updateConfiguredProject(project, triggerFile);
188721
+ if (!delayLoad) {
188722
+ ({ sentConfigFileDiag, configFileExistenceInfo } = updateProjectFoundUsingFind(
188723
+ project,
188724
+ kind,
188725
+ triggerFile
188726
+ ));
188727
+ }
188548
188728
  break;
188549
- case 2 /* Reload */:
188729
+ case 4 /* ReloadOptimized */:
188730
+ project ?? (project = this.createConfiguredProject(configFileName, reloadReason(reason)));
188731
+ project.projectService.reloadConfiguredProjectOptimized(project, reason, reloadedProjects);
188732
+ configFileExistenceInfo = configFileExistenceInfoForOptimizedLoading(project);
188733
+ if (configFileExistenceInfo) break;
188734
+ case 5 /* Reload */:
188550
188735
  project ?? (project = this.createConfiguredProject(configFileName, reloadReason(reason)));
188551
188736
  sentConfigFileDiag = !delayReloadedConfiguredProjects && this.reloadConfiguredProjectClearingSemanticCache(project, reason, reloadedProjects);
188552
188737
  if (delayReloadedConfiguredProjects && !delayReloadedConfiguredProjects.has(project) && !reloadedProjects.has(project)) {
188553
- project.pendingUpdateLevel = 2 /* Full */;
188554
- project.pendingUpdateReason = reloadReason(reason);
188738
+ this.setProjectForReload(project, 2 /* Full */, reason);
188555
188739
  delayReloadedConfiguredProjects.add(project);
188556
188740
  }
188557
188741
  break;
188558
188742
  default:
188559
188743
  Debug.assertNever(kind);
188560
188744
  }
188561
- return { project, sentConfigFileDiag };
188745
+ return { project, sentConfigFileDiag, configFileExistenceInfo, reason };
188562
188746
  }
188563
188747
  /**
188564
188748
  * Finds the default configured project for given info
@@ -188566,54 +188750,162 @@ Dynamic files must always be opened with service's current directory or service
188566
188750
  * The search happens for all tsconfigs till projectRootPath
188567
188751
  */
188568
188752
  tryFindDefaultConfiguredProjectForOpenScriptInfo(info, kind, allowDeferredClosed, reloadedProjects) {
188569
- const configFileName = this.getConfigFileNameForFile(info, kind === 0 /* Find */);
188753
+ const configFileName = this.getConfigFileNameForFile(info, kind === 1 /* Find */);
188570
188754
  if (!configFileName) return;
188755
+ const optimizedKind = toConfiguredProjectLoadOptimized(kind);
188571
188756
  const result = this.findCreateOrReloadConfiguredProject(
188572
188757
  configFileName,
188573
- kind,
188758
+ optimizedKind,
188574
188759
  fileOpenReason(info),
188575
188760
  allowDeferredClosed,
188576
188761
  info.fileName,
188577
188762
  reloadedProjects
188578
188763
  );
188579
- if (!result) return;
188580
- const seenProjects = /* @__PURE__ */ new Set();
188581
- const sentConfigDiag = new Set(result.sentConfigFileDiag ? [result.project] : void 0);
188764
+ return result && this.tryFindDefaultConfiguredProjectForOpenScriptInfoOrClosedFileInfo(
188765
+ info,
188766
+ kind,
188767
+ result,
188768
+ (project) => `Creating project referenced in solution ${project.projectName} to find possible configured project for ${info.fileName} to open`,
188769
+ allowDeferredClosed,
188770
+ reloadedProjects
188771
+ );
188772
+ }
188773
+ isMatchedByConfig(configFileName, config, info) {
188774
+ if (config.fileNames.some((rootName) => this.toPath(rootName) === info.path)) return true;
188775
+ if (isSupportedSourceFileName(
188776
+ info.fileName,
188777
+ config.options,
188778
+ this.hostConfiguration.extraFileExtensions
188779
+ )) return false;
188780
+ const { validatedFilesSpec, validatedIncludeSpecs, validatedExcludeSpecs } = config.options.configFile.configFileSpecs;
188781
+ const basePath = toNormalizedPath(getNormalizedAbsolutePath(getDirectoryPath(configFileName), this.currentDirectory));
188782
+ if (validatedFilesSpec == null ? void 0 : validatedFilesSpec.some((fileSpec) => this.toPath(getNormalizedAbsolutePath(fileSpec, basePath)) === info.path)) return true;
188783
+ if (!(validatedIncludeSpecs == null ? void 0 : validatedIncludeSpecs.length)) return false;
188784
+ if (matchesExcludeWorker(
188785
+ info.fileName,
188786
+ validatedExcludeSpecs,
188787
+ this.host.useCaseSensitiveFileNames,
188788
+ this.currentDirectory,
188789
+ basePath
188790
+ )) return false;
188791
+ return validatedIncludeSpecs == null ? void 0 : validatedIncludeSpecs.some((includeSpec) => {
188792
+ const pattern = getPatternFromSpec(includeSpec, basePath, "files");
188793
+ return !!pattern && getRegexFromPattern(`(${pattern})$`, this.host.useCaseSensitiveFileNames).test(info.fileName);
188794
+ });
188795
+ }
188796
+ tryFindDefaultConfiguredProjectForOpenScriptInfoOrClosedFileInfo(info, kind, initialConfigResult, referencedProjectReason, allowDeferredClosed, reloadedProjects) {
188797
+ const infoIsOpenScriptInfo = isOpenScriptInfo(info);
188798
+ const optimizedKind = toConfiguredProjectLoadOptimized(kind);
188799
+ const seenProjects = /* @__PURE__ */ new Map();
188800
+ let seenConfigs;
188801
+ const sentConfigDiag = /* @__PURE__ */ new Set();
188582
188802
  let defaultProject;
188583
188803
  let possiblyDefault;
188584
- tryFindDefaultConfiguredProject(result.project);
188804
+ let tsconfigOfDefault;
188805
+ let tsconfigOfPossiblyDefault;
188806
+ tryFindDefaultConfiguredProject(initialConfigResult);
188585
188807
  return {
188586
188808
  defaultProject: defaultProject ?? possiblyDefault,
188809
+ tsconfigProject: tsconfigOfDefault ?? tsconfigOfPossiblyDefault,
188587
188810
  sentConfigDiag,
188588
188811
  seenProjects
188589
188812
  };
188590
- function tryFindDefaultConfiguredProject(project) {
188591
- return isDefaultProject(project) ? defaultProject : tryFindDefaultConfiguredProjectFromReferences(project);
188813
+ function tryFindDefaultConfiguredProject(result) {
188814
+ return isDefaultProjectOptimized(result, result.project) ?? tryFindDefaultConfiguredProjectFromReferences(result.project) ?? tryFindDefaultConfiguredProjectFromAncestor(result.project);
188592
188815
  }
188593
- function isDefaultProject(project) {
188594
- if (!tryAddToSet(seenProjects, project)) return;
188595
- const projectWithInfo = project.containsScriptInfo(info);
188596
- if (projectWithInfo && !project.isSourceOfProjectReferenceRedirect(info.path)) return defaultProject = project;
188597
- possiblyDefault ?? (possiblyDefault = projectWithInfo ? project : void 0);
188598
- }
188599
- function tryFindDefaultConfiguredProjectFromReferences(project) {
188600
- return forEachResolvedProjectReferenceProject(
188816
+ function isDefaultConfigFileExistenceInfo(configFileExistenceInfo, project, childConfigName, reason, tsconfigProject, canonicalConfigFilePath) {
188817
+ if (project) {
188818
+ if (seenProjects.has(project)) return;
188819
+ seenProjects.set(project, optimizedKind);
188820
+ } else {
188821
+ if (seenConfigs == null ? void 0 : seenConfigs.has(canonicalConfigFilePath)) return;
188822
+ (seenConfigs ?? (seenConfigs = /* @__PURE__ */ new Set())).add(canonicalConfigFilePath);
188823
+ }
188824
+ if (!tsconfigProject.projectService.isMatchedByConfig(
188825
+ childConfigName,
188826
+ configFileExistenceInfo.config.parsedCommandLine,
188827
+ info
188828
+ )) {
188829
+ if (tsconfigProject.languageServiceEnabled) {
188830
+ tsconfigProject.projectService.watchWildcards(
188831
+ childConfigName,
188832
+ configFileExistenceInfo,
188833
+ tsconfigProject
188834
+ );
188835
+ }
188836
+ return;
188837
+ }
188838
+ const result = project ? updateProjectFoundUsingFind(
188601
188839
  project,
188602
- info.path,
188603
- (child, sentConfigFileDiag) => {
188604
- if (sentConfigFileDiag) sentConfigDiag.add(child);
188605
- return isDefaultProject(child);
188606
- },
188607
188840
  kind,
188608
- `Creating project referenced in solution ${project.projectName} to find possible configured project for ${info.fileName} to open`,
188841
+ info.fileName,
188842
+ reason,
188843
+ reloadedProjects
188844
+ ) : tsconfigProject.projectService.findCreateOrReloadConfiguredProject(
188845
+ childConfigName,
188846
+ kind,
188847
+ reason,
188609
188848
  allowDeferredClosed,
188610
188849
  info.fileName,
188611
188850
  reloadedProjects
188612
188851
  );
188852
+ seenProjects.set(result.project, optimizedKind);
188853
+ if (result.sentConfigFileDiag) sentConfigDiag.add(result.project);
188854
+ return isDefaultProject(result.project, tsconfigProject);
188855
+ }
188856
+ function isDefaultProject(project, tsconfigProject) {
188857
+ if (seenProjects.get(project) === kind) return;
188858
+ seenProjects.set(project, kind);
188859
+ const scriptInfo = infoIsOpenScriptInfo ? info : project.projectService.getScriptInfo(info.fileName);
188860
+ const projectWithInfo = scriptInfo && project.containsScriptInfo(scriptInfo);
188861
+ if (projectWithInfo && !project.isSourceOfProjectReferenceRedirect(scriptInfo.path)) {
188862
+ tsconfigOfDefault = tsconfigProject;
188863
+ return defaultProject = project;
188864
+ }
188865
+ if (!possiblyDefault && infoIsOpenScriptInfo && projectWithInfo) {
188866
+ tsconfigOfPossiblyDefault = tsconfigProject;
188867
+ possiblyDefault = project;
188868
+ }
188869
+ }
188870
+ function isDefaultProjectOptimized(result, tsconfigProject) {
188871
+ if (result.sentConfigFileDiag) sentConfigDiag.add(result.project);
188872
+ return result.configFileExistenceInfo ? isDefaultConfigFileExistenceInfo(
188873
+ result.configFileExistenceInfo,
188874
+ result.project,
188875
+ toNormalizedPath(result.project.getConfigFilePath()),
188876
+ result.reason,
188877
+ result.project,
188878
+ result.project.canonicalConfigFilePath
188879
+ ) : isDefaultProject(result.project, tsconfigProject);
188880
+ }
188881
+ function tryFindDefaultConfiguredProjectFromReferences(project) {
188882
+ return project.parsedCommandLine && forEachResolvedProjectReferenceProjectLoad(
188883
+ project,
188884
+ project.parsedCommandLine,
188885
+ isDefaultConfigFileExistenceInfo,
188886
+ optimizedKind,
188887
+ referencedProjectReason(project),
188888
+ allowDeferredClosed,
188889
+ reloadedProjects
188890
+ );
188891
+ }
188892
+ function tryFindDefaultConfiguredProjectFromAncestor(project) {
188893
+ return infoIsOpenScriptInfo ? forEachAncestorProjectLoad(
188894
+ // If not in referenced projects, try ancestors and its references
188895
+ info,
188896
+ project,
188897
+ tryFindDefaultConfiguredProject,
188898
+ optimizedKind,
188899
+ `Creating possible configured project for ${info.fileName} to open`,
188900
+ allowDeferredClosed,
188901
+ reloadedProjects,
188902
+ /*searchOnlyPotentialSolution*/
188903
+ false
188904
+ ) : void 0;
188613
188905
  }
188614
188906
  }
188615
188907
  tryFindDefaultConfiguredProjectAndLoadAncestorsForOpenScriptInfo(info, kind, reloadedProjects, delayReloadedConfiguredProjects) {
188616
- const allowDeferredClosed = kind === 0 /* Find */;
188908
+ const allowDeferredClosed = kind === 1 /* Find */;
188617
188909
  const result = this.tryFindDefaultConfiguredProjectForOpenScriptInfo(
188618
188910
  info,
188619
188911
  kind,
@@ -188621,18 +188913,20 @@ Dynamic files must always be opened with service's current directory or service
188621
188913
  reloadedProjects
188622
188914
  );
188623
188915
  if (!result) return;
188624
- const { defaultProject, seenProjects } = result;
188916
+ const { defaultProject, tsconfigProject, seenProjects } = result;
188625
188917
  if (defaultProject) {
188626
- forEachAncestorProject(
188918
+ forEachAncestorProjectLoad(
188627
188919
  info,
188628
- defaultProject,
188920
+ tsconfigProject,
188629
188921
  (ancestor) => {
188630
- seenProjects.add(ancestor);
188922
+ seenProjects.set(ancestor.project, kind);
188631
188923
  },
188632
188924
  kind,
188633
188925
  `Creating project possibly referencing default composite project ${defaultProject.getProjectName()} of open file ${info.fileName}`,
188634
188926
  allowDeferredClosed,
188635
188927
  reloadedProjects,
188928
+ /*searchOnlyPotentialSolution*/
188929
+ true,
188636
188930
  delayReloadedConfiguredProjects
188637
188931
  );
188638
188932
  }
@@ -188641,7 +188935,7 @@ Dynamic files must always be opened with service's current directory or service
188641
188935
  /** @internal */
188642
188936
  loadAncestorProjectTree(forProjects) {
188643
188937
  forProjects ?? (forProjects = new Set(
188644
- mapDefinedIterator(this.configuredProjects.entries(), ([key, project]) => !project.isInitialLoadPending() ? key : void 0)
188938
+ mapDefinedIterator(this.configuredProjects.entries(), ([key, project]) => !project.initialLoadPending ? key : void 0)
188645
188939
  ));
188646
188940
  const seenProjects = /* @__PURE__ */ new Set();
188647
188941
  const currentConfiguredProjects = arrayFrom(this.configuredProjects.values());
@@ -188747,7 +189041,7 @@ Dynamic files must always be opened with service's current directory or service
188747
189041
  );
188748
189042
  }
188749
189043
  };
188750
- toRetainConfiguredProjects == null ? void 0 : toRetainConfiguredProjects.forEach(retainConfiguredProject);
189044
+ toRetainConfiguredProjects == null ? void 0 : toRetainConfiguredProjects.forEach((_, project) => retainConfiguredProject(project));
188751
189045
  if (!toRemoveConfiguredProjects.size) return toRemoveConfiguredProjects;
188752
189046
  this.inferredProjects.forEach(markOriginalProjectsAsUsed);
188753
189047
  this.externalProjects.forEach(markOriginalProjectsAsUsed);
@@ -188763,10 +189057,10 @@ Dynamic files must always be opened with service's current directory or service
188763
189057
  if (find(info.containingProjects, isExternalProject)) return;
188764
189058
  const result = this.tryFindDefaultConfiguredProjectAndLoadAncestorsForOpenScriptInfo(
188765
189059
  info,
188766
- 0 /* Find */
189060
+ 1 /* Find */
188767
189061
  );
188768
189062
  if (result == null ? void 0 : result.defaultProject) {
188769
- result == null ? void 0 : result.seenProjects.forEach(retainConfiguredProject);
189063
+ result == null ? void 0 : result.seenProjects.forEach((_, project) => retainConfiguredProject(project));
188770
189064
  if (!toRemoveConfiguredProjects.size) return toRemoveConfiguredProjects;
188771
189065
  }
188772
189066
  });
@@ -188797,7 +189091,7 @@ Dynamic files must always be opened with service's current directory or service
188797
189091
  const toRemoveScriptInfos = new Map(this.filenameToScriptInfo);
188798
189092
  this.filenameToScriptInfo.forEach((info) => {
188799
189093
  if (info.deferredDelete) return;
188800
- if (!info.isScriptOpen() && info.isOrphan() && !info.isContainedByBackgroundProject()) {
189094
+ if (!info.isScriptOpen() && info.isOrphan() && !scriptInfoIsContainedByDeferredClosedProject(info) && !scriptInfoIsContainedByBackgroundProject(info)) {
188801
189095
  if (!info.sourceMapFilePath) return;
188802
189096
  let sourceInfos;
188803
189097
  if (isString(info.sourceMapFilePath)) {
@@ -188915,10 +189209,14 @@ Dynamic files must always be opened with service's current directory or service
188915
189209
  existingOpenScriptInfos,
188916
189210
  (existing, index) => !existing && openScriptInfos[index] && !openScriptInfos[index].isDynamic ? this.tryInvokeWildCardDirectories(openScriptInfos[index]) : void 0
188917
189211
  );
188918
- openScriptInfos == null ? void 0 : openScriptInfos.forEach((info) => {
188919
- var _a;
188920
- return (_a = this.assignProjectToOpenedScriptInfo(info).retainProjects) == null ? void 0 : _a.forEach((p) => (retainProjects ?? (retainProjects = /* @__PURE__ */ new Set())).add(p));
188921
- });
189212
+ openScriptInfos == null ? void 0 : openScriptInfos.forEach(
189213
+ (info) => {
189214
+ var _a;
189215
+ return (_a = this.assignProjectToOpenedScriptInfo(info).retainProjects) == null ? void 0 : _a.forEach(
189216
+ (kind, p) => (retainProjects ?? (retainProjects = /* @__PURE__ */ new Map())).set(p, kind)
189217
+ );
189218
+ }
189219
+ );
188922
189220
  if (assignOrphanScriptInfosToInferredProject) {
188923
189221
  this.assignOrphanScriptInfosToInferredProject();
188924
189222
  }
@@ -193949,6 +194247,8 @@ __export(ts_server_exports4, {
193949
194247
  nullCancellationToken: () => nullCancellationToken,
193950
194248
  nullTypingsInstaller: () => nullTypingsInstaller,
193951
194249
  protocol: () => ts_server_protocol_exports,
194250
+ scriptInfoIsContainedByBackgroundProject: () => scriptInfoIsContainedByBackgroundProject,
194251
+ scriptInfoIsContainedByDeferredClosedProject: () => scriptInfoIsContainedByDeferredClosedProject,
193952
194252
  stringifyIndented: () => stringifyIndented,
193953
194253
  toEvent: () => toEvent,
193954
194254
  toNormalizedPath: () => toNormalizedPath,
@@ -195628,6 +195928,7 @@ if (typeof console !== "undefined") {
195628
195928
  isSimpleInlineableExpression,
195629
195929
  isSimpleParameterList,
195630
195930
  isSingleOrDoubleQuote,
195931
+ isSolutionConfig,
195631
195932
  isSourceElement,
195632
195933
  isSourceFile,
195633
195934
  isSourceFileFromLibrary,
@@ -195773,6 +196074,7 @@ if (typeof console !== "undefined") {
195773
196074
  matchPatternOrExact,
195774
196075
  matchedText,
195775
196076
  matchesExclude,
196077
+ matchesExcludeWorker,
195776
196078
  maxBy,
195777
196079
  maybeBind,
195778
196080
  maybeSetLocalizedDiagnosticMessages,