typescript 5.5.0-dev.20240510 → 5.5.0-dev.20240512
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/tsc.js +134 -99
- package/lib/typescript.d.ts +31 -38
- package/lib/typescript.js +651 -573
- package/package.json +2 -2
package/lib/typescript.js
CHANGED
|
@@ -68,7 +68,6 @@ __export(typescript_exports, {
|
|
|
68
68
|
EmitHint: () => EmitHint,
|
|
69
69
|
EmitOnly: () => EmitOnly,
|
|
70
70
|
EndOfLineState: () => EndOfLineState,
|
|
71
|
-
EnumKind: () => EnumKind,
|
|
72
71
|
ExitStatus: () => ExitStatus,
|
|
73
72
|
ExportKind: () => ExportKind,
|
|
74
73
|
Extension: () => Extension,
|
|
@@ -2369,7 +2368,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2369
2368
|
|
|
2370
2369
|
// src/compiler/corePublic.ts
|
|
2371
2370
|
var versionMajorMinor = "5.5";
|
|
2372
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2371
|
+
var version = `${versionMajorMinor}.0-dev.20240512`;
|
|
2373
2372
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2374
2373
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2375
2374
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -6492,11 +6491,6 @@ var SymbolFlags = /* @__PURE__ */ ((SymbolFlags3) => {
|
|
|
6492
6491
|
SymbolFlags3[SymbolFlags3["LateBindingContainer"] = 6256] = "LateBindingContainer";
|
|
6493
6492
|
return SymbolFlags3;
|
|
6494
6493
|
})(SymbolFlags || {});
|
|
6495
|
-
var EnumKind = /* @__PURE__ */ ((EnumKind2) => {
|
|
6496
|
-
EnumKind2[EnumKind2["Numeric"] = 0] = "Numeric";
|
|
6497
|
-
EnumKind2[EnumKind2["Literal"] = 1] = "Literal";
|
|
6498
|
-
return EnumKind2;
|
|
6499
|
-
})(EnumKind || {});
|
|
6500
6494
|
var CheckFlags = /* @__PURE__ */ ((CheckFlags2) => {
|
|
6501
6495
|
CheckFlags2[CheckFlags2["None"] = 0] = "None";
|
|
6502
6496
|
CheckFlags2[CheckFlags2["Instantiated"] = 1] = "Instantiated";
|
|
@@ -15978,7 +15972,7 @@ function canHaveLocals(node) {
|
|
|
15978
15972
|
}
|
|
15979
15973
|
}
|
|
15980
15974
|
function isDeclarationKind(kind) {
|
|
15981
|
-
return kind === 219 /* ArrowFunction */ || kind === 208 /* BindingElement */ || kind === 263 /* ClassDeclaration */ || kind === 231 /* ClassExpression */ || kind === 175 /* ClassStaticBlockDeclaration */ || kind === 176 /* Constructor */ || kind === 266 /* EnumDeclaration */ || kind === 306 /* EnumMember */ || kind === 281 /* ExportSpecifier */ || kind === 262 /* FunctionDeclaration */ || kind === 218 /* FunctionExpression */ || kind === 177 /* GetAccessor */ || kind === 273 /* ImportClause */ || kind === 271 /* ImportEqualsDeclaration */ || kind === 276 /* ImportSpecifier */ || kind === 264 /* InterfaceDeclaration */ || kind === 291 /* JsxAttribute */ || kind === 174 /* MethodDeclaration */ || kind === 173 /* MethodSignature */ || kind === 267 /* ModuleDeclaration */ || kind === 270 /* NamespaceExportDeclaration */ || kind === 274 /* NamespaceImport */ || kind === 280 /* NamespaceExport */ || kind === 169 /* Parameter */ || kind === 303 /* PropertyAssignment */ || kind === 172 /* PropertyDeclaration */ || kind === 171 /* PropertySignature */ || kind === 178 /* SetAccessor */ || kind === 304 /* ShorthandPropertyAssignment */ || kind === 265 /* TypeAliasDeclaration */ || kind === 168 /* TypeParameter */ || kind === 260 /* VariableDeclaration */ || kind === 346 /* JSDocTypedefTag */ || kind === 338 /* JSDocCallbackTag */ || kind === 348 /* JSDocPropertyTag */;
|
|
15975
|
+
return kind === 219 /* ArrowFunction */ || kind === 208 /* BindingElement */ || kind === 263 /* ClassDeclaration */ || kind === 231 /* ClassExpression */ || kind === 175 /* ClassStaticBlockDeclaration */ || kind === 176 /* Constructor */ || kind === 266 /* EnumDeclaration */ || kind === 306 /* EnumMember */ || kind === 281 /* ExportSpecifier */ || kind === 262 /* FunctionDeclaration */ || kind === 218 /* FunctionExpression */ || kind === 177 /* GetAccessor */ || kind === 273 /* ImportClause */ || kind === 271 /* ImportEqualsDeclaration */ || kind === 276 /* ImportSpecifier */ || kind === 264 /* InterfaceDeclaration */ || kind === 291 /* JsxAttribute */ || kind === 174 /* MethodDeclaration */ || kind === 173 /* MethodSignature */ || kind === 267 /* ModuleDeclaration */ || kind === 270 /* NamespaceExportDeclaration */ || kind === 274 /* NamespaceImport */ || kind === 280 /* NamespaceExport */ || kind === 169 /* Parameter */ || kind === 303 /* PropertyAssignment */ || kind === 172 /* PropertyDeclaration */ || kind === 171 /* PropertySignature */ || kind === 178 /* SetAccessor */ || kind === 304 /* ShorthandPropertyAssignment */ || kind === 265 /* TypeAliasDeclaration */ || kind === 168 /* TypeParameter */ || kind === 260 /* VariableDeclaration */ || kind === 346 /* JSDocTypedefTag */ || kind === 338 /* JSDocCallbackTag */ || kind === 348 /* JSDocPropertyTag */ || kind === 202 /* NamedTupleMember */;
|
|
15982
15976
|
}
|
|
15983
15977
|
function isDeclarationStatementKind(kind) {
|
|
15984
15978
|
return kind === 262 /* FunctionDeclaration */ || kind === 282 /* MissingDeclaration */ || kind === 263 /* ClassDeclaration */ || kind === 264 /* InterfaceDeclaration */ || kind === 265 /* TypeAliasDeclaration */ || kind === 266 /* EnumDeclaration */ || kind === 267 /* ModuleDeclaration */ || kind === 272 /* ImportDeclaration */ || kind === 271 /* ImportEqualsDeclaration */ || kind === 278 /* ExportDeclaration */ || kind === 277 /* ExportAssignment */ || kind === 270 /* NamespaceExportDeclaration */;
|
|
@@ -23156,13 +23150,15 @@ function createNameResolver({
|
|
|
23156
23150
|
let useResult = true;
|
|
23157
23151
|
if (isFunctionLike(location) && lastLocation && lastLocation !== location.body) {
|
|
23158
23152
|
if (meaning & result.flags & 788968 /* Type */ && lastLocation.kind !== 320 /* JSDoc */) {
|
|
23159
|
-
useResult = result.flags & 262144 /* TypeParameter */ ? lastLocation
|
|
23153
|
+
useResult = result.flags & 262144 /* TypeParameter */ ? !!(lastLocation.flags & 16 /* Synthesized */) || // Synthetic fake scopes are added for signatures so type parameters are accessible from them
|
|
23154
|
+
lastLocation === location.type || lastLocation.kind === 169 /* Parameter */ || lastLocation.kind === 341 /* JSDocParameterTag */ || lastLocation.kind === 342 /* JSDocReturnTag */ || lastLocation.kind === 168 /* TypeParameter */ : false;
|
|
23160
23155
|
}
|
|
23161
23156
|
if (meaning & result.flags & 3 /* Variable */) {
|
|
23162
23157
|
if (useOuterVariableScopeInParameter(result, location, lastLocation)) {
|
|
23163
23158
|
useResult = false;
|
|
23164
23159
|
} else if (result.flags & 1 /* FunctionScopedVariable */) {
|
|
23165
|
-
useResult = lastLocation.kind === 169 /* Parameter */ || lastLocation
|
|
23160
|
+
useResult = lastLocation.kind === 169 /* Parameter */ || !!(lastLocation.flags & 16 /* Synthesized */) || // Synthetic fake scopes are added for signatures so parameters are accessible from them
|
|
23161
|
+
lastLocation === location.type && !!findAncestor(result.valueDeclaration, isParameter);
|
|
23166
23162
|
}
|
|
23167
23163
|
}
|
|
23168
23164
|
} else if (location.kind === 194 /* ConditionalType */) {
|
|
@@ -51210,7 +51206,6 @@ function createTypeChecker(host) {
|
|
|
51210
51206
|
if (meaning) {
|
|
51211
51207
|
const symbol = getMergedSymbol(symbols.get(name));
|
|
51212
51208
|
if (symbol) {
|
|
51213
|
-
Debug.assert((getCheckFlags(symbol) & 1 /* Instantiated */) === 0, "Should never get an instantiated symbol here.");
|
|
51214
51209
|
if (symbol.flags & meaning) {
|
|
51215
51210
|
return symbol;
|
|
51216
51211
|
}
|
|
@@ -52614,7 +52609,6 @@ function createTypeChecker(host) {
|
|
|
52614
52609
|
} else {
|
|
52615
52610
|
Debug.assertNever(name, "Unknown entity name kind.");
|
|
52616
52611
|
}
|
|
52617
|
-
Debug.assert((getCheckFlags(symbol) & 1 /* Instantiated */) === 0, "Should never get an instantiated symbol here.");
|
|
52618
52612
|
if (!nodeIsSynthesized(name) && isEntityName(name) && (symbol.flags & 2097152 /* Alias */ || name.parent.kind === 277 /* ExportAssignment */)) {
|
|
52619
52613
|
markSymbolOfAliasDeclarationIfTypeOnly(
|
|
52620
52614
|
getAliasDeclarationFromName(name),
|
|
@@ -54035,7 +54029,6 @@ function createTypeChecker(host) {
|
|
|
54035
54029
|
return symbolToExpression(symbol, context, meaning);
|
|
54036
54030
|
}
|
|
54037
54031
|
function withContext2(enclosingDeclaration, flags, tracker, cb) {
|
|
54038
|
-
Debug.assert(enclosingDeclaration === void 0 || (enclosingDeclaration.flags & 16 /* Synthesized */) === 0);
|
|
54039
54032
|
const moduleResolverHost = (tracker == null ? void 0 : tracker.trackSymbol) ? tracker.moduleResolverHost : flags & 134217728 /* DoNotIncludeSymbolChain */ ? createBasicNodeBuilderModuleSpecifierResolutionHost(host) : void 0;
|
|
54040
54033
|
const context = {
|
|
54041
54034
|
enclosingDeclaration,
|
|
@@ -54049,7 +54042,18 @@ function createTypeChecker(host) {
|
|
|
54049
54042
|
inferTypeParameters: void 0,
|
|
54050
54043
|
approximateLength: 0,
|
|
54051
54044
|
trackedSymbols: void 0,
|
|
54052
|
-
bundled: !!compilerOptions.outFile && !!enclosingDeclaration && isExternalOrCommonJsModule(getSourceFileOfNode(enclosingDeclaration))
|
|
54045
|
+
bundled: !!compilerOptions.outFile && !!enclosingDeclaration && isExternalOrCommonJsModule(getSourceFileOfNode(enclosingDeclaration)),
|
|
54046
|
+
truncating: false,
|
|
54047
|
+
usedSymbolNames: void 0,
|
|
54048
|
+
remappedSymbolNames: void 0,
|
|
54049
|
+
remappedSymbolReferences: void 0,
|
|
54050
|
+
reverseMappedStack: void 0,
|
|
54051
|
+
mustCreateTypeParameterSymbolList: true,
|
|
54052
|
+
typeParameterSymbolList: void 0,
|
|
54053
|
+
mustCreateTypeParametersNamesLookups: true,
|
|
54054
|
+
typeParameterNames: void 0,
|
|
54055
|
+
typeParameterNamesByText: void 0,
|
|
54056
|
+
typeParameterNamesByTextNextNameCount: void 0
|
|
54053
54057
|
};
|
|
54054
54058
|
context.tracker = new SymbolTrackerImpl(context, tracker, moduleResolverHost);
|
|
54055
54059
|
const resultingNode = cb(context);
|
|
@@ -55044,22 +55048,22 @@ function createTypeChecker(host) {
|
|
|
55044
55048
|
}
|
|
55045
55049
|
function signatureToSignatureDeclarationHelper(signature, kind, context, options) {
|
|
55046
55050
|
var _a;
|
|
55047
|
-
const flags = context.flags;
|
|
55048
|
-
context.flags &= ~256 /* SuppressAnyReturnType */;
|
|
55049
|
-
context.approximateLength += 3;
|
|
55050
55051
|
let typeParameters;
|
|
55051
55052
|
let typeArguments;
|
|
55052
|
-
if (context.flags & 32 /* WriteTypeArgumentsOfSignature */ && signature.target && signature.mapper && signature.target.typeParameters) {
|
|
55053
|
-
typeArguments = signature.target.typeParameters.map((parameter) => typeToTypeNodeHelper(instantiateType(parameter, signature.mapper), context));
|
|
55054
|
-
} else {
|
|
55055
|
-
typeParameters = signature.typeParameters && signature.typeParameters.map((parameter) => typeParameterToDeclaration(parameter, context));
|
|
55056
|
-
}
|
|
55057
55053
|
const expandedParams = getExpandedParameters(
|
|
55058
55054
|
signature,
|
|
55059
55055
|
/*skipUnionExpanding*/
|
|
55060
55056
|
true
|
|
55061
55057
|
)[0];
|
|
55062
|
-
const cleanup = enterNewScope(context, signature.declaration, expandedParams, signature.typeParameters);
|
|
55058
|
+
const cleanup = enterNewScope(context, signature.declaration, expandedParams, signature.typeParameters, signature.parameters);
|
|
55059
|
+
context.approximateLength += 3;
|
|
55060
|
+
if (context.flags & 32 /* WriteTypeArgumentsOfSignature */ && signature.target && signature.mapper && signature.target.typeParameters) {
|
|
55061
|
+
typeArguments = signature.target.typeParameters.map((parameter) => typeToTypeNodeHelper(instantiateType(parameter, signature.mapper), context));
|
|
55062
|
+
} else {
|
|
55063
|
+
typeParameters = signature.typeParameters && signature.typeParameters.map((parameter) => typeParameterToDeclaration(parameter, context));
|
|
55064
|
+
}
|
|
55065
|
+
const flags = context.flags;
|
|
55066
|
+
context.flags &= ~256 /* SuppressAnyReturnType */;
|
|
55063
55067
|
const parameters = (some(expandedParams, (p) => p !== expandedParams[expandedParams.length - 1] && !!(getCheckFlags(p) & 32768 /* RestParameter */)) ? signature.parameters : expandedParams).map((parameter) => symbolToParameterDeclaration(parameter, context, kind === 176 /* Constructor */));
|
|
55064
55068
|
const thisParameter = context.flags & 33554432 /* OmitThisParameter */ ? void 0 : tryGetThisParameterDeclaration(signature, context);
|
|
55065
55069
|
if (thisParameter) {
|
|
@@ -55157,15 +55161,14 @@ function createTypeChecker(host) {
|
|
|
55157
55161
|
return isFunctionLike(node) || isJSDocSignature(node) ? getSignatureFromDeclaration(node).typeParameters : isConditionalTypeNode(node) ? getInferTypeParameters(node) : [getDeclaredTypeOfTypeParameter(getSymbolOfDeclaration(node.typeParameter))];
|
|
55158
55162
|
}
|
|
55159
55163
|
function getParametersInScope(node) {
|
|
55160
|
-
return isFunctionLike(node) || isJSDocSignature(node) ?
|
|
55161
|
-
|
|
55162
|
-
|
|
55163
|
-
|
|
55164
|
-
|
|
55165
|
-
|
|
55166
|
-
|
|
55167
|
-
|
|
55168
|
-
if (context.enclosingDeclaration && declaration && declaration !== context.enclosingDeclaration && !isInJSFile(declaration) && (some(expandedParams) || some(typeParameters))) {
|
|
55164
|
+
return isFunctionLike(node) || isJSDocSignature(node) ? getSignatureFromDeclaration(node).parameters : void 0;
|
|
55165
|
+
}
|
|
55166
|
+
function enterNewScope(context, declaration, expandedParams, typeParameters, originalParameters) {
|
|
55167
|
+
const cleanupContext = cloneNodeBuilderContext(context);
|
|
55168
|
+
let cleanupParams;
|
|
55169
|
+
let cleanupTypeParams;
|
|
55170
|
+
const oldEnclosingDecl = context.enclosingDeclaration;
|
|
55171
|
+
if (context.enclosingDeclaration && declaration) {
|
|
55169
55172
|
let pushFakeScope2 = function(kind, addAll) {
|
|
55170
55173
|
Debug.assert(context.enclosingDeclaration);
|
|
55171
55174
|
let existingFakeScope;
|
|
@@ -55177,39 +55180,45 @@ function createTypeChecker(host) {
|
|
|
55177
55180
|
Debug.assertOptionalNode(existingFakeScope, isBlock);
|
|
55178
55181
|
const locals = (existingFakeScope == null ? void 0 : existingFakeScope.locals) ?? createSymbolTable();
|
|
55179
55182
|
let newLocals;
|
|
55183
|
+
let oldLocals;
|
|
55180
55184
|
addAll((name, symbol) => {
|
|
55181
|
-
if (
|
|
55182
|
-
|
|
55183
|
-
|
|
55185
|
+
if (existingFakeScope) {
|
|
55186
|
+
const oldSymbol = locals.get(name);
|
|
55187
|
+
if (!oldSymbol) {
|
|
55188
|
+
newLocals = append(newLocals, name);
|
|
55189
|
+
} else {
|
|
55190
|
+
oldLocals = append(oldLocals, { name, oldSymbol });
|
|
55191
|
+
}
|
|
55184
55192
|
}
|
|
55193
|
+
locals.set(name, symbol);
|
|
55185
55194
|
});
|
|
55186
|
-
if (!
|
|
55187
|
-
|
|
55188
|
-
function undo() {
|
|
55189
|
-
forEach(newLocals, (s) => locals.delete(s));
|
|
55190
|
-
oldCleanup == null ? void 0 : oldCleanup();
|
|
55191
|
-
}
|
|
55192
|
-
if (existingFakeScope) {
|
|
55193
|
-
cleanup = undo;
|
|
55194
|
-
} else {
|
|
55195
|
-
const fakeScope = parseNodeFactory.createBlock(emptyArray);
|
|
55195
|
+
if (!existingFakeScope) {
|
|
55196
|
+
const fakeScope = factory.createBlock(emptyArray);
|
|
55196
55197
|
getNodeLinks(fakeScope).fakeScopeForSignatureDeclaration = kind;
|
|
55197
55198
|
fakeScope.locals = locals;
|
|
55198
|
-
|
|
55199
|
-
setParent(fakeScope, saveEnclosingDeclaration);
|
|
55199
|
+
setParent(fakeScope, context.enclosingDeclaration);
|
|
55200
55200
|
context.enclosingDeclaration = fakeScope;
|
|
55201
|
-
|
|
55202
|
-
|
|
55203
|
-
|
|
55201
|
+
} else {
|
|
55202
|
+
return function undo() {
|
|
55203
|
+
forEach(newLocals, (s) => locals.delete(s));
|
|
55204
|
+
forEach(oldLocals, (s) => locals.set(s.name, s.oldSymbol));
|
|
55204
55205
|
};
|
|
55205
55206
|
}
|
|
55206
55207
|
};
|
|
55207
55208
|
var pushFakeScope = pushFakeScope2;
|
|
55208
|
-
pushFakeScope2(
|
|
55209
|
+
cleanupParams = !some(expandedParams) ? void 0 : pushFakeScope2(
|
|
55209
55210
|
"params",
|
|
55210
55211
|
(add) => {
|
|
55211
|
-
|
|
55212
|
-
|
|
55212
|
+
if (!expandedParams) return;
|
|
55213
|
+
for (let pIndex = 0; pIndex < expandedParams.length; pIndex++) {
|
|
55214
|
+
const param = expandedParams[pIndex];
|
|
55215
|
+
const originalParam = originalParameters == null ? void 0 : originalParameters[pIndex];
|
|
55216
|
+
if (originalParameters && originalParam !== param) {
|
|
55217
|
+
add(param.escapedName, unknownSymbol);
|
|
55218
|
+
if (originalParam) {
|
|
55219
|
+
add(originalParam.escapedName, unknownSymbol);
|
|
55220
|
+
}
|
|
55221
|
+
} else if (!forEach(param.declarations, (d) => {
|
|
55213
55222
|
if (isParameter(d) && isBindingPattern(d.name)) {
|
|
55214
55223
|
bindPattern(d.name);
|
|
55215
55224
|
return true;
|
|
@@ -55240,8 +55249,8 @@ function createTypeChecker(host) {
|
|
|
55240
55249
|
}
|
|
55241
55250
|
}
|
|
55242
55251
|
);
|
|
55243
|
-
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */) {
|
|
55244
|
-
pushFakeScope2(
|
|
55252
|
+
if (context.flags & 4 /* GenerateNamesForShadowedTypeParams */ && some(typeParameters)) {
|
|
55253
|
+
cleanupTypeParams = pushFakeScope2(
|
|
55245
55254
|
"typeParams",
|
|
55246
55255
|
(add) => {
|
|
55247
55256
|
for (const typeParam of typeParameters ?? emptyArray) {
|
|
@@ -55251,8 +55260,13 @@ function createTypeChecker(host) {
|
|
|
55251
55260
|
}
|
|
55252
55261
|
);
|
|
55253
55262
|
}
|
|
55254
|
-
return cleanup;
|
|
55255
55263
|
}
|
|
55264
|
+
return () => {
|
|
55265
|
+
cleanupParams == null ? void 0 : cleanupParams();
|
|
55266
|
+
cleanupTypeParams == null ? void 0 : cleanupTypeParams();
|
|
55267
|
+
cleanupContext();
|
|
55268
|
+
context.enclosingDeclaration = oldEnclosingDecl;
|
|
55269
|
+
};
|
|
55256
55270
|
}
|
|
55257
55271
|
function tryGetThisParameterDeclaration(signature, context) {
|
|
55258
55272
|
if (signature.thisParameter) {
|
|
@@ -55470,7 +55484,11 @@ function createTypeChecker(host) {
|
|
|
55470
55484
|
if ((_a = context.typeParameterSymbolList) == null ? void 0 : _a.has(symbolId)) {
|
|
55471
55485
|
return void 0;
|
|
55472
55486
|
}
|
|
55473
|
-
|
|
55487
|
+
if (context.mustCreateTypeParameterSymbolList) {
|
|
55488
|
+
context.mustCreateTypeParameterSymbolList = false;
|
|
55489
|
+
context.typeParameterSymbolList = new Set(context.typeParameterSymbolList);
|
|
55490
|
+
}
|
|
55491
|
+
context.typeParameterSymbolList.add(symbolId);
|
|
55474
55492
|
let typeParameterNodes;
|
|
55475
55493
|
if (context.flags & 512 /* WriteTypeParametersInQualifiedName */ && index < chain.length - 1) {
|
|
55476
55494
|
const parentSymbol = symbol;
|
|
@@ -55731,9 +55749,15 @@ function createTypeChecker(host) {
|
|
|
55731
55749
|
result = factory.createIdentifier(text);
|
|
55732
55750
|
setIdentifierTypeArguments(result, typeArguments);
|
|
55733
55751
|
}
|
|
55734
|
-
|
|
55735
|
-
|
|
55736
|
-
|
|
55752
|
+
if (context.mustCreateTypeParametersNamesLookups) {
|
|
55753
|
+
context.mustCreateTypeParametersNamesLookups = false;
|
|
55754
|
+
context.typeParameterNames = new Map(context.typeParameterNames);
|
|
55755
|
+
context.typeParameterNamesByTextNextNameCount = new Map(context.typeParameterNamesByTextNextNameCount);
|
|
55756
|
+
context.typeParameterNamesByText = new Set(context.typeParameterNamesByText);
|
|
55757
|
+
}
|
|
55758
|
+
context.typeParameterNamesByTextNextNameCount.set(rawtext, i);
|
|
55759
|
+
context.typeParameterNames.set(getTypeId(type), result);
|
|
55760
|
+
context.typeParameterNamesByText.add(text);
|
|
55737
55761
|
}
|
|
55738
55762
|
return result;
|
|
55739
55763
|
}
|
|
@@ -55855,21 +55879,22 @@ function createTypeChecker(host) {
|
|
|
55855
55879
|
}
|
|
55856
55880
|
}
|
|
55857
55881
|
function cloneNodeBuilderContext(context) {
|
|
55858
|
-
const
|
|
55859
|
-
|
|
55860
|
-
|
|
55861
|
-
|
|
55862
|
-
|
|
55863
|
-
|
|
55864
|
-
|
|
55865
|
-
|
|
55866
|
-
|
|
55867
|
-
|
|
55868
|
-
|
|
55869
|
-
|
|
55870
|
-
|
|
55871
|
-
|
|
55872
|
-
|
|
55882
|
+
const oldMustCreateTypeParameterSymbolList = context.mustCreateTypeParameterSymbolList;
|
|
55883
|
+
const oldMustCreateTypeParametersNamesLookups = context.mustCreateTypeParametersNamesLookups;
|
|
55884
|
+
context.mustCreateTypeParameterSymbolList = true;
|
|
55885
|
+
context.mustCreateTypeParametersNamesLookups = true;
|
|
55886
|
+
const oldTypeParameterNames = context.typeParameterNames;
|
|
55887
|
+
const oldTypeParameterNamesByText = context.typeParameterNamesByText;
|
|
55888
|
+
const oldTypeParameterNamesByTextNextNameCount = context.typeParameterNamesByTextNextNameCount;
|
|
55889
|
+
const oldTypeParameterSymbolList = context.typeParameterSymbolList;
|
|
55890
|
+
return () => {
|
|
55891
|
+
context.typeParameterNames = oldTypeParameterNames;
|
|
55892
|
+
context.typeParameterNamesByText = oldTypeParameterNamesByText;
|
|
55893
|
+
context.typeParameterNamesByTextNextNameCount = oldTypeParameterNamesByTextNextNameCount;
|
|
55894
|
+
context.typeParameterSymbolList = oldTypeParameterSymbolList;
|
|
55895
|
+
context.mustCreateTypeParameterSymbolList = oldMustCreateTypeParameterSymbolList;
|
|
55896
|
+
context.mustCreateTypeParametersNamesLookups = oldMustCreateTypeParametersNamesLookups;
|
|
55897
|
+
};
|
|
55873
55898
|
}
|
|
55874
55899
|
function getDeclarationWithTypeAnnotation(symbol, enclosingDeclaration) {
|
|
55875
55900
|
return symbol.declarations && find(symbol.declarations, (s) => !!getNonlocalEffectiveTypeAnnotationNode(s) && (!enclosingDeclaration || !!findAncestor(s, (n) => n === enclosingDeclaration)));
|
|
@@ -56002,13 +56027,34 @@ function createTypeChecker(host) {
|
|
|
56002
56027
|
/*dontResolveAlias*/
|
|
56003
56028
|
true
|
|
56004
56029
|
);
|
|
56030
|
+
if (context.enclosingDeclaration && (getNodeLinks(context.enclosingDeclaration).fakeScopeForSignatureDeclaration || !findAncestor(node, (n) => n === context.enclosingDeclaration)) && !(sym && sym.flags & 262144 /* TypeParameter */)) {
|
|
56031
|
+
sym = getExportSymbolOfValueSymbolIfExported(sym);
|
|
56032
|
+
const symAtLocation = resolveEntityName(
|
|
56033
|
+
leftmost,
|
|
56034
|
+
meaning,
|
|
56035
|
+
/*ignoreErrors*/
|
|
56036
|
+
true,
|
|
56037
|
+
/*dontResolveAlias*/
|
|
56038
|
+
true,
|
|
56039
|
+
context.enclosingDeclaration
|
|
56040
|
+
);
|
|
56041
|
+
if (
|
|
56042
|
+
// Check for unusable parameters symbols
|
|
56043
|
+
symAtLocation === unknownSymbol || // If the symbol is not found, but was not found in the original scope either we probably have an error, don't reuse the node
|
|
56044
|
+
symAtLocation === void 0 && sym !== void 0 || // If the symbol is found both in declaration scope and in current scope then it shoudl point to the same reference
|
|
56045
|
+
symAtLocation && sym && !getSymbolIfSameReference(getExportSymbolOfValueSymbolIfExported(symAtLocation), sym)
|
|
56046
|
+
) {
|
|
56047
|
+
introducesError = true;
|
|
56048
|
+
return { introducesError, node, sym };
|
|
56049
|
+
}
|
|
56050
|
+
}
|
|
56005
56051
|
if (sym) {
|
|
56006
56052
|
if (sym.flags & 1 /* FunctionScopedVariable */ && sym.valueDeclaration) {
|
|
56007
|
-
if (isPartOfParameterDeclaration(sym.valueDeclaration)) {
|
|
56053
|
+
if (isPartOfParameterDeclaration(sym.valueDeclaration) || isJSDocParameterTag(sym.valueDeclaration)) {
|
|
56008
56054
|
return { introducesError, node: attachSymbolToLeftmostIdentifier(node) };
|
|
56009
56055
|
}
|
|
56010
56056
|
}
|
|
56011
|
-
if (!(sym.flags & 262144 /* TypeParameter */) && // Type parameters are visible in the
|
|
56057
|
+
if (!(sym.flags & 262144 /* TypeParameter */) && // Type parameters are visible in the current context if they are are resolvable
|
|
56012
56058
|
!isDeclarationName(node) && isSymbolAccessible(
|
|
56013
56059
|
sym,
|
|
56014
56060
|
context.enclosingDeclaration,
|
|
@@ -56059,14 +56105,7 @@ function createTypeChecker(host) {
|
|
|
56059
56105
|
return result === node ? setTextRange2(context, factory.cloneNode(result), node) : result;
|
|
56060
56106
|
}
|
|
56061
56107
|
function onEnterNewScope(node) {
|
|
56062
|
-
|
|
56063
|
-
context = cloneNodeBuilderContext(context);
|
|
56064
|
-
const cleanup = enterNewScope(context, node, getParametersInScope(node), getTypeParametersInScope(node));
|
|
56065
|
-
return onExitNewScope;
|
|
56066
|
-
function onExitNewScope() {
|
|
56067
|
-
cleanup == null ? void 0 : cleanup();
|
|
56068
|
-
context = oldContex;
|
|
56069
|
-
}
|
|
56108
|
+
return enterNewScope(context, node, getParametersInScope(node), getTypeParametersInScope(node));
|
|
56070
56109
|
}
|
|
56071
56110
|
function visitExistingNodeTreeSymbolsWorker(node) {
|
|
56072
56111
|
if (isJSDocAllType(node) || node.kind === 319 /* JSDocNamepathType */) {
|
|
@@ -56516,17 +56555,9 @@ function createTypeChecker(host) {
|
|
|
56516
56555
|
visitedSymbols.add(getSymbolId(visitedSym));
|
|
56517
56556
|
const skipMembershipCheck = !isPrivate;
|
|
56518
56557
|
if (skipMembershipCheck || !!length(symbol.declarations) && some(symbol.declarations, (d) => !!findAncestor(d, (n) => n === enclosingDeclaration))) {
|
|
56519
|
-
const
|
|
56520
|
-
context = cloneNodeBuilderContext(context);
|
|
56558
|
+
const scopeCleanup = cloneNodeBuilderContext(context);
|
|
56521
56559
|
serializeSymbolWorker(symbol, isPrivate, propertyAsAlias);
|
|
56522
|
-
|
|
56523
|
-
oldcontext.reportedDiagnostic = context.reportedDiagnostic;
|
|
56524
|
-
}
|
|
56525
|
-
if (context.trackedSymbols) {
|
|
56526
|
-
if (!oldContext.trackedSymbols) oldContext.trackedSymbols = context.trackedSymbols;
|
|
56527
|
-
else Debug.assert(context.trackedSymbols === oldContext.trackedSymbols);
|
|
56528
|
-
}
|
|
56529
|
-
context = oldContext;
|
|
56560
|
+
scopeCleanup();
|
|
56530
56561
|
}
|
|
56531
56562
|
}
|
|
56532
56563
|
function serializeSymbolWorker(symbol, isPrivate, propertyAsAlias, escapedSymbolName = symbol.escapedName) {
|
|
@@ -58093,8 +58124,6 @@ function createTypeChecker(host) {
|
|
|
58093
58124
|
switch (propertyName) {
|
|
58094
58125
|
case 0 /* Type */:
|
|
58095
58126
|
return !!getSymbolLinks(target).type;
|
|
58096
|
-
case 5 /* EnumTagType */:
|
|
58097
|
-
return !!getNodeLinks(target).resolvedEnumType;
|
|
58098
58127
|
case 2 /* DeclaredType */:
|
|
58099
58128
|
return !!getSymbolLinks(target).declaredType;
|
|
58100
58129
|
case 1 /* ResolvedBaseConstructorType */:
|
|
@@ -58103,13 +58132,13 @@ function createTypeChecker(host) {
|
|
|
58103
58132
|
return !!target.resolvedReturnType;
|
|
58104
58133
|
case 4 /* ImmediateBaseConstraint */:
|
|
58105
58134
|
return !!target.immediateBaseConstraint;
|
|
58106
|
-
case
|
|
58135
|
+
case 5 /* ResolvedTypeArguments */:
|
|
58107
58136
|
return !!target.resolvedTypeArguments;
|
|
58108
|
-
case
|
|
58137
|
+
case 6 /* ResolvedBaseTypes */:
|
|
58109
58138
|
return !!target.baseTypesResolved;
|
|
58110
|
-
case
|
|
58139
|
+
case 7 /* WriteType */:
|
|
58111
58140
|
return !!getSymbolLinks(target).writeType;
|
|
58112
|
-
case
|
|
58141
|
+
case 8 /* ParameterInitializerContainsUndefined */:
|
|
58113
58142
|
return getNodeLinks(target).parameterInitializerContainsUndefined !== void 0;
|
|
58114
58143
|
}
|
|
58115
58144
|
return Debug.assertNever(propertyName);
|
|
@@ -59128,7 +59157,7 @@ function createTypeChecker(host) {
|
|
|
59128
59157
|
function getWriteTypeOfAccessors(symbol) {
|
|
59129
59158
|
const links = getSymbolLinks(symbol);
|
|
59130
59159
|
if (!links.writeType) {
|
|
59131
|
-
if (!pushTypeResolution(symbol,
|
|
59160
|
+
if (!pushTypeResolution(symbol, 7 /* WriteType */)) {
|
|
59132
59161
|
return errorType;
|
|
59133
59162
|
}
|
|
59134
59163
|
const setter = getDeclarationOfKind(symbol, 178 /* SetAccessor */) ?? tryCast(getDeclarationOfKind(symbol, 172 /* PropertyDeclaration */), isAutoAccessorPropertyDeclaration);
|
|
@@ -59538,7 +59567,7 @@ function createTypeChecker(host) {
|
|
|
59538
59567
|
}
|
|
59539
59568
|
function getBaseTypes(type) {
|
|
59540
59569
|
if (!type.baseTypesResolved) {
|
|
59541
|
-
if (pushTypeResolution(type,
|
|
59570
|
+
if (pushTypeResolution(type, 6 /* ResolvedBaseTypes */)) {
|
|
59542
59571
|
if (type.objectFlags & 8 /* Tuple */) {
|
|
59543
59572
|
type.resolvedBaseTypes = [getTupleBaseType(type)];
|
|
59544
59573
|
} else if (type.symbol.flags & (32 /* Class */ | 64 /* Interface */)) {
|
|
@@ -62433,7 +62462,7 @@ function createTypeChecker(host) {
|
|
|
62433
62462
|
function getTypeArguments(type) {
|
|
62434
62463
|
var _a, _b;
|
|
62435
62464
|
if (!type.resolvedTypeArguments) {
|
|
62436
|
-
if (!pushTypeResolution(type,
|
|
62465
|
+
if (!pushTypeResolution(type, 5 /* ResolvedTypeArguments */)) {
|
|
62437
62466
|
return ((_a = type.target.localTypeParameters) == null ? void 0 : _a.map(() => errorType)) || emptyArray;
|
|
62438
62467
|
}
|
|
62439
62468
|
const node = type.node;
|
|
@@ -73632,7 +73661,7 @@ function createTypeChecker(host) {
|
|
|
73632
73661
|
function parameterInitializerContainsUndefined(declaration) {
|
|
73633
73662
|
const links = getNodeLinks(declaration);
|
|
73634
73663
|
if (links.parameterInitializerContainsUndefined === void 0) {
|
|
73635
|
-
if (!pushTypeResolution(declaration,
|
|
73664
|
+
if (!pushTypeResolution(declaration, 8 /* ParameterInitializerContainsUndefined */)) {
|
|
73636
73665
|
reportCircularityError(declaration.symbol);
|
|
73637
73666
|
return true;
|
|
73638
73667
|
}
|
|
@@ -160161,7 +160190,7 @@ function createSignatureDeclarationFromSignature(kind, context, quotePreference,
|
|
|
160161
160190
|
}
|
|
160162
160191
|
let typeParameters = isJs ? void 0 : signatureDeclaration.typeParameters;
|
|
160163
160192
|
let parameters = signatureDeclaration.parameters;
|
|
160164
|
-
let type = isJs ? void 0 : signatureDeclaration.type;
|
|
160193
|
+
let type = isJs ? void 0 : getSynthesizedDeepClone(signatureDeclaration.type);
|
|
160165
160194
|
if (importAdder) {
|
|
160166
160195
|
if (typeParameters) {
|
|
160167
160196
|
const newTypeParameters = sameMap(typeParameters, (typeParameterDecl) => {
|
|
@@ -168986,7 +169015,7 @@ function getDefinitionAtPosition(program, sourceFile, position, searchOtherFiles
|
|
|
168986
169015
|
}
|
|
168987
169016
|
if (searchOtherFilesOnly && every(symbol.declarations, (d) => d.getSourceFile().fileName === sourceFile.fileName)) return void 0;
|
|
168988
169017
|
const calledDeclaration = tryGetSignatureDeclaration(typeChecker, node);
|
|
168989
|
-
if (calledDeclaration && !(isJsxOpeningLikeElement(node.parent) &&
|
|
169018
|
+
if (calledDeclaration && !(isJsxOpeningLikeElement(node.parent) && isJsxConstructorLike(calledDeclaration))) {
|
|
168990
169019
|
const sigInfo = createDefinitionFromSignatureDeclaration(typeChecker, calledDeclaration, failedAliasResolution);
|
|
168991
169020
|
if (typeChecker.getRootSymbols(symbol).some((s) => symbolMatchesSignature(s, calledDeclaration))) {
|
|
168992
169021
|
return [sigInfo];
|
|
@@ -169407,10 +169436,11 @@ function tryGetSignatureDeclaration(typeChecker, node) {
|
|
|
169407
169436
|
const signature = callLike && typeChecker.getResolvedSignature(callLike);
|
|
169408
169437
|
return tryCast(signature && signature.declaration, (d) => isFunctionLike(d) && !isFunctionTypeNode(d));
|
|
169409
169438
|
}
|
|
169410
|
-
function
|
|
169439
|
+
function isJsxConstructorLike(node) {
|
|
169411
169440
|
switch (node.kind) {
|
|
169412
169441
|
case 176 /* Constructor */:
|
|
169413
169442
|
case 185 /* ConstructorType */:
|
|
169443
|
+
case 179 /* CallSignature */:
|
|
169414
169444
|
case 180 /* ConstructSignature */:
|
|
169415
169445
|
return true;
|
|
169416
169446
|
default:
|
|
@@ -177320,7 +177350,6 @@ __export(ts_exports2, {
|
|
|
177320
177350
|
EmitHint: () => EmitHint,
|
|
177321
177351
|
EmitOnly: () => EmitOnly,
|
|
177322
177352
|
EndOfLineState: () => EndOfLineState,
|
|
177323
|
-
EnumKind: () => EnumKind,
|
|
177324
177353
|
ExitStatus: () => ExitStatus,
|
|
177325
177354
|
ExportKind: () => ExportKind,
|
|
177326
177355
|
Extension: () => Extension,
|
|
@@ -179741,6 +179770,7 @@ __export(ts_server_exports3, {
|
|
|
179741
179770
|
CommandNames: () => CommandNames,
|
|
179742
179771
|
ConfigFileDiagEvent: () => ConfigFileDiagEvent,
|
|
179743
179772
|
ConfiguredProject: () => ConfiguredProject2,
|
|
179773
|
+
ConfiguredProjectLoadKind: () => ConfiguredProjectLoadKind,
|
|
179744
179774
|
CreateDirectoryWatcherEvent: () => CreateDirectoryWatcherEvent,
|
|
179745
179775
|
CreateFileWatcherEvent: () => CreateFileWatcherEvent,
|
|
179746
179776
|
Errors: () => Errors,
|
|
@@ -179748,7 +179778,7 @@ __export(ts_server_exports3, {
|
|
|
179748
179778
|
EventEndInstallTypes: () => EventEndInstallTypes,
|
|
179749
179779
|
EventInitializationFailed: () => EventInitializationFailed,
|
|
179750
179780
|
EventTypesRegistry: () => EventTypesRegistry,
|
|
179751
|
-
ExternalProject: () =>
|
|
179781
|
+
ExternalProject: () => ExternalProject,
|
|
179752
179782
|
GcTimer: () => GcTimer,
|
|
179753
179783
|
InferredProject: () => InferredProject2,
|
|
179754
179784
|
LargeFileReferencedEvent: () => LargeFileReferencedEvent,
|
|
@@ -179764,7 +179794,6 @@ __export(ts_server_exports3, {
|
|
|
179764
179794
|
ProjectLanguageServiceStateEvent: () => ProjectLanguageServiceStateEvent,
|
|
179765
179795
|
ProjectLoadingFinishEvent: () => ProjectLoadingFinishEvent,
|
|
179766
179796
|
ProjectLoadingStartEvent: () => ProjectLoadingStartEvent,
|
|
179767
|
-
ProjectReferenceProjectLoadKind: () => ProjectReferenceProjectLoadKind,
|
|
179768
179797
|
ProjectService: () => ProjectService3,
|
|
179769
179798
|
ProjectsUpdatedInBackgroundEvent: () => ProjectsUpdatedInBackgroundEvent,
|
|
179770
179799
|
ScriptInfo: () => ScriptInfo,
|
|
@@ -179816,7 +179845,6 @@ __export(ts_server_exports3, {
|
|
|
179816
179845
|
nowString: () => nowString,
|
|
179817
179846
|
nullCancellationToken: () => nullCancellationToken,
|
|
179818
179847
|
nullTypingsInstaller: () => nullTypingsInstaller,
|
|
179819
|
-
projectContainsInfoDirectly: () => projectContainsInfoDirectly,
|
|
179820
179848
|
protocol: () => ts_server_protocol_exports,
|
|
179821
179849
|
removeSorted: () => removeSorted,
|
|
179822
179850
|
stringifyIndented: () => stringifyIndented,
|
|
@@ -180994,11 +181022,8 @@ var ScriptInfo = class {
|
|
|
180994
181022
|
case 0:
|
|
180995
181023
|
return Errors.ThrowNoProject();
|
|
180996
181024
|
case 1:
|
|
180997
|
-
return
|
|
180998
|
-
!isProjectDeferredClose(this.containingProjects[0]) ? this.containingProjects[0] : void 0
|
|
180999
|
-
);
|
|
181025
|
+
return isProjectDeferredClose(this.containingProjects[0]) || isBackgroundProject(this.containingProjects[0]) ? Errors.ThrowNoProject() : this.containingProjects[0];
|
|
181000
181026
|
default:
|
|
181001
|
-
let firstExternalProject;
|
|
181002
181027
|
let firstConfiguredProject;
|
|
181003
181028
|
let firstInferredProject;
|
|
181004
181029
|
let firstNonSourceOfProjectReferenceRedirect;
|
|
@@ -181015,15 +181040,13 @@ var ScriptInfo = class {
|
|
|
181015
181040
|
if (!firstNonSourceOfProjectReferenceRedirect) firstNonSourceOfProjectReferenceRedirect = project;
|
|
181016
181041
|
}
|
|
181017
181042
|
if (!firstConfiguredProject) firstConfiguredProject = project;
|
|
181018
|
-
} else if (
|
|
181019
|
-
|
|
181043
|
+
} else if (isExternalProject(project)) {
|
|
181044
|
+
return project;
|
|
181020
181045
|
} else if (!firstInferredProject && isInferredProject(project)) {
|
|
181021
181046
|
firstInferredProject = project;
|
|
181022
181047
|
}
|
|
181023
181048
|
}
|
|
181024
|
-
return
|
|
181025
|
-
defaultConfiguredProject || firstNonSourceOfProjectReferenceRedirect || firstConfiguredProject || firstExternalProject || firstInferredProject
|
|
181026
|
-
);
|
|
181049
|
+
return (defaultConfiguredProject || firstNonSourceOfProjectReferenceRedirect || firstConfiguredProject || firstInferredProject) ?? Errors.ThrowNoProject();
|
|
181027
181050
|
}
|
|
181028
181051
|
}
|
|
181029
181052
|
registerFileUpdate() {
|
|
@@ -181113,12 +181136,6 @@ var ScriptInfo = class {
|
|
|
181113
181136
|
}
|
|
181114
181137
|
}
|
|
181115
181138
|
};
|
|
181116
|
-
function ensurePrimaryProjectKind(project) {
|
|
181117
|
-
if (!project || isBackgroundProject(project)) {
|
|
181118
|
-
return Errors.ThrowNoProject();
|
|
181119
|
-
}
|
|
181120
|
-
return project;
|
|
181121
|
-
}
|
|
181122
181139
|
function failIfInvalidPosition(position) {
|
|
181123
181140
|
Debug.assert(typeof position === "number", `Expected position ${position} to be a number.`);
|
|
181124
181141
|
Debug.assert(position >= 0, `Expected position to be non-negative.`);
|
|
@@ -182869,7 +182886,7 @@ var Project3 = class _Project {
|
|
|
182869
182886
|
isDefaultProjectForOpenFiles() {
|
|
182870
182887
|
return !!forEachEntry(
|
|
182871
182888
|
this.projectService.openFiles,
|
|
182872
|
-
(
|
|
182889
|
+
(_projectRootPath, path) => this.projectService.tryGetDefaultProjectForFile(this.projectService.getScriptInfoForPath(path)) === this
|
|
182873
182890
|
);
|
|
182874
182891
|
}
|
|
182875
182892
|
/** @internal */
|
|
@@ -183008,7 +183025,7 @@ var InferredProject2 = class extends Project3 {
|
|
|
183008
183025
|
super.addRoot(info);
|
|
183009
183026
|
}
|
|
183010
183027
|
removeRoot(info) {
|
|
183011
|
-
this.projectService.
|
|
183028
|
+
this.projectService.stopWatchingConfigFilesForScriptInfo(info);
|
|
183012
183029
|
super.removeRoot(info);
|
|
183013
183030
|
if (!this.isOrphan() && this._isJsInferredProject && info.isJavaScript()) {
|
|
183014
183031
|
if (every(this.getRootScriptInfos(), (rootInfo) => !rootInfo.isJavaScript())) {
|
|
@@ -183027,7 +183044,7 @@ var InferredProject2 = class extends Project3 {
|
|
|
183027
183044
|
return !this.projectRootPath && !this.projectService.useSingleInferredProject || this.getRootScriptInfos().length === 1;
|
|
183028
183045
|
}
|
|
183029
183046
|
close() {
|
|
183030
|
-
forEach(this.getRootScriptInfos(), (info) => this.projectService.
|
|
183047
|
+
forEach(this.getRootScriptInfos(), (info) => this.projectService.stopWatchingConfigFilesForScriptInfo(info));
|
|
183031
183048
|
super.close();
|
|
183032
183049
|
}
|
|
183033
183050
|
getTypeAcquisition() {
|
|
@@ -183359,8 +183376,6 @@ var ConfiguredProject2 = class extends Project3 {
|
|
|
183359
183376
|
this.openFileWatchTriggered = /* @__PURE__ */ new Map();
|
|
183360
183377
|
/** @internal */
|
|
183361
183378
|
this.canConfigFileJsonReportNoInputFiles = false;
|
|
183362
|
-
/** Ref count to the project when opened from external project */
|
|
183363
|
-
this.externalProjectRefCount = 0;
|
|
183364
183379
|
/** @internal */
|
|
183365
183380
|
this.isInitialLoadPending = returnTrue;
|
|
183366
183381
|
/** @internal */
|
|
@@ -183422,13 +183437,7 @@ var ConfiguredProject2 = class extends Project3 {
|
|
|
183422
183437
|
case 2 /* Full */:
|
|
183423
183438
|
this.openFileWatchTriggered.clear();
|
|
183424
183439
|
const reason = Debug.checkDefined(this.pendingUpdateReason);
|
|
183425
|
-
this.
|
|
183426
|
-
this.projectService.reloadConfiguredProject(
|
|
183427
|
-
this,
|
|
183428
|
-
reason,
|
|
183429
|
-
/*clearSemanticCache*/
|
|
183430
|
-
false
|
|
183431
|
-
);
|
|
183440
|
+
this.projectService.reloadConfiguredProject(this, reason);
|
|
183432
183441
|
result = true;
|
|
183433
183442
|
break;
|
|
183434
183443
|
default:
|
|
@@ -183532,69 +183541,13 @@ var ConfiguredProject2 = class extends Project3 {
|
|
|
183532
183541
|
super.markAsDirty();
|
|
183533
183542
|
}
|
|
183534
183543
|
/** @internal */
|
|
183535
|
-
addExternalProjectReference() {
|
|
183536
|
-
this.externalProjectRefCount++;
|
|
183537
|
-
}
|
|
183538
|
-
/** @internal */
|
|
183539
|
-
deleteExternalProjectReference() {
|
|
183540
|
-
this.externalProjectRefCount--;
|
|
183541
|
-
}
|
|
183542
|
-
/** @internal */
|
|
183543
183544
|
isSolution() {
|
|
183544
183545
|
return this.getRootFilesMap().size === 0 && !this.canConfigFileJsonReportNoInputFiles;
|
|
183545
183546
|
}
|
|
183546
|
-
/**
|
|
183547
|
-
* Find the configured project from the project references in project which contains the info directly
|
|
183548
|
-
*
|
|
183549
|
-
* @internal
|
|
183550
|
-
*/
|
|
183551
|
-
getDefaultChildProjectFromProjectWithReferences(info) {
|
|
183552
|
-
return forEachResolvedProjectReferenceProject(
|
|
183553
|
-
this,
|
|
183554
|
-
info.path,
|
|
183555
|
-
(child) => projectContainsInfoDirectly(child, info) ? child : void 0,
|
|
183556
|
-
0 /* Find */
|
|
183557
|
-
);
|
|
183558
|
-
}
|
|
183559
|
-
/**
|
|
183560
|
-
* Returns true if the project is needed by any of the open script info/external project
|
|
183561
|
-
*
|
|
183562
|
-
* @internal
|
|
183563
|
-
*/
|
|
183564
|
-
hasOpenRef() {
|
|
183565
|
-
var _a, _b;
|
|
183566
|
-
if (!!this.externalProjectRefCount) {
|
|
183567
|
-
return true;
|
|
183568
|
-
}
|
|
183569
|
-
if (this.isClosed()) {
|
|
183570
|
-
return false;
|
|
183571
|
-
}
|
|
183572
|
-
const configFileExistenceInfo = this.projectService.configFileExistenceInfoCache.get(this.canonicalConfigFilePath);
|
|
183573
|
-
if (this.deferredClose) return !!((_a = configFileExistenceInfo.openFilesImpactedByConfigFile) == null ? void 0 : _a.size);
|
|
183574
|
-
if (this.projectService.hasPendingProjectUpdate(this)) {
|
|
183575
|
-
return !!((_b = configFileExistenceInfo.openFilesImpactedByConfigFile) == null ? void 0 : _b.size);
|
|
183576
|
-
}
|
|
183577
|
-
return !!configFileExistenceInfo.openFilesImpactedByConfigFile && forEachEntry(
|
|
183578
|
-
configFileExistenceInfo.openFilesImpactedByConfigFile,
|
|
183579
|
-
(_value, infoPath) => {
|
|
183580
|
-
const info = this.projectService.getScriptInfoForPath(infoPath);
|
|
183581
|
-
return this.containsScriptInfo(info) || !!forEachResolvedProjectReferenceProject(
|
|
183582
|
-
this,
|
|
183583
|
-
info.path,
|
|
183584
|
-
(child) => child.containsScriptInfo(info),
|
|
183585
|
-
0 /* Find */
|
|
183586
|
-
);
|
|
183587
|
-
}
|
|
183588
|
-
) || false;
|
|
183589
|
-
}
|
|
183590
183547
|
/** @internal */
|
|
183591
183548
|
isOrphan() {
|
|
183592
183549
|
return !!this.deferredClose;
|
|
183593
183550
|
}
|
|
183594
|
-
/** @internal */
|
|
183595
|
-
hasExternalProjectRef() {
|
|
183596
|
-
return !!this.externalProjectRefCount;
|
|
183597
|
-
}
|
|
183598
183551
|
getEffectiveTypeRoots() {
|
|
183599
183552
|
return getEffectiveTypeRoots(this.getCompilationSettings(), this) || [];
|
|
183600
183553
|
}
|
|
@@ -183603,7 +183556,7 @@ var ConfiguredProject2 = class extends Project3 {
|
|
|
183603
183556
|
updateErrorForNoInputFiles(fileNames, this.getConfigFilePath(), this.getCompilerOptions().configFile.configFileSpecs, this.projectErrors, this.canConfigFileJsonReportNoInputFiles);
|
|
183604
183557
|
}
|
|
183605
183558
|
};
|
|
183606
|
-
var
|
|
183559
|
+
var ExternalProject = class extends Project3 {
|
|
183607
183560
|
/** @internal */
|
|
183608
183561
|
constructor(externalProjectName, projectService, documentRegistry, compilerOptions, lastFileExceededProgramSize, compileOnSaveEnabled, projectFilePath, watchOptions) {
|
|
183609
183562
|
super(
|
|
@@ -183811,59 +183764,115 @@ function findProjectByName(projectName, projects) {
|
|
|
183811
183764
|
}
|
|
183812
183765
|
}
|
|
183813
183766
|
var noopConfigFileWatcher = { close: noop };
|
|
183767
|
+
function getConfigFileNameFromCache(info, cache) {
|
|
183768
|
+
if (!cache || isAncestorConfigFileInfo(info)) return void 0;
|
|
183769
|
+
return cache.get(info.path);
|
|
183770
|
+
}
|
|
183814
183771
|
function isOpenScriptInfo(infoOrFileNameOrConfig) {
|
|
183815
183772
|
return !!infoOrFileNameOrConfig.containingProjects;
|
|
183816
183773
|
}
|
|
183817
183774
|
function isAncestorConfigFileInfo(infoOrFileNameOrConfig) {
|
|
183818
183775
|
return !!infoOrFileNameOrConfig.configFileInfo;
|
|
183819
183776
|
}
|
|
183820
|
-
var
|
|
183821
|
-
|
|
183822
|
-
|
|
183823
|
-
|
|
183824
|
-
|
|
183825
|
-
|
|
183777
|
+
var ConfiguredProjectLoadKind = /* @__PURE__ */ ((ConfiguredProjectLoadKind2) => {
|
|
183778
|
+
ConfiguredProjectLoadKind2[ConfiguredProjectLoadKind2["Find"] = 0] = "Find";
|
|
183779
|
+
ConfiguredProjectLoadKind2[ConfiguredProjectLoadKind2["Create"] = 1] = "Create";
|
|
183780
|
+
ConfiguredProjectLoadKind2[ConfiguredProjectLoadKind2["Reload"] = 2] = "Reload";
|
|
183781
|
+
return ConfiguredProjectLoadKind2;
|
|
183782
|
+
})(ConfiguredProjectLoadKind || {});
|
|
183783
|
+
function forEachAncestorProject(info, project, cb, kind, reason, allowDeferredClosed, reloadedProjects, delayReloadedConfiguredProjects) {
|
|
183784
|
+
while (true) {
|
|
183785
|
+
if (!project.isInitialLoadPending() && (!project.getCompilerOptions().composite || project.getCompilerOptions().disableSolutionSearching)) return;
|
|
183786
|
+
const configFileName = project.projectService.getConfigFileNameForFile({
|
|
183787
|
+
fileName: project.getConfigFilePath(),
|
|
183788
|
+
path: info.path,
|
|
183789
|
+
configFileInfo: true
|
|
183790
|
+
}, kind === 0 /* Find */);
|
|
183791
|
+
if (!configFileName) return;
|
|
183792
|
+
const ancestor = project.projectService.findCreateOrReloadConfiguredProject(
|
|
183793
|
+
configFileName,
|
|
183794
|
+
kind,
|
|
183795
|
+
reason,
|
|
183796
|
+
allowDeferredClosed,
|
|
183797
|
+
/*triggerFile*/
|
|
183798
|
+
void 0,
|
|
183799
|
+
reloadedProjects,
|
|
183800
|
+
/*delayLoad*/
|
|
183801
|
+
true,
|
|
183802
|
+
delayReloadedConfiguredProjects
|
|
183803
|
+
);
|
|
183804
|
+
if (!ancestor) return;
|
|
183805
|
+
if (ancestor.project.isInitialLoadPending() && project.getCompilerOptions().composite) {
|
|
183806
|
+
ancestor.project.setPotentialProjectReference(project.canonicalConfigFilePath);
|
|
183807
|
+
}
|
|
183808
|
+
const result = cb(ancestor.project);
|
|
183809
|
+
if (result) return result;
|
|
183810
|
+
project = ancestor.project;
|
|
183811
|
+
}
|
|
183812
|
+
}
|
|
183813
|
+
function forEachResolvedProjectReferenceProject(project, fileName, cb, kind, reason, allowDeferredClosed, triggerFile, reloadedProjects) {
|
|
183826
183814
|
var _a;
|
|
183827
183815
|
const resolvedRefs = (_a = project.getCurrentProgram()) == null ? void 0 : _a.getResolvedProjectReferences();
|
|
183828
183816
|
if (!resolvedRefs) return void 0;
|
|
183829
|
-
let seenResolvedRefs;
|
|
183830
183817
|
const possibleDefaultRef = fileName ? project.getResolvedProjectReferenceToRedirect(fileName) : void 0;
|
|
183831
183818
|
if (possibleDefaultRef) {
|
|
183832
183819
|
const configFileName = toNormalizedPath(possibleDefaultRef.sourceFile.fileName);
|
|
183833
|
-
const child = project.projectService.findConfiguredProjectByProjectName(
|
|
183820
|
+
const child = project.projectService.findConfiguredProjectByProjectName(
|
|
183821
|
+
configFileName,
|
|
183822
|
+
allowDeferredClosed
|
|
183823
|
+
);
|
|
183834
183824
|
if (child) {
|
|
183835
|
-
const result =
|
|
183825
|
+
const result = callbackWithProjectFoundUsingFind(child);
|
|
183836
183826
|
if (result) return result;
|
|
183837
|
-
} else if (
|
|
183838
|
-
seenResolvedRefs = /* @__PURE__ */ new Map();
|
|
183827
|
+
} else if (kind !== 0 /* Find */) {
|
|
183839
183828
|
const result = forEachResolvedProjectReferenceProjectWorker(
|
|
183840
183829
|
resolvedRefs,
|
|
183841
183830
|
project.getCompilerOptions(),
|
|
183842
183831
|
(ref, loadKind) => possibleDefaultRef === ref ? callback(ref, loadKind) : void 0,
|
|
183843
|
-
|
|
183844
|
-
project.projectService
|
|
183845
|
-
seenResolvedRefs
|
|
183832
|
+
kind,
|
|
183833
|
+
project.projectService
|
|
183846
183834
|
);
|
|
183847
183835
|
if (result) return result;
|
|
183848
|
-
seenResolvedRefs.clear();
|
|
183849
183836
|
}
|
|
183850
183837
|
}
|
|
183851
183838
|
return forEachResolvedProjectReferenceProjectWorker(
|
|
183852
183839
|
resolvedRefs,
|
|
183853
183840
|
project.getCompilerOptions(),
|
|
183854
183841
|
(ref, loadKind) => possibleDefaultRef !== ref ? callback(ref, loadKind) : void 0,
|
|
183855
|
-
|
|
183856
|
-
project.projectService
|
|
183857
|
-
seenResolvedRefs
|
|
183842
|
+
kind,
|
|
183843
|
+
project.projectService
|
|
183858
183844
|
);
|
|
183859
183845
|
function callback(ref, loadKind) {
|
|
183860
|
-
const
|
|
183861
|
-
|
|
183862
|
-
|
|
183846
|
+
const result = project.projectService.findCreateOrReloadConfiguredProject(
|
|
183847
|
+
toNormalizedPath(ref.sourceFile.fileName),
|
|
183848
|
+
loadKind,
|
|
183849
|
+
reason,
|
|
183850
|
+
allowDeferredClosed,
|
|
183851
|
+
triggerFile,
|
|
183852
|
+
reloadedProjects
|
|
183853
|
+
);
|
|
183854
|
+
return result && (loadKind === kind ? cb(result.project, result.sentConfigFileDiag) : callbackWithProjectFoundUsingFind(result.project));
|
|
183855
|
+
}
|
|
183856
|
+
function callbackWithProjectFoundUsingFind(child) {
|
|
183857
|
+
let sentConfigFileDiag = false;
|
|
183858
|
+
switch (kind) {
|
|
183859
|
+
case 1 /* Create */:
|
|
183860
|
+
sentConfigFileDiag = updateConfiguredProject(child, triggerFile);
|
|
183861
|
+
break;
|
|
183862
|
+
case 2 /* Reload */:
|
|
183863
|
+
sentConfigFileDiag = child.projectService.reloadConfiguredProjectClearingSemanticCache(child, reason, reloadedProjects);
|
|
183864
|
+
break;
|
|
183865
|
+
case 0 /* Find */:
|
|
183866
|
+
break;
|
|
183867
|
+
default:
|
|
183868
|
+
Debug.assertNever(kind);
|
|
183869
|
+
}
|
|
183870
|
+
const result = cb(child, sentConfigFileDiag);
|
|
183871
|
+
if (result) return result;
|
|
183863
183872
|
}
|
|
183864
183873
|
}
|
|
183865
|
-
function forEachResolvedProjectReferenceProjectWorker(resolvedProjectReferences, parentOptions, cb,
|
|
183866
|
-
const loadKind = parentOptions.disableReferencedProjectLoad ? 0 /* Find */ :
|
|
183874
|
+
function forEachResolvedProjectReferenceProjectWorker(resolvedProjectReferences, parentOptions, cb, kind, projectService, seenResolvedRefs) {
|
|
183875
|
+
const loadKind = parentOptions.disableReferencedProjectLoad ? 0 /* Find */ : kind;
|
|
183867
183876
|
return forEach(resolvedProjectReferences, (ref) => {
|
|
183868
183877
|
if (!ref) return void 0;
|
|
183869
183878
|
const configFileName = toNormalizedPath(ref.sourceFile.fileName);
|
|
@@ -183904,9 +183913,6 @@ function getDetailWatchInfo(watchType, project) {
|
|
|
183904
183913
|
function isScriptInfoWatchedFromNodeModules(info) {
|
|
183905
183914
|
return !info.isScriptOpen() && info.mTime !== void 0;
|
|
183906
183915
|
}
|
|
183907
|
-
function projectContainsInfoDirectly(project, info) {
|
|
183908
|
-
return project.containsScriptInfo(info) && !project.isSourceOfProjectReferenceRedirect(info.path);
|
|
183909
|
-
}
|
|
183910
183916
|
function updateProjectIfDirty(project) {
|
|
183911
183917
|
project.invalidateResolutionsOfFailedLookupLocations();
|
|
183912
183918
|
return project.dirty && !project.updateGraph();
|
|
@@ -183924,6 +183930,25 @@ function updateWithTriggerFile(project, triggerFile, isReload) {
|
|
|
183924
183930
|
project.triggerFileForConfigFileDiag = void 0;
|
|
183925
183931
|
return sent;
|
|
183926
183932
|
}
|
|
183933
|
+
function updateConfiguredProject(project, triggerFile) {
|
|
183934
|
+
if (triggerFile) {
|
|
183935
|
+
if (updateWithTriggerFile(
|
|
183936
|
+
project,
|
|
183937
|
+
triggerFile,
|
|
183938
|
+
/*isReload*/
|
|
183939
|
+
false
|
|
183940
|
+
)) return true;
|
|
183941
|
+
} else {
|
|
183942
|
+
updateProjectIfDirty(project);
|
|
183943
|
+
}
|
|
183944
|
+
return false;
|
|
183945
|
+
}
|
|
183946
|
+
function fileOpenReason(info) {
|
|
183947
|
+
return `Creating possible configured project for ${info.fileName} to open`;
|
|
183948
|
+
}
|
|
183949
|
+
function reloadReason(reason) {
|
|
183950
|
+
return `User requested reload projects: ${reason}`;
|
|
183951
|
+
}
|
|
183927
183952
|
function setProjectOptionsUsed(project) {
|
|
183928
183953
|
if (isConfiguredProject(project)) {
|
|
183929
183954
|
project.projectOptions = true;
|
|
@@ -184063,8 +184088,10 @@ var _ProjectService = class _ProjectService {
|
|
|
184063
184088
|
* Open files: with value being project root path, and key being Path of the file that is open
|
|
184064
184089
|
*/
|
|
184065
184090
|
this.openFiles = /* @__PURE__ */ new Map();
|
|
184066
|
-
/**
|
|
184091
|
+
/** Config files looked up and cached config files for open script info */
|
|
184067
184092
|
this.configFileForOpenFiles = /* @__PURE__ */ new Map();
|
|
184093
|
+
/** Set of open script infos that are root of inferred project */
|
|
184094
|
+
this.rootOfInferredProjects = /* @__PURE__ */ new Set();
|
|
184068
184095
|
/**
|
|
184069
184096
|
* Map of open files that are opened without complete path but have projectRoot as current directory
|
|
184070
184097
|
*/
|
|
@@ -184418,9 +184445,28 @@ var _ProjectService = class _ProjectService {
|
|
|
184418
184445
|
const scriptInfo = isString(fileNameOrScriptInfo) ? this.getScriptInfoForNormalizedPath(fileNameOrScriptInfo) : fileNameOrScriptInfo;
|
|
184419
184446
|
return scriptInfo && !scriptInfo.isOrphan() ? scriptInfo.getDefaultProject() : void 0;
|
|
184420
184447
|
}
|
|
184448
|
+
/**
|
|
184449
|
+
* If there is default project calculation pending for this file,
|
|
184450
|
+
* then it completes that calculation so that correct default project is used for the project
|
|
184451
|
+
*/
|
|
184452
|
+
tryGetDefaultProjectForEnsuringConfiguredProjectForFile(fileNameOrScriptInfo) {
|
|
184453
|
+
var _a;
|
|
184454
|
+
const scriptInfo = isString(fileNameOrScriptInfo) ? this.getScriptInfoForNormalizedPath(fileNameOrScriptInfo) : fileNameOrScriptInfo;
|
|
184455
|
+
if (!scriptInfo) return void 0;
|
|
184456
|
+
if ((_a = this.pendingOpenFileProjectUpdates) == null ? void 0 : _a.delete(scriptInfo.path)) {
|
|
184457
|
+
this.tryFindDefaultConfiguredProjectAndLoadAncestorsForOpenScriptInfo(
|
|
184458
|
+
scriptInfo,
|
|
184459
|
+
1 /* Create */
|
|
184460
|
+
);
|
|
184461
|
+
if (scriptInfo.isOrphan()) {
|
|
184462
|
+
this.assignOrphanScriptInfoToInferredProject(scriptInfo, this.openFiles.get(scriptInfo.path));
|
|
184463
|
+
}
|
|
184464
|
+
}
|
|
184465
|
+
return this.tryGetDefaultProjectForFile(scriptInfo);
|
|
184466
|
+
}
|
|
184421
184467
|
/** @internal */
|
|
184422
184468
|
ensureDefaultProjectForFile(fileNameOrScriptInfo) {
|
|
184423
|
-
return this.
|
|
184469
|
+
return this.tryGetDefaultProjectForEnsuringConfiguredProjectForFile(fileNameOrScriptInfo) || this.doEnsureDefaultProjectForFile(fileNameOrScriptInfo);
|
|
184424
184470
|
}
|
|
184425
184471
|
doEnsureDefaultProjectForFile(fileNameOrScriptInfo) {
|
|
184426
184472
|
this.ensureProjectStructuresUptoDate();
|
|
@@ -184641,7 +184687,7 @@ var _ProjectService = class _ProjectService {
|
|
|
184641
184687
|
return scheduledAnyProjectUpdate;
|
|
184642
184688
|
}
|
|
184643
184689
|
/** @internal */
|
|
184644
|
-
onConfigFileChanged(canonicalConfigFilePath, eventKind) {
|
|
184690
|
+
onConfigFileChanged(configFileName, canonicalConfigFilePath, eventKind) {
|
|
184645
184691
|
const configFileExistenceInfo = this.configFileExistenceInfoCache.get(canonicalConfigFilePath);
|
|
184646
184692
|
const project = this.getConfiguredProjectByCanonicalConfigFilePath(canonicalConfigFilePath);
|
|
184647
184693
|
const wasDefferedClose = project == null ? void 0 : project.deferredClose;
|
|
@@ -184655,44 +184701,35 @@ var _ProjectService = class _ProjectService {
|
|
|
184655
184701
|
project.markAsDirty();
|
|
184656
184702
|
}
|
|
184657
184703
|
}
|
|
184658
|
-
this.delayUpdateProjectsFromParsedConfigOnConfigFileChange(
|
|
184659
|
-
|
|
184660
|
-
configFileExistenceInfo,
|
|
184661
|
-
!wasDefferedClose && eventKind !== 2 /* Deleted */ ? identity : (
|
|
184662
|
-
// Reload open files if they are root of inferred project
|
|
184663
|
-
returnTrue
|
|
184664
|
-
),
|
|
184665
|
-
// Reload all the open files impacted by config file
|
|
184704
|
+
this.delayUpdateProjectsFromParsedConfigOnConfigFileChange(
|
|
184705
|
+
canonicalConfigFilePath,
|
|
184666
184706
|
"Change in config file detected"
|
|
184667
184707
|
);
|
|
184668
|
-
|
|
184669
|
-
|
|
184670
|
-
|
|
184671
|
-
|
|
184672
|
-
|
|
184673
|
-
* If there is no existing project it just opens the configured project for the config file
|
|
184674
|
-
* shouldReloadProjectFor provides a way to filter out files to reload configured project for
|
|
184675
|
-
*/
|
|
184676
|
-
delayReloadConfiguredProjectsForFile(configFileExistenceInfo, shouldReloadProjectFor, reason) {
|
|
184677
|
-
var _a;
|
|
184678
|
-
const updatedProjects = /* @__PURE__ */ new Set();
|
|
184679
|
-
(_a = configFileExistenceInfo == null ? void 0 : configFileExistenceInfo.openFilesImpactedByConfigFile) == null ? void 0 : _a.forEach((infoIsRootOfInferredProject, path) => {
|
|
184708
|
+
const updatedProjects = new Set(project ? [project] : void 0);
|
|
184709
|
+
this.openFiles.forEach((_projectRootPath, path) => {
|
|
184710
|
+
var _a, _b;
|
|
184711
|
+
const configFileForOpenFile = this.configFileForOpenFiles.get(path);
|
|
184712
|
+
if (!((_a = configFileExistenceInfo.openFilesImpactedByConfigFile) == null ? void 0 : _a.has(path))) return;
|
|
184680
184713
|
this.configFileForOpenFiles.delete(path);
|
|
184681
|
-
if (!shouldReloadProjectFor(infoIsRootOfInferredProject)) {
|
|
184682
|
-
return;
|
|
184683
|
-
}
|
|
184684
184714
|
const info = this.getScriptInfoForPath(path);
|
|
184685
|
-
|
|
184686
|
-
|
|
184687
|
-
|
|
184688
|
-
|
|
184689
|
-
|
|
184690
|
-
|
|
184691
|
-
|
|
184692
|
-
|
|
184693
|
-
}
|
|
184715
|
+
const newConfigFileNameForInfo = this.getConfigFileNameForFile(
|
|
184716
|
+
info,
|
|
184717
|
+
/*findFromCacheOnly*/
|
|
184718
|
+
false
|
|
184719
|
+
);
|
|
184720
|
+
if (!newConfigFileNameForInfo) return;
|
|
184721
|
+
const projectForInfo = this.findConfiguredProjectByProjectName(newConfigFileNameForInfo) ?? this.createConfiguredProject(
|
|
184722
|
+
newConfigFileNameForInfo,
|
|
184723
|
+
`Change in config file ${configFileName} detected, ${fileOpenReason(info)}`
|
|
184724
|
+
);
|
|
184725
|
+
if (!((_b = this.pendingOpenFileProjectUpdates) == null ? void 0 : _b.has(path))) {
|
|
184726
|
+
(this.pendingOpenFileProjectUpdates ?? (this.pendingOpenFileProjectUpdates = /* @__PURE__ */ new Map())).set(path, configFileForOpenFile);
|
|
184727
|
+
}
|
|
184728
|
+
if (tryAddToSet(updatedProjects, projectForInfo) && projectForInfo.isInitialLoadPending()) {
|
|
184729
|
+
this.delayUpdateProjectGraph(projectForInfo);
|
|
184694
184730
|
}
|
|
184695
184731
|
});
|
|
184732
|
+
this.delayEnsureProjectForOpenFiles();
|
|
184696
184733
|
}
|
|
184697
184734
|
removeProject(project) {
|
|
184698
184735
|
this.logger.info("`remove Project::");
|
|
@@ -184793,9 +184830,10 @@ var _ProjectService = class _ProjectService {
|
|
|
184793
184830
|
* @param info The file that has been closed or newly configured
|
|
184794
184831
|
*/
|
|
184795
184832
|
closeOpenFile(info, skipAssignOrphanScriptInfosToInferredProject) {
|
|
184833
|
+
var _a;
|
|
184796
184834
|
const fileExists = info.isDynamic ? false : this.host.fileExists(info.fileName);
|
|
184797
184835
|
info.close(fileExists);
|
|
184798
|
-
this.
|
|
184836
|
+
this.stopWatchingConfigFilesForScriptInfo(info);
|
|
184799
184837
|
const canonicalFileName = this.toCanonicalFileName(info.fileName);
|
|
184800
184838
|
if (this.openFilesWithNonRootedDiskPath.get(canonicalFileName) === info) {
|
|
184801
184839
|
this.openFilesWithNonRootedDiskPath.delete(canonicalFileName);
|
|
@@ -184831,6 +184869,8 @@ var _ProjectService = class _ProjectService {
|
|
|
184831
184869
|
}
|
|
184832
184870
|
this.openFiles.delete(info.path);
|
|
184833
184871
|
this.configFileForOpenFiles.delete(info.path);
|
|
184872
|
+
(_a = this.pendingOpenFileProjectUpdates) == null ? void 0 : _a.delete(info.path);
|
|
184873
|
+
Debug.assert(!this.rootOfInferredProjects.has(info));
|
|
184834
184874
|
if (!skipAssignOrphanScriptInfosToInferredProject && ensureProjectsForOpenFiles) {
|
|
184835
184875
|
this.assignOrphanScriptInfosToInferredProject();
|
|
184836
184876
|
}
|
|
@@ -184857,21 +184897,15 @@ var _ProjectService = class _ProjectService {
|
|
|
184857
184897
|
info.closeSourceMapFileWatcher();
|
|
184858
184898
|
}
|
|
184859
184899
|
configFileExists(configFileName, canonicalConfigFilePath, info) {
|
|
184860
|
-
|
|
184861
|
-
let configFileExistenceInfo = this.configFileExistenceInfoCache.get(canonicalConfigFilePath);
|
|
184862
|
-
if (configFileExistenceInfo) {
|
|
184863
|
-
if (isOpenScriptInfo(info) && !((_a = configFileExistenceInfo.openFilesImpactedByConfigFile) == null ? void 0 : _a.has(info.path))) {
|
|
184864
|
-
(configFileExistenceInfo.openFilesImpactedByConfigFile || (configFileExistenceInfo.openFilesImpactedByConfigFile = /* @__PURE__ */ new Map())).set(info.path, false);
|
|
184865
|
-
}
|
|
184866
|
-
return configFileExistenceInfo.exists;
|
|
184867
|
-
}
|
|
184868
|
-
const exists = this.host.fileExists(configFileName);
|
|
184900
|
+
const configFileExistenceInfo = this.configFileExistenceInfoCache.get(canonicalConfigFilePath);
|
|
184869
184901
|
let openFilesImpactedByConfigFile;
|
|
184870
|
-
if (
|
|
184871
|
-
(openFilesImpactedByConfigFile
|
|
184902
|
+
if (this.openFiles.has(info.path) && !isAncestorConfigFileInfo(info)) {
|
|
184903
|
+
if (configFileExistenceInfo) (configFileExistenceInfo.openFilesImpactedByConfigFile ?? (configFileExistenceInfo.openFilesImpactedByConfigFile = /* @__PURE__ */ new Set())).add(info.path);
|
|
184904
|
+
else (openFilesImpactedByConfigFile = /* @__PURE__ */ new Set()).add(info.path);
|
|
184872
184905
|
}
|
|
184873
|
-
configFileExistenceInfo
|
|
184874
|
-
this.
|
|
184906
|
+
if (configFileExistenceInfo) return configFileExistenceInfo.exists;
|
|
184907
|
+
const exists = this.host.fileExists(configFileName);
|
|
184908
|
+
this.configFileExistenceInfoCache.set(canonicalConfigFilePath, { exists, openFilesImpactedByConfigFile });
|
|
184875
184909
|
return exists;
|
|
184876
184910
|
}
|
|
184877
184911
|
/** @internal */
|
|
@@ -184881,7 +184915,7 @@ var _ProjectService = class _ProjectService {
|
|
|
184881
184915
|
if (!configFileExistenceInfo.watcher || configFileExistenceInfo.watcher === noopConfigFileWatcher) {
|
|
184882
184916
|
configFileExistenceInfo.watcher = this.watchFactory.watchFile(
|
|
184883
184917
|
configFileName,
|
|
184884
|
-
(_fileName, eventKind) => this.onConfigFileChanged(canonicalConfigFilePath, eventKind),
|
|
184918
|
+
(_fileName, eventKind) => this.onConfigFileChanged(configFileName, canonicalConfigFilePath, eventKind),
|
|
184885
184919
|
2e3 /* High */,
|
|
184886
184920
|
this.getWatchOptionsFromProjectWatchOptions((_b = (_a = configFileExistenceInfo == null ? void 0 : configFileExistenceInfo.config) == null ? void 0 : _a.parsedCommandLine) == null ? void 0 : _b.watchOptions, getDirectoryPath(configFileName)),
|
|
184887
184921
|
WatchType.ConfigFile,
|
|
@@ -184891,12 +184925,6 @@ var _ProjectService = class _ProjectService {
|
|
|
184891
184925
|
const projects = configFileExistenceInfo.config.projects;
|
|
184892
184926
|
projects.set(forProject.canonicalConfigFilePath, projects.get(forProject.canonicalConfigFilePath) || false);
|
|
184893
184927
|
}
|
|
184894
|
-
/**
|
|
184895
|
-
* Returns true if the configFileExistenceInfo is needed/impacted by open files that are root of inferred project
|
|
184896
|
-
*/
|
|
184897
|
-
configFileExistenceImpactsRootOfInferredProject(configFileExistenceInfo) {
|
|
184898
|
-
return configFileExistenceInfo.openFilesImpactedByConfigFile && forEachEntry(configFileExistenceInfo.openFilesImpactedByConfigFile, identity);
|
|
184899
|
-
}
|
|
184900
184928
|
/** @internal */
|
|
184901
184929
|
releaseParsedConfig(canonicalConfigFilePath, forProject) {
|
|
184902
184930
|
var _a, _b, _c;
|
|
@@ -184907,7 +184935,7 @@ var _ProjectService = class _ProjectService {
|
|
|
184907
184935
|
clearSharedExtendedConfigFileWatcher(canonicalConfigFilePath, this.sharedExtendedConfigFileWatchers);
|
|
184908
184936
|
Debug.checkDefined(configFileExistenceInfo.watcher);
|
|
184909
184937
|
if ((_c = configFileExistenceInfo.openFilesImpactedByConfigFile) == null ? void 0 : _c.size) {
|
|
184910
|
-
if (
|
|
184938
|
+
if (configFileExistenceInfo.inferredProjectRoots) {
|
|
184911
184939
|
if (!canWatchDirectoryOrFile(getPathComponents(getDirectoryPath(canonicalConfigFilePath)))) {
|
|
184912
184940
|
configFileExistenceInfo.watcher.close();
|
|
184913
184941
|
configFileExistenceInfo.watcher = noopConfigFileWatcher;
|
|
@@ -184922,36 +184950,35 @@ var _ProjectService = class _ProjectService {
|
|
|
184922
184950
|
}
|
|
184923
184951
|
}
|
|
184924
184952
|
/**
|
|
184925
|
-
*
|
|
184926
|
-
*
|
|
184927
|
-
*
|
|
184953
|
+
* This is called on file close or when its removed from inferred project as root,
|
|
184954
|
+
* so that we handle the watches and inferred project root data
|
|
184928
184955
|
* @internal
|
|
184929
184956
|
*/
|
|
184930
|
-
|
|
184931
|
-
if (
|
|
184932
|
-
|
|
184933
|
-
|
|
184934
|
-
|
|
184935
|
-
}
|
|
184936
|
-
/**
|
|
184937
|
-
* This is called on file close, so that we stop watching the config file for this script info
|
|
184938
|
-
*/
|
|
184939
|
-
stopWatchingConfigFilesForClosedScriptInfo(info) {
|
|
184940
|
-
Debug.assert(!info.isScriptOpen());
|
|
184957
|
+
stopWatchingConfigFilesForScriptInfo(info) {
|
|
184958
|
+
if (this.serverMode !== 0 /* Semantic */) return;
|
|
184959
|
+
const isRootOfInferredProject = this.rootOfInferredProjects.delete(info);
|
|
184960
|
+
const isOpen = info.isScriptOpen();
|
|
184961
|
+
if (isOpen && !isRootOfInferredProject) return;
|
|
184941
184962
|
this.forEachConfigFileLocation(info, (canonicalConfigFilePath) => {
|
|
184942
184963
|
var _a, _b, _c;
|
|
184943
184964
|
const configFileExistenceInfo = this.configFileExistenceInfoCache.get(canonicalConfigFilePath);
|
|
184944
|
-
if (configFileExistenceInfo)
|
|
184945
|
-
|
|
184946
|
-
(
|
|
184947
|
-
|
|
184948
|
-
|
|
184949
|
-
|
|
184950
|
-
|
|
184951
|
-
|
|
184952
|
-
|
|
184965
|
+
if (!configFileExistenceInfo) return;
|
|
184966
|
+
if (isOpen) {
|
|
184967
|
+
if (!((_a = configFileExistenceInfo == null ? void 0 : configFileExistenceInfo.openFilesImpactedByConfigFile) == null ? void 0 : _a.has(info.path))) return;
|
|
184968
|
+
} else {
|
|
184969
|
+
if (!((_b = configFileExistenceInfo.openFilesImpactedByConfigFile) == null ? void 0 : _b.delete(info.path))) return;
|
|
184970
|
+
}
|
|
184971
|
+
if (isRootOfInferredProject) {
|
|
184972
|
+
configFileExistenceInfo.inferredProjectRoots--;
|
|
184973
|
+
if (configFileExistenceInfo.watcher && !configFileExistenceInfo.config && !configFileExistenceInfo.inferredProjectRoots) {
|
|
184974
|
+
configFileExistenceInfo.watcher.close();
|
|
184975
|
+
configFileExistenceInfo.watcher = void 0;
|
|
184953
184976
|
}
|
|
184954
184977
|
}
|
|
184978
|
+
if (!((_c = configFileExistenceInfo.openFilesImpactedByConfigFile) == null ? void 0 : _c.size) && !configFileExistenceInfo.config) {
|
|
184979
|
+
Debug.assert(!configFileExistenceInfo.watcher);
|
|
184980
|
+
this.configFileExistenceInfoCache.delete(canonicalConfigFilePath);
|
|
184981
|
+
}
|
|
184955
184982
|
});
|
|
184956
184983
|
}
|
|
184957
184984
|
/**
|
|
@@ -184960,39 +184987,27 @@ var _ProjectService = class _ProjectService {
|
|
|
184960
184987
|
* @internal
|
|
184961
184988
|
*/
|
|
184962
184989
|
startWatchingConfigFilesForInferredProjectRoot(info) {
|
|
184990
|
+
if (this.serverMode !== 0 /* Semantic */) return;
|
|
184963
184991
|
Debug.assert(info.isScriptOpen());
|
|
184992
|
+
this.rootOfInferredProjects.add(info);
|
|
184964
184993
|
this.forEachConfigFileLocation(info, (canonicalConfigFilePath, configFileName) => {
|
|
184965
184994
|
let configFileExistenceInfo = this.configFileExistenceInfoCache.get(canonicalConfigFilePath);
|
|
184966
184995
|
if (!configFileExistenceInfo) {
|
|
184967
|
-
configFileExistenceInfo = { exists: this.host.fileExists(configFileName) };
|
|
184996
|
+
configFileExistenceInfo = { exists: this.host.fileExists(configFileName), inferredProjectRoots: 1 };
|
|
184968
184997
|
this.configFileExistenceInfoCache.set(canonicalConfigFilePath, configFileExistenceInfo);
|
|
184998
|
+
} else {
|
|
184999
|
+
configFileExistenceInfo.inferredProjectRoots = (configFileExistenceInfo.inferredProjectRoots ?? 0) + 1;
|
|
184969
185000
|
}
|
|
184970
|
-
(configFileExistenceInfo.openFilesImpactedByConfigFile
|
|
185001
|
+
(configFileExistenceInfo.openFilesImpactedByConfigFile ?? (configFileExistenceInfo.openFilesImpactedByConfigFile = /* @__PURE__ */ new Set())).add(info.path);
|
|
184971
185002
|
configFileExistenceInfo.watcher || (configFileExistenceInfo.watcher = canWatchDirectoryOrFile(getPathComponents(getDirectoryPath(canonicalConfigFilePath))) ? this.watchFactory.watchFile(
|
|
184972
185003
|
configFileName,
|
|
184973
|
-
(_filename, eventKind) => this.onConfigFileChanged(canonicalConfigFilePath, eventKind),
|
|
185004
|
+
(_filename, eventKind) => this.onConfigFileChanged(configFileName, canonicalConfigFilePath, eventKind),
|
|
184974
185005
|
2e3 /* High */,
|
|
184975
185006
|
this.hostConfiguration.watchOptions,
|
|
184976
185007
|
WatchType.ConfigFileForInferredRoot
|
|
184977
185008
|
) : noopConfigFileWatcher);
|
|
184978
185009
|
});
|
|
184979
185010
|
}
|
|
184980
|
-
/**
|
|
184981
|
-
* This is called by inferred project whenever root script info is removed from it
|
|
184982
|
-
*
|
|
184983
|
-
* @internal
|
|
184984
|
-
*/
|
|
184985
|
-
stopWatchingConfigFilesForInferredProjectRoot(info) {
|
|
184986
|
-
this.forEachConfigFileLocation(info, (canonicalConfigFilePath) => {
|
|
184987
|
-
var _a;
|
|
184988
|
-
const configFileExistenceInfo = this.configFileExistenceInfoCache.get(canonicalConfigFilePath);
|
|
184989
|
-
if ((_a = configFileExistenceInfo == null ? void 0 : configFileExistenceInfo.openFilesImpactedByConfigFile) == null ? void 0 : _a.has(info.path)) {
|
|
184990
|
-
Debug.assert(info.isScriptOpen());
|
|
184991
|
-
configFileExistenceInfo.openFilesImpactedByConfigFile.set(info.path, false);
|
|
184992
|
-
this.closeConfigFileWatcherOnReleaseOfOpenFile(configFileExistenceInfo);
|
|
184993
|
-
}
|
|
184994
|
-
});
|
|
184995
|
-
}
|
|
184996
185011
|
/**
|
|
184997
185012
|
* This function tries to search for a tsconfig.json for the given file.
|
|
184998
185013
|
* This is different from the method the compiler uses because
|
|
@@ -185035,10 +185050,25 @@ var _ProjectService = class _ProjectService {
|
|
|
185035
185050
|
}
|
|
185036
185051
|
/** @internal */
|
|
185037
185052
|
findDefaultConfiguredProject(info) {
|
|
185038
|
-
|
|
185039
|
-
|
|
185040
|
-
|
|
185041
|
-
|
|
185053
|
+
var _a;
|
|
185054
|
+
return info.isScriptOpen() ? (_a = this.tryFindDefaultConfiguredProjectForOpenScriptInfo(
|
|
185055
|
+
info,
|
|
185056
|
+
0 /* Find */
|
|
185057
|
+
)) == null ? void 0 : _a.defaultProject : void 0;
|
|
185058
|
+
}
|
|
185059
|
+
/** Get cached configFileName for scriptInfo or ancestor of open script info */
|
|
185060
|
+
getConfigFileNameForFileFromCache(info, lookInPendingFilesForValue) {
|
|
185061
|
+
if (lookInPendingFilesForValue) {
|
|
185062
|
+
const result = getConfigFileNameFromCache(info, this.pendingOpenFileProjectUpdates);
|
|
185063
|
+
if (result !== void 0) return result;
|
|
185064
|
+
}
|
|
185065
|
+
return getConfigFileNameFromCache(info, this.configFileForOpenFiles);
|
|
185066
|
+
}
|
|
185067
|
+
/** Caches the configFilename for script info or ancestor of open script info */
|
|
185068
|
+
setConfigFileNameForFileInCache(info, configFileName) {
|
|
185069
|
+
if (!this.openFiles.has(info.path)) return;
|
|
185070
|
+
if (isAncestorConfigFileInfo(info)) return;
|
|
185071
|
+
this.configFileForOpenFiles.set(info.path, configFileName || false);
|
|
185042
185072
|
}
|
|
185043
185073
|
/**
|
|
185044
185074
|
* This function tries to search for a tsconfig.json for the given file.
|
|
@@ -185049,17 +185079,16 @@ var _ProjectService = class _ProjectService {
|
|
|
185049
185079
|
* the newly opened file.
|
|
185050
185080
|
* If script info is passed in, it is asserted to be open script info
|
|
185051
185081
|
* otherwise just file name
|
|
185082
|
+
* when findFromCacheOnly is true only looked up in cache instead of hitting disk to figure things out
|
|
185083
|
+
* @internal
|
|
185052
185084
|
*/
|
|
185053
|
-
getConfigFileNameForFile(info) {
|
|
185054
|
-
|
|
185055
|
-
|
|
185056
|
-
|
|
185057
|
-
}
|
|
185085
|
+
getConfigFileNameForFile(info, findFromCacheOnly) {
|
|
185086
|
+
const fromCache = this.getConfigFileNameForFileFromCache(info, findFromCacheOnly);
|
|
185087
|
+
if (fromCache !== void 0) return fromCache || void 0;
|
|
185088
|
+
if (findFromCacheOnly) return void 0;
|
|
185058
185089
|
const configFileName = this.forEachConfigFileLocation(info, (canonicalConfigFilePath, configFileName2) => this.configFileExists(configFileName2, canonicalConfigFilePath, info));
|
|
185059
185090
|
this.logger.info(`getConfigFileNameForFile:: File: ${info.fileName} ProjectRootPath: ${this.openFiles.get(info.path)}:: Result: ${configFileName}`);
|
|
185060
|
-
|
|
185061
|
-
this.configFileForOpenFiles.set(info.path, configFileName || false);
|
|
185062
|
-
}
|
|
185091
|
+
this.setConfigFileNameForFileInCache(info, configFileName);
|
|
185063
185092
|
return configFileName;
|
|
185064
185093
|
}
|
|
185065
185094
|
printProjects() {
|
|
@@ -185079,10 +185108,10 @@ var _ProjectService = class _ProjectService {
|
|
|
185079
185108
|
this.logger.endGroup();
|
|
185080
185109
|
}
|
|
185081
185110
|
/** @internal */
|
|
185082
|
-
findConfiguredProjectByProjectName(configFileName) {
|
|
185111
|
+
findConfiguredProjectByProjectName(configFileName, allowDeferredClosed) {
|
|
185083
185112
|
const canonicalConfigFilePath = asNormalizedPath(this.toCanonicalFileName(configFileName));
|
|
185084
185113
|
const result = this.getConfiguredProjectByCanonicalConfigFilePath(canonicalConfigFilePath);
|
|
185085
|
-
return !(result == null ? void 0 : result.deferredClose) ? result : void 0;
|
|
185114
|
+
return allowDeferredClosed ? result : !(result == null ? void 0 : result.deferredClose) ? result : void 0;
|
|
185086
185115
|
}
|
|
185087
185116
|
getConfiguredProjectByCanonicalConfigFilePath(canonicalConfigFilePath) {
|
|
185088
185117
|
return this.configuredProjects.get(canonicalConfigFilePath);
|
|
@@ -185116,7 +185145,7 @@ var _ProjectService = class _ProjectService {
|
|
|
185116
185145
|
createExternalProject(projectFileName, files, options, typeAcquisition, excludedFiles) {
|
|
185117
185146
|
const compilerOptions = convertCompilerOptions(options);
|
|
185118
185147
|
const watchOptionsAndErrors = convertWatchOptions(options, getDirectoryPath(normalizeSlashes(projectFileName)));
|
|
185119
|
-
const project = new
|
|
185148
|
+
const project = new ExternalProject(
|
|
185120
185149
|
projectFileName,
|
|
185121
185150
|
this,
|
|
185122
185151
|
this.documentRegistry,
|
|
@@ -185162,7 +185191,7 @@ var _ProjectService = class _ProjectService {
|
|
|
185162
185191
|
exclude: projectOptions && projectOptions.configHasExcludeProperty,
|
|
185163
185192
|
compileOnSave: project.compileOnSaveEnabled,
|
|
185164
185193
|
configFileName: configFileName(),
|
|
185165
|
-
projectType: project instanceof
|
|
185194
|
+
projectType: project instanceof ExternalProject ? "external" : "configured",
|
|
185166
185195
|
languageServiceEnabled: project.languageServiceEnabled,
|
|
185167
185196
|
version
|
|
185168
185197
|
};
|
|
@@ -185218,18 +185247,6 @@ var _ProjectService = class _ProjectService {
|
|
|
185218
185247
|
this.createConfigFileWatcherForParsedConfig(configFileName, canonicalConfigFilePath, project);
|
|
185219
185248
|
return project;
|
|
185220
185249
|
}
|
|
185221
|
-
/** @internal */
|
|
185222
|
-
createLoadAndUpdateConfiguredProject(configFileName, reason, triggerFile) {
|
|
185223
|
-
const project = this.createConfiguredProject(configFileName, reason);
|
|
185224
|
-
if (triggerFile) updateWithTriggerFile(
|
|
185225
|
-
project,
|
|
185226
|
-
triggerFile,
|
|
185227
|
-
/*isReload*/
|
|
185228
|
-
false
|
|
185229
|
-
);
|
|
185230
|
-
else project.updateGraph();
|
|
185231
|
-
return project;
|
|
185232
|
-
}
|
|
185233
185250
|
/**
|
|
185234
185251
|
* Read the config file of the project, and update the project root file names.
|
|
185235
185252
|
*
|
|
@@ -185503,14 +185520,23 @@ var _ProjectService = class _ProjectService {
|
|
|
185503
185520
|
setFileNamesOfAutpImportProviderOrAuxillaryProject(project, fileNames) {
|
|
185504
185521
|
this.updateNonInferredProjectFiles(project, fileNames, fileNamePropertyReader);
|
|
185505
185522
|
}
|
|
185523
|
+
/** @internal */
|
|
185524
|
+
reloadConfiguredProjectClearingSemanticCache(project, reason, reloadedProjects) {
|
|
185525
|
+
if (!tryAddToSet(reloadedProjects, project)) return false;
|
|
185526
|
+
this.clearSemanticCache(project);
|
|
185527
|
+
this.reloadConfiguredProject(project, reloadReason(reason));
|
|
185528
|
+
return true;
|
|
185529
|
+
}
|
|
185506
185530
|
/**
|
|
185507
185531
|
* Read the config file of the project again by clearing the cache and update the project graph
|
|
185508
185532
|
*
|
|
185509
185533
|
* @internal
|
|
185510
185534
|
*/
|
|
185511
|
-
reloadConfiguredProject(project, reason
|
|
185535
|
+
reloadConfiguredProject(project, reason) {
|
|
185536
|
+
project.isInitialLoadPending = returnFalse;
|
|
185537
|
+
project.pendingUpdateReason = void 0;
|
|
185538
|
+
project.pendingUpdateLevel = 0 /* Update */;
|
|
185512
185539
|
const host = project.getCachedDirectoryStructureHost();
|
|
185513
|
-
if (clearSemanticCache) this.clearSemanticCache(project);
|
|
185514
185540
|
host.clearCache();
|
|
185515
185541
|
this.loadConfiguredProject(project, reason);
|
|
185516
185542
|
updateWithTriggerFile(
|
|
@@ -185522,6 +185548,7 @@ var _ProjectService = class _ProjectService {
|
|
|
185522
185548
|
}
|
|
185523
185549
|
/** @internal */
|
|
185524
185550
|
clearSemanticCache(project) {
|
|
185551
|
+
project.originalConfiguredProjects = void 0;
|
|
185525
185552
|
project.resolutionCache.clear();
|
|
185526
185553
|
project.getLanguageService(
|
|
185527
185554
|
/*ensureSynchronized*/
|
|
@@ -186066,7 +186093,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
186066
186093
|
if (lazyConfiguredProjectsFromExternalProject && !this.hostConfiguration.preferences.lazyConfiguredProjectsFromExternalProject) {
|
|
186067
186094
|
this.externalProjectToConfiguredProjectMap.forEach(
|
|
186068
186095
|
(projects) => projects.forEach((project) => {
|
|
186069
|
-
if (!project.deferredClose && !project.isClosed() && project.
|
|
186096
|
+
if (!project.deferredClose && !project.isClosed() && project.pendingUpdateLevel === 2 /* Full */ && !this.hasPendingProjectUpdate(project)) {
|
|
186070
186097
|
project.updateGraph();
|
|
186071
186098
|
}
|
|
186072
186099
|
})
|
|
@@ -186126,76 +186153,57 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
186126
186153
|
this.pendingProjectUpdates.delete(projectName);
|
|
186127
186154
|
});
|
|
186128
186155
|
this.throttledOperations.cancel(ensureProjectForOpenFileSchedule);
|
|
186156
|
+
this.pendingOpenFileProjectUpdates = void 0;
|
|
186129
186157
|
this.pendingEnsureProjectForOpenFiles = false;
|
|
186130
186158
|
this.configFileExistenceInfoCache.forEach((info) => {
|
|
186131
186159
|
if (info.config) info.config.updateLevel = 2 /* Full */;
|
|
186132
186160
|
});
|
|
186133
|
-
this.
|
|
186161
|
+
this.configFileForOpenFiles.clear();
|
|
186134
186162
|
this.externalProjects.forEach((project) => {
|
|
186135
186163
|
this.clearSemanticCache(project);
|
|
186136
186164
|
project.updateGraph();
|
|
186137
186165
|
});
|
|
186138
|
-
|
|
186139
|
-
|
|
186140
|
-
this.
|
|
186141
|
-
|
|
186142
|
-
|
|
186143
|
-
|
|
186144
|
-
|
|
186145
|
-
|
|
186146
|
-
|
|
186147
|
-
|
|
186148
|
-
|
|
186149
|
-
|
|
186150
|
-
|
|
186151
|
-
|
|
186152
|
-
if (tryAddToSet(updatedProjects, child)) {
|
|
186153
|
-
this.reloadConfiguredProject(
|
|
186154
|
-
child,
|
|
186155
|
-
reason,
|
|
186156
|
-
/*clearSemanticCache*/
|
|
186157
|
-
true
|
|
186158
|
-
);
|
|
186159
|
-
}
|
|
186160
|
-
};
|
|
186161
|
-
(_a = this.openFiles) == null ? void 0 : _a.forEach((_projectRoot, path) => {
|
|
186162
|
-
this.configFileForOpenFiles.delete(path);
|
|
186163
|
-
const info = this.getScriptInfoForPath(path);
|
|
186164
|
-
Debug.assert(info.isScriptOpen());
|
|
186165
|
-
const configFileName = this.getConfigFileNameForFile(info);
|
|
186166
|
-
if (configFileName) {
|
|
186167
|
-
const project = this.findConfiguredProjectByProjectName(configFileName) || this.createConfiguredProject(configFileName, reason);
|
|
186168
|
-
if (tryAddToSet(updatedProjects, project)) {
|
|
186169
|
-
this.reloadConfiguredProject(
|
|
186166
|
+
const reloadedConfiguredProjects = /* @__PURE__ */ new Set();
|
|
186167
|
+
const delayReloadedConfiguredProjects = /* @__PURE__ */ new Set();
|
|
186168
|
+
this.externalProjectToConfiguredProjectMap.forEach((projects, externalProjectName) => {
|
|
186169
|
+
const reason = `Reloading configured project in external project: ${externalProjectName}`;
|
|
186170
|
+
projects.forEach((project) => {
|
|
186171
|
+
if (this.getHostPreferences().lazyConfiguredProjectsFromExternalProject) {
|
|
186172
|
+
if (!project.isInitialLoadPending()) {
|
|
186173
|
+
this.clearSemanticCache(project);
|
|
186174
|
+
project.pendingUpdateLevel = 2 /* Full */;
|
|
186175
|
+
project.pendingUpdateReason = reloadReason(reason);
|
|
186176
|
+
}
|
|
186177
|
+
delayReloadedConfiguredProjects.add(project);
|
|
186178
|
+
} else {
|
|
186179
|
+
this.reloadConfiguredProjectClearingSemanticCache(
|
|
186170
186180
|
project,
|
|
186171
186181
|
reason,
|
|
186172
|
-
|
|
186173
|
-
true
|
|
186182
|
+
reloadedConfiguredProjects
|
|
186174
186183
|
);
|
|
186175
|
-
if (!projectContainsInfoDirectly(project, info)) {
|
|
186176
|
-
const referencedProject = forEachResolvedProjectReferenceProject(
|
|
186177
|
-
project,
|
|
186178
|
-
info.path,
|
|
186179
|
-
(child) => {
|
|
186180
|
-
reloadChildProject(child);
|
|
186181
|
-
return projectContainsInfoDirectly(child, info);
|
|
186182
|
-
},
|
|
186183
|
-
1 /* FindCreate */,
|
|
186184
|
-
reason
|
|
186185
|
-
);
|
|
186186
|
-
if (referencedProject) {
|
|
186187
|
-
forEachResolvedProjectReferenceProject(
|
|
186188
|
-
project,
|
|
186189
|
-
/*fileName*/
|
|
186190
|
-
void 0,
|
|
186191
|
-
reloadChildProject,
|
|
186192
|
-
0 /* Find */
|
|
186193
|
-
);
|
|
186194
|
-
}
|
|
186195
|
-
}
|
|
186196
186184
|
}
|
|
186197
|
-
}
|
|
186185
|
+
});
|
|
186186
|
+
});
|
|
186187
|
+
this.openFiles.forEach((_projectRootPath, path) => {
|
|
186188
|
+
const info = this.getScriptInfoForPath(path);
|
|
186189
|
+
if (find(info.containingProjects, isExternalProject)) return;
|
|
186190
|
+
this.tryFindDefaultConfiguredProjectAndLoadAncestorsForOpenScriptInfo(
|
|
186191
|
+
info,
|
|
186192
|
+
2 /* Reload */,
|
|
186193
|
+
reloadedConfiguredProjects,
|
|
186194
|
+
delayReloadedConfiguredProjects
|
|
186195
|
+
);
|
|
186198
186196
|
});
|
|
186197
|
+
delayReloadedConfiguredProjects.forEach((p) => reloadedConfiguredProjects.add(p));
|
|
186198
|
+
this.inferredProjects.forEach((project) => this.clearSemanticCache(project));
|
|
186199
|
+
this.ensureProjectForOpenFiles();
|
|
186200
|
+
this.cleanupProjectsAndScriptInfos(
|
|
186201
|
+
reloadedConfiguredProjects,
|
|
186202
|
+
new Set(this.openFiles.keys()),
|
|
186203
|
+
new Set(this.externalProjectToConfiguredProjectMap.keys())
|
|
186204
|
+
);
|
|
186205
|
+
this.logger.info("After reloading projects..");
|
|
186206
|
+
this.printProjects();
|
|
186199
186207
|
}
|
|
186200
186208
|
/**
|
|
186201
186209
|
* Remove the root of inferred project if script info is part of another project
|
|
@@ -186223,6 +186231,14 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
186223
186231
|
ensureProjectForOpenFiles() {
|
|
186224
186232
|
this.logger.info("Before ensureProjectForOpenFiles:");
|
|
186225
186233
|
this.printProjects();
|
|
186234
|
+
const pendingOpenFileProjectUpdates = this.pendingOpenFileProjectUpdates;
|
|
186235
|
+
this.pendingOpenFileProjectUpdates = void 0;
|
|
186236
|
+
pendingOpenFileProjectUpdates == null ? void 0 : pendingOpenFileProjectUpdates.forEach(
|
|
186237
|
+
(_config, path) => this.tryFindDefaultConfiguredProjectAndLoadAncestorsForOpenScriptInfo(
|
|
186238
|
+
this.getScriptInfoForPath(path),
|
|
186239
|
+
1 /* Create */
|
|
186240
|
+
)
|
|
186241
|
+
);
|
|
186226
186242
|
this.openFiles.forEach((projectRootPath, path) => {
|
|
186227
186243
|
const info = this.getScriptInfoForPath(path);
|
|
186228
186244
|
if (info.isOrphan()) {
|
|
@@ -186260,7 +186276,11 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
186260
186276
|
const scriptInfo = this.getScriptInfo(fileName);
|
|
186261
186277
|
if (!scriptInfo && !this.host.fileExists(fileName)) return void 0;
|
|
186262
186278
|
const originalFileInfo = { fileName: toNormalizedPath(fileName), path: this.toPath(fileName) };
|
|
186263
|
-
const configFileName = this.getConfigFileNameForFile(
|
|
186279
|
+
const configFileName = this.getConfigFileNameForFile(
|
|
186280
|
+
originalFileInfo,
|
|
186281
|
+
/*findFromCacheOnly*/
|
|
186282
|
+
false
|
|
186283
|
+
);
|
|
186264
186284
|
if (!configFileName) return void 0;
|
|
186265
186285
|
let configuredProject = this.findConfiguredProjectByProjectName(configFileName);
|
|
186266
186286
|
if (!configuredProject) {
|
|
@@ -186275,17 +186295,14 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
186275
186295
|
updateProjectIfDirty(configuredProject);
|
|
186276
186296
|
const projectContainsOriginalInfo = (project2) => {
|
|
186277
186297
|
const info = this.getScriptInfo(fileName);
|
|
186278
|
-
return info &&
|
|
186298
|
+
return info && project2.containsScriptInfo(info) && !project2.isSourceOfProjectReferenceRedirect(info.path);
|
|
186279
186299
|
};
|
|
186280
186300
|
if (configuredProject.isSolution() || !projectContainsOriginalInfo(configuredProject)) {
|
|
186281
186301
|
configuredProject = forEachResolvedProjectReferenceProject(
|
|
186282
186302
|
configuredProject,
|
|
186283
186303
|
fileName,
|
|
186284
|
-
(child) =>
|
|
186285
|
-
|
|
186286
|
-
return projectContainsOriginalInfo(child) ? child : void 0;
|
|
186287
|
-
},
|
|
186288
|
-
1 /* FindCreate */,
|
|
186304
|
+
(child) => projectContainsOriginalInfo(child) ? child : void 0,
|
|
186305
|
+
1 /* Create */,
|
|
186289
186306
|
`Creating project referenced in solution ${configuredProject.projectName} to find possible configured project for original file: ${originalFileInfo.fileName}${location !== originalLocation ? " for location: " + location.fileName : ""}`
|
|
186290
186307
|
);
|
|
186291
186308
|
if (!configuredProject) return void 0;
|
|
@@ -186334,107 +186351,148 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
186334
186351
|
assignProjectToOpenedScriptInfo(info) {
|
|
186335
186352
|
let configFileName;
|
|
186336
186353
|
let configFileErrors;
|
|
186337
|
-
|
|
186354
|
+
const project = this.findExternalProjectContainingOpenScriptInfo(info);
|
|
186338
186355
|
let retainProjects;
|
|
186339
|
-
let projectForConfigFileDiag;
|
|
186340
186356
|
let sentConfigDiag;
|
|
186341
186357
|
if (!project && this.serverMode === 0 /* Semantic */) {
|
|
186342
|
-
|
|
186343
|
-
|
|
186344
|
-
|
|
186345
|
-
|
|
186346
|
-
|
|
186347
|
-
|
|
186348
|
-
|
|
186349
|
-
|
|
186350
|
-
|
|
186351
|
-
|
|
186352
|
-
false
|
|
186353
|
-
)) {
|
|
186354
|
-
(sentConfigDiag ?? (sentConfigDiag = /* @__PURE__ */ new Set())).add(project);
|
|
186355
|
-
}
|
|
186356
|
-
projectForConfigFileDiag = project.containsScriptInfo(info) ? project : void 0;
|
|
186357
|
-
retainProjects = project;
|
|
186358
|
-
if (!projectContainsInfoDirectly(project, info)) {
|
|
186359
|
-
forEachResolvedProjectReferenceProject(
|
|
186360
|
-
project,
|
|
186361
|
-
info.path,
|
|
186362
|
-
(child) => {
|
|
186363
|
-
if (updateWithTriggerFile(
|
|
186364
|
-
child,
|
|
186365
|
-
info.fileName,
|
|
186366
|
-
/*isReload*/
|
|
186367
|
-
false
|
|
186368
|
-
)) {
|
|
186369
|
-
(sentConfigDiag ?? (sentConfigDiag = /* @__PURE__ */ new Set())).add(child);
|
|
186370
|
-
}
|
|
186371
|
-
if (!isArray(retainProjects)) {
|
|
186372
|
-
retainProjects = [project, child];
|
|
186373
|
-
} else {
|
|
186374
|
-
retainProjects.push(child);
|
|
186375
|
-
}
|
|
186376
|
-
if (projectContainsInfoDirectly(child, info)) {
|
|
186377
|
-
projectForConfigFileDiag = child;
|
|
186378
|
-
return child;
|
|
186379
|
-
}
|
|
186380
|
-
if (!projectForConfigFileDiag && child.containsScriptInfo(info)) {
|
|
186381
|
-
projectForConfigFileDiag = child;
|
|
186382
|
-
}
|
|
186383
|
-
},
|
|
186384
|
-
1 /* FindCreate */,
|
|
186385
|
-
`Creating project referenced in solution ${project.projectName} to find possible configured project for ${info.fileName} to open`
|
|
186386
|
-
);
|
|
186387
|
-
}
|
|
186388
|
-
if (projectForConfigFileDiag) {
|
|
186389
|
-
configFileName = projectForConfigFileDiag.getConfigFilePath();
|
|
186390
|
-
configFileErrors = projectForConfigFileDiag.getAllProjectErrors();
|
|
186391
|
-
} else {
|
|
186392
|
-
configFileName = void 0;
|
|
186358
|
+
const result = this.tryFindDefaultConfiguredProjectAndLoadAncestorsForOpenScriptInfo(
|
|
186359
|
+
info,
|
|
186360
|
+
1 /* Create */
|
|
186361
|
+
);
|
|
186362
|
+
if (result) {
|
|
186363
|
+
retainProjects = result.seenProjects;
|
|
186364
|
+
sentConfigDiag = result.sentConfigDiag;
|
|
186365
|
+
if (result.defaultProject) {
|
|
186366
|
+
configFileName = result.defaultProject.getConfigFilePath();
|
|
186367
|
+
configFileErrors = result.defaultProject.getAllProjectErrors();
|
|
186393
186368
|
}
|
|
186394
|
-
this.createAncestorProjects(info, project);
|
|
186395
186369
|
}
|
|
186396
186370
|
}
|
|
186397
186371
|
info.containingProjects.forEach(updateProjectIfDirty);
|
|
186398
186372
|
if (info.isOrphan()) {
|
|
186399
|
-
|
|
186400
|
-
|
|
186401
|
-
|
|
186402
|
-
project2,
|
|
186403
|
-
info.fileName,
|
|
186404
|
-
/*force*/
|
|
186405
|
-
true
|
|
186406
|
-
);
|
|
186407
|
-
});
|
|
186408
|
-
} else if (retainProjects && !(sentConfigDiag == null ? void 0 : sentConfigDiag.has(retainProjects))) {
|
|
186409
|
-
this.sendConfigFileDiagEvent(
|
|
186410
|
-
retainProjects,
|
|
186373
|
+
retainProjects == null ? void 0 : retainProjects.forEach((project2) => {
|
|
186374
|
+
if (!sentConfigDiag.has(project2)) this.sendConfigFileDiagEvent(
|
|
186375
|
+
project2,
|
|
186411
186376
|
info.fileName,
|
|
186412
186377
|
/*force*/
|
|
186413
186378
|
true
|
|
186414
186379
|
);
|
|
186415
|
-
}
|
|
186380
|
+
});
|
|
186416
186381
|
Debug.assert(this.openFiles.has(info.path));
|
|
186417
186382
|
this.assignOrphanScriptInfoToInferredProject(info, this.openFiles.get(info.path));
|
|
186418
186383
|
}
|
|
186419
186384
|
Debug.assert(!info.isOrphan());
|
|
186420
186385
|
return { configFileName, configFileErrors, retainProjects };
|
|
186421
186386
|
}
|
|
186422
|
-
|
|
186423
|
-
|
|
186424
|
-
|
|
186425
|
-
|
|
186426
|
-
|
|
186427
|
-
|
|
186428
|
-
|
|
186429
|
-
|
|
186430
|
-
|
|
186431
|
-
|
|
186432
|
-
|
|
186433
|
-
|
|
186434
|
-
|
|
186435
|
-
|
|
186436
|
-
|
|
186387
|
+
/**
|
|
186388
|
+
* Depending on kind
|
|
186389
|
+
* - Find the configuedProject and return it - if allowDeferredClosed is set it will find the deferredClosed project as well
|
|
186390
|
+
* - Create - if the project doesnt exist, it creates one as well. If not delayLoad, the project is updated (with triggerFile if passed)
|
|
186391
|
+
* - Reload - if the project doesnt exist, it creates one. If not delayLoad, the project is reloaded clearing semantic cache
|
|
186392
|
+
* @internal
|
|
186393
|
+
*/
|
|
186394
|
+
findCreateOrReloadConfiguredProject(configFileName, kind, reason, allowDeferredClosed, triggerFile, reloadedProjects, delayLoad, delayReloadedConfiguredProjects) {
|
|
186395
|
+
let project = this.findConfiguredProjectByProjectName(configFileName, allowDeferredClosed);
|
|
186396
|
+
let sentConfigFileDiag = false;
|
|
186397
|
+
switch (kind) {
|
|
186398
|
+
case 0 /* Find */:
|
|
186399
|
+
if (!project) return;
|
|
186400
|
+
break;
|
|
186401
|
+
case 1 /* Create */:
|
|
186402
|
+
project ?? (project = this.createConfiguredProject(configFileName, reason));
|
|
186403
|
+
sentConfigFileDiag = !delayLoad && updateConfiguredProject(project, triggerFile);
|
|
186404
|
+
break;
|
|
186405
|
+
case 2 /* Reload */:
|
|
186406
|
+
project ?? (project = this.createConfiguredProject(configFileName, reloadReason(reason)));
|
|
186407
|
+
sentConfigFileDiag = !delayReloadedConfiguredProjects && this.reloadConfiguredProjectClearingSemanticCache(project, reason, reloadedProjects);
|
|
186408
|
+
if (delayReloadedConfiguredProjects && !delayReloadedConfiguredProjects.has(project) && !reloadedProjects.has(project)) {
|
|
186409
|
+
project.pendingUpdateLevel = 2 /* Full */;
|
|
186410
|
+
project.pendingUpdateReason = reloadReason(reason);
|
|
186411
|
+
delayReloadedConfiguredProjects.add(project);
|
|
186412
|
+
}
|
|
186413
|
+
break;
|
|
186414
|
+
default:
|
|
186415
|
+
Debug.assertNever(kind);
|
|
186437
186416
|
}
|
|
186417
|
+
return { project, sentConfigFileDiag };
|
|
186418
|
+
}
|
|
186419
|
+
/**
|
|
186420
|
+
* Finds the default configured project for given info
|
|
186421
|
+
* For any tsconfig found, it looks into that project, if not then all its references,
|
|
186422
|
+
* The search happens for all tsconfigs till projectRootPath
|
|
186423
|
+
*/
|
|
186424
|
+
tryFindDefaultConfiguredProjectForOpenScriptInfo(info, kind, allowDeferredClosed, reloadedProjects) {
|
|
186425
|
+
const configFileName = this.getConfigFileNameForFile(info, kind === 0 /* Find */);
|
|
186426
|
+
if (!configFileName) return;
|
|
186427
|
+
const result = this.findCreateOrReloadConfiguredProject(
|
|
186428
|
+
configFileName,
|
|
186429
|
+
kind,
|
|
186430
|
+
fileOpenReason(info),
|
|
186431
|
+
allowDeferredClosed,
|
|
186432
|
+
info.fileName,
|
|
186433
|
+
reloadedProjects
|
|
186434
|
+
);
|
|
186435
|
+
if (!result) return;
|
|
186436
|
+
const seenProjects = /* @__PURE__ */ new Set();
|
|
186437
|
+
const sentConfigDiag = new Set(result.sentConfigFileDiag ? [result.project] : void 0);
|
|
186438
|
+
let defaultProject;
|
|
186439
|
+
let possiblyDefault;
|
|
186440
|
+
tryFindDefaultConfiguredProject(result.project);
|
|
186441
|
+
return {
|
|
186442
|
+
defaultProject: defaultProject ?? possiblyDefault,
|
|
186443
|
+
sentConfigDiag,
|
|
186444
|
+
seenProjects
|
|
186445
|
+
};
|
|
186446
|
+
function tryFindDefaultConfiguredProject(project) {
|
|
186447
|
+
return isDefaultProject(project) ? defaultProject : tryFindDefaultConfiguredProjectFromReferences(project);
|
|
186448
|
+
}
|
|
186449
|
+
function isDefaultProject(project) {
|
|
186450
|
+
if (!tryAddToSet(seenProjects, project)) return;
|
|
186451
|
+
const projectWithInfo = project.containsScriptInfo(info);
|
|
186452
|
+
if (projectWithInfo && !project.isSourceOfProjectReferenceRedirect(info.path)) return defaultProject = project;
|
|
186453
|
+
possiblyDefault ?? (possiblyDefault = projectWithInfo ? project : void 0);
|
|
186454
|
+
}
|
|
186455
|
+
function tryFindDefaultConfiguredProjectFromReferences(project) {
|
|
186456
|
+
return forEachResolvedProjectReferenceProject(
|
|
186457
|
+
project,
|
|
186458
|
+
info.path,
|
|
186459
|
+
(child, sentConfigFileDiag) => {
|
|
186460
|
+
if (sentConfigFileDiag) sentConfigDiag.add(child);
|
|
186461
|
+
return isDefaultProject(child);
|
|
186462
|
+
},
|
|
186463
|
+
kind,
|
|
186464
|
+
`Creating project referenced in solution ${project.projectName} to find possible configured project for ${info.fileName} to open`,
|
|
186465
|
+
allowDeferredClosed,
|
|
186466
|
+
info.fileName,
|
|
186467
|
+
reloadedProjects
|
|
186468
|
+
);
|
|
186469
|
+
}
|
|
186470
|
+
}
|
|
186471
|
+
tryFindDefaultConfiguredProjectAndLoadAncestorsForOpenScriptInfo(info, kind, reloadedProjects, delayReloadedConfiguredProjects) {
|
|
186472
|
+
const allowDeferredClosed = kind === 0 /* Find */;
|
|
186473
|
+
const result = this.tryFindDefaultConfiguredProjectForOpenScriptInfo(
|
|
186474
|
+
info,
|
|
186475
|
+
kind,
|
|
186476
|
+
allowDeferredClosed,
|
|
186477
|
+
reloadedProjects
|
|
186478
|
+
);
|
|
186479
|
+
if (!result) return;
|
|
186480
|
+
const { defaultProject, seenProjects } = result;
|
|
186481
|
+
if (defaultProject) {
|
|
186482
|
+
forEachAncestorProject(
|
|
186483
|
+
info,
|
|
186484
|
+
defaultProject,
|
|
186485
|
+
(ancestor) => {
|
|
186486
|
+
seenProjects.add(ancestor);
|
|
186487
|
+
},
|
|
186488
|
+
kind,
|
|
186489
|
+
`Creating project possibly referencing default composite project ${defaultProject.getProjectName()} of open file ${info.fileName}`,
|
|
186490
|
+
allowDeferredClosed,
|
|
186491
|
+
reloadedProjects,
|
|
186492
|
+
delayReloadedConfiguredProjects
|
|
186493
|
+
);
|
|
186494
|
+
}
|
|
186495
|
+
return result;
|
|
186438
186496
|
}
|
|
186439
186497
|
/** @internal */
|
|
186440
186498
|
loadAncestorProjectTree(forProjects) {
|
|
@@ -186461,13 +186519,27 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
186461
186519
|
const referencedProject = forEachResolvedProjectReference(child.references, (ref) => forProjects.has(ref.sourceFile.path) ? ref : void 0);
|
|
186462
186520
|
if (!referencedProject) continue;
|
|
186463
186521
|
const configFileName = toNormalizedPath(child.sourceFile.fileName);
|
|
186464
|
-
const childProject =
|
|
186522
|
+
const childProject = this.findConfiguredProjectByProjectName(configFileName) ?? this.createConfiguredProject(
|
|
186523
|
+
configFileName,
|
|
186524
|
+
`Creating project referenced by : ${project.projectName} as it references project ${referencedProject.sourceFile.fileName}`
|
|
186525
|
+
);
|
|
186465
186526
|
updateProjectIfDirty(childProject);
|
|
186466
186527
|
this.ensureProjectChildren(childProject, forProjects, seenProjects);
|
|
186467
186528
|
}
|
|
186468
186529
|
}
|
|
186469
|
-
|
|
186470
|
-
this.
|
|
186530
|
+
cleanupConfiguredProjects(toRetainConfiguredProjects, externalProjectsRetainingConfiguredProjects, openFilesWithRetainedConfiguredProject) {
|
|
186531
|
+
this.getOrphanConfiguredProjects(
|
|
186532
|
+
toRetainConfiguredProjects,
|
|
186533
|
+
openFilesWithRetainedConfiguredProject,
|
|
186534
|
+
externalProjectsRetainingConfiguredProjects
|
|
186535
|
+
).forEach((project) => this.removeProject(project));
|
|
186536
|
+
}
|
|
186537
|
+
cleanupProjectsAndScriptInfos(toRetainConfiguredProjects, openFilesWithRetainedConfiguredProject, externalProjectsRetainingConfiguredProjects) {
|
|
186538
|
+
this.cleanupConfiguredProjects(
|
|
186539
|
+
toRetainConfiguredProjects,
|
|
186540
|
+
externalProjectsRetainingConfiguredProjects,
|
|
186541
|
+
openFilesWithRetainedConfiguredProject
|
|
186542
|
+
);
|
|
186471
186543
|
for (const inferredProject of this.inferredProjects.slice()) {
|
|
186472
186544
|
if (inferredProject.isOrphan()) {
|
|
186473
186545
|
this.removeProject(inferredProject);
|
|
@@ -186478,17 +186550,18 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
186478
186550
|
openClientFileWithNormalizedPath(fileName, fileContent, scriptKind, hasMixedContent, projectRootPath) {
|
|
186479
186551
|
const info = this.getOrCreateOpenScriptInfo(fileName, fileContent, scriptKind, hasMixedContent, projectRootPath);
|
|
186480
186552
|
const { retainProjects, ...result } = this.assignProjectToOpenedScriptInfo(info);
|
|
186481
|
-
this.
|
|
186553
|
+
this.cleanupProjectsAndScriptInfos(
|
|
186554
|
+
retainProjects,
|
|
186555
|
+
/* @__PURE__ */ new Set([info.path]),
|
|
186556
|
+
/*externalProjectsRetainingConfiguredProjects*/
|
|
186557
|
+
void 0
|
|
186558
|
+
);
|
|
186482
186559
|
this.telemetryOnOpenFile(info);
|
|
186483
186560
|
this.printProjects();
|
|
186484
186561
|
return result;
|
|
186485
186562
|
}
|
|
186486
|
-
removeOrphanConfiguredProjects(toRetainConfiguredProjects) {
|
|
186487
|
-
const orphanConfiguredProjects = this.getOrphanConfiguredProjects(toRetainConfiguredProjects);
|
|
186488
|
-
orphanConfiguredProjects.forEach((project) => this.removeProject(project));
|
|
186489
|
-
}
|
|
186490
186563
|
/** @internal */
|
|
186491
|
-
getOrphanConfiguredProjects(toRetainConfiguredProjects) {
|
|
186564
|
+
getOrphanConfiguredProjects(toRetainConfiguredProjects, openFilesWithRetainedConfiguredProject, externalProjectsRetainingConfiguredProjects) {
|
|
186492
186565
|
const toRemoveConfiguredProjects = new Set(this.configuredProjects.values());
|
|
186493
186566
|
const markOriginalProjectsAsUsed = (project) => {
|
|
186494
186567
|
if (project.originalConfiguredProjects && (isConfiguredProject(project) || !project.isOrphan())) {
|
|
@@ -186500,32 +186573,45 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
186500
186573
|
);
|
|
186501
186574
|
}
|
|
186502
186575
|
};
|
|
186503
|
-
|
|
186504
|
-
if (isArray(toRetainConfiguredProjects)) {
|
|
186505
|
-
toRetainConfiguredProjects.forEach(retainConfiguredProject);
|
|
186506
|
-
} else {
|
|
186507
|
-
retainConfiguredProject(toRetainConfiguredProjects);
|
|
186508
|
-
}
|
|
186509
|
-
}
|
|
186576
|
+
toRetainConfiguredProjects == null ? void 0 : toRetainConfiguredProjects.forEach(retainConfiguredProject);
|
|
186510
186577
|
this.inferredProjects.forEach(markOriginalProjectsAsUsed);
|
|
186511
186578
|
this.externalProjects.forEach(markOriginalProjectsAsUsed);
|
|
186579
|
+
this.externalProjectToConfiguredProjectMap.forEach((projects, externalProjectName) => {
|
|
186580
|
+
if (!(externalProjectsRetainingConfiguredProjects == null ? void 0 : externalProjectsRetainingConfiguredProjects.has(externalProjectName))) {
|
|
186581
|
+
projects.forEach(retainConfiguredProject);
|
|
186582
|
+
}
|
|
186583
|
+
});
|
|
186584
|
+
this.openFiles.forEach((_projectRootPath, path) => {
|
|
186585
|
+
if (openFilesWithRetainedConfiguredProject == null ? void 0 : openFilesWithRetainedConfiguredProject.has(path)) return;
|
|
186586
|
+
const info = this.getScriptInfoForPath(path);
|
|
186587
|
+
if (find(info.containingProjects, isExternalProject)) return;
|
|
186588
|
+
const result = this.tryFindDefaultConfiguredProjectAndLoadAncestorsForOpenScriptInfo(
|
|
186589
|
+
info,
|
|
186590
|
+
0 /* Find */
|
|
186591
|
+
);
|
|
186592
|
+
if (result == null ? void 0 : result.defaultProject) {
|
|
186593
|
+
result == null ? void 0 : result.seenProjects.forEach(retainConfiguredProject);
|
|
186594
|
+
}
|
|
186595
|
+
});
|
|
186512
186596
|
this.configuredProjects.forEach((project) => {
|
|
186513
|
-
if (
|
|
186514
|
-
|
|
186515
|
-
|
|
186516
|
-
|
|
186517
|
-
retainConfiguredProject(project);
|
|
186597
|
+
if (toRemoveConfiguredProjects.has(project)) {
|
|
186598
|
+
if (isPendingUpdate(project) || forEachReferencedProject(project, isRetained)) {
|
|
186599
|
+
retainConfiguredProject(project);
|
|
186600
|
+
}
|
|
186518
186601
|
}
|
|
186519
186602
|
});
|
|
186520
186603
|
return toRemoveConfiguredProjects;
|
|
186521
186604
|
function isRetained(project) {
|
|
186522
|
-
return !toRemoveConfiguredProjects.has(project) || project
|
|
186605
|
+
return !toRemoveConfiguredProjects.has(project) || isPendingUpdate(project);
|
|
186606
|
+
}
|
|
186607
|
+
function isPendingUpdate(project) {
|
|
186608
|
+
var _a, _b;
|
|
186609
|
+
return (project.deferredClose || project.projectService.hasPendingProjectUpdate(project)) && !!((_b = (_a = project.projectService.configFileExistenceInfoCache.get(project.canonicalConfigFilePath)) == null ? void 0 : _a.openFilesImpactedByConfigFile) == null ? void 0 : _b.size);
|
|
186523
186610
|
}
|
|
186524
186611
|
function retainConfiguredProject(project) {
|
|
186525
|
-
if (toRemoveConfiguredProjects.delete(project))
|
|
186526
|
-
|
|
186527
|
-
|
|
186528
|
-
}
|
|
186612
|
+
if (!toRemoveConfiguredProjects.delete(project)) return;
|
|
186613
|
+
markOriginalProjectsAsUsed(project);
|
|
186614
|
+
forEachReferencedProject(project, retainConfiguredProject);
|
|
186529
186615
|
}
|
|
186530
186616
|
}
|
|
186531
186617
|
removeOrphanScriptInfos() {
|
|
@@ -186640,14 +186726,20 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
186640
186726
|
}
|
|
186641
186727
|
}
|
|
186642
186728
|
let retainProjects;
|
|
186643
|
-
|
|
186644
|
-
|
|
186645
|
-
|
|
186729
|
+
openScriptInfos == null ? void 0 : openScriptInfos.forEach((info) => {
|
|
186730
|
+
var _a;
|
|
186731
|
+
return (_a = this.assignProjectToOpenedScriptInfo(info).retainProjects) == null ? void 0 : _a.forEach((p) => (retainProjects ?? (retainProjects = /* @__PURE__ */ new Set())).add(p));
|
|
186732
|
+
});
|
|
186646
186733
|
if (assignOrphanScriptInfosToInferredProject) {
|
|
186647
186734
|
this.assignOrphanScriptInfosToInferredProject();
|
|
186648
186735
|
}
|
|
186649
186736
|
if (openScriptInfos) {
|
|
186650
|
-
this.
|
|
186737
|
+
this.cleanupProjectsAndScriptInfos(
|
|
186738
|
+
retainProjects,
|
|
186739
|
+
new Set(openScriptInfos.map((info) => info.path)),
|
|
186740
|
+
/*externalProjectsRetainingConfiguredProjects*/
|
|
186741
|
+
void 0
|
|
186742
|
+
);
|
|
186651
186743
|
openScriptInfos.forEach((info) => this.telemetryOnOpenFile(info));
|
|
186652
186744
|
this.printProjects();
|
|
186653
186745
|
} else if (length(closedFiles)) {
|
|
@@ -186660,20 +186752,11 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
186660
186752
|
scriptInfo.editContent(change.span.start, change.span.start + change.span.length, change.newText);
|
|
186661
186753
|
}
|
|
186662
186754
|
}
|
|
186663
|
-
closeConfiguredProjectReferencedFromExternalProject(configuredProjects) {
|
|
186664
|
-
configuredProjects == null ? void 0 : configuredProjects.forEach((configuredProject) => {
|
|
186665
|
-
if (!configuredProject.isClosed()) {
|
|
186666
|
-
configuredProject.deleteExternalProjectReference();
|
|
186667
|
-
if (!configuredProject.hasOpenRef()) this.removeProject(configuredProject);
|
|
186668
|
-
}
|
|
186669
|
-
});
|
|
186670
|
-
}
|
|
186671
186755
|
// eslint-disable-line @typescript-eslint/unified-signatures
|
|
186672
|
-
closeExternalProject(uncheckedFileName,
|
|
186756
|
+
closeExternalProject(uncheckedFileName, cleanupAfter) {
|
|
186673
186757
|
const fileName = toNormalizedPath(uncheckedFileName);
|
|
186674
|
-
const
|
|
186675
|
-
if (
|
|
186676
|
-
this.closeConfiguredProjectReferencedFromExternalProject(configuredProjects);
|
|
186758
|
+
const projects = this.externalProjectToConfiguredProjectMap.get(fileName);
|
|
186759
|
+
if (projects) {
|
|
186677
186760
|
this.externalProjectToConfiguredProjectMap.delete(fileName);
|
|
186678
186761
|
} else {
|
|
186679
186762
|
const externalProject = this.findExternalProjectByProjectName(uncheckedFileName);
|
|
@@ -186681,28 +186764,28 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
186681
186764
|
this.removeProject(externalProject);
|
|
186682
186765
|
}
|
|
186683
186766
|
}
|
|
186684
|
-
if (
|
|
186767
|
+
if (cleanupAfter) {
|
|
186768
|
+
this.cleanupConfiguredProjects();
|
|
186769
|
+
this.printProjects();
|
|
186770
|
+
}
|
|
186685
186771
|
}
|
|
186686
186772
|
openExternalProjects(projects) {
|
|
186687
|
-
const projectsToClose =
|
|
186688
|
-
|
|
186689
|
-
projectsToClose.set(externalProjectName, true);
|
|
186690
|
-
});
|
|
186773
|
+
const projectsToClose = new Set(this.externalProjects.map((p) => p.getProjectName()));
|
|
186774
|
+
this.externalProjectToConfiguredProjectMap.forEach((_, externalProjectName) => projectsToClose.add(externalProjectName));
|
|
186691
186775
|
for (const externalProject of projects) {
|
|
186692
186776
|
this.openExternalProject(
|
|
186693
186777
|
externalProject,
|
|
186694
|
-
/*
|
|
186778
|
+
/*cleanupAfter*/
|
|
186695
186779
|
false
|
|
186696
186780
|
);
|
|
186697
186781
|
projectsToClose.delete(externalProject.projectFileName);
|
|
186698
186782
|
}
|
|
186699
|
-
|
|
186700
|
-
|
|
186701
|
-
|
|
186702
|
-
|
|
186703
|
-
|
|
186704
|
-
|
|
186705
|
-
});
|
|
186783
|
+
projectsToClose.forEach((externalProjectName) => this.closeExternalProject(
|
|
186784
|
+
externalProjectName,
|
|
186785
|
+
/*cleanupAfter*/
|
|
186786
|
+
false
|
|
186787
|
+
));
|
|
186788
|
+
this.cleanupConfiguredProjects();
|
|
186706
186789
|
this.printProjects();
|
|
186707
186790
|
}
|
|
186708
186791
|
static escapeFilenameForRegex(filename) {
|
|
@@ -186807,9 +186890,8 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
186807
186890
|
}
|
|
186808
186891
|
}
|
|
186809
186892
|
// eslint-disable-line @typescript-eslint/unified-signatures
|
|
186810
|
-
openExternalProject(proj,
|
|
186893
|
+
openExternalProject(proj, cleanupAfter) {
|
|
186811
186894
|
const existingExternalProject = this.findExternalProjectByProjectName(proj.projectFileName);
|
|
186812
|
-
const existingConfiguredProjects = this.externalProjectToConfiguredProjectMap.get(proj.projectFileName);
|
|
186813
186895
|
let configuredProjects;
|
|
186814
186896
|
let rootFiles = [];
|
|
186815
186897
|
for (const file of proj.rootFiles) {
|
|
@@ -186818,18 +186900,11 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
186818
186900
|
if (this.serverMode === 0 /* Semantic */ && this.host.fileExists(normalized)) {
|
|
186819
186901
|
let project = this.findConfiguredProjectByProjectName(normalized);
|
|
186820
186902
|
if (!project) {
|
|
186821
|
-
project = this.
|
|
186822
|
-
|
|
186823
|
-
`Creating configured project in external project: ${proj.projectFileName}`,
|
|
186824
|
-
/*triggerFile*/
|
|
186825
|
-
void 0
|
|
186826
|
-
);
|
|
186827
|
-
}
|
|
186828
|
-
if (!(existingConfiguredProjects == null ? void 0 : existingConfiguredProjects.has(project))) {
|
|
186829
|
-
project.addExternalProjectReference();
|
|
186903
|
+
project = this.createConfiguredProject(normalized, `Creating configured project in external project: ${proj.projectFileName}`);
|
|
186904
|
+
if (!this.getHostPreferences().lazyConfiguredProjectsFromExternalProject) project.updateGraph();
|
|
186830
186905
|
}
|
|
186831
186906
|
(configuredProjects ?? (configuredProjects = /* @__PURE__ */ new Set())).add(project);
|
|
186832
|
-
|
|
186907
|
+
Debug.assert(!project.isClosed());
|
|
186833
186908
|
}
|
|
186834
186909
|
} else {
|
|
186835
186910
|
rootFiles.push(file);
|
|
@@ -186867,8 +186942,13 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
186867
186942
|
project.updateGraph();
|
|
186868
186943
|
}
|
|
186869
186944
|
}
|
|
186870
|
-
|
|
186871
|
-
|
|
186945
|
+
if (cleanupAfter) {
|
|
186946
|
+
this.cleanupConfiguredProjects(
|
|
186947
|
+
configuredProjects,
|
|
186948
|
+
new Set(proj.projectFileName)
|
|
186949
|
+
);
|
|
186950
|
+
this.printProjects();
|
|
186951
|
+
}
|
|
186872
186952
|
}
|
|
186873
186953
|
hasDeferredExtension() {
|
|
186874
186954
|
for (const extension of this.hostConfiguration.extraFileExtensions) {
|
|
@@ -187782,7 +187862,7 @@ var Session3 = class _Session {
|
|
|
187782
187862
|
["openExternalProject" /* OpenExternalProject */]: (request) => {
|
|
187783
187863
|
this.projectService.openExternalProject(
|
|
187784
187864
|
request.arguments,
|
|
187785
|
-
/*
|
|
187865
|
+
/*cleanupAfter*/
|
|
187786
187866
|
true
|
|
187787
187867
|
);
|
|
187788
187868
|
return this.requiredResponse(
|
|
@@ -187800,7 +187880,7 @@ var Session3 = class _Session {
|
|
|
187800
187880
|
["closeExternalProject" /* CloseExternalProject */]: (request) => {
|
|
187801
187881
|
this.projectService.closeExternalProject(
|
|
187802
187882
|
request.arguments.projectFileName,
|
|
187803
|
-
/*
|
|
187883
|
+
/*cleanupAfter*/
|
|
187804
187884
|
true
|
|
187805
187885
|
);
|
|
187806
187886
|
return this.requiredResponse(
|
|
@@ -191525,6 +191605,7 @@ __export(ts_server_exports4, {
|
|
|
191525
191605
|
CommandNames: () => CommandNames,
|
|
191526
191606
|
ConfigFileDiagEvent: () => ConfigFileDiagEvent,
|
|
191527
191607
|
ConfiguredProject: () => ConfiguredProject2,
|
|
191608
|
+
ConfiguredProjectLoadKind: () => ConfiguredProjectLoadKind,
|
|
191528
191609
|
CreateDirectoryWatcherEvent: () => CreateDirectoryWatcherEvent,
|
|
191529
191610
|
CreateFileWatcherEvent: () => CreateFileWatcherEvent,
|
|
191530
191611
|
Errors: () => Errors,
|
|
@@ -191532,7 +191613,7 @@ __export(ts_server_exports4, {
|
|
|
191532
191613
|
EventEndInstallTypes: () => EventEndInstallTypes,
|
|
191533
191614
|
EventInitializationFailed: () => EventInitializationFailed,
|
|
191534
191615
|
EventTypesRegistry: () => EventTypesRegistry,
|
|
191535
|
-
ExternalProject: () =>
|
|
191616
|
+
ExternalProject: () => ExternalProject,
|
|
191536
191617
|
GcTimer: () => GcTimer,
|
|
191537
191618
|
InferredProject: () => InferredProject2,
|
|
191538
191619
|
LargeFileReferencedEvent: () => LargeFileReferencedEvent,
|
|
@@ -191548,7 +191629,6 @@ __export(ts_server_exports4, {
|
|
|
191548
191629
|
ProjectLanguageServiceStateEvent: () => ProjectLanguageServiceStateEvent,
|
|
191549
191630
|
ProjectLoadingFinishEvent: () => ProjectLoadingFinishEvent,
|
|
191550
191631
|
ProjectLoadingStartEvent: () => ProjectLoadingStartEvent,
|
|
191551
|
-
ProjectReferenceProjectLoadKind: () => ProjectReferenceProjectLoadKind,
|
|
191552
191632
|
ProjectService: () => ProjectService3,
|
|
191553
191633
|
ProjectsUpdatedInBackgroundEvent: () => ProjectsUpdatedInBackgroundEvent,
|
|
191554
191634
|
ScriptInfo: () => ScriptInfo,
|
|
@@ -191600,7 +191680,6 @@ __export(ts_server_exports4, {
|
|
|
191600
191680
|
nowString: () => nowString,
|
|
191601
191681
|
nullCancellationToken: () => nullCancellationToken,
|
|
191602
191682
|
nullTypingsInstaller: () => nullTypingsInstaller,
|
|
191603
|
-
projectContainsInfoDirectly: () => projectContainsInfoDirectly,
|
|
191604
191683
|
protocol: () => ts_server_protocol_exports,
|
|
191605
191684
|
removeSorted: () => removeSorted,
|
|
191606
191685
|
stringifyIndented: () => stringifyIndented,
|
|
@@ -191662,7 +191741,6 @@ if (typeof console !== "undefined") {
|
|
|
191662
191741
|
EmitHint,
|
|
191663
191742
|
EmitOnly,
|
|
191664
191743
|
EndOfLineState,
|
|
191665
|
-
EnumKind,
|
|
191666
191744
|
ExitStatus,
|
|
191667
191745
|
ExportKind,
|
|
191668
191746
|
Extension,
|