Update LKG

This commit is contained in:
Daniel Rosenwasser
2023-01-25 20:14:47 +00:00
parent d4d640f32b
commit dcad07ffd2
7 changed files with 5828 additions and 108 deletions
+25 -9
View File
@@ -11724,6 +11724,20 @@ function getScriptTargetFeatures() {
BigUint64Array: ["at"],
ObjectConstructor: ["hasOwn"],
Error: ["cause"]
},
es2023: {
Array: ["findLastIndex", "findLast"],
Int8Array: ["findLastIndex", "findLast"],
Uint8Array: ["findLastIndex", "findLast"],
Uint8ClampedArray: ["findLastIndex", "findLast"],
Int16Array: ["findLastIndex", "findLast"],
Uint16Array: ["findLastIndex", "findLast"],
Int32Array: ["findLastIndex", "findLast"],
Uint32Array: ["findLastIndex", "findLast"],
Float32Array: ["findLastIndex", "findLast"],
Float64Array: ["findLastIndex", "findLast"],
BigInt64Array: ["findLastIndex", "findLast"],
BigUint64Array: ["findLastIndex", "findLast"]
}
};
}
@@ -46308,7 +46322,7 @@ function createTypeChecker(host) {
return writer ? symbolToStringWorker(writer).getText() : usingSingleLineStringWriter(symbolToStringWorker);
function symbolToStringWorker(writer2) {
const entity = builder(symbol, meaning, enclosingDeclaration, nodeFlags);
const printer = (enclosingDeclaration == null ? void 0 : enclosingDeclaration.kind) === 308 /* SourceFile */ ? createPrinter({ removeComments: true, neverAsciiEscape: true }) : createPrinter({ removeComments: true });
const printer = (enclosingDeclaration == null ? void 0 : enclosingDeclaration.kind) === 308 /* SourceFile */ ? createPrinterWithRemoveCommentsNeverAsciiEscape() : createPrinterWithRemoveComments();
const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
printer.writeNode(
4 /* Unspecified */,
@@ -46330,7 +46344,7 @@ function createTypeChecker(host) {
sigOutput = kind === 1 /* Construct */ ? 177 /* ConstructSignature */ : 176 /* CallSignature */;
}
const sig = nodeBuilder.signatureToSignatureDeclaration(signature, sigOutput, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | 512 /* WriteTypeParametersInQualifiedName */);
const printer = createPrinter({ removeComments: true, omitTrailingSemicolon: true });
const printer = createPrinterWithRemoveCommentsOmitTrailingSemicolon();
const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
printer.writeNode(
4 /* Unspecified */,
@@ -46347,8 +46361,7 @@ function createTypeChecker(host) {
const typeNode = nodeBuilder.typeToTypeNode(type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | (noTruncation ? 1 /* NoTruncation */ : 0));
if (typeNode === void 0)
return Debug.fail("should always get typenode");
const options = { removeComments: type !== unresolvedType };
const printer = createPrinter(options);
const printer = type !== unresolvedType ? createPrinterWithRemoveComments() : createPrinterWithDefaults();
const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
printer.writeNode(
4 /* Unspecified */,
@@ -49699,7 +49712,7 @@ function createTypeChecker(host) {
typePredicate.type && nodeBuilder.typeToTypeNode(typePredicate.type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | 512 /* WriteTypeParametersInQualifiedName */)
// TODO: GH#18217
);
const printer = createPrinter({ removeComments: true });
const printer = createPrinterWithRemoveComments();
const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
printer.writeNode(
4 /* Unspecified */,
@@ -64727,7 +64740,7 @@ function createTypeChecker(host) {
return getNonMissingTypeOfSymbol(symbol);
}
function getControlFlowContainer(node) {
return findAncestor(node.parent, (node2) => isFunctionLike(node2) && !getImmediatelyInvokedFunctionExpression(node2) || node2.kind === 265 /* ModuleBlock */ || node2.kind === 308 /* SourceFile */ || node2.kind === 295 /* CatchClause */ || node2.kind === 169 /* PropertyDeclaration */);
return findAncestor(node.parent, (node2) => isFunctionLike(node2) && !getImmediatelyInvokedFunctionExpression(node2) || node2.kind === 265 /* ModuleBlock */ || node2.kind === 308 /* SourceFile */ || node2.kind === 169 /* PropertyDeclaration */);
}
function isSymbolAssigned(symbol) {
if (!symbol.valueDeclaration) {
@@ -64988,14 +65001,13 @@ function createTypeChecker(host) {
const isParameter2 = getRootDeclaration(declaration).kind === 166 /* Parameter */;
const declarationContainer = getControlFlowContainer(declaration);
let flowContainer = getControlFlowContainer(node);
const isCatch = flowContainer.kind === 295 /* CatchClause */;
const isOuterVariable = flowContainer !== declarationContainer;
const isSpreadDestructuringAssignmentTarget = node.parent && node.parent.parent && isSpreadAssignment(node.parent) && isDestructuringAssignmentTarget(node.parent.parent);
const isModuleExports = symbol.flags & 134217728 /* ModuleExports */;
while (flowContainer !== declarationContainer && (flowContainer.kind === 215 /* FunctionExpression */ || flowContainer.kind === 216 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstVariable(localOrExportSymbol) && type !== autoArrayType || isParameter2 && !isSymbolAssigned(localOrExportSymbol))) {
flowContainer = getControlFlowContainer(flowContainer);
}
const assumeInitialized = isParameter2 || isCatch || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 278 /* ExportSpecifier */) || node.parent.kind === 232 /* NonNullExpression */ || declaration.kind === 257 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 16777216 /* Ambient */;
const assumeInitialized = isParameter2 || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 278 /* ExportSpecifier */) || node.parent.kind === 232 /* NonNullExpression */ || declaration.kind === 257 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 16777216 /* Ambient */;
const initialType = assumeInitialized ? isParameter2 ? removeOptionalityFromDeclaredType(type, declaration) : type : type === autoType || type === autoArrayType ? undefinedType : getOptionalType(type);
const flowType = getFlowTypeOfReference(node, type, initialType, flowContainer);
if (!isEvolvingArrayOperationTarget(node) && (type === autoType || type === autoArrayType)) {
@@ -78255,7 +78267,7 @@ function createTypeChecker(host) {
if (typeAnnotationNode) {
checkTypeAssignableTo(checkExpressionCached(node.expression), getTypeFromTypeNode(typeAnnotationNode), node.expression);
}
const isIllegalExportDefaultInCJS = !node.isExportEquals && compilerOptions.verbatimModuleSyntax && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */);
const isIllegalExportDefaultInCJS = !node.isExportEquals && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */);
if (node.expression.kind === 79 /* Identifier */) {
const id = node.expression;
const sym = resolveEntityName(
@@ -106274,6 +106286,10 @@ function emitUsingBuildInfoWorker(config, host, getCommandLine, customTransforme
);
return outputFiles;
}
var createPrinterWithDefaults = memoize(() => createPrinter({}));
var createPrinterWithRemoveComments = memoize(() => createPrinter({ removeComments: true }));
var createPrinterWithRemoveCommentsNeverAsciiEscape = memoize(() => createPrinter({ removeComments: true, neverAsciiEscape: true }));
var createPrinterWithRemoveCommentsOmitTrailingSemicolon = memoize(() => createPrinter({ removeComments: true, omitTrailingSemicolon: true }));
function createPrinter(printerOptions = {}, handlers = {}) {
const {
hasGlobalName,
+55 -32
View File
@@ -429,6 +429,10 @@ __export(server_exports, {
createPatternMatcher: () => createPatternMatcher,
createPrependNodes: () => createPrependNodes,
createPrinter: () => createPrinter,
createPrinterWithDefaults: () => createPrinterWithDefaults,
createPrinterWithRemoveComments: () => createPrinterWithRemoveComments,
createPrinterWithRemoveCommentsNeverAsciiEscape: () => createPrinterWithRemoveCommentsNeverAsciiEscape,
createPrinterWithRemoveCommentsOmitTrailingSemicolon: () => createPrinterWithRemoveCommentsOmitTrailingSemicolon,
createProgram: () => createProgram,
createProgramHost: () => createProgramHost,
createPropertyNameNodeForIdentifierOrLiteral: () => createPropertyNameNodeForIdentifierOrLiteral,
@@ -15492,6 +15496,20 @@ function getScriptTargetFeatures() {
BigUint64Array: ["at"],
ObjectConstructor: ["hasOwn"],
Error: ["cause"]
},
es2023: {
Array: ["findLastIndex", "findLast"],
Int8Array: ["findLastIndex", "findLast"],
Uint8Array: ["findLastIndex", "findLast"],
Uint8ClampedArray: ["findLastIndex", "findLast"],
Int16Array: ["findLastIndex", "findLast"],
Uint16Array: ["findLastIndex", "findLast"],
Int32Array: ["findLastIndex", "findLast"],
Uint32Array: ["findLastIndex", "findLast"],
Float32Array: ["findLastIndex", "findLast"],
Float64Array: ["findLastIndex", "findLast"],
BigInt64Array: ["findLastIndex", "findLast"],
BigUint64Array: ["findLastIndex", "findLast"]
}
};
}
@@ -50977,7 +50995,7 @@ function createTypeChecker(host) {
return writer ? symbolToStringWorker(writer).getText() : usingSingleLineStringWriter(symbolToStringWorker);
function symbolToStringWorker(writer2) {
const entity = builder(symbol, meaning, enclosingDeclaration, nodeFlags);
const printer = (enclosingDeclaration == null ? void 0 : enclosingDeclaration.kind) === 308 /* SourceFile */ ? createPrinter({ removeComments: true, neverAsciiEscape: true }) : createPrinter({ removeComments: true });
const printer = (enclosingDeclaration == null ? void 0 : enclosingDeclaration.kind) === 308 /* SourceFile */ ? createPrinterWithRemoveCommentsNeverAsciiEscape() : createPrinterWithRemoveComments();
const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
printer.writeNode(
4 /* Unspecified */,
@@ -50999,7 +51017,7 @@ function createTypeChecker(host) {
sigOutput = kind === 1 /* Construct */ ? 177 /* ConstructSignature */ : 176 /* CallSignature */;
}
const sig = nodeBuilder.signatureToSignatureDeclaration(signature, sigOutput, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | 512 /* WriteTypeParametersInQualifiedName */);
const printer = createPrinter({ removeComments: true, omitTrailingSemicolon: true });
const printer = createPrinterWithRemoveCommentsOmitTrailingSemicolon();
const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
printer.writeNode(
4 /* Unspecified */,
@@ -51016,8 +51034,7 @@ function createTypeChecker(host) {
const typeNode = nodeBuilder.typeToTypeNode(type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | (noTruncation ? 1 /* NoTruncation */ : 0));
if (typeNode === void 0)
return Debug.fail("should always get typenode");
const options = { removeComments: type !== unresolvedType };
const printer = createPrinter(options);
const printer = type !== unresolvedType ? createPrinterWithRemoveComments() : createPrinterWithDefaults();
const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
printer.writeNode(
4 /* Unspecified */,
@@ -54368,7 +54385,7 @@ function createTypeChecker(host) {
typePredicate.type && nodeBuilder.typeToTypeNode(typePredicate.type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | 512 /* WriteTypeParametersInQualifiedName */)
// TODO: GH#18217
);
const printer = createPrinter({ removeComments: true });
const printer = createPrinterWithRemoveComments();
const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
printer.writeNode(
4 /* Unspecified */,
@@ -69396,7 +69413,7 @@ function createTypeChecker(host) {
return getNonMissingTypeOfSymbol(symbol);
}
function getControlFlowContainer(node) {
return findAncestor(node.parent, (node2) => isFunctionLike(node2) && !getImmediatelyInvokedFunctionExpression(node2) || node2.kind === 265 /* ModuleBlock */ || node2.kind === 308 /* SourceFile */ || node2.kind === 295 /* CatchClause */ || node2.kind === 169 /* PropertyDeclaration */);
return findAncestor(node.parent, (node2) => isFunctionLike(node2) && !getImmediatelyInvokedFunctionExpression(node2) || node2.kind === 265 /* ModuleBlock */ || node2.kind === 308 /* SourceFile */ || node2.kind === 169 /* PropertyDeclaration */);
}
function isSymbolAssigned(symbol) {
if (!symbol.valueDeclaration) {
@@ -69657,14 +69674,13 @@ function createTypeChecker(host) {
const isParameter2 = getRootDeclaration(declaration).kind === 166 /* Parameter */;
const declarationContainer = getControlFlowContainer(declaration);
let flowContainer = getControlFlowContainer(node);
const isCatch = flowContainer.kind === 295 /* CatchClause */;
const isOuterVariable = flowContainer !== declarationContainer;
const isSpreadDestructuringAssignmentTarget = node.parent && node.parent.parent && isSpreadAssignment(node.parent) && isDestructuringAssignmentTarget(node.parent.parent);
const isModuleExports = symbol.flags & 134217728 /* ModuleExports */;
while (flowContainer !== declarationContainer && (flowContainer.kind === 215 /* FunctionExpression */ || flowContainer.kind === 216 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstVariable(localOrExportSymbol) && type !== autoArrayType || isParameter2 && !isSymbolAssigned(localOrExportSymbol))) {
flowContainer = getControlFlowContainer(flowContainer);
}
const assumeInitialized = isParameter2 || isCatch || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 278 /* ExportSpecifier */) || node.parent.kind === 232 /* NonNullExpression */ || declaration.kind === 257 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 16777216 /* Ambient */;
const assumeInitialized = isParameter2 || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 278 /* ExportSpecifier */) || node.parent.kind === 232 /* NonNullExpression */ || declaration.kind === 257 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 16777216 /* Ambient */;
const initialType = assumeInitialized ? isParameter2 ? removeOptionalityFromDeclaredType(type, declaration) : type : type === autoType || type === autoArrayType ? undefinedType : getOptionalType(type);
const flowType = getFlowTypeOfReference(node, type, initialType, flowContainer);
if (!isEvolvingArrayOperationTarget(node) && (type === autoType || type === autoArrayType)) {
@@ -82924,7 +82940,7 @@ function createTypeChecker(host) {
if (typeAnnotationNode) {
checkTypeAssignableTo(checkExpressionCached(node.expression), getTypeFromTypeNode(typeAnnotationNode), node.expression);
}
const isIllegalExportDefaultInCJS = !node.isExportEquals && compilerOptions.verbatimModuleSyntax && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */);
const isIllegalExportDefaultInCJS = !node.isExportEquals && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */);
if (node.expression.kind === 79 /* Identifier */) {
const id = node.expression;
const sym = resolveEntityName(
@@ -111125,6 +111141,10 @@ function emitUsingBuildInfoWorker(config, host, getCommandLine, customTransforme
);
return outputFiles;
}
var createPrinterWithDefaults = memoize(() => createPrinter({}));
var createPrinterWithRemoveComments = memoize(() => createPrinter({ removeComments: true }));
var createPrinterWithRemoveCommentsNeverAsciiEscape = memoize(() => createPrinter({ removeComments: true, neverAsciiEscape: true }));
var createPrinterWithRemoveCommentsOmitTrailingSemicolon = memoize(() => createPrinter({ removeComments: true, omitTrailingSemicolon: true }));
function createPrinter(printerOptions = {}, handlers = {}) {
const {
hasGlobalName,
@@ -126912,6 +126932,10 @@ __export(ts_exports3, {
createPatternMatcher: () => createPatternMatcher,
createPrependNodes: () => createPrependNodes,
createPrinter: () => createPrinter,
createPrinterWithDefaults: () => createPrinterWithDefaults,
createPrinterWithRemoveComments: () => createPrinterWithRemoveComments,
createPrinterWithRemoveCommentsNeverAsciiEscape: () => createPrinterWithRemoveCommentsNeverAsciiEscape,
createPrinterWithRemoveCommentsOmitTrailingSemicolon: () => createPrinterWithRemoveCommentsOmitTrailingSemicolon,
createProgram: () => createProgram,
createProgramHost: () => createProgramHost,
createPropertyNameNodeForIdentifierOrLiteral: () => createPropertyNameNodeForIdentifierOrLiteral,
@@ -131004,7 +131028,7 @@ function signatureToDisplayParts(typechecker, signature, enclosingDeclaration, f
function nodeToDisplayParts(node, enclosingDeclaration) {
const file = enclosingDeclaration.getSourceFile();
return mapToDisplayParts((writer) => {
const printer = createPrinter({ removeComments: true, omitTrailingSemicolon: true });
const printer = createPrinterWithRemoveCommentsOmitTrailingSemicolon();
printer.writeNode(4 /* Unspecified */, node, file, writer);
});
}
@@ -137389,12 +137413,9 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
Debug.assertEqual(action.type, "install package");
return host.installPackage ? host.installPackage({ fileName: getPath(action.file), packageName: action.packageName }) : Promise.reject("Host does not implement `installPackage`");
}
function getDocCommentTemplateAtPosition2(fileName, position, options) {
return ts_JsDoc_exports.getDocCommentTemplateAtPosition(getNewLineOrDefaultFromHost(
host,
/*formatSettings*/
void 0
), syntaxTreeCache.getCurrentSourceFile(fileName), position, options);
function getDocCommentTemplateAtPosition2(fileName, position, options, formatOptions) {
const formatSettings = formatOptions ? ts_formatting_exports.getFormatContext(formatOptions, host).options : void 0;
return ts_JsDoc_exports.getDocCommentTemplateAtPosition(getNewLineOrDefaultFromHost(host, formatSettings), syntaxTreeCache.getCurrentSourceFile(fileName), position, options);
}
function isValidBraceCompletionAtPosition(fileName, position, openingBrace) {
if (openingBrace === 60 /* lessThan */) {
@@ -138575,10 +138596,10 @@ var LanguageServiceShimObject = class extends ShimBase {
}
);
}
getDocCommentTemplateAtPosition(fileName, position, options) {
getDocCommentTemplateAtPosition(fileName, position, options, formatOptions) {
return this.forwardJSONCall(
`getDocCommentTemplateAtPosition('${fileName}', ${position})`,
() => this.languageService.getDocCommentTemplateAtPosition(fileName, position, options)
() => this.languageService.getDocCommentTemplateAtPosition(fileName, position, options, formatOptions)
);
}
/// NAVIGATE TO
@@ -139470,7 +139491,7 @@ function getCallHierarchyItemName(program, node) {
}
}
if (text === void 0) {
const printer = createPrinter({ removeComments: true, omitTrailingSemicolon: true });
const printer = createPrinterWithRemoveCommentsOmitTrailingSemicolon();
text = usingSingleLineStringWriter((writer) => printer.writeNode(4 /* Unspecified */, node, node.getSourceFile(), writer));
}
return { text, pos: declName.getStart(), end: declName.getEnd() };
@@ -146192,7 +146213,7 @@ function getDeleteAction(context, { name, jsDocHost, jsDocParameterTag }) {
Diagnostics.Delete_all_unused_param_tags
);
}
function getRenameAction(context, { name, signature, jsDocParameterTag }) {
function getRenameAction(context, { name, jsDocHost, signature, jsDocParameterTag }) {
if (!length(signature.parameters))
return void 0;
const sourceFile = context.sourceFile;
@@ -146215,7 +146236,7 @@ function getRenameAction(context, { name, signature, jsDocParameterTag }) {
jsDocParameterTag.isNameFirst,
jsDocParameterTag.comment
);
const changes = ts_textChanges_exports.ChangeTracker.with(context, (changeTracker) => changeTracker.replaceJSDocComment(sourceFile, signature, map(tags, (t) => t === jsDocParameterTag ? newJSDocParameterTag : t)));
const changes = ts_textChanges_exports.ChangeTracker.with(context, (changeTracker) => changeTracker.replaceJSDocComment(sourceFile, jsDocHost, map(tags, (t) => t === jsDocParameterTag ? newJSDocParameterTag : t)));
return createCodeFixActionWithoutFixAll(renameUnmatchedParameter, changes, [Diagnostics.Rename_param_tag_name_0_to_1, name.getText(sourceFile), parameterName]);
}
function getInfo10(sourceFile, pos) {
@@ -157240,8 +157261,7 @@ function provideInlayHints(context) {
}
function printTypeInSingleLine(type) {
const flags = 70221824 /* IgnoreErrors */ | 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */;
const options = { removeComments: true };
const printer = createPrinter(options);
const printer = createPrinterWithRemoveComments();
return usingSingleLineStringWriter((writer) => {
const typeNode = checker.typeToTypeNode(
type,
@@ -157331,6 +157351,8 @@ var jsDocTagNames = [
"lends",
"license",
"link",
"linkcode",
"linkplain",
"listens",
"member",
"memberof",
@@ -157343,6 +157365,7 @@ var jsDocTagNames = [
"package",
"param",
"private",
"prop",
"property",
"protected",
"public",
@@ -164169,7 +164192,7 @@ function createTypeHelpItems(symbol, { argumentCount, argumentsSpan: applicableS
}
function getTypeHelpItem(symbol, typeParameters, checker, enclosingDeclaration, sourceFile) {
const typeSymbolDisplay = symbolToDisplayParts(checker, symbol);
const printer = createPrinter({ removeComments: true });
const printer = createPrinterWithRemoveComments();
const parameters = typeParameters.map((t) => createSignatureHelpParameterForTypeParameter(t, checker, enclosingDeclaration, sourceFile, printer));
const documentation = symbol.getDocumentationComment(checker);
const tags = symbol.getJsDocTags(checker);
@@ -164213,7 +164236,7 @@ function returnTypeToDisplayParts(candidateSignature, enclosingDeclaration, chec
}
function itemInfoForTypeParameters(candidateSignature, checker, enclosingDeclaration, sourceFile) {
const typeParameters = (candidateSignature.target || candidateSignature).typeParameters;
const printer = createPrinter({ removeComments: true });
const printer = createPrinterWithRemoveComments();
const parameters = (typeParameters || emptyArray).map((t) => createSignatureHelpParameterForTypeParameter(t, checker, enclosingDeclaration, sourceFile, printer));
const thisParameter = candidateSignature.thisParameter ? [checker.symbolToParameterDeclaration(candidateSignature.thisParameter, enclosingDeclaration, signatureHelpNodeBuilderFlags)] : [];
return checker.getExpandedParameters(candidateSignature).map((paramList) => {
@@ -164225,7 +164248,7 @@ function itemInfoForTypeParameters(candidateSignature, checker, enclosingDeclara
});
}
function itemInfoForParameters(candidateSignature, checker, enclosingDeclaration, sourceFile) {
const printer = createPrinter({ removeComments: true });
const printer = createPrinterWithRemoveComments();
const typeParameterParts = mapToDisplayParts((writer) => {
if (candidateSignature.typeParameters && candidateSignature.typeParameters.length) {
const args = factory.createNodeArray(candidateSignature.typeParameters.map((p) => checker.typeParameterToDeclaration(p, enclosingDeclaration, signatureHelpNodeBuilderFlags)));
@@ -164600,7 +164623,6 @@ function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, so
let hasAddedSymbolInfo = false;
const isThisExpression = location.kind === 108 /* ThisKeyword */ && isInExpressionContext(location) || isThisInTypeQuery(location);
let type;
let printer;
let documentationFromAlias;
let tagsFromAlias;
let hasMultipleSignatures = false;
@@ -164993,10 +165015,7 @@ function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, so
}
return { displayParts, documentation, symbolKind, tags: tags.length === 0 ? void 0 : tags };
function getPrinter() {
if (!printer) {
printer = createPrinter({ removeComments: true });
}
return printer;
return createPrinterWithRemoveComments();
}
function prefixNextMeaning() {
if (displayParts.length) {
@@ -178153,7 +178172,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
getDocCommentTemplate(args) {
const { file, languageService } = this.getFileAndLanguageServiceForSyntacticOperation(args);
const position = this.getPositionInFile(args, file);
return languageService.getDocCommentTemplateAtPosition(file, position, this.getPreferences(file));
return languageService.getDocCommentTemplateAtPosition(file, position, this.getPreferences(file), this.getFormatOptions(file));
}
getSpanOfEnclosingComment(args) {
const { file, languageService } = this.getFileAndLanguageServiceForSyntacticOperation(args);
@@ -181076,6 +181095,10 @@ start(initializeNodeSystem(), require("os").platform());
createPatternMatcher,
createPrependNodes,
createPrinter,
createPrinterWithDefaults,
createPrinterWithRemoveComments,
createPrinterWithRemoveCommentsNeverAsciiEscape,
createPrinterWithRemoveCommentsOmitTrailingSemicolon,
createProgram,
createProgramHost,
createPropertyNameNodeForIdentifierOrLiteral,
+1 -1
View File
@@ -9990,7 +9990,7 @@ declare namespace ts {
getFormattingEditsForRange(fileName: string, start: number, end: number, options: FormatCodeOptions | FormatCodeSettings): TextChange[];
getFormattingEditsForDocument(fileName: string, options: FormatCodeOptions | FormatCodeSettings): TextChange[];
getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions | FormatCodeSettings): TextChange[];
getDocCommentTemplateAtPosition(fileName: string, position: number, options?: DocCommentTemplateOptions): TextInsertion | undefined;
getDocCommentTemplateAtPosition(fileName: string, position: number, options?: DocCommentTemplateOptions, formatOptions?: FormatCodeSettings): TextInsertion | undefined;
isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): boolean;
/**
* This will return a defined result if the position is after the `>` of the opening tag, or somewhere in the text, of a JSXElement with no closing tag.
+52 -33
View File
@@ -13247,6 +13247,20 @@ ${lanes.join("\n")}
BigUint64Array: ["at"],
ObjectConstructor: ["hasOwn"],
Error: ["cause"]
},
es2023: {
Array: ["findLastIndex", "findLast"],
Int8Array: ["findLastIndex", "findLast"],
Uint8Array: ["findLastIndex", "findLast"],
Uint8ClampedArray: ["findLastIndex", "findLast"],
Int16Array: ["findLastIndex", "findLast"],
Uint16Array: ["findLastIndex", "findLast"],
Int32Array: ["findLastIndex", "findLast"],
Uint32Array: ["findLastIndex", "findLast"],
Float32Array: ["findLastIndex", "findLast"],
Float64Array: ["findLastIndex", "findLast"],
BigInt64Array: ["findLastIndex", "findLast"],
BigUint64Array: ["findLastIndex", "findLast"]
}
};
}
@@ -48708,7 +48722,7 @@ ${lanes.join("\n")}
return writer ? symbolToStringWorker(writer).getText() : usingSingleLineStringWriter(symbolToStringWorker);
function symbolToStringWorker(writer2) {
const entity = builder(symbol, meaning, enclosingDeclaration, nodeFlags);
const printer = (enclosingDeclaration == null ? void 0 : enclosingDeclaration.kind) === 308 /* SourceFile */ ? createPrinter({ removeComments: true, neverAsciiEscape: true }) : createPrinter({ removeComments: true });
const printer = (enclosingDeclaration == null ? void 0 : enclosingDeclaration.kind) === 308 /* SourceFile */ ? createPrinterWithRemoveCommentsNeverAsciiEscape() : createPrinterWithRemoveComments();
const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
printer.writeNode(
4 /* Unspecified */,
@@ -48730,7 +48744,7 @@ ${lanes.join("\n")}
sigOutput = kind === 1 /* Construct */ ? 177 /* ConstructSignature */ : 176 /* CallSignature */;
}
const sig = nodeBuilder.signatureToSignatureDeclaration(signature, sigOutput, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | 512 /* WriteTypeParametersInQualifiedName */);
const printer = createPrinter({ removeComments: true, omitTrailingSemicolon: true });
const printer = createPrinterWithRemoveCommentsOmitTrailingSemicolon();
const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
printer.writeNode(
4 /* Unspecified */,
@@ -48747,8 +48761,7 @@ ${lanes.join("\n")}
const typeNode = nodeBuilder.typeToTypeNode(type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | (noTruncation ? 1 /* NoTruncation */ : 0));
if (typeNode === void 0)
return Debug.fail("should always get typenode");
const options = { removeComments: type !== unresolvedType };
const printer = createPrinter(options);
const printer = type !== unresolvedType ? createPrinterWithRemoveComments() : createPrinterWithDefaults();
const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
printer.writeNode(
4 /* Unspecified */,
@@ -52099,7 +52112,7 @@ ${lanes.join("\n")}
typePredicate.type && nodeBuilder.typeToTypeNode(typePredicate.type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | 512 /* WriteTypeParametersInQualifiedName */)
// TODO: GH#18217
);
const printer = createPrinter({ removeComments: true });
const printer = createPrinterWithRemoveComments();
const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
printer.writeNode(
4 /* Unspecified */,
@@ -67127,7 +67140,7 @@ ${lanes.join("\n")}
return getNonMissingTypeOfSymbol(symbol);
}
function getControlFlowContainer(node) {
return findAncestor(node.parent, (node2) => isFunctionLike(node2) && !getImmediatelyInvokedFunctionExpression(node2) || node2.kind === 265 /* ModuleBlock */ || node2.kind === 308 /* SourceFile */ || node2.kind === 295 /* CatchClause */ || node2.kind === 169 /* PropertyDeclaration */);
return findAncestor(node.parent, (node2) => isFunctionLike(node2) && !getImmediatelyInvokedFunctionExpression(node2) || node2.kind === 265 /* ModuleBlock */ || node2.kind === 308 /* SourceFile */ || node2.kind === 169 /* PropertyDeclaration */);
}
function isSymbolAssigned(symbol) {
if (!symbol.valueDeclaration) {
@@ -67388,14 +67401,13 @@ ${lanes.join("\n")}
const isParameter2 = getRootDeclaration(declaration).kind === 166 /* Parameter */;
const declarationContainer = getControlFlowContainer(declaration);
let flowContainer = getControlFlowContainer(node);
const isCatch = flowContainer.kind === 295 /* CatchClause */;
const isOuterVariable = flowContainer !== declarationContainer;
const isSpreadDestructuringAssignmentTarget = node.parent && node.parent.parent && isSpreadAssignment(node.parent) && isDestructuringAssignmentTarget(node.parent.parent);
const isModuleExports = symbol.flags & 134217728 /* ModuleExports */;
while (flowContainer !== declarationContainer && (flowContainer.kind === 215 /* FunctionExpression */ || flowContainer.kind === 216 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstVariable(localOrExportSymbol) && type !== autoArrayType || isParameter2 && !isSymbolAssigned(localOrExportSymbol))) {
flowContainer = getControlFlowContainer(flowContainer);
}
const assumeInitialized = isParameter2 || isCatch || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 278 /* ExportSpecifier */) || node.parent.kind === 232 /* NonNullExpression */ || declaration.kind === 257 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 16777216 /* Ambient */;
const assumeInitialized = isParameter2 || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 278 /* ExportSpecifier */) || node.parent.kind === 232 /* NonNullExpression */ || declaration.kind === 257 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 16777216 /* Ambient */;
const initialType = assumeInitialized ? isParameter2 ? removeOptionalityFromDeclaredType(type, declaration) : type : type === autoType || type === autoArrayType ? undefinedType : getOptionalType(type);
const flowType = getFlowTypeOfReference(node, type, initialType, flowContainer);
if (!isEvolvingArrayOperationTarget(node) && (type === autoType || type === autoArrayType)) {
@@ -80655,7 +80667,7 @@ ${lanes.join("\n")}
if (typeAnnotationNode) {
checkTypeAssignableTo(checkExpressionCached(node.expression), getTypeFromTypeNode(typeAnnotationNode), node.expression);
}
const isIllegalExportDefaultInCJS = !node.isExportEquals && compilerOptions.verbatimModuleSyntax && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */);
const isIllegalExportDefaultInCJS = !node.isExportEquals && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */);
if (node.expression.kind === 79 /* Identifier */) {
const id = node.expression;
const sym = resolveEntityName(
@@ -113784,7 +113796,7 @@ ${lanes.join("\n")}
function getEmitListItem(emit, parenthesizerRule) {
return emit.length === 1 ? emitListItemNoParenthesizer : typeof parenthesizerRule === "object" ? emitListItemWithParenthesizerRuleSelector : emitListItemWithParenthesizerRule;
}
var brackets, notImplementedResolver, TempFlags;
var brackets, notImplementedResolver, createPrinterWithDefaults, createPrinterWithRemoveComments, createPrinterWithRemoveCommentsNeverAsciiEscape, createPrinterWithRemoveCommentsOmitTrailingSemicolon, TempFlags;
var init_emitter = __esm({
"src/compiler/emitter.ts"() {
"use strict";
@@ -113835,6 +113847,10 @@ ${lanes.join("\n")}
getDeclarationStatementsForSourceFile: notImplemented,
isImportRequiredByAugmentation: notImplemented
};
createPrinterWithDefaults = memoize(() => createPrinter({}));
createPrinterWithRemoveComments = memoize(() => createPrinter({ removeComments: true }));
createPrinterWithRemoveCommentsNeverAsciiEscape = memoize(() => createPrinter({ removeComments: true, neverAsciiEscape: true }));
createPrinterWithRemoveCommentsOmitTrailingSemicolon = memoize(() => createPrinter({ removeComments: true, omitTrailingSemicolon: true }));
TempFlags = /* @__PURE__ */ ((TempFlags2) => {
TempFlags2[TempFlags2["Auto"] = 0] = "Auto";
TempFlags2[TempFlags2["CountMask"] = 268435455] = "CountMask";
@@ -126889,7 +126905,7 @@ ${lanes.join("\n")}
function nodeToDisplayParts(node, enclosingDeclaration) {
const file = enclosingDeclaration.getSourceFile();
return mapToDisplayParts((writer) => {
const printer = createPrinter({ removeComments: true, omitTrailingSemicolon: true });
const printer = createPrinterWithRemoveCommentsOmitTrailingSemicolon();
printer.writeNode(4 /* Unspecified */, node, file, writer);
});
}
@@ -132743,12 +132759,9 @@ ${lanes.join("\n")}
Debug.assertEqual(action.type, "install package");
return host.installPackage ? host.installPackage({ fileName: getPath(action.file), packageName: action.packageName }) : Promise.reject("Host does not implement `installPackage`");
}
function getDocCommentTemplateAtPosition2(fileName, position, options) {
return ts_JsDoc_exports.getDocCommentTemplateAtPosition(getNewLineOrDefaultFromHost(
host,
/*formatSettings*/
void 0
), syntaxTreeCache.getCurrentSourceFile(fileName), position, options);
function getDocCommentTemplateAtPosition2(fileName, position, options, formatOptions) {
const formatSettings = formatOptions ? ts_formatting_exports.getFormatContext(formatOptions, host).options : void 0;
return ts_JsDoc_exports.getDocCommentTemplateAtPosition(getNewLineOrDefaultFromHost(host, formatSettings), syntaxTreeCache.getCurrentSourceFile(fileName), position, options);
}
function isValidBraceCompletionAtPosition(fileName, position, openingBrace) {
if (openingBrace === 60 /* lessThan */) {
@@ -134620,10 +134633,10 @@ ${lanes.join("\n")}
}
);
}
getDocCommentTemplateAtPosition(fileName, position, options) {
getDocCommentTemplateAtPosition(fileName, position, options, formatOptions) {
return this.forwardJSONCall(
`getDocCommentTemplateAtPosition('${fileName}', ${position})`,
() => this.languageService.getDocCommentTemplateAtPosition(fileName, position, options)
() => this.languageService.getDocCommentTemplateAtPosition(fileName, position, options, formatOptions)
);
}
/// NAVIGATE TO
@@ -135517,7 +135530,7 @@ ${lanes.join("\n")}
}
}
if (text === void 0) {
const printer = createPrinter({ removeComments: true, omitTrailingSemicolon: true });
const printer = createPrinterWithRemoveCommentsOmitTrailingSemicolon();
text = usingSingleLineStringWriter((writer) => printer.writeNode(4 /* Unspecified */, node, node.getSourceFile(), writer));
}
return { text, pos: declName.getStart(), end: declName.getEnd() };
@@ -142522,7 +142535,7 @@ ${lanes.join("\n")}
Diagnostics.Delete_all_unused_param_tags
);
}
function getRenameAction(context, { name, signature, jsDocParameterTag }) {
function getRenameAction(context, { name, jsDocHost, signature, jsDocParameterTag }) {
if (!length(signature.parameters))
return void 0;
const sourceFile = context.sourceFile;
@@ -142545,7 +142558,7 @@ ${lanes.join("\n")}
jsDocParameterTag.isNameFirst,
jsDocParameterTag.comment
);
const changes = ts_textChanges_exports.ChangeTracker.with(context, (changeTracker) => changeTracker.replaceJSDocComment(sourceFile, signature, map(tags, (t) => t === jsDocParameterTag ? newJSDocParameterTag : t)));
const changes = ts_textChanges_exports.ChangeTracker.with(context, (changeTracker) => changeTracker.replaceJSDocComment(sourceFile, jsDocHost, map(tags, (t) => t === jsDocParameterTag ? newJSDocParameterTag : t)));
return createCodeFixActionWithoutFixAll(renameUnmatchedParameter, changes, [Diagnostics.Rename_param_tag_name_0_to_1, name.getText(sourceFile), parameterName]);
}
function getInfo10(sourceFile, pos) {
@@ -153998,8 +154011,7 @@ ${lanes.join("\n")}
}
function printTypeInSingleLine(type) {
const flags = 70221824 /* IgnoreErrors */ | 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */;
const options = { removeComments: true };
const printer = createPrinter(options);
const printer = createPrinterWithRemoveComments();
return usingSingleLineStringWriter((writer) => {
const typeNode = checker.typeToTypeNode(
type,
@@ -154415,6 +154427,8 @@ ${lanes.join("\n")}
"lends",
"license",
"link",
"linkcode",
"linkplain",
"listens",
"member",
"memberof",
@@ -154427,6 +154441,7 @@ ${lanes.join("\n")}
"package",
"param",
"private",
"prop",
"property",
"protected",
"public",
@@ -161171,7 +161186,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
}
function getTypeHelpItem(symbol, typeParameters, checker, enclosingDeclaration, sourceFile) {
const typeSymbolDisplay = symbolToDisplayParts(checker, symbol);
const printer = createPrinter({ removeComments: true });
const printer = createPrinterWithRemoveComments();
const parameters = typeParameters.map((t) => createSignatureHelpParameterForTypeParameter(t, checker, enclosingDeclaration, sourceFile, printer));
const documentation = symbol.getDocumentationComment(checker);
const tags = symbol.getJsDocTags(checker);
@@ -161214,7 +161229,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
}
function itemInfoForTypeParameters(candidateSignature, checker, enclosingDeclaration, sourceFile) {
const typeParameters = (candidateSignature.target || candidateSignature).typeParameters;
const printer = createPrinter({ removeComments: true });
const printer = createPrinterWithRemoveComments();
const parameters = (typeParameters || emptyArray).map((t) => createSignatureHelpParameterForTypeParameter(t, checker, enclosingDeclaration, sourceFile, printer));
const thisParameter = candidateSignature.thisParameter ? [checker.symbolToParameterDeclaration(candidateSignature.thisParameter, enclosingDeclaration, signatureHelpNodeBuilderFlags)] : [];
return checker.getExpandedParameters(candidateSignature).map((paramList) => {
@@ -161226,7 +161241,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
});
}
function itemInfoForParameters(candidateSignature, checker, enclosingDeclaration, sourceFile) {
const printer = createPrinter({ removeComments: true });
const printer = createPrinterWithRemoveComments();
const typeParameterParts = mapToDisplayParts((writer) => {
if (candidateSignature.typeParameters && candidateSignature.typeParameters.length) {
const args = factory.createNodeArray(candidateSignature.typeParameters.map((p) => checker.typeParameterToDeclaration(p, enclosingDeclaration, signatureHelpNodeBuilderFlags)));
@@ -161632,7 +161647,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
let hasAddedSymbolInfo = false;
const isThisExpression = location.kind === 108 /* ThisKeyword */ && isInExpressionContext(location) || isThisInTypeQuery(location);
let type;
let printer;
let documentationFromAlias;
let tagsFromAlias;
let hasMultipleSignatures = false;
@@ -162025,10 +162039,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
}
return { displayParts, documentation, symbolKind, tags: tags.length === 0 ? void 0 : tags };
function getPrinter() {
if (!printer) {
printer = createPrinter({ removeComments: true });
}
return printer;
return createPrinterWithRemoveComments();
}
function prefixNextMeaning() {
if (displayParts.length) {
@@ -175499,7 +175510,7 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
getDocCommentTemplate(args) {
const { file, languageService } = this.getFileAndLanguageServiceForSyntacticOperation(args);
const position = this.getPositionInFile(args, file);
return languageService.getDocCommentTemplateAtPosition(file, position, this.getPreferences(file));
return languageService.getDocCommentTemplateAtPosition(file, position, this.getPreferences(file), this.getFormatOptions(file));
}
getSpanOfEnclosingComment(args) {
const { file, languageService } = this.getFileAndLanguageServiceForSyntacticOperation(args);
@@ -177735,6 +177746,10 @@ ${e.message}`;
createPatternMatcher: () => createPatternMatcher,
createPrependNodes: () => createPrependNodes,
createPrinter: () => createPrinter,
createPrinterWithDefaults: () => createPrinterWithDefaults,
createPrinterWithRemoveComments: () => createPrinterWithRemoveComments,
createPrinterWithRemoveCommentsNeverAsciiEscape: () => createPrinterWithRemoveCommentsNeverAsciiEscape,
createPrinterWithRemoveCommentsOmitTrailingSemicolon: () => createPrinterWithRemoveCommentsOmitTrailingSemicolon,
createProgram: () => createProgram,
createProgramHost: () => createProgramHost,
createPropertyNameNodeForIdentifierOrLiteral: () => createPropertyNameNodeForIdentifierOrLiteral,
@@ -180087,6 +180102,10 @@ ${e.message}`;
createPatternMatcher: () => createPatternMatcher,
createPrependNodes: () => createPrependNodes,
createPrinter: () => createPrinter,
createPrinterWithDefaults: () => createPrinterWithDefaults,
createPrinterWithRemoveComments: () => createPrinterWithRemoveComments,
createPrinterWithRemoveCommentsNeverAsciiEscape: () => createPrinterWithRemoveCommentsNeverAsciiEscape,
createPrinterWithRemoveCommentsOmitTrailingSemicolon: () => createPrinterWithRemoveCommentsOmitTrailingSemicolon,
createProgram: () => createProgram,
createProgramHost: () => createProgramHost,
createPropertyNameNodeForIdentifierOrLiteral: () => createPropertyNameNodeForIdentifierOrLiteral,
+1 -1
View File
@@ -6088,7 +6088,7 @@ declare namespace ts {
getFormattingEditsForRange(fileName: string, start: number, end: number, options: FormatCodeOptions | FormatCodeSettings): TextChange[];
getFormattingEditsForDocument(fileName: string, options: FormatCodeOptions | FormatCodeSettings): TextChange[];
getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions | FormatCodeSettings): TextChange[];
getDocCommentTemplateAtPosition(fileName: string, position: number, options?: DocCommentTemplateOptions): TextInsertion | undefined;
getDocCommentTemplateAtPosition(fileName: string, position: number, options?: DocCommentTemplateOptions, formatOptions?: FormatCodeSettings): TextInsertion | undefined;
isValidBraceCompletionAtPosition(fileName: string, position: number, openingBrace: number): boolean;
/**
* This will return a defined result if the position is after the `>` of the opening tag, or somewhere in the text, of a JSXElement with no closing tag.
+47 -32
View File
@@ -13247,6 +13247,20 @@ ${lanes.join("\n")}
BigUint64Array: ["at"],
ObjectConstructor: ["hasOwn"],
Error: ["cause"]
},
es2023: {
Array: ["findLastIndex", "findLast"],
Int8Array: ["findLastIndex", "findLast"],
Uint8Array: ["findLastIndex", "findLast"],
Uint8ClampedArray: ["findLastIndex", "findLast"],
Int16Array: ["findLastIndex", "findLast"],
Uint16Array: ["findLastIndex", "findLast"],
Int32Array: ["findLastIndex", "findLast"],
Uint32Array: ["findLastIndex", "findLast"],
Float32Array: ["findLastIndex", "findLast"],
Float64Array: ["findLastIndex", "findLast"],
BigInt64Array: ["findLastIndex", "findLast"],
BigUint64Array: ["findLastIndex", "findLast"]
}
};
}
@@ -48708,7 +48722,7 @@ ${lanes.join("\n")}
return writer ? symbolToStringWorker(writer).getText() : usingSingleLineStringWriter(symbolToStringWorker);
function symbolToStringWorker(writer2) {
const entity = builder(symbol, meaning, enclosingDeclaration, nodeFlags);
const printer = (enclosingDeclaration == null ? void 0 : enclosingDeclaration.kind) === 308 /* SourceFile */ ? createPrinter({ removeComments: true, neverAsciiEscape: true }) : createPrinter({ removeComments: true });
const printer = (enclosingDeclaration == null ? void 0 : enclosingDeclaration.kind) === 308 /* SourceFile */ ? createPrinterWithRemoveCommentsNeverAsciiEscape() : createPrinterWithRemoveComments();
const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
printer.writeNode(
4 /* Unspecified */,
@@ -48730,7 +48744,7 @@ ${lanes.join("\n")}
sigOutput = kind === 1 /* Construct */ ? 177 /* ConstructSignature */ : 176 /* CallSignature */;
}
const sig = nodeBuilder.signatureToSignatureDeclaration(signature, sigOutput, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | 512 /* WriteTypeParametersInQualifiedName */);
const printer = createPrinter({ removeComments: true, omitTrailingSemicolon: true });
const printer = createPrinterWithRemoveCommentsOmitTrailingSemicolon();
const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
printer.writeNode(
4 /* Unspecified */,
@@ -48747,8 +48761,7 @@ ${lanes.join("\n")}
const typeNode = nodeBuilder.typeToTypeNode(type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | (noTruncation ? 1 /* NoTruncation */ : 0));
if (typeNode === void 0)
return Debug.fail("should always get typenode");
const options = { removeComments: type !== unresolvedType };
const printer = createPrinter(options);
const printer = type !== unresolvedType ? createPrinterWithRemoveComments() : createPrinterWithDefaults();
const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
printer.writeNode(
4 /* Unspecified */,
@@ -52099,7 +52112,7 @@ ${lanes.join("\n")}
typePredicate.type && nodeBuilder.typeToTypeNode(typePredicate.type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | 512 /* WriteTypeParametersInQualifiedName */)
// TODO: GH#18217
);
const printer = createPrinter({ removeComments: true });
const printer = createPrinterWithRemoveComments();
const sourceFile = enclosingDeclaration && getSourceFileOfNode(enclosingDeclaration);
printer.writeNode(
4 /* Unspecified */,
@@ -67127,7 +67140,7 @@ ${lanes.join("\n")}
return getNonMissingTypeOfSymbol(symbol);
}
function getControlFlowContainer(node) {
return findAncestor(node.parent, (node2) => isFunctionLike(node2) && !getImmediatelyInvokedFunctionExpression(node2) || node2.kind === 265 /* ModuleBlock */ || node2.kind === 308 /* SourceFile */ || node2.kind === 295 /* CatchClause */ || node2.kind === 169 /* PropertyDeclaration */);
return findAncestor(node.parent, (node2) => isFunctionLike(node2) && !getImmediatelyInvokedFunctionExpression(node2) || node2.kind === 265 /* ModuleBlock */ || node2.kind === 308 /* SourceFile */ || node2.kind === 169 /* PropertyDeclaration */);
}
function isSymbolAssigned(symbol) {
if (!symbol.valueDeclaration) {
@@ -67388,14 +67401,13 @@ ${lanes.join("\n")}
const isParameter2 = getRootDeclaration(declaration).kind === 166 /* Parameter */;
const declarationContainer = getControlFlowContainer(declaration);
let flowContainer = getControlFlowContainer(node);
const isCatch = flowContainer.kind === 295 /* CatchClause */;
const isOuterVariable = flowContainer !== declarationContainer;
const isSpreadDestructuringAssignmentTarget = node.parent && node.parent.parent && isSpreadAssignment(node.parent) && isDestructuringAssignmentTarget(node.parent.parent);
const isModuleExports = symbol.flags & 134217728 /* ModuleExports */;
while (flowContainer !== declarationContainer && (flowContainer.kind === 215 /* FunctionExpression */ || flowContainer.kind === 216 /* ArrowFunction */ || isObjectLiteralOrClassExpressionMethodOrAccessor(flowContainer)) && (isConstVariable(localOrExportSymbol) && type !== autoArrayType || isParameter2 && !isSymbolAssigned(localOrExportSymbol))) {
flowContainer = getControlFlowContainer(flowContainer);
}
const assumeInitialized = isParameter2 || isCatch || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 278 /* ExportSpecifier */) || node.parent.kind === 232 /* NonNullExpression */ || declaration.kind === 257 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 16777216 /* Ambient */;
const assumeInitialized = isParameter2 || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || isSameScopedBindingElement(node, declaration) || type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & (3 /* AnyOrUnknown */ | 16384 /* Void */)) !== 0 || isInTypeQuery(node) || isInAmbientOrTypeNode(node) || node.parent.kind === 278 /* ExportSpecifier */) || node.parent.kind === 232 /* NonNullExpression */ || declaration.kind === 257 /* VariableDeclaration */ && declaration.exclamationToken || declaration.flags & 16777216 /* Ambient */;
const initialType = assumeInitialized ? isParameter2 ? removeOptionalityFromDeclaredType(type, declaration) : type : type === autoType || type === autoArrayType ? undefinedType : getOptionalType(type);
const flowType = getFlowTypeOfReference(node, type, initialType, flowContainer);
if (!isEvolvingArrayOperationTarget(node) && (type === autoType || type === autoArrayType)) {
@@ -80655,7 +80667,7 @@ ${lanes.join("\n")}
if (typeAnnotationNode) {
checkTypeAssignableTo(checkExpressionCached(node.expression), getTypeFromTypeNode(typeAnnotationNode), node.expression);
}
const isIllegalExportDefaultInCJS = !node.isExportEquals && compilerOptions.verbatimModuleSyntax && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */);
const isIllegalExportDefaultInCJS = !node.isExportEquals && !(node.flags & 16777216 /* Ambient */) && compilerOptions.verbatimModuleSyntax && (moduleKind === 1 /* CommonJS */ || getSourceFileOfNode(node).impliedNodeFormat === 1 /* CommonJS */);
if (node.expression.kind === 79 /* Identifier */) {
const id = node.expression;
const sym = resolveEntityName(
@@ -113784,7 +113796,7 @@ ${lanes.join("\n")}
function getEmitListItem(emit, parenthesizerRule) {
return emit.length === 1 ? emitListItemNoParenthesizer : typeof parenthesizerRule === "object" ? emitListItemWithParenthesizerRuleSelector : emitListItemWithParenthesizerRule;
}
var brackets, notImplementedResolver, TempFlags;
var brackets, notImplementedResolver, createPrinterWithDefaults, createPrinterWithRemoveComments, createPrinterWithRemoveCommentsNeverAsciiEscape, createPrinterWithRemoveCommentsOmitTrailingSemicolon, TempFlags;
var init_emitter = __esm({
"src/compiler/emitter.ts"() {
"use strict";
@@ -113835,6 +113847,10 @@ ${lanes.join("\n")}
getDeclarationStatementsForSourceFile: notImplemented,
isImportRequiredByAugmentation: notImplemented
};
createPrinterWithDefaults = memoize(() => createPrinter({}));
createPrinterWithRemoveComments = memoize(() => createPrinter({ removeComments: true }));
createPrinterWithRemoveCommentsNeverAsciiEscape = memoize(() => createPrinter({ removeComments: true, neverAsciiEscape: true }));
createPrinterWithRemoveCommentsOmitTrailingSemicolon = memoize(() => createPrinter({ removeComments: true, omitTrailingSemicolon: true }));
TempFlags = /* @__PURE__ */ ((TempFlags2) => {
TempFlags2[TempFlags2["Auto"] = 0] = "Auto";
TempFlags2[TempFlags2["CountMask"] = 268435455] = "CountMask";
@@ -126903,7 +126919,7 @@ ${lanes.join("\n")}
function nodeToDisplayParts(node, enclosingDeclaration) {
const file = enclosingDeclaration.getSourceFile();
return mapToDisplayParts((writer) => {
const printer = createPrinter({ removeComments: true, omitTrailingSemicolon: true });
const printer = createPrinterWithRemoveCommentsOmitTrailingSemicolon();
printer.writeNode(4 /* Unspecified */, node, file, writer);
});
}
@@ -132757,12 +132773,9 @@ ${lanes.join("\n")}
Debug.assertEqual(action.type, "install package");
return host.installPackage ? host.installPackage({ fileName: getPath(action.file), packageName: action.packageName }) : Promise.reject("Host does not implement `installPackage`");
}
function getDocCommentTemplateAtPosition2(fileName, position, options) {
return ts_JsDoc_exports.getDocCommentTemplateAtPosition(getNewLineOrDefaultFromHost(
host,
/*formatSettings*/
void 0
), syntaxTreeCache.getCurrentSourceFile(fileName), position, options);
function getDocCommentTemplateAtPosition2(fileName, position, options, formatOptions) {
const formatSettings = formatOptions ? ts_formatting_exports.getFormatContext(formatOptions, host).options : void 0;
return ts_JsDoc_exports.getDocCommentTemplateAtPosition(getNewLineOrDefaultFromHost(host, formatSettings), syntaxTreeCache.getCurrentSourceFile(fileName), position, options);
}
function isValidBraceCompletionAtPosition(fileName, position, openingBrace) {
if (openingBrace === 60 /* lessThan */) {
@@ -134634,10 +134647,10 @@ ${lanes.join("\n")}
}
);
}
getDocCommentTemplateAtPosition(fileName, position, options) {
getDocCommentTemplateAtPosition(fileName, position, options, formatOptions) {
return this.forwardJSONCall(
`getDocCommentTemplateAtPosition('${fileName}', ${position})`,
() => this.languageService.getDocCommentTemplateAtPosition(fileName, position, options)
() => this.languageService.getDocCommentTemplateAtPosition(fileName, position, options, formatOptions)
);
}
/// NAVIGATE TO
@@ -135531,7 +135544,7 @@ ${lanes.join("\n")}
}
}
if (text === void 0) {
const printer = createPrinter({ removeComments: true, omitTrailingSemicolon: true });
const printer = createPrinterWithRemoveCommentsOmitTrailingSemicolon();
text = usingSingleLineStringWriter((writer) => printer.writeNode(4 /* Unspecified */, node, node.getSourceFile(), writer));
}
return { text, pos: declName.getStart(), end: declName.getEnd() };
@@ -142536,7 +142549,7 @@ ${lanes.join("\n")}
Diagnostics.Delete_all_unused_param_tags
);
}
function getRenameAction(context, { name, signature, jsDocParameterTag }) {
function getRenameAction(context, { name, jsDocHost, signature, jsDocParameterTag }) {
if (!length(signature.parameters))
return void 0;
const sourceFile = context.sourceFile;
@@ -142559,7 +142572,7 @@ ${lanes.join("\n")}
jsDocParameterTag.isNameFirst,
jsDocParameterTag.comment
);
const changes = ts_textChanges_exports.ChangeTracker.with(context, (changeTracker) => changeTracker.replaceJSDocComment(sourceFile, signature, map(tags, (t) => t === jsDocParameterTag ? newJSDocParameterTag : t)));
const changes = ts_textChanges_exports.ChangeTracker.with(context, (changeTracker) => changeTracker.replaceJSDocComment(sourceFile, jsDocHost, map(tags, (t) => t === jsDocParameterTag ? newJSDocParameterTag : t)));
return createCodeFixActionWithoutFixAll(renameUnmatchedParameter, changes, [Diagnostics.Rename_param_tag_name_0_to_1, name.getText(sourceFile), parameterName]);
}
function getInfo10(sourceFile, pos) {
@@ -154012,8 +154025,7 @@ ${lanes.join("\n")}
}
function printTypeInSingleLine(type) {
const flags = 70221824 /* IgnoreErrors */ | 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */;
const options = { removeComments: true };
const printer = createPrinter(options);
const printer = createPrinterWithRemoveComments();
return usingSingleLineStringWriter((writer) => {
const typeNode = checker.typeToTypeNode(
type,
@@ -154429,6 +154441,8 @@ ${lanes.join("\n")}
"lends",
"license",
"link",
"linkcode",
"linkplain",
"listens",
"member",
"memberof",
@@ -154441,6 +154455,7 @@ ${lanes.join("\n")}
"package",
"param",
"private",
"prop",
"property",
"protected",
"public",
@@ -161185,7 +161200,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
}
function getTypeHelpItem(symbol, typeParameters, checker, enclosingDeclaration, sourceFile) {
const typeSymbolDisplay = symbolToDisplayParts(checker, symbol);
const printer = createPrinter({ removeComments: true });
const printer = createPrinterWithRemoveComments();
const parameters = typeParameters.map((t) => createSignatureHelpParameterForTypeParameter(t, checker, enclosingDeclaration, sourceFile, printer));
const documentation = symbol.getDocumentationComment(checker);
const tags = symbol.getJsDocTags(checker);
@@ -161228,7 +161243,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
}
function itemInfoForTypeParameters(candidateSignature, checker, enclosingDeclaration, sourceFile) {
const typeParameters = (candidateSignature.target || candidateSignature).typeParameters;
const printer = createPrinter({ removeComments: true });
const printer = createPrinterWithRemoveComments();
const parameters = (typeParameters || emptyArray).map((t) => createSignatureHelpParameterForTypeParameter(t, checker, enclosingDeclaration, sourceFile, printer));
const thisParameter = candidateSignature.thisParameter ? [checker.symbolToParameterDeclaration(candidateSignature.thisParameter, enclosingDeclaration, signatureHelpNodeBuilderFlags)] : [];
return checker.getExpandedParameters(candidateSignature).map((paramList) => {
@@ -161240,7 +161255,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
});
}
function itemInfoForParameters(candidateSignature, checker, enclosingDeclaration, sourceFile) {
const printer = createPrinter({ removeComments: true });
const printer = createPrinterWithRemoveComments();
const typeParameterParts = mapToDisplayParts((writer) => {
if (candidateSignature.typeParameters && candidateSignature.typeParameters.length) {
const args = factory.createNodeArray(candidateSignature.typeParameters.map((p) => checker.typeParameterToDeclaration(p, enclosingDeclaration, signatureHelpNodeBuilderFlags)));
@@ -161646,7 +161661,6 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
let hasAddedSymbolInfo = false;
const isThisExpression = location.kind === 108 /* ThisKeyword */ && isInExpressionContext(location) || isThisInTypeQuery(location);
let type;
let printer;
let documentationFromAlias;
let tagsFromAlias;
let hasMultipleSignatures = false;
@@ -162039,10 +162053,7 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
}
return { displayParts, documentation, symbolKind, tags: tags.length === 0 ? void 0 : tags };
function getPrinter() {
if (!printer) {
printer = createPrinter({ removeComments: true });
}
return printer;
return createPrinterWithRemoveComments();
}
function prefixNextMeaning() {
if (displayParts.length) {
@@ -166920,6 +166931,10 @@ ${options.prefix}` : "\n" : options.prefix
createPatternMatcher: () => createPatternMatcher,
createPrependNodes: () => createPrependNodes,
createPrinter: () => createPrinter,
createPrinterWithDefaults: () => createPrinterWithDefaults,
createPrinterWithRemoveComments: () => createPrinterWithRemoveComments,
createPrinterWithRemoveCommentsNeverAsciiEscape: () => createPrinterWithRemoveCommentsNeverAsciiEscape,
createPrinterWithRemoveCommentsOmitTrailingSemicolon: () => createPrinterWithRemoveCommentsOmitTrailingSemicolon,
createProgram: () => createProgram,
createProgramHost: () => createProgramHost,
createPropertyNameNodeForIdentifierOrLiteral: () => createPropertyNameNodeForIdentifierOrLiteral,
File diff suppressed because it is too large Load Diff