typescript 5.2.0-dev.20230523 → 5.2.0-dev.20230526
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 +33 -28
- package/lib/tsserver.js +102 -51
- package/lib/tsserverlibrary.d.ts +1 -1
- package/lib/tsserverlibrary.js +102 -51
- package/lib/typescript.d.ts +1 -1
- package/lib/typescript.js +102 -51
- package/lib/typingsInstaller.js +1 -1
- package/package.json +2 -2
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.2";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20230526`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -47902,32 +47902,34 @@ function createTypeChecker(host) {
|
|
|
47902
47902
|
const methodDeclaration = signatureToSignatureDeclarationHelper(signature, 172 /* MethodSignature */, context, { name: propertyName, questionToken: optionalToken });
|
|
47903
47903
|
typeElements.push(preserveCommentsOn(methodDeclaration));
|
|
47904
47904
|
}
|
|
47905
|
+
if (signatures.length || !optionalToken) {
|
|
47906
|
+
return;
|
|
47907
|
+
}
|
|
47908
|
+
}
|
|
47909
|
+
let propertyTypeNode;
|
|
47910
|
+
if (shouldUsePlaceholderForProperty(propertySymbol, context)) {
|
|
47911
|
+
propertyTypeNode = createElidedInformationPlaceholder(context);
|
|
47905
47912
|
} else {
|
|
47906
|
-
|
|
47907
|
-
|
|
47908
|
-
|
|
47909
|
-
} else {
|
|
47910
|
-
if (propertyIsReverseMapped) {
|
|
47911
|
-
context.reverseMappedStack || (context.reverseMappedStack = []);
|
|
47912
|
-
context.reverseMappedStack.push(propertySymbol);
|
|
47913
|
-
}
|
|
47914
|
-
propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
47915
|
-
if (propertyIsReverseMapped) {
|
|
47916
|
-
context.reverseMappedStack.pop();
|
|
47917
|
-
}
|
|
47913
|
+
if (propertyIsReverseMapped) {
|
|
47914
|
+
context.reverseMappedStack || (context.reverseMappedStack = []);
|
|
47915
|
+
context.reverseMappedStack.push(propertySymbol);
|
|
47918
47916
|
}
|
|
47919
|
-
|
|
47920
|
-
if (
|
|
47921
|
-
context.
|
|
47917
|
+
propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
47918
|
+
if (propertyIsReverseMapped) {
|
|
47919
|
+
context.reverseMappedStack.pop();
|
|
47922
47920
|
}
|
|
47923
|
-
const propertySignature = factory.createPropertySignature(
|
|
47924
|
-
modifiers,
|
|
47925
|
-
propertyName,
|
|
47926
|
-
optionalToken,
|
|
47927
|
-
propertyTypeNode
|
|
47928
|
-
);
|
|
47929
|
-
typeElements.push(preserveCommentsOn(propertySignature));
|
|
47930
47921
|
}
|
|
47922
|
+
const modifiers = isReadonlySymbol(propertySymbol) ? [factory.createToken(148 /* ReadonlyKeyword */)] : void 0;
|
|
47923
|
+
if (modifiers) {
|
|
47924
|
+
context.approximateLength += 9;
|
|
47925
|
+
}
|
|
47926
|
+
const propertySignature = factory.createPropertySignature(
|
|
47927
|
+
modifiers,
|
|
47928
|
+
propertyName,
|
|
47929
|
+
optionalToken,
|
|
47930
|
+
propertyTypeNode
|
|
47931
|
+
);
|
|
47932
|
+
typeElements.push(preserveCommentsOn(propertySignature));
|
|
47931
47933
|
function preserveCommentsOn(node) {
|
|
47932
47934
|
var _a2;
|
|
47933
47935
|
if (some(propertySymbol.declarations, (d) => d.kind === 354 /* JSDocPropertyTag */)) {
|
|
@@ -57280,9 +57282,9 @@ function createTypeChecker(host) {
|
|
|
57280
57282
|
);
|
|
57281
57283
|
if (freshMapper) {
|
|
57282
57284
|
const freshCombinedMapper = combineTypeMappers(mapper, freshMapper);
|
|
57283
|
-
for (
|
|
57284
|
-
if (root.inferTypeParameters
|
|
57285
|
-
|
|
57285
|
+
for (let i = 0; i < freshParams.length; i++) {
|
|
57286
|
+
if (freshParams[i] !== root.inferTypeParameters[i]) {
|
|
57287
|
+
freshParams[i].mapper = freshCombinedMapper;
|
|
57286
57288
|
}
|
|
57287
57289
|
}
|
|
57288
57290
|
}
|
|
@@ -58185,6 +58187,9 @@ function createTypeChecker(host) {
|
|
|
58185
58187
|
const elementFlags = tupleType.target.elementFlags;
|
|
58186
58188
|
const elementTypes = map(getElementTypes(tupleType), (t, i) => {
|
|
58187
58189
|
const singleton = elementFlags[i] & 8 /* Variadic */ ? t : elementFlags[i] & 4 /* Rest */ ? createArrayType(t) : createTupleType([t], [elementFlags[i]]);
|
|
58190
|
+
if (singleton === typeVariable) {
|
|
58191
|
+
return mappedType;
|
|
58192
|
+
}
|
|
58188
58193
|
return instantiateMappedType(mappedType, prependTypeMapping(typeVariable, singleton, mapper));
|
|
58189
58194
|
});
|
|
58190
58195
|
const newReadonly = getModifiedReadonlyState(tupleType.target.readonly, getMappedTypeModifiers(mappedType));
|
|
@@ -64800,7 +64805,7 @@ function createTypeChecker(host) {
|
|
|
64800
64805
|
target.antecedents = saveAntecedents;
|
|
64801
64806
|
} else if (flags & 2 /* Start */) {
|
|
64802
64807
|
const container = flow.node;
|
|
64803
|
-
if (container && container !== flowContainer && reference.kind !== 210 /* PropertyAccessExpression */ && reference.kind !== 211 /* ElementAccessExpression */ && reference.kind
|
|
64808
|
+
if (container && container !== flowContainer && reference.kind !== 210 /* PropertyAccessExpression */ && reference.kind !== 211 /* ElementAccessExpression */ && !(reference.kind === 110 /* ThisKeyword */ && container.kind !== 218 /* ArrowFunction */)) {
|
|
64804
64809
|
flow = container.flowNode;
|
|
64805
64810
|
continue;
|
|
64806
64811
|
}
|
|
@@ -74241,7 +74246,7 @@ function createTypeChecker(host) {
|
|
|
74241
74246
|
if (getIsolatedModules(compilerOptions)) {
|
|
74242
74247
|
Debug.assert(!!(type.symbol.flags & 128 /* ConstEnum */));
|
|
74243
74248
|
const constEnumDeclaration = type.symbol.valueDeclaration;
|
|
74244
|
-
if (constEnumDeclaration.flags & 16777216 /* Ambient */) {
|
|
74249
|
+
if (constEnumDeclaration.flags & 16777216 /* Ambient */ && !isValidTypeOnlyAliasUseSite(node)) {
|
|
74245
74250
|
error(node, Diagnostics.Cannot_access_ambient_const_enums_when_0_is_enabled, isolatedModulesLikeFlagName);
|
|
74246
74251
|
}
|
|
74247
74252
|
}
|
package/lib/tsserver.js
CHANGED
|
@@ -2304,7 +2304,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2304
2304
|
|
|
2305
2305
|
// src/compiler/corePublic.ts
|
|
2306
2306
|
var versionMajorMinor = "5.2";
|
|
2307
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2307
|
+
var version = `${versionMajorMinor}.0-dev.20230526`;
|
|
2308
2308
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2309
2309
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2310
2310
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -52553,32 +52553,34 @@ function createTypeChecker(host) {
|
|
|
52553
52553
|
const methodDeclaration = signatureToSignatureDeclarationHelper(signature, 172 /* MethodSignature */, context, { name: propertyName, questionToken: optionalToken });
|
|
52554
52554
|
typeElements.push(preserveCommentsOn(methodDeclaration));
|
|
52555
52555
|
}
|
|
52556
|
+
if (signatures.length || !optionalToken) {
|
|
52557
|
+
return;
|
|
52558
|
+
}
|
|
52559
|
+
}
|
|
52560
|
+
let propertyTypeNode;
|
|
52561
|
+
if (shouldUsePlaceholderForProperty(propertySymbol, context)) {
|
|
52562
|
+
propertyTypeNode = createElidedInformationPlaceholder(context);
|
|
52556
52563
|
} else {
|
|
52557
|
-
|
|
52558
|
-
|
|
52559
|
-
|
|
52560
|
-
} else {
|
|
52561
|
-
if (propertyIsReverseMapped) {
|
|
52562
|
-
context.reverseMappedStack || (context.reverseMappedStack = []);
|
|
52563
|
-
context.reverseMappedStack.push(propertySymbol);
|
|
52564
|
-
}
|
|
52565
|
-
propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
52566
|
-
if (propertyIsReverseMapped) {
|
|
52567
|
-
context.reverseMappedStack.pop();
|
|
52568
|
-
}
|
|
52564
|
+
if (propertyIsReverseMapped) {
|
|
52565
|
+
context.reverseMappedStack || (context.reverseMappedStack = []);
|
|
52566
|
+
context.reverseMappedStack.push(propertySymbol);
|
|
52569
52567
|
}
|
|
52570
|
-
|
|
52571
|
-
if (
|
|
52572
|
-
context.
|
|
52568
|
+
propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
52569
|
+
if (propertyIsReverseMapped) {
|
|
52570
|
+
context.reverseMappedStack.pop();
|
|
52573
52571
|
}
|
|
52574
|
-
const propertySignature = factory.createPropertySignature(
|
|
52575
|
-
modifiers,
|
|
52576
|
-
propertyName,
|
|
52577
|
-
optionalToken,
|
|
52578
|
-
propertyTypeNode
|
|
52579
|
-
);
|
|
52580
|
-
typeElements.push(preserveCommentsOn(propertySignature));
|
|
52581
52572
|
}
|
|
52573
|
+
const modifiers = isReadonlySymbol(propertySymbol) ? [factory.createToken(148 /* ReadonlyKeyword */)] : void 0;
|
|
52574
|
+
if (modifiers) {
|
|
52575
|
+
context.approximateLength += 9;
|
|
52576
|
+
}
|
|
52577
|
+
const propertySignature = factory.createPropertySignature(
|
|
52578
|
+
modifiers,
|
|
52579
|
+
propertyName,
|
|
52580
|
+
optionalToken,
|
|
52581
|
+
propertyTypeNode
|
|
52582
|
+
);
|
|
52583
|
+
typeElements.push(preserveCommentsOn(propertySignature));
|
|
52582
52584
|
function preserveCommentsOn(node) {
|
|
52583
52585
|
var _a2;
|
|
52584
52586
|
if (some(propertySymbol.declarations, (d) => d.kind === 354 /* JSDocPropertyTag */)) {
|
|
@@ -61931,9 +61933,9 @@ function createTypeChecker(host) {
|
|
|
61931
61933
|
);
|
|
61932
61934
|
if (freshMapper) {
|
|
61933
61935
|
const freshCombinedMapper = combineTypeMappers(mapper, freshMapper);
|
|
61934
|
-
for (
|
|
61935
|
-
if (root.inferTypeParameters
|
|
61936
|
-
|
|
61936
|
+
for (let i = 0; i < freshParams.length; i++) {
|
|
61937
|
+
if (freshParams[i] !== root.inferTypeParameters[i]) {
|
|
61938
|
+
freshParams[i].mapper = freshCombinedMapper;
|
|
61937
61939
|
}
|
|
61938
61940
|
}
|
|
61939
61941
|
}
|
|
@@ -62836,6 +62838,9 @@ function createTypeChecker(host) {
|
|
|
62836
62838
|
const elementFlags = tupleType.target.elementFlags;
|
|
62837
62839
|
const elementTypes = map(getElementTypes(tupleType), (t, i) => {
|
|
62838
62840
|
const singleton = elementFlags[i] & 8 /* Variadic */ ? t : elementFlags[i] & 4 /* Rest */ ? createArrayType(t) : createTupleType([t], [elementFlags[i]]);
|
|
62841
|
+
if (singleton === typeVariable) {
|
|
62842
|
+
return mappedType;
|
|
62843
|
+
}
|
|
62839
62844
|
return instantiateMappedType(mappedType, prependTypeMapping(typeVariable, singleton, mapper));
|
|
62840
62845
|
});
|
|
62841
62846
|
const newReadonly = getModifiedReadonlyState(tupleType.target.readonly, getMappedTypeModifiers(mappedType));
|
|
@@ -69451,7 +69456,7 @@ function createTypeChecker(host) {
|
|
|
69451
69456
|
target.antecedents = saveAntecedents;
|
|
69452
69457
|
} else if (flags & 2 /* Start */) {
|
|
69453
69458
|
const container = flow.node;
|
|
69454
|
-
if (container && container !== flowContainer && reference.kind !== 210 /* PropertyAccessExpression */ && reference.kind !== 211 /* ElementAccessExpression */ && reference.kind
|
|
69459
|
+
if (container && container !== flowContainer && reference.kind !== 210 /* PropertyAccessExpression */ && reference.kind !== 211 /* ElementAccessExpression */ && !(reference.kind === 110 /* ThisKeyword */ && container.kind !== 218 /* ArrowFunction */)) {
|
|
69455
69460
|
flow = container.flowNode;
|
|
69456
69461
|
continue;
|
|
69457
69462
|
}
|
|
@@ -78892,7 +78897,7 @@ function createTypeChecker(host) {
|
|
|
78892
78897
|
if (getIsolatedModules(compilerOptions)) {
|
|
78893
78898
|
Debug.assert(!!(type.symbol.flags & 128 /* ConstEnum */));
|
|
78894
78899
|
const constEnumDeclaration = type.symbol.valueDeclaration;
|
|
78895
|
-
if (constEnumDeclaration.flags & 16777216 /* Ambient */) {
|
|
78900
|
+
if (constEnumDeclaration.flags & 16777216 /* Ambient */ && !isValidTypeOnlyAliasUseSite(node)) {
|
|
78896
78901
|
error(node, Diagnostics.Cannot_access_ambient_const_enums_when_0_is_enabled, isolatedModulesLikeFlagName);
|
|
78897
78902
|
}
|
|
78898
78903
|
}
|
|
@@ -136506,10 +136511,9 @@ registerRefactor(refactorNameForMoveToFile, {
|
|
|
136506
136511
|
}
|
|
136507
136512
|
});
|
|
136508
136513
|
function doChange4(context, oldFile, targetFile, program, toMove, changes, host, preferences) {
|
|
136509
|
-
var _a;
|
|
136510
136514
|
const checker = program.getTypeChecker();
|
|
136511
136515
|
const usage = getUsageInfo(oldFile, toMove.all, checker);
|
|
136512
|
-
if (!host.fileExists(targetFile)
|
|
136516
|
+
if (!host.fileExists(targetFile)) {
|
|
136513
136517
|
changes.createNewFile(oldFile, targetFile, getNewStatementsAndRemoveFromOldFile2(oldFile, targetFile, usage, changes, toMove, program, host, preferences));
|
|
136514
136518
|
addNewFileToTsconfig(program, changes, oldFile.fileName, targetFile, hostGetCanonicalFileName(host));
|
|
136515
136519
|
} else {
|
|
@@ -136547,6 +136551,13 @@ function getNewStatementsAndRemoveFromOldFile2(oldFile, targetFile, usage, chang
|
|
|
136547
136551
|
if (typeof targetFile !== "string") {
|
|
136548
136552
|
if (targetFile.statements.length > 0) {
|
|
136549
136553
|
changes.insertNodesAfter(targetFile, targetFile.statements[targetFile.statements.length - 1], body);
|
|
136554
|
+
} else {
|
|
136555
|
+
changes.insertNodesAtEndOfFile(
|
|
136556
|
+
targetFile,
|
|
136557
|
+
body,
|
|
136558
|
+
/*blankLineBetween*/
|
|
136559
|
+
false
|
|
136560
|
+
);
|
|
136550
136561
|
}
|
|
136551
136562
|
if (imports.length > 0) {
|
|
136552
136563
|
insertImports(
|
|
@@ -137133,6 +137144,10 @@ function getRangeToMove(context) {
|
|
|
137133
137144
|
if (isNamedDeclaration(startStatement) && startStatement.name && rangeContainsRange(startStatement.name, range)) {
|
|
137134
137145
|
return { toMove: [statements[startNodeIndex]], afterLast: statements[startNodeIndex + 1] };
|
|
137135
137146
|
}
|
|
137147
|
+
const overloadRangeToMove = getOverloadRangeToMove(file, startStatement);
|
|
137148
|
+
if (overloadRangeToMove) {
|
|
137149
|
+
return overloadRangeToMove;
|
|
137150
|
+
}
|
|
137136
137151
|
if (range.pos > startStatement.getStart(file))
|
|
137137
137152
|
return void 0;
|
|
137138
137153
|
const afterEndNodeIndex = findIndex(statements, (s) => s.end > range.end, startNodeIndex);
|
|
@@ -137328,6 +137343,19 @@ function isNonVariableTopLevelDeclaration(node) {
|
|
|
137328
137343
|
return false;
|
|
137329
137344
|
}
|
|
137330
137345
|
}
|
|
137346
|
+
function getOverloadRangeToMove(sourceFile, statement) {
|
|
137347
|
+
if (isFunctionLikeDeclaration(statement)) {
|
|
137348
|
+
const declarations = statement.symbol.declarations;
|
|
137349
|
+
if (declarations === void 0 || length(declarations) <= 1 || !contains(declarations, statement)) {
|
|
137350
|
+
return void 0;
|
|
137351
|
+
}
|
|
137352
|
+
const lastDecl = declarations[length(declarations) - 1];
|
|
137353
|
+
const statementsToMove = mapDefined(declarations, (d) => getSourceFileOfNode(d) === sourceFile && isStatement(d) ? d : void 0);
|
|
137354
|
+
const end = findLastIndex(sourceFile.statements, (s) => s.end > lastDecl.end);
|
|
137355
|
+
return { toMove: statementsToMove, afterLast: end >= 0 ? sourceFile.statements[end] : void 0 };
|
|
137356
|
+
}
|
|
137357
|
+
return void 0;
|
|
137358
|
+
}
|
|
137331
137359
|
|
|
137332
137360
|
// src/services/_namespaces/ts.refactor.addOrRemoveBracesToArrowFunction.ts
|
|
137333
137361
|
var ts_refactor_addOrRemoveBracesToArrowFunction_exports = {};
|
|
@@ -138508,7 +138536,7 @@ function getEditsForToTemplateLiteral(context, node) {
|
|
|
138508
138536
|
}
|
|
138509
138537
|
}
|
|
138510
138538
|
function isNotEqualsOperator(node) {
|
|
138511
|
-
return node.operatorToken.kind
|
|
138539
|
+
return !(node.operatorToken.kind === 64 /* EqualsToken */ || node.operatorToken.kind === 65 /* PlusEqualsToken */);
|
|
138512
138540
|
}
|
|
138513
138541
|
function getParentBinaryExpression(expr) {
|
|
138514
138542
|
const container = findAncestor(expr.parent, (n) => {
|
|
@@ -141884,7 +141912,11 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
141884
141912
|
onUnRecoverableConfigFileDiagnostic: noop
|
|
141885
141913
|
};
|
|
141886
141914
|
const documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings);
|
|
141915
|
+
let releasedScriptKinds = /* @__PURE__ */ new Set();
|
|
141887
141916
|
if (isProgramUptoDate(program, rootFileNames, newSettings, (_path, fileName) => host.getScriptVersion(fileName), (fileName) => compilerHost.fileExists(fileName), hasInvalidatedResolutions, hasInvalidatedLibResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
141917
|
+
compilerHost = void 0;
|
|
141918
|
+
parsedCommandLines = void 0;
|
|
141919
|
+
releasedScriptKinds = void 0;
|
|
141888
141920
|
return;
|
|
141889
141921
|
}
|
|
141890
141922
|
const options = {
|
|
@@ -141897,6 +141929,7 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
141897
141929
|
program = createProgram(options);
|
|
141898
141930
|
compilerHost = void 0;
|
|
141899
141931
|
parsedCommandLines = void 0;
|
|
141932
|
+
releasedScriptKinds = void 0;
|
|
141900
141933
|
sourceMapper.clearCache();
|
|
141901
141934
|
program.getTypeChecker();
|
|
141902
141935
|
return;
|
|
@@ -141951,10 +141984,11 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
141951
141984
|
if (!shouldCreateNewSourceFile) {
|
|
141952
141985
|
const oldSourceFile = program && program.getSourceFileByPath(path);
|
|
141953
141986
|
if (oldSourceFile) {
|
|
141954
|
-
if (scriptKind === oldSourceFile.scriptKind) {
|
|
141987
|
+
if (scriptKind === oldSourceFile.scriptKind || releasedScriptKinds.has(oldSourceFile.resolvedPath)) {
|
|
141955
141988
|
return documentRegistry.updateDocumentWithKey(fileName, path, host, documentRegistryBucketKey, scriptSnapshot, scriptVersion, scriptKind, languageVersionOrOptions);
|
|
141956
141989
|
} else {
|
|
141957
141990
|
documentRegistry.releaseDocumentWithKey(oldSourceFile.resolvedPath, documentRegistry.getKeyForCompilationSettings(program.getCompilerOptions()), oldSourceFile.scriptKind, oldSourceFile.impliedNodeFormat);
|
|
141991
|
+
releasedScriptKinds.add(oldSourceFile.resolvedPath);
|
|
141958
141992
|
}
|
|
141959
141993
|
}
|
|
141960
141994
|
}
|
|
@@ -161507,9 +161541,9 @@ var Core;
|
|
|
161507
161541
|
if (refNode.parent.kind === 303 /* ShorthandPropertyAssignment */) {
|
|
161508
161542
|
getReferenceEntriesForShorthandPropertyAssignment(refNode, state.checker, addReference2);
|
|
161509
161543
|
}
|
|
161510
|
-
const
|
|
161511
|
-
if (
|
|
161512
|
-
addReference2(
|
|
161544
|
+
const containingNode = getContainingNodeIfInHeritageClause(refNode);
|
|
161545
|
+
if (containingNode) {
|
|
161546
|
+
addReference2(containingNode);
|
|
161513
161547
|
return;
|
|
161514
161548
|
}
|
|
161515
161549
|
const typeNode = findAncestor(refNode, (a) => !isQualifiedName(a.parent) && !isTypeNode(a.parent) && !isTypeElement(a.parent));
|
|
@@ -161536,8 +161570,8 @@ var Core;
|
|
|
161536
161570
|
addReference2(e);
|
|
161537
161571
|
}
|
|
161538
161572
|
}
|
|
161539
|
-
function
|
|
161540
|
-
return isIdentifier(node) || isPropertyAccessExpression(node) ?
|
|
161573
|
+
function getContainingNodeIfInHeritageClause(node) {
|
|
161574
|
+
return isIdentifier(node) || isPropertyAccessExpression(node) ? getContainingNodeIfInHeritageClause(node.parent) : isExpressionWithTypeArguments(node) ? tryCast(node.parent.parent, or(isClassLike, isInterfaceDeclaration)) : void 0;
|
|
161541
161575
|
}
|
|
161542
161576
|
function isImplementationExpression(node) {
|
|
161543
161577
|
switch (node.kind) {
|
|
@@ -163088,7 +163122,7 @@ function getDocCommentTemplateAtPosition(newLine, sourceFile, position, options)
|
|
|
163088
163122
|
const tags = (parameters ? parameterDocComments(parameters || [], isJavaScriptFile, indentationStr, newLine) : "") + (hasReturn2 ? returnsDocComment(indentationStr, newLine) : "");
|
|
163089
163123
|
const openComment = "/**";
|
|
163090
163124
|
const closeComment = " */";
|
|
163091
|
-
const hasTag = (
|
|
163125
|
+
const hasTag = length(getJSDocTags(commentOwner)) > 0;
|
|
163092
163126
|
if (tags && !hasTag) {
|
|
163093
163127
|
const preamble = openComment + newLine + indentationStr + " * ";
|
|
163094
163128
|
const endLine = tokenStart === position ? newLine + indentationStr : "";
|
|
@@ -166011,6 +166045,17 @@ var ChangeTracker = class {
|
|
|
166011
166045
|
this.insertNodeAt(sourceFile, pos, insert, options);
|
|
166012
166046
|
}
|
|
166013
166047
|
}
|
|
166048
|
+
insertNodesAtEndOfFile(sourceFile, newNodes, blankLineBetween) {
|
|
166049
|
+
this.insertAtEndOfFile(sourceFile, newNodes, blankLineBetween);
|
|
166050
|
+
}
|
|
166051
|
+
insertAtEndOfFile(sourceFile, insert, blankLineBetween) {
|
|
166052
|
+
const pos = sourceFile.end + 1;
|
|
166053
|
+
const options = {
|
|
166054
|
+
prefix: this.newLineCharacter,
|
|
166055
|
+
suffix: this.newLineCharacter + (blankLineBetween ? this.newLineCharacter : "")
|
|
166056
|
+
};
|
|
166057
|
+
this.insertNodesAt(sourceFile, pos, insert, options);
|
|
166058
|
+
}
|
|
166014
166059
|
insertStatementsInNewFile(fileName, statements, oldFile) {
|
|
166015
166060
|
if (!this.newFileChanges) {
|
|
166016
166061
|
this.newFileChanges = createMultiMap();
|
|
@@ -168428,7 +168473,8 @@ function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delt
|
|
|
168428
168473
|
}
|
|
168429
168474
|
processNode(enclosingNode, enclosingNode, startLine, undecoratedStartLine, initialIndentation, delta);
|
|
168430
168475
|
}
|
|
168431
|
-
|
|
168476
|
+
const remainingTrivia = formattingScanner.getCurrentLeadingTrivia();
|
|
168477
|
+
if (remainingTrivia) {
|
|
168432
168478
|
const indentation = SmartIndenter.nodeWillIndentChild(
|
|
168433
168479
|
options,
|
|
168434
168480
|
enclosingNode,
|
|
@@ -168438,25 +168484,30 @@ function formatSpanWorker(originalRange, enclosingNode, initialIndentation, delt
|
|
|
168438
168484
|
/*indentByDefault*/
|
|
168439
168485
|
false
|
|
168440
168486
|
) ? initialIndentation + options.indentSize : initialIndentation;
|
|
168441
|
-
|
|
168442
|
-
|
|
168443
|
-
|
|
168444
|
-
|
|
168445
|
-
|
|
168446
|
-
|
|
168447
|
-
|
|
168448
|
-
(item) => processRange(
|
|
168487
|
+
indentTriviaItems(
|
|
168488
|
+
remainingTrivia,
|
|
168489
|
+
indentation,
|
|
168490
|
+
/*indentNextTokenOrTrivia*/
|
|
168491
|
+
true,
|
|
168492
|
+
(item) => {
|
|
168493
|
+
processRange(
|
|
168449
168494
|
item,
|
|
168450
168495
|
sourceFile.getLineAndCharacterOfPosition(item.pos),
|
|
168451
168496
|
enclosingNode,
|
|
168452
168497
|
enclosingNode,
|
|
168453
168498
|
/*dynamicIndentation*/
|
|
168454
168499
|
void 0
|
|
168455
|
-
)
|
|
168456
|
-
|
|
168457
|
-
|
|
168458
|
-
|
|
168500
|
+
);
|
|
168501
|
+
insertIndentation(
|
|
168502
|
+
item.pos,
|
|
168503
|
+
indentation,
|
|
168504
|
+
/*lineAdded*/
|
|
168505
|
+
false
|
|
168506
|
+
);
|
|
168459
168507
|
}
|
|
168508
|
+
);
|
|
168509
|
+
if (options.trimTrailingWhitespace !== false) {
|
|
168510
|
+
trimTrailingWhitespacesForRemainingRange(remainingTrivia);
|
|
168460
168511
|
}
|
|
168461
168512
|
}
|
|
168462
168513
|
if (previousRange && formattingScanner.getTokenFullStart() >= originalRange.end) {
|
package/lib/tsserverlibrary.d.ts
CHANGED
|
@@ -10196,7 +10196,7 @@ declare namespace ts {
|
|
|
10196
10196
|
* arguments for any interactive action before offering it.
|
|
10197
10197
|
*/
|
|
10198
10198
|
getApplicableRefactors(fileName: string, positionOrRange: number | TextRange, preferences: UserPreferences | undefined, triggerReason?: RefactorTriggerReason, kind?: string, includeInteractiveActions?: boolean): ApplicableRefactorInfo[];
|
|
10199
|
-
getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string, preferences: UserPreferences | undefined,
|
|
10199
|
+
getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string, preferences: UserPreferences | undefined, interactiveRefactorArguments?: InteractiveRefactorArguments): RefactorEditInfo | undefined;
|
|
10200
10200
|
getMoveToRefactoringFileSuggestions(fileName: string, positionOrRange: number | TextRange, preferences: UserPreferences | undefined, triggerReason?: RefactorTriggerReason, kind?: string): {
|
|
10201
10201
|
newFileName: string;
|
|
10202
10202
|
files: string[];
|
package/lib/tsserverlibrary.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.2";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230526`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -50344,32 +50344,34 @@ ${lanes.join("\n")}
|
|
|
50344
50344
|
const methodDeclaration = signatureToSignatureDeclarationHelper(signature, 172 /* MethodSignature */, context, { name: propertyName, questionToken: optionalToken });
|
|
50345
50345
|
typeElements.push(preserveCommentsOn(methodDeclaration));
|
|
50346
50346
|
}
|
|
50347
|
+
if (signatures.length || !optionalToken) {
|
|
50348
|
+
return;
|
|
50349
|
+
}
|
|
50350
|
+
}
|
|
50351
|
+
let propertyTypeNode;
|
|
50352
|
+
if (shouldUsePlaceholderForProperty(propertySymbol, context)) {
|
|
50353
|
+
propertyTypeNode = createElidedInformationPlaceholder(context);
|
|
50347
50354
|
} else {
|
|
50348
|
-
|
|
50349
|
-
|
|
50350
|
-
|
|
50351
|
-
} else {
|
|
50352
|
-
if (propertyIsReverseMapped) {
|
|
50353
|
-
context.reverseMappedStack || (context.reverseMappedStack = []);
|
|
50354
|
-
context.reverseMappedStack.push(propertySymbol);
|
|
50355
|
-
}
|
|
50356
|
-
propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
50357
|
-
if (propertyIsReverseMapped) {
|
|
50358
|
-
context.reverseMappedStack.pop();
|
|
50359
|
-
}
|
|
50355
|
+
if (propertyIsReverseMapped) {
|
|
50356
|
+
context.reverseMappedStack || (context.reverseMappedStack = []);
|
|
50357
|
+
context.reverseMappedStack.push(propertySymbol);
|
|
50360
50358
|
}
|
|
50361
|
-
|
|
50362
|
-
if (
|
|
50363
|
-
context.
|
|
50359
|
+
propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
50360
|
+
if (propertyIsReverseMapped) {
|
|
50361
|
+
context.reverseMappedStack.pop();
|
|
50364
50362
|
}
|
|
50365
|
-
const propertySignature = factory.createPropertySignature(
|
|
50366
|
-
modifiers,
|
|
50367
|
-
propertyName,
|
|
50368
|
-
optionalToken,
|
|
50369
|
-
propertyTypeNode
|
|
50370
|
-
);
|
|
50371
|
-
typeElements.push(preserveCommentsOn(propertySignature));
|
|
50372
50363
|
}
|
|
50364
|
+
const modifiers = isReadonlySymbol(propertySymbol) ? [factory.createToken(148 /* ReadonlyKeyword */)] : void 0;
|
|
50365
|
+
if (modifiers) {
|
|
50366
|
+
context.approximateLength += 9;
|
|
50367
|
+
}
|
|
50368
|
+
const propertySignature = factory.createPropertySignature(
|
|
50369
|
+
modifiers,
|
|
50370
|
+
propertyName,
|
|
50371
|
+
optionalToken,
|
|
50372
|
+
propertyTypeNode
|
|
50373
|
+
);
|
|
50374
|
+
typeElements.push(preserveCommentsOn(propertySignature));
|
|
50373
50375
|
function preserveCommentsOn(node) {
|
|
50374
50376
|
var _a2;
|
|
50375
50377
|
if (some(propertySymbol.declarations, (d) => d.kind === 354 /* JSDocPropertyTag */)) {
|
|
@@ -59722,9 +59724,9 @@ ${lanes.join("\n")}
|
|
|
59722
59724
|
);
|
|
59723
59725
|
if (freshMapper) {
|
|
59724
59726
|
const freshCombinedMapper = combineTypeMappers(mapper, freshMapper);
|
|
59725
|
-
for (
|
|
59726
|
-
if (root.inferTypeParameters
|
|
59727
|
-
|
|
59727
|
+
for (let i = 0; i < freshParams.length; i++) {
|
|
59728
|
+
if (freshParams[i] !== root.inferTypeParameters[i]) {
|
|
59729
|
+
freshParams[i].mapper = freshCombinedMapper;
|
|
59728
59730
|
}
|
|
59729
59731
|
}
|
|
59730
59732
|
}
|
|
@@ -60627,6 +60629,9 @@ ${lanes.join("\n")}
|
|
|
60627
60629
|
const elementFlags = tupleType.target.elementFlags;
|
|
60628
60630
|
const elementTypes = map(getElementTypes(tupleType), (t, i) => {
|
|
60629
60631
|
const singleton = elementFlags[i] & 8 /* Variadic */ ? t : elementFlags[i] & 4 /* Rest */ ? createArrayType(t) : createTupleType([t], [elementFlags[i]]);
|
|
60632
|
+
if (singleton === typeVariable) {
|
|
60633
|
+
return mappedType;
|
|
60634
|
+
}
|
|
60630
60635
|
return instantiateMappedType(mappedType, prependTypeMapping(typeVariable, singleton, mapper));
|
|
60631
60636
|
});
|
|
60632
60637
|
const newReadonly = getModifiedReadonlyState(tupleType.target.readonly, getMappedTypeModifiers(mappedType));
|
|
@@ -67242,7 +67247,7 @@ ${lanes.join("\n")}
|
|
|
67242
67247
|
target.antecedents = saveAntecedents;
|
|
67243
67248
|
} else if (flags & 2 /* Start */) {
|
|
67244
67249
|
const container = flow.node;
|
|
67245
|
-
if (container && container !== flowContainer && reference.kind !== 210 /* PropertyAccessExpression */ && reference.kind !== 211 /* ElementAccessExpression */ && reference.kind
|
|
67250
|
+
if (container && container !== flowContainer && reference.kind !== 210 /* PropertyAccessExpression */ && reference.kind !== 211 /* ElementAccessExpression */ && !(reference.kind === 110 /* ThisKeyword */ && container.kind !== 218 /* ArrowFunction */)) {
|
|
67246
67251
|
flow = container.flowNode;
|
|
67247
67252
|
continue;
|
|
67248
67253
|
}
|
|
@@ -76683,7 +76688,7 @@ ${lanes.join("\n")}
|
|
|
76683
76688
|
if (getIsolatedModules(compilerOptions)) {
|
|
76684
76689
|
Debug.assert(!!(type.symbol.flags & 128 /* ConstEnum */));
|
|
76685
76690
|
const constEnumDeclaration = type.symbol.valueDeclaration;
|
|
76686
|
-
if (constEnumDeclaration.flags & 16777216 /* Ambient */) {
|
|
76691
|
+
if (constEnumDeclaration.flags & 16777216 /* Ambient */ && !isValidTypeOnlyAliasUseSite(node)) {
|
|
76687
76692
|
error(node, Diagnostics.Cannot_access_ambient_const_enums_when_0_is_enabled, isolatedModulesLikeFlagName);
|
|
76688
76693
|
}
|
|
76689
76694
|
}
|
|
@@ -134885,10 +134890,9 @@ ${lanes.join("\n")}
|
|
|
134885
134890
|
|
|
134886
134891
|
// src/services/refactors/moveToFile.ts
|
|
134887
134892
|
function doChange4(context, oldFile, targetFile, program, toMove, changes, host, preferences) {
|
|
134888
|
-
var _a;
|
|
134889
134893
|
const checker = program.getTypeChecker();
|
|
134890
134894
|
const usage = getUsageInfo(oldFile, toMove.all, checker);
|
|
134891
|
-
if (!host.fileExists(targetFile)
|
|
134895
|
+
if (!host.fileExists(targetFile)) {
|
|
134892
134896
|
changes.createNewFile(oldFile, targetFile, getNewStatementsAndRemoveFromOldFile2(oldFile, targetFile, usage, changes, toMove, program, host, preferences));
|
|
134893
134897
|
addNewFileToTsconfig(program, changes, oldFile.fileName, targetFile, hostGetCanonicalFileName(host));
|
|
134894
134898
|
} else {
|
|
@@ -134926,6 +134930,13 @@ ${lanes.join("\n")}
|
|
|
134926
134930
|
if (typeof targetFile !== "string") {
|
|
134927
134931
|
if (targetFile.statements.length > 0) {
|
|
134928
134932
|
changes.insertNodesAfter(targetFile, targetFile.statements[targetFile.statements.length - 1], body);
|
|
134933
|
+
} else {
|
|
134934
|
+
changes.insertNodesAtEndOfFile(
|
|
134935
|
+
targetFile,
|
|
134936
|
+
body,
|
|
134937
|
+
/*blankLineBetween*/
|
|
134938
|
+
false
|
|
134939
|
+
);
|
|
134929
134940
|
}
|
|
134930
134941
|
if (imports.length > 0) {
|
|
134931
134942
|
insertImports(
|
|
@@ -135512,6 +135523,10 @@ ${lanes.join("\n")}
|
|
|
135512
135523
|
if (isNamedDeclaration(startStatement) && startStatement.name && rangeContainsRange(startStatement.name, range)) {
|
|
135513
135524
|
return { toMove: [statements[startNodeIndex]], afterLast: statements[startNodeIndex + 1] };
|
|
135514
135525
|
}
|
|
135526
|
+
const overloadRangeToMove = getOverloadRangeToMove(file, startStatement);
|
|
135527
|
+
if (overloadRangeToMove) {
|
|
135528
|
+
return overloadRangeToMove;
|
|
135529
|
+
}
|
|
135515
135530
|
if (range.pos > startStatement.getStart(file))
|
|
135516
135531
|
return void 0;
|
|
135517
135532
|
const afterEndNodeIndex = findIndex(statements, (s) => s.end > range.end, startNodeIndex);
|
|
@@ -135707,6 +135722,19 @@ ${lanes.join("\n")}
|
|
|
135707
135722
|
return false;
|
|
135708
135723
|
}
|
|
135709
135724
|
}
|
|
135725
|
+
function getOverloadRangeToMove(sourceFile, statement) {
|
|
135726
|
+
if (isFunctionLikeDeclaration(statement)) {
|
|
135727
|
+
const declarations = statement.symbol.declarations;
|
|
135728
|
+
if (declarations === void 0 || length(declarations) <= 1 || !contains(declarations, statement)) {
|
|
135729
|
+
return void 0;
|
|
135730
|
+
}
|
|
135731
|
+
const lastDecl = declarations[length(declarations) - 1];
|
|
135732
|
+
const statementsToMove = mapDefined(declarations, (d) => getSourceFileOfNode(d) === sourceFile && isStatement(d) ? d : void 0);
|
|
135733
|
+
const end = findLastIndex(sourceFile.statements, (s) => s.end > lastDecl.end);
|
|
135734
|
+
return { toMove: statementsToMove, afterLast: end >= 0 ? sourceFile.statements[end] : void 0 };
|
|
135735
|
+
}
|
|
135736
|
+
return void 0;
|
|
135737
|
+
}
|
|
135710
135738
|
var refactorNameForMoveToFile, description2, moveToFileAction;
|
|
135711
135739
|
var init_moveToFile = __esm({
|
|
135712
135740
|
"src/services/refactors/moveToFile.ts"() {
|
|
@@ -136970,7 +136998,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
136970
136998
|
}
|
|
136971
136999
|
}
|
|
136972
137000
|
function isNotEqualsOperator(node) {
|
|
136973
|
-
return node.operatorToken.kind
|
|
137001
|
+
return !(node.operatorToken.kind === 64 /* EqualsToken */ || node.operatorToken.kind === 65 /* PlusEqualsToken */);
|
|
136974
137002
|
}
|
|
136975
137003
|
function getParentBinaryExpression(expr) {
|
|
136976
137004
|
const container = findAncestor(expr.parent, (n) => {
|
|
@@ -139828,7 +139856,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
139828
139856
|
onUnRecoverableConfigFileDiagnostic: noop
|
|
139829
139857
|
};
|
|
139830
139858
|
const documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings);
|
|
139859
|
+
let releasedScriptKinds = /* @__PURE__ */ new Set();
|
|
139831
139860
|
if (isProgramUptoDate(program, rootFileNames, newSettings, (_path, fileName) => host.getScriptVersion(fileName), (fileName) => compilerHost.fileExists(fileName), hasInvalidatedResolutions, hasInvalidatedLibResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
139861
|
+
compilerHost = void 0;
|
|
139862
|
+
parsedCommandLines = void 0;
|
|
139863
|
+
releasedScriptKinds = void 0;
|
|
139832
139864
|
return;
|
|
139833
139865
|
}
|
|
139834
139866
|
const options = {
|
|
@@ -139841,6 +139873,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
139841
139873
|
program = createProgram(options);
|
|
139842
139874
|
compilerHost = void 0;
|
|
139843
139875
|
parsedCommandLines = void 0;
|
|
139876
|
+
releasedScriptKinds = void 0;
|
|
139844
139877
|
sourceMapper.clearCache();
|
|
139845
139878
|
program.getTypeChecker();
|
|
139846
139879
|
return;
|
|
@@ -139895,10 +139928,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
139895
139928
|
if (!shouldCreateNewSourceFile) {
|
|
139896
139929
|
const oldSourceFile = program && program.getSourceFileByPath(path);
|
|
139897
139930
|
if (oldSourceFile) {
|
|
139898
|
-
if (scriptKind === oldSourceFile.scriptKind) {
|
|
139931
|
+
if (scriptKind === oldSourceFile.scriptKind || releasedScriptKinds.has(oldSourceFile.resolvedPath)) {
|
|
139899
139932
|
return documentRegistry.updateDocumentWithKey(fileName, path, host, documentRegistryBucketKey, scriptSnapshot, scriptVersion, scriptKind, languageVersionOrOptions);
|
|
139900
139933
|
} else {
|
|
139901
139934
|
documentRegistry.releaseDocumentWithKey(oldSourceFile.resolvedPath, documentRegistry.getKeyForCompilationSettings(program.getCompilerOptions()), oldSourceFile.scriptKind, oldSourceFile.impliedNodeFormat);
|
|
139935
|
+
releasedScriptKinds.add(oldSourceFile.resolvedPath);
|
|
139902
139936
|
}
|
|
139903
139937
|
}
|
|
139904
139938
|
}
|
|
@@ -160818,9 +160852,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
160818
160852
|
if (refNode.parent.kind === 303 /* ShorthandPropertyAssignment */) {
|
|
160819
160853
|
getReferenceEntriesForShorthandPropertyAssignment(refNode, state.checker, addReference2);
|
|
160820
160854
|
}
|
|
160821
|
-
const
|
|
160822
|
-
if (
|
|
160823
|
-
addReference2(
|
|
160855
|
+
const containingNode = getContainingNodeIfInHeritageClause(refNode);
|
|
160856
|
+
if (containingNode) {
|
|
160857
|
+
addReference2(containingNode);
|
|
160824
160858
|
return;
|
|
160825
160859
|
}
|
|
160826
160860
|
const typeNode = findAncestor(refNode, (a) => !isQualifiedName(a.parent) && !isTypeNode(a.parent) && !isTypeElement(a.parent));
|
|
@@ -160847,8 +160881,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
160847
160881
|
addReference2(e);
|
|
160848
160882
|
}
|
|
160849
160883
|
}
|
|
160850
|
-
function
|
|
160851
|
-
return isIdentifier(node) || isPropertyAccessExpression(node) ?
|
|
160884
|
+
function getContainingNodeIfInHeritageClause(node) {
|
|
160885
|
+
return isIdentifier(node) || isPropertyAccessExpression(node) ? getContainingNodeIfInHeritageClause(node.parent) : isExpressionWithTypeArguments(node) ? tryCast(node.parent.parent, or(isClassLike, isInterfaceDeclaration)) : void 0;
|
|
160852
160886
|
}
|
|
160853
160887
|
function isImplementationExpression(node) {
|
|
160854
160888
|
switch (node.kind) {
|
|
@@ -162360,7 +162394,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
162360
162394
|
const tags = (parameters ? parameterDocComments(parameters || [], isJavaScriptFile, indentationStr, newLine) : "") + (hasReturn2 ? returnsDocComment(indentationStr, newLine) : "");
|
|
162361
162395
|
const openComment = "/**";
|
|
162362
162396
|
const closeComment = " */";
|
|
162363
|
-
const hasTag = (
|
|
162397
|
+
const hasTag = length(getJSDocTags(commentOwner)) > 0;
|
|
162364
162398
|
if (tags && !hasTag) {
|
|
162365
162399
|
const preamble = openComment + newLine + indentationStr + " * ";
|
|
162366
162400
|
const endLine = tokenStart === position ? newLine + indentationStr : "";
|
|
@@ -165881,6 +165915,17 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
165881
165915
|
this.insertNodeAt(sourceFile, pos, insert, options);
|
|
165882
165916
|
}
|
|
165883
165917
|
}
|
|
165918
|
+
insertNodesAtEndOfFile(sourceFile, newNodes, blankLineBetween) {
|
|
165919
|
+
this.insertAtEndOfFile(sourceFile, newNodes, blankLineBetween);
|
|
165920
|
+
}
|
|
165921
|
+
insertAtEndOfFile(sourceFile, insert, blankLineBetween) {
|
|
165922
|
+
const pos = sourceFile.end + 1;
|
|
165923
|
+
const options = {
|
|
165924
|
+
prefix: this.newLineCharacter,
|
|
165925
|
+
suffix: this.newLineCharacter + (blankLineBetween ? this.newLineCharacter : "")
|
|
165926
|
+
};
|
|
165927
|
+
this.insertNodesAt(sourceFile, pos, insert, options);
|
|
165928
|
+
}
|
|
165884
165929
|
insertStatementsInNewFile(fileName, statements, oldFile) {
|
|
165885
165930
|
if (!this.newFileChanges) {
|
|
165886
165931
|
this.newFileChanges = createMultiMap();
|
|
@@ -167913,7 +167958,8 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
167913
167958
|
}
|
|
167914
167959
|
processNode(enclosingNode, enclosingNode, startLine, undecoratedStartLine, initialIndentation, delta);
|
|
167915
167960
|
}
|
|
167916
|
-
|
|
167961
|
+
const remainingTrivia = formattingScanner.getCurrentLeadingTrivia();
|
|
167962
|
+
if (remainingTrivia) {
|
|
167917
167963
|
const indentation = SmartIndenter.nodeWillIndentChild(
|
|
167918
167964
|
options,
|
|
167919
167965
|
enclosingNode,
|
|
@@ -167923,25 +167969,30 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
167923
167969
|
/*indentByDefault*/
|
|
167924
167970
|
false
|
|
167925
167971
|
) ? initialIndentation + options.indentSize : initialIndentation;
|
|
167926
|
-
|
|
167927
|
-
|
|
167928
|
-
|
|
167929
|
-
|
|
167930
|
-
|
|
167931
|
-
|
|
167932
|
-
|
|
167933
|
-
(item) => processRange(
|
|
167972
|
+
indentTriviaItems(
|
|
167973
|
+
remainingTrivia,
|
|
167974
|
+
indentation,
|
|
167975
|
+
/*indentNextTokenOrTrivia*/
|
|
167976
|
+
true,
|
|
167977
|
+
(item) => {
|
|
167978
|
+
processRange(
|
|
167934
167979
|
item,
|
|
167935
167980
|
sourceFile.getLineAndCharacterOfPosition(item.pos),
|
|
167936
167981
|
enclosingNode,
|
|
167937
167982
|
enclosingNode,
|
|
167938
167983
|
/*dynamicIndentation*/
|
|
167939
167984
|
void 0
|
|
167940
|
-
)
|
|
167941
|
-
|
|
167942
|
-
|
|
167943
|
-
|
|
167985
|
+
);
|
|
167986
|
+
insertIndentation(
|
|
167987
|
+
item.pos,
|
|
167988
|
+
indentation,
|
|
167989
|
+
/*lineAdded*/
|
|
167990
|
+
false
|
|
167991
|
+
);
|
|
167944
167992
|
}
|
|
167993
|
+
);
|
|
167994
|
+
if (options.trimTrailingWhitespace !== false) {
|
|
167995
|
+
trimTrailingWhitespacesForRemainingRange(remainingTrivia);
|
|
167945
167996
|
}
|
|
167946
167997
|
}
|
|
167947
167998
|
if (previousRange && formattingScanner.getTokenFullStart() >= originalRange.end) {
|
package/lib/typescript.d.ts
CHANGED
|
@@ -6227,7 +6227,7 @@ declare namespace ts {
|
|
|
6227
6227
|
* arguments for any interactive action before offering it.
|
|
6228
6228
|
*/
|
|
6229
6229
|
getApplicableRefactors(fileName: string, positionOrRange: number | TextRange, preferences: UserPreferences | undefined, triggerReason?: RefactorTriggerReason, kind?: string, includeInteractiveActions?: boolean): ApplicableRefactorInfo[];
|
|
6230
|
-
getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string, preferences: UserPreferences | undefined,
|
|
6230
|
+
getEditsForRefactor(fileName: string, formatOptions: FormatCodeSettings, positionOrRange: number | TextRange, refactorName: string, actionName: string, preferences: UserPreferences | undefined, interactiveRefactorArguments?: InteractiveRefactorArguments): RefactorEditInfo | undefined;
|
|
6231
6231
|
getMoveToRefactoringFileSuggestions(fileName: string, positionOrRange: number | TextRange, preferences: UserPreferences | undefined, triggerReason?: RefactorTriggerReason, kind?: string): {
|
|
6232
6232
|
newFileName: string;
|
|
6233
6233
|
files: string[];
|
package/lib/typescript.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.2";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230526`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -50344,32 +50344,34 @@ ${lanes.join("\n")}
|
|
|
50344
50344
|
const methodDeclaration = signatureToSignatureDeclarationHelper(signature, 172 /* MethodSignature */, context, { name: propertyName, questionToken: optionalToken });
|
|
50345
50345
|
typeElements.push(preserveCommentsOn(methodDeclaration));
|
|
50346
50346
|
}
|
|
50347
|
+
if (signatures.length || !optionalToken) {
|
|
50348
|
+
return;
|
|
50349
|
+
}
|
|
50350
|
+
}
|
|
50351
|
+
let propertyTypeNode;
|
|
50352
|
+
if (shouldUsePlaceholderForProperty(propertySymbol, context)) {
|
|
50353
|
+
propertyTypeNode = createElidedInformationPlaceholder(context);
|
|
50347
50354
|
} else {
|
|
50348
|
-
|
|
50349
|
-
|
|
50350
|
-
|
|
50351
|
-
} else {
|
|
50352
|
-
if (propertyIsReverseMapped) {
|
|
50353
|
-
context.reverseMappedStack || (context.reverseMappedStack = []);
|
|
50354
|
-
context.reverseMappedStack.push(propertySymbol);
|
|
50355
|
-
}
|
|
50356
|
-
propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
50357
|
-
if (propertyIsReverseMapped) {
|
|
50358
|
-
context.reverseMappedStack.pop();
|
|
50359
|
-
}
|
|
50355
|
+
if (propertyIsReverseMapped) {
|
|
50356
|
+
context.reverseMappedStack || (context.reverseMappedStack = []);
|
|
50357
|
+
context.reverseMappedStack.push(propertySymbol);
|
|
50360
50358
|
}
|
|
50361
|
-
|
|
50362
|
-
if (
|
|
50363
|
-
context.
|
|
50359
|
+
propertyTypeNode = propertyType ? serializeTypeForDeclaration(context, propertyType, propertySymbol, saveEnclosingDeclaration) : factory.createKeywordTypeNode(133 /* AnyKeyword */);
|
|
50360
|
+
if (propertyIsReverseMapped) {
|
|
50361
|
+
context.reverseMappedStack.pop();
|
|
50364
50362
|
}
|
|
50365
|
-
const propertySignature = factory.createPropertySignature(
|
|
50366
|
-
modifiers,
|
|
50367
|
-
propertyName,
|
|
50368
|
-
optionalToken,
|
|
50369
|
-
propertyTypeNode
|
|
50370
|
-
);
|
|
50371
|
-
typeElements.push(preserveCommentsOn(propertySignature));
|
|
50372
50363
|
}
|
|
50364
|
+
const modifiers = isReadonlySymbol(propertySymbol) ? [factory.createToken(148 /* ReadonlyKeyword */)] : void 0;
|
|
50365
|
+
if (modifiers) {
|
|
50366
|
+
context.approximateLength += 9;
|
|
50367
|
+
}
|
|
50368
|
+
const propertySignature = factory.createPropertySignature(
|
|
50369
|
+
modifiers,
|
|
50370
|
+
propertyName,
|
|
50371
|
+
optionalToken,
|
|
50372
|
+
propertyTypeNode
|
|
50373
|
+
);
|
|
50374
|
+
typeElements.push(preserveCommentsOn(propertySignature));
|
|
50373
50375
|
function preserveCommentsOn(node) {
|
|
50374
50376
|
var _a2;
|
|
50375
50377
|
if (some(propertySymbol.declarations, (d) => d.kind === 354 /* JSDocPropertyTag */)) {
|
|
@@ -59722,9 +59724,9 @@ ${lanes.join("\n")}
|
|
|
59722
59724
|
);
|
|
59723
59725
|
if (freshMapper) {
|
|
59724
59726
|
const freshCombinedMapper = combineTypeMappers(mapper, freshMapper);
|
|
59725
|
-
for (
|
|
59726
|
-
if (root.inferTypeParameters
|
|
59727
|
-
|
|
59727
|
+
for (let i = 0; i < freshParams.length; i++) {
|
|
59728
|
+
if (freshParams[i] !== root.inferTypeParameters[i]) {
|
|
59729
|
+
freshParams[i].mapper = freshCombinedMapper;
|
|
59728
59730
|
}
|
|
59729
59731
|
}
|
|
59730
59732
|
}
|
|
@@ -60627,6 +60629,9 @@ ${lanes.join("\n")}
|
|
|
60627
60629
|
const elementFlags = tupleType.target.elementFlags;
|
|
60628
60630
|
const elementTypes = map(getElementTypes(tupleType), (t, i) => {
|
|
60629
60631
|
const singleton = elementFlags[i] & 8 /* Variadic */ ? t : elementFlags[i] & 4 /* Rest */ ? createArrayType(t) : createTupleType([t], [elementFlags[i]]);
|
|
60632
|
+
if (singleton === typeVariable) {
|
|
60633
|
+
return mappedType;
|
|
60634
|
+
}
|
|
60630
60635
|
return instantiateMappedType(mappedType, prependTypeMapping(typeVariable, singleton, mapper));
|
|
60631
60636
|
});
|
|
60632
60637
|
const newReadonly = getModifiedReadonlyState(tupleType.target.readonly, getMappedTypeModifiers(mappedType));
|
|
@@ -67242,7 +67247,7 @@ ${lanes.join("\n")}
|
|
|
67242
67247
|
target.antecedents = saveAntecedents;
|
|
67243
67248
|
} else if (flags & 2 /* Start */) {
|
|
67244
67249
|
const container = flow.node;
|
|
67245
|
-
if (container && container !== flowContainer && reference.kind !== 210 /* PropertyAccessExpression */ && reference.kind !== 211 /* ElementAccessExpression */ && reference.kind
|
|
67250
|
+
if (container && container !== flowContainer && reference.kind !== 210 /* PropertyAccessExpression */ && reference.kind !== 211 /* ElementAccessExpression */ && !(reference.kind === 110 /* ThisKeyword */ && container.kind !== 218 /* ArrowFunction */)) {
|
|
67246
67251
|
flow = container.flowNode;
|
|
67247
67252
|
continue;
|
|
67248
67253
|
}
|
|
@@ -76683,7 +76688,7 @@ ${lanes.join("\n")}
|
|
|
76683
76688
|
if (getIsolatedModules(compilerOptions)) {
|
|
76684
76689
|
Debug.assert(!!(type.symbol.flags & 128 /* ConstEnum */));
|
|
76685
76690
|
const constEnumDeclaration = type.symbol.valueDeclaration;
|
|
76686
|
-
if (constEnumDeclaration.flags & 16777216 /* Ambient */) {
|
|
76691
|
+
if (constEnumDeclaration.flags & 16777216 /* Ambient */ && !isValidTypeOnlyAliasUseSite(node)) {
|
|
76687
76692
|
error(node, Diagnostics.Cannot_access_ambient_const_enums_when_0_is_enabled, isolatedModulesLikeFlagName);
|
|
76688
76693
|
}
|
|
76689
76694
|
}
|
|
@@ -134900,10 +134905,9 @@ ${lanes.join("\n")}
|
|
|
134900
134905
|
|
|
134901
134906
|
// src/services/refactors/moveToFile.ts
|
|
134902
134907
|
function doChange4(context, oldFile, targetFile, program, toMove, changes, host, preferences) {
|
|
134903
|
-
var _a;
|
|
134904
134908
|
const checker = program.getTypeChecker();
|
|
134905
134909
|
const usage = getUsageInfo(oldFile, toMove.all, checker);
|
|
134906
|
-
if (!host.fileExists(targetFile)
|
|
134910
|
+
if (!host.fileExists(targetFile)) {
|
|
134907
134911
|
changes.createNewFile(oldFile, targetFile, getNewStatementsAndRemoveFromOldFile2(oldFile, targetFile, usage, changes, toMove, program, host, preferences));
|
|
134908
134912
|
addNewFileToTsconfig(program, changes, oldFile.fileName, targetFile, hostGetCanonicalFileName(host));
|
|
134909
134913
|
} else {
|
|
@@ -134941,6 +134945,13 @@ ${lanes.join("\n")}
|
|
|
134941
134945
|
if (typeof targetFile !== "string") {
|
|
134942
134946
|
if (targetFile.statements.length > 0) {
|
|
134943
134947
|
changes.insertNodesAfter(targetFile, targetFile.statements[targetFile.statements.length - 1], body);
|
|
134948
|
+
} else {
|
|
134949
|
+
changes.insertNodesAtEndOfFile(
|
|
134950
|
+
targetFile,
|
|
134951
|
+
body,
|
|
134952
|
+
/*blankLineBetween*/
|
|
134953
|
+
false
|
|
134954
|
+
);
|
|
134944
134955
|
}
|
|
134945
134956
|
if (imports.length > 0) {
|
|
134946
134957
|
insertImports(
|
|
@@ -135527,6 +135538,10 @@ ${lanes.join("\n")}
|
|
|
135527
135538
|
if (isNamedDeclaration(startStatement) && startStatement.name && rangeContainsRange(startStatement.name, range)) {
|
|
135528
135539
|
return { toMove: [statements[startNodeIndex]], afterLast: statements[startNodeIndex + 1] };
|
|
135529
135540
|
}
|
|
135541
|
+
const overloadRangeToMove = getOverloadRangeToMove(file, startStatement);
|
|
135542
|
+
if (overloadRangeToMove) {
|
|
135543
|
+
return overloadRangeToMove;
|
|
135544
|
+
}
|
|
135530
135545
|
if (range.pos > startStatement.getStart(file))
|
|
135531
135546
|
return void 0;
|
|
135532
135547
|
const afterEndNodeIndex = findIndex(statements, (s) => s.end > range.end, startNodeIndex);
|
|
@@ -135722,6 +135737,19 @@ ${lanes.join("\n")}
|
|
|
135722
135737
|
return false;
|
|
135723
135738
|
}
|
|
135724
135739
|
}
|
|
135740
|
+
function getOverloadRangeToMove(sourceFile, statement) {
|
|
135741
|
+
if (isFunctionLikeDeclaration(statement)) {
|
|
135742
|
+
const declarations = statement.symbol.declarations;
|
|
135743
|
+
if (declarations === void 0 || length(declarations) <= 1 || !contains(declarations, statement)) {
|
|
135744
|
+
return void 0;
|
|
135745
|
+
}
|
|
135746
|
+
const lastDecl = declarations[length(declarations) - 1];
|
|
135747
|
+
const statementsToMove = mapDefined(declarations, (d) => getSourceFileOfNode(d) === sourceFile && isStatement(d) ? d : void 0);
|
|
135748
|
+
const end = findLastIndex(sourceFile.statements, (s) => s.end > lastDecl.end);
|
|
135749
|
+
return { toMove: statementsToMove, afterLast: end >= 0 ? sourceFile.statements[end] : void 0 };
|
|
135750
|
+
}
|
|
135751
|
+
return void 0;
|
|
135752
|
+
}
|
|
135725
135753
|
var refactorNameForMoveToFile, description2, moveToFileAction;
|
|
135726
135754
|
var init_moveToFile = __esm({
|
|
135727
135755
|
"src/services/refactors/moveToFile.ts"() {
|
|
@@ -136985,7 +137013,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
136985
137013
|
}
|
|
136986
137014
|
}
|
|
136987
137015
|
function isNotEqualsOperator(node) {
|
|
136988
|
-
return node.operatorToken.kind
|
|
137016
|
+
return !(node.operatorToken.kind === 64 /* EqualsToken */ || node.operatorToken.kind === 65 /* PlusEqualsToken */);
|
|
136989
137017
|
}
|
|
136990
137018
|
function getParentBinaryExpression(expr) {
|
|
136991
137019
|
const container = findAncestor(expr.parent, (n) => {
|
|
@@ -139843,7 +139871,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
139843
139871
|
onUnRecoverableConfigFileDiagnostic: noop
|
|
139844
139872
|
};
|
|
139845
139873
|
const documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings);
|
|
139874
|
+
let releasedScriptKinds = /* @__PURE__ */ new Set();
|
|
139846
139875
|
if (isProgramUptoDate(program, rootFileNames, newSettings, (_path, fileName) => host.getScriptVersion(fileName), (fileName) => compilerHost.fileExists(fileName), hasInvalidatedResolutions, hasInvalidatedLibResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
139876
|
+
compilerHost = void 0;
|
|
139877
|
+
parsedCommandLines = void 0;
|
|
139878
|
+
releasedScriptKinds = void 0;
|
|
139847
139879
|
return;
|
|
139848
139880
|
}
|
|
139849
139881
|
const options = {
|
|
@@ -139856,6 +139888,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
139856
139888
|
program = createProgram(options);
|
|
139857
139889
|
compilerHost = void 0;
|
|
139858
139890
|
parsedCommandLines = void 0;
|
|
139891
|
+
releasedScriptKinds = void 0;
|
|
139859
139892
|
sourceMapper.clearCache();
|
|
139860
139893
|
program.getTypeChecker();
|
|
139861
139894
|
return;
|
|
@@ -139910,10 +139943,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
139910
139943
|
if (!shouldCreateNewSourceFile) {
|
|
139911
139944
|
const oldSourceFile = program && program.getSourceFileByPath(path);
|
|
139912
139945
|
if (oldSourceFile) {
|
|
139913
|
-
if (scriptKind === oldSourceFile.scriptKind) {
|
|
139946
|
+
if (scriptKind === oldSourceFile.scriptKind || releasedScriptKinds.has(oldSourceFile.resolvedPath)) {
|
|
139914
139947
|
return documentRegistry.updateDocumentWithKey(fileName, path, host, documentRegistryBucketKey, scriptSnapshot, scriptVersion, scriptKind, languageVersionOrOptions);
|
|
139915
139948
|
} else {
|
|
139916
139949
|
documentRegistry.releaseDocumentWithKey(oldSourceFile.resolvedPath, documentRegistry.getKeyForCompilationSettings(program.getCompilerOptions()), oldSourceFile.scriptKind, oldSourceFile.impliedNodeFormat);
|
|
139950
|
+
releasedScriptKinds.add(oldSourceFile.resolvedPath);
|
|
139917
139951
|
}
|
|
139918
139952
|
}
|
|
139919
139953
|
}
|
|
@@ -160833,9 +160867,9 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
160833
160867
|
if (refNode.parent.kind === 303 /* ShorthandPropertyAssignment */) {
|
|
160834
160868
|
getReferenceEntriesForShorthandPropertyAssignment(refNode, state.checker, addReference2);
|
|
160835
160869
|
}
|
|
160836
|
-
const
|
|
160837
|
-
if (
|
|
160838
|
-
addReference2(
|
|
160870
|
+
const containingNode = getContainingNodeIfInHeritageClause(refNode);
|
|
160871
|
+
if (containingNode) {
|
|
160872
|
+
addReference2(containingNode);
|
|
160839
160873
|
return;
|
|
160840
160874
|
}
|
|
160841
160875
|
const typeNode = findAncestor(refNode, (a) => !isQualifiedName(a.parent) && !isTypeNode(a.parent) && !isTypeElement(a.parent));
|
|
@@ -160862,8 +160896,8 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
160862
160896
|
addReference2(e);
|
|
160863
160897
|
}
|
|
160864
160898
|
}
|
|
160865
|
-
function
|
|
160866
|
-
return isIdentifier(node) || isPropertyAccessExpression(node) ?
|
|
160899
|
+
function getContainingNodeIfInHeritageClause(node) {
|
|
160900
|
+
return isIdentifier(node) || isPropertyAccessExpression(node) ? getContainingNodeIfInHeritageClause(node.parent) : isExpressionWithTypeArguments(node) ? tryCast(node.parent.parent, or(isClassLike, isInterfaceDeclaration)) : void 0;
|
|
160867
160901
|
}
|
|
160868
160902
|
function isImplementationExpression(node) {
|
|
160869
160903
|
switch (node.kind) {
|
|
@@ -162375,7 +162409,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
162375
162409
|
const tags = (parameters ? parameterDocComments(parameters || [], isJavaScriptFile, indentationStr, newLine) : "") + (hasReturn2 ? returnsDocComment(indentationStr, newLine) : "");
|
|
162376
162410
|
const openComment = "/**";
|
|
162377
162411
|
const closeComment = " */";
|
|
162378
|
-
const hasTag = (
|
|
162412
|
+
const hasTag = length(getJSDocTags(commentOwner)) > 0;
|
|
162379
162413
|
if (tags && !hasTag) {
|
|
162380
162414
|
const preamble = openComment + newLine + indentationStr + " * ";
|
|
162381
162415
|
const endLine = tokenStart === position ? newLine + indentationStr : "";
|
|
@@ -165896,6 +165930,17 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
165896
165930
|
this.insertNodeAt(sourceFile, pos, insert, options);
|
|
165897
165931
|
}
|
|
165898
165932
|
}
|
|
165933
|
+
insertNodesAtEndOfFile(sourceFile, newNodes, blankLineBetween) {
|
|
165934
|
+
this.insertAtEndOfFile(sourceFile, newNodes, blankLineBetween);
|
|
165935
|
+
}
|
|
165936
|
+
insertAtEndOfFile(sourceFile, insert, blankLineBetween) {
|
|
165937
|
+
const pos = sourceFile.end + 1;
|
|
165938
|
+
const options = {
|
|
165939
|
+
prefix: this.newLineCharacter,
|
|
165940
|
+
suffix: this.newLineCharacter + (blankLineBetween ? this.newLineCharacter : "")
|
|
165941
|
+
};
|
|
165942
|
+
this.insertNodesAt(sourceFile, pos, insert, options);
|
|
165943
|
+
}
|
|
165899
165944
|
insertStatementsInNewFile(fileName, statements, oldFile) {
|
|
165900
165945
|
if (!this.newFileChanges) {
|
|
165901
165946
|
this.newFileChanges = createMultiMap();
|
|
@@ -167928,7 +167973,8 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
167928
167973
|
}
|
|
167929
167974
|
processNode(enclosingNode, enclosingNode, startLine, undecoratedStartLine, initialIndentation, delta);
|
|
167930
167975
|
}
|
|
167931
|
-
|
|
167976
|
+
const remainingTrivia = formattingScanner.getCurrentLeadingTrivia();
|
|
167977
|
+
if (remainingTrivia) {
|
|
167932
167978
|
const indentation = SmartIndenter.nodeWillIndentChild(
|
|
167933
167979
|
options,
|
|
167934
167980
|
enclosingNode,
|
|
@@ -167938,25 +167984,30 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
167938
167984
|
/*indentByDefault*/
|
|
167939
167985
|
false
|
|
167940
167986
|
) ? initialIndentation + options.indentSize : initialIndentation;
|
|
167941
|
-
|
|
167942
|
-
|
|
167943
|
-
|
|
167944
|
-
|
|
167945
|
-
|
|
167946
|
-
|
|
167947
|
-
|
|
167948
|
-
(item) => processRange(
|
|
167987
|
+
indentTriviaItems(
|
|
167988
|
+
remainingTrivia,
|
|
167989
|
+
indentation,
|
|
167990
|
+
/*indentNextTokenOrTrivia*/
|
|
167991
|
+
true,
|
|
167992
|
+
(item) => {
|
|
167993
|
+
processRange(
|
|
167949
167994
|
item,
|
|
167950
167995
|
sourceFile.getLineAndCharacterOfPosition(item.pos),
|
|
167951
167996
|
enclosingNode,
|
|
167952
167997
|
enclosingNode,
|
|
167953
167998
|
/*dynamicIndentation*/
|
|
167954
167999
|
void 0
|
|
167955
|
-
)
|
|
167956
|
-
|
|
167957
|
-
|
|
167958
|
-
|
|
168000
|
+
);
|
|
168001
|
+
insertIndentation(
|
|
168002
|
+
item.pos,
|
|
168003
|
+
indentation,
|
|
168004
|
+
/*lineAdded*/
|
|
168005
|
+
false
|
|
168006
|
+
);
|
|
167959
168007
|
}
|
|
168008
|
+
);
|
|
168009
|
+
if (options.trimTrailingWhitespace !== false) {
|
|
168010
|
+
trimTrailingWhitespacesForRemainingRange(remainingTrivia);
|
|
167960
168011
|
}
|
|
167961
168012
|
}
|
|
167962
168013
|
if (previousRange && formattingScanner.getTokenFullStart() >= originalRange.end) {
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
|
|
|
54
54
|
|
|
55
55
|
// src/compiler/corePublic.ts
|
|
56
56
|
var versionMajorMinor = "5.2";
|
|
57
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
57
|
+
var version = `${versionMajorMinor}.0-dev.20230526`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.2.0-dev.
|
|
5
|
+
"version": "5.2.0-dev.20230526",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -113,5 +113,5 @@
|
|
|
113
113
|
"node": "20.1.0",
|
|
114
114
|
"npm": "8.19.4"
|
|
115
115
|
},
|
|
116
|
-
"gitHead": "
|
|
116
|
+
"gitHead": "fb7efcfe06ed68bf31614e43f474732167302728"
|
|
117
117
|
}
|