typescript 4.6.0-dev.20211123 → 4.6.0-dev.20211130
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 +58 -18
- package/lib/tsserver.js +160 -94
- package/lib/tsserverlibrary.js +160 -94
- package/lib/typescript.js +160 -94
- package/lib/typescriptServices.js +160 -94
- package/lib/typingsInstaller.js +68 -21
- package/package.json +1 -1
package/lib/typescript.js
CHANGED
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20211130";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -83649,9 +83649,8 @@ var ts;
|
|
|
83649
83649
|
var enclosingFile = ts.getSourceFileOfNode(node);
|
|
83650
83650
|
var links = getNodeLinks(enclosingFile);
|
|
83651
83651
|
if (!(links.flags & 1 /* TypeChecked */)) {
|
|
83652
|
-
links.deferredNodes
|
|
83653
|
-
|
|
83654
|
-
links.deferredNodes.set(id, node);
|
|
83652
|
+
links.deferredNodes || (links.deferredNodes = new ts.Set());
|
|
83653
|
+
links.deferredNodes.add(node);
|
|
83655
83654
|
}
|
|
83656
83655
|
}
|
|
83657
83656
|
function checkDeferredNodes(context) {
|
|
@@ -91105,11 +91104,10 @@ var ts;
|
|
|
91105
91104
|
// we can safely elide the parentheses here, as a new synthetic
|
|
91106
91105
|
// ParenthesizedExpression will be inserted if we remove parentheses too
|
|
91107
91106
|
// aggressively.
|
|
91108
|
-
//
|
|
91109
|
-
//
|
|
91110
|
-
|
|
91111
|
-
|
|
91112
|
-
}
|
|
91107
|
+
//
|
|
91108
|
+
// If there are leading comments on the expression itself, the emitter will handle ASI
|
|
91109
|
+
// for return, throw, and yield by re-introducing parenthesis during emit on an as-need
|
|
91110
|
+
// basis.
|
|
91113
91111
|
return factory.createPartiallyEmittedExpression(expression, node);
|
|
91114
91112
|
}
|
|
91115
91113
|
return ts.visitEachChild(node, visitor, context);
|
|
@@ -95057,11 +95055,11 @@ var ts;
|
|
|
95057
95055
|
}
|
|
95058
95056
|
function visitOptionalExpression(node, captureThisArg, isDelete) {
|
|
95059
95057
|
var _a = flattenChain(node), expression = _a.expression, chain = _a.chain;
|
|
95060
|
-
var left = visitNonOptionalExpression(expression, ts.isCallChain(chain[0]), /*isDelete*/ false);
|
|
95058
|
+
var left = visitNonOptionalExpression(ts.skipPartiallyEmittedExpressions(expression), ts.isCallChain(chain[0]), /*isDelete*/ false);
|
|
95061
95059
|
var leftThisArg = ts.isSyntheticReference(left) ? left.thisArg : undefined;
|
|
95062
|
-
var
|
|
95063
|
-
var
|
|
95064
|
-
if (!ts.isSimpleCopiableExpression(
|
|
95060
|
+
var capturedLeft = ts.isSyntheticReference(left) ? left.expression : left;
|
|
95061
|
+
var leftExpression = factory.restoreOuterExpressions(expression, capturedLeft, 8 /* PartiallyEmittedExpressions */);
|
|
95062
|
+
if (!ts.isSimpleCopiableExpression(capturedLeft)) {
|
|
95065
95063
|
capturedLeft = factory.createTempVariable(hoistVariableDeclaration);
|
|
95066
95064
|
leftExpression = factory.createAssignment(capturedLeft, leftExpression);
|
|
95067
95065
|
}
|
|
@@ -95087,6 +95085,10 @@ var ts;
|
|
|
95087
95085
|
break;
|
|
95088
95086
|
case 207 /* CallExpression */:
|
|
95089
95087
|
if (i === 0 && leftThisArg) {
|
|
95088
|
+
if (!ts.isGeneratedIdentifier(leftThisArg)) {
|
|
95089
|
+
leftThisArg = factory.cloneNode(leftThisArg);
|
|
95090
|
+
ts.addEmitFlags(leftThisArg, 1536 /* NoComments */);
|
|
95091
|
+
}
|
|
95090
95092
|
rightExpression = factory.createFunctionCallCall(rightExpression, leftThisArg.kind === 106 /* SuperKeyword */ ? factory.createThis() : leftThisArg, ts.visitNodes(segment.arguments, visitor, ts.isExpression));
|
|
95091
95093
|
}
|
|
95092
95094
|
else {
|
|
@@ -109869,7 +109871,7 @@ var ts;
|
|
|
109869
109871
|
function emitYieldExpression(node) {
|
|
109870
109872
|
emitTokenWithComment(125 /* YieldKeyword */, node.pos, writeKeyword, node);
|
|
109871
109873
|
emit(node.asteriskToken);
|
|
109872
|
-
emitExpressionWithLeadingSpace(node.expression
|
|
109874
|
+
emitExpressionWithLeadingSpace(node.expression && parenthesizeExpressionForNoAsi(node.expression), parenthesizeExpressionForNoAsiAndDisallowedComma);
|
|
109873
109875
|
}
|
|
109874
109876
|
function emitSpreadElement(node) {
|
|
109875
109877
|
emitTokenWithComment(25 /* DotDotDotToken */, node.pos, writePunctuation, node);
|
|
@@ -110066,9 +110068,49 @@ var ts;
|
|
|
110066
110068
|
}
|
|
110067
110069
|
return pos;
|
|
110068
110070
|
}
|
|
110071
|
+
function commentWillEmitNewLine(node) {
|
|
110072
|
+
return node.kind === 2 /* SingleLineCommentTrivia */ || !!node.hasTrailingNewLine;
|
|
110073
|
+
}
|
|
110074
|
+
function willEmitLeadingNewLine(node) {
|
|
110075
|
+
if (!currentSourceFile)
|
|
110076
|
+
return false;
|
|
110077
|
+
if (ts.some(ts.getLeadingCommentRanges(currentSourceFile.text, node.pos), commentWillEmitNewLine))
|
|
110078
|
+
return true;
|
|
110079
|
+
if (ts.some(ts.getSyntheticLeadingComments(node), commentWillEmitNewLine))
|
|
110080
|
+
return true;
|
|
110081
|
+
if (ts.isPartiallyEmittedExpression(node)) {
|
|
110082
|
+
if (node.pos !== node.expression.pos) {
|
|
110083
|
+
if (ts.some(ts.getTrailingCommentRanges(currentSourceFile.text, node.expression.pos), commentWillEmitNewLine))
|
|
110084
|
+
return true;
|
|
110085
|
+
}
|
|
110086
|
+
return willEmitLeadingNewLine(node.expression);
|
|
110087
|
+
}
|
|
110088
|
+
return false;
|
|
110089
|
+
}
|
|
110090
|
+
/**
|
|
110091
|
+
* Wraps an expression in parens if we would emit a leading comment that would introduce a line separator
|
|
110092
|
+
* between the node and its parent.
|
|
110093
|
+
*/
|
|
110094
|
+
function parenthesizeExpressionForNoAsi(node) {
|
|
110095
|
+
if (!commentsDisabled && ts.isPartiallyEmittedExpression(node) && willEmitLeadingNewLine(node)) {
|
|
110096
|
+
var parseNode = ts.getParseTreeNode(node);
|
|
110097
|
+
if (parseNode && ts.isParenthesizedExpression(parseNode)) {
|
|
110098
|
+
// If the original node was a parenthesized expression, restore it to preserve comment and source map emit
|
|
110099
|
+
var parens = ts.factory.createParenthesizedExpression(node.expression);
|
|
110100
|
+
ts.setOriginalNode(parens, node);
|
|
110101
|
+
ts.setTextRange(parens, parseNode);
|
|
110102
|
+
return parens;
|
|
110103
|
+
}
|
|
110104
|
+
return ts.factory.createParenthesizedExpression(node);
|
|
110105
|
+
}
|
|
110106
|
+
return node;
|
|
110107
|
+
}
|
|
110108
|
+
function parenthesizeExpressionForNoAsiAndDisallowedComma(node) {
|
|
110109
|
+
return parenthesizeExpressionForNoAsi(parenthesizer.parenthesizeExpressionForDisallowedComma(node));
|
|
110110
|
+
}
|
|
110069
110111
|
function emitReturnStatement(node) {
|
|
110070
110112
|
emitTokenWithComment(105 /* ReturnKeyword */, node.pos, writeKeyword, /*contextNode*/ node);
|
|
110071
|
-
emitExpressionWithLeadingSpace(node.expression);
|
|
110113
|
+
emitExpressionWithLeadingSpace(node.expression && parenthesizeExpressionForNoAsi(node.expression), parenthesizeExpressionForNoAsi);
|
|
110072
110114
|
writeTrailingSemicolon();
|
|
110073
110115
|
}
|
|
110074
110116
|
function emitWithStatement(node) {
|
|
@@ -110096,7 +110138,7 @@ var ts;
|
|
|
110096
110138
|
}
|
|
110097
110139
|
function emitThrowStatement(node) {
|
|
110098
110140
|
emitTokenWithComment(109 /* ThrowKeyword */, node.pos, writeKeyword, node);
|
|
110099
|
-
emitExpressionWithLeadingSpace(node.expression);
|
|
110141
|
+
emitExpressionWithLeadingSpace(parenthesizeExpressionForNoAsi(node.expression), parenthesizeExpressionForNoAsi);
|
|
110100
110142
|
writeTrailingSemicolon();
|
|
110101
110143
|
}
|
|
110102
110144
|
function emitTryStatement(node) {
|
|
@@ -110940,7 +110982,14 @@ var ts;
|
|
|
110940
110982
|
}
|
|
110941
110983
|
// Transformation nodes
|
|
110942
110984
|
function emitPartiallyEmittedExpression(node) {
|
|
110985
|
+
var emitFlags = ts.getEmitFlags(node);
|
|
110986
|
+
if (!(emitFlags & 512 /* NoLeadingComments */) && node.pos !== node.expression.pos) {
|
|
110987
|
+
emitTrailingCommentsOfPosition(node.expression.pos);
|
|
110988
|
+
}
|
|
110943
110989
|
emitExpression(node.expression);
|
|
110990
|
+
if (!(emitFlags & 1024 /* NoTrailingComments */) && node.end !== node.expression.end) {
|
|
110991
|
+
emitLeadingCommentsOfPosition(node.expression.end);
|
|
110992
|
+
}
|
|
110944
110993
|
}
|
|
110945
110994
|
function emitCommaList(node) {
|
|
110946
110995
|
emitExpressionList(node, node.elements, 528 /* CommaListElements */, /*parenthesizerRule*/ undefined);
|
|
@@ -111304,10 +111353,8 @@ var ts;
|
|
|
111304
111353
|
// Emit this child.
|
|
111305
111354
|
previousSourceFileTextKind = recordBundleFileInternalSectionStart(child);
|
|
111306
111355
|
if (shouldEmitInterveningComments) {
|
|
111307
|
-
|
|
111308
|
-
|
|
111309
|
-
emitTrailingCommentsOfPosition(commentRange.pos);
|
|
111310
|
-
}
|
|
111356
|
+
var commentRange = ts.getCommentRange(child);
|
|
111357
|
+
emitTrailingCommentsOfPosition(commentRange.pos);
|
|
111311
111358
|
}
|
|
111312
111359
|
else {
|
|
111313
111360
|
shouldEmitInterveningComments = mayEmitInterveningComments;
|
|
@@ -111628,7 +111675,7 @@ var ts;
|
|
|
111628
111675
|
function writeLineSeparatorsAndIndentBefore(node, parent) {
|
|
111629
111676
|
var leadingNewlines = preserveSourceNewlines && getLeadingLineTerminatorCount(parent, [node], 0 /* None */);
|
|
111630
111677
|
if (leadingNewlines) {
|
|
111631
|
-
writeLinesAndIndent(leadingNewlines, /*
|
|
111678
|
+
writeLinesAndIndent(leadingNewlines, /*writeSpaceIfNotIndenting*/ false);
|
|
111632
111679
|
}
|
|
111633
111680
|
return !!leadingNewlines;
|
|
111634
111681
|
}
|
|
@@ -126006,7 +126053,6 @@ var ts;
|
|
|
126006
126053
|
|| kind === 165 /* PropertySignature */
|
|
126007
126054
|
|| kind === 167 /* MethodSignature */;
|
|
126008
126055
|
}
|
|
126009
|
-
ts.syntaxRequiresTrailingCommaOrSemicolonOrASI = syntaxRequiresTrailingCommaOrSemicolonOrASI;
|
|
126010
126056
|
function syntaxRequiresTrailingFunctionBlockOrSemicolonOrASI(kind) {
|
|
126011
126057
|
return kind === 255 /* FunctionDeclaration */
|
|
126012
126058
|
|| kind === 170 /* Constructor */
|
|
@@ -126014,11 +126060,9 @@ var ts;
|
|
|
126014
126060
|
|| kind === 171 /* GetAccessor */
|
|
126015
126061
|
|| kind === 172 /* SetAccessor */;
|
|
126016
126062
|
}
|
|
126017
|
-
ts.syntaxRequiresTrailingFunctionBlockOrSemicolonOrASI = syntaxRequiresTrailingFunctionBlockOrSemicolonOrASI;
|
|
126018
126063
|
function syntaxRequiresTrailingModuleBlockOrSemicolonOrASI(kind) {
|
|
126019
126064
|
return kind === 260 /* ModuleDeclaration */;
|
|
126020
126065
|
}
|
|
126021
|
-
ts.syntaxRequiresTrailingModuleBlockOrSemicolonOrASI = syntaxRequiresTrailingModuleBlockOrSemicolonOrASI;
|
|
126022
126066
|
function syntaxRequiresTrailingSemicolonOrASI(kind) {
|
|
126023
126067
|
return kind === 236 /* VariableStatement */
|
|
126024
126068
|
|| kind === 237 /* ExpressionStatement */
|
|
@@ -126093,19 +126137,34 @@ var ts;
|
|
|
126093
126137
|
ts.forEachChild(sourceFile, function visit(node) {
|
|
126094
126138
|
if (syntaxRequiresTrailingSemicolonOrASI(node.kind)) {
|
|
126095
126139
|
var lastToken = node.getLastToken(sourceFile);
|
|
126096
|
-
if (lastToken
|
|
126140
|
+
if ((lastToken === null || lastToken === void 0 ? void 0 : lastToken.kind) === 26 /* SemicolonToken */) {
|
|
126097
126141
|
withSemicolon++;
|
|
126098
126142
|
}
|
|
126099
126143
|
else {
|
|
126100
126144
|
withoutSemicolon++;
|
|
126101
126145
|
}
|
|
126102
126146
|
}
|
|
126147
|
+
else if (syntaxRequiresTrailingCommaOrSemicolonOrASI(node.kind)) {
|
|
126148
|
+
var lastToken = node.getLastToken(sourceFile);
|
|
126149
|
+
if ((lastToken === null || lastToken === void 0 ? void 0 : lastToken.kind) === 26 /* SemicolonToken */) {
|
|
126150
|
+
withSemicolon++;
|
|
126151
|
+
}
|
|
126152
|
+
else if (lastToken && lastToken.kind !== 27 /* CommaToken */) {
|
|
126153
|
+
var lastTokenLine = ts.getLineAndCharacterOfPosition(sourceFile, lastToken.getStart(sourceFile)).line;
|
|
126154
|
+
var nextTokenLine = ts.getLineAndCharacterOfPosition(sourceFile, ts.getSpanOfTokenAtPosition(sourceFile, lastToken.end).start).line;
|
|
126155
|
+
// Avoid counting missing semicolon in single-line objects:
|
|
126156
|
+
// `function f(p: { x: string /*no semicolon here is insignificant*/ }) {`
|
|
126157
|
+
if (lastTokenLine !== nextTokenLine) {
|
|
126158
|
+
withoutSemicolon++;
|
|
126159
|
+
}
|
|
126160
|
+
}
|
|
126161
|
+
}
|
|
126103
126162
|
if (withSemicolon + withoutSemicolon >= nStatementsToObserve) {
|
|
126104
126163
|
return true;
|
|
126105
126164
|
}
|
|
126106
126165
|
return ts.forEachChild(node, visit);
|
|
126107
126166
|
});
|
|
126108
|
-
// One statement missing a semicolon isn
|
|
126167
|
+
// One statement missing a semicolon isn't sufficient evidence to say the user
|
|
126109
126168
|
// doesn’t want semicolons, because they may not even be done writing that statement.
|
|
126110
126169
|
if (withSemicolon === 0 && withoutSemicolon <= 1) {
|
|
126111
126170
|
return true;
|
|
@@ -141971,6 +142030,7 @@ var ts;
|
|
|
141971
142030
|
lastTrailingTriviaWasNewLine: function () { return wasNewLine; },
|
|
141972
142031
|
skipToEndOf: skipToEndOf,
|
|
141973
142032
|
skipToStartOf: skipToStartOf,
|
|
142033
|
+
getStartPos: function () { var _a; return (_a = lastTokenInfo === null || lastTokenInfo === void 0 ? void 0 : lastTokenInfo.token.pos) !== null && _a !== void 0 ? _a : scanner.getTokenPos(); },
|
|
141974
142034
|
});
|
|
141975
142035
|
lastTokenInfo = undefined;
|
|
141976
142036
|
scanner.setText(undefined);
|
|
@@ -142144,8 +142204,7 @@ var ts;
|
|
|
142144
142204
|
}
|
|
142145
142205
|
function isOnToken() {
|
|
142146
142206
|
var current = lastTokenInfo ? lastTokenInfo.token.kind : scanner.getToken();
|
|
142147
|
-
|
|
142148
|
-
return startPos < endPos && current !== 1 /* EndOfFileToken */ && !ts.isTrivia(current);
|
|
142207
|
+
return current !== 1 /* EndOfFileToken */ && !ts.isTrivia(current);
|
|
142149
142208
|
}
|
|
142150
142209
|
function isOnEOF() {
|
|
142151
142210
|
var current = lastTokenInfo ? lastTokenInfo.token.kind : scanner.getToken();
|
|
@@ -143333,7 +143392,7 @@ var ts;
|
|
|
143333
143392
|
return 0;
|
|
143334
143393
|
}
|
|
143335
143394
|
function formatNodeGivenIndentation(node, sourceFileLike, languageVariant, initialIndentation, delta, formatContext) {
|
|
143336
|
-
var range = { pos:
|
|
143395
|
+
var range = { pos: node.pos, end: node.end };
|
|
143337
143396
|
return formatting.getFormattingScanner(sourceFileLike.text, languageVariant, range.pos, range.end, function (scanner) { return formatSpanWorker(range, node, initialIndentation, delta, scanner, formatContext, 1 /* FormatSelection */, function (_) { return false; }, // assume that node does not have any errors
|
|
143338
143397
|
sourceFileLike); });
|
|
143339
143398
|
}
|
|
@@ -143384,6 +143443,15 @@ var ts;
|
|
|
143384
143443
|
}
|
|
143385
143444
|
}
|
|
143386
143445
|
}
|
|
143446
|
+
if (previousRange && formattingScanner.getStartPos() >= originalRange.end) {
|
|
143447
|
+
var token = formattingScanner.isOnEOF() ? formattingScanner.readEOFTokenRange() :
|
|
143448
|
+
formattingScanner.isOnToken() ? formattingScanner.readTokenInfo(enclosingNode).token :
|
|
143449
|
+
undefined;
|
|
143450
|
+
if (token) {
|
|
143451
|
+
processPair(token, sourceFile.getLineAndCharacterOfPosition(token.pos).line, enclosingNode, previousRange, previousRangeStartLine, previousParent, enclosingNode,
|
|
143452
|
+
/*dynamicIndentation*/ undefined);
|
|
143453
|
+
}
|
|
143454
|
+
}
|
|
143387
143455
|
return edits;
|
|
143388
143456
|
// local functions
|
|
143389
143457
|
/** Tries to compute the indentation for a list element.
|
|
@@ -143566,19 +143634,13 @@ var ts;
|
|
|
143566
143634
|
processChildNodes(nodes, node, nodeStartLine, nodeDynamicIndentation);
|
|
143567
143635
|
});
|
|
143568
143636
|
// proceed any tokens in the node that are located after child nodes
|
|
143569
|
-
while (formattingScanner.isOnToken()) {
|
|
143637
|
+
while (formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) {
|
|
143570
143638
|
var tokenInfo = formattingScanner.readTokenInfo(node);
|
|
143571
|
-
if (tokenInfo.token.end > node.end) {
|
|
143639
|
+
if (tokenInfo.token.end > Math.min(node.end, originalRange.end)) {
|
|
143572
143640
|
break;
|
|
143573
143641
|
}
|
|
143574
143642
|
consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation, node);
|
|
143575
143643
|
}
|
|
143576
|
-
if (!node.parent && formattingScanner.isOnEOF()) {
|
|
143577
|
-
var token = formattingScanner.readEOFTokenRange();
|
|
143578
|
-
if (token.end <= node.end && previousRange) {
|
|
143579
|
-
processPair(token, sourceFile.getLineAndCharacterOfPosition(token.pos).line, node, previousRange, previousRangeStartLine, previousParent, contextNode, nodeDynamicIndentation);
|
|
143580
|
-
}
|
|
143581
|
-
}
|
|
143582
143644
|
function processChildNode(child, inheritedIndentation, parent, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem, isFirstListItem) {
|
|
143583
143645
|
var childStartPos = child.getStart(sourceFile);
|
|
143584
143646
|
var childStartLine = sourceFile.getLineAndCharacterOfPosition(childStartPos).line;
|
|
@@ -143604,9 +143666,12 @@ var ts;
|
|
|
143604
143666
|
if (child.getFullWidth() === 0) {
|
|
143605
143667
|
return inheritedIndentation;
|
|
143606
143668
|
}
|
|
143607
|
-
while (formattingScanner.isOnToken()) {
|
|
143669
|
+
while (formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) {
|
|
143608
143670
|
// proceed any parent tokens that are located prior to child.getStart()
|
|
143609
143671
|
var tokenInfo = formattingScanner.readTokenInfo(node);
|
|
143672
|
+
if (tokenInfo.token.end > originalRange.end) {
|
|
143673
|
+
return inheritedIndentation;
|
|
143674
|
+
}
|
|
143610
143675
|
if (tokenInfo.token.end > childStartPos) {
|
|
143611
143676
|
if (tokenInfo.token.pos > childStartPos) {
|
|
143612
143677
|
formattingScanner.skipToStartOf(child);
|
|
@@ -143616,7 +143681,7 @@ var ts;
|
|
|
143616
143681
|
}
|
|
143617
143682
|
consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, node);
|
|
143618
143683
|
}
|
|
143619
|
-
if (!formattingScanner.isOnToken()) {
|
|
143684
|
+
if (!formattingScanner.isOnToken() || formattingScanner.getStartPos() >= originalRange.end) {
|
|
143620
143685
|
return inheritedIndentation;
|
|
143621
143686
|
}
|
|
143622
143687
|
if (ts.isToken(child)) {
|
|
@@ -143645,7 +143710,7 @@ var ts;
|
|
|
143645
143710
|
var startLine = parentStartLine;
|
|
143646
143711
|
if (listStartToken !== 0 /* Unknown */) {
|
|
143647
143712
|
// introduce a new indentation scope for lists (including list start and end tokens)
|
|
143648
|
-
while (formattingScanner.isOnToken()) {
|
|
143713
|
+
while (formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) {
|
|
143649
143714
|
var tokenInfo = formattingScanner.readTokenInfo(parent);
|
|
143650
143715
|
if (tokenInfo.token.end > nodes.pos) {
|
|
143651
143716
|
// stop when formatting scanner moves past the beginning of node list
|
|
@@ -143681,7 +143746,7 @@ var ts;
|
|
|
143681
143746
|
inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, startLine, startLine, /*isListItem*/ true, /*isFirstListItem*/ i === 0);
|
|
143682
143747
|
}
|
|
143683
143748
|
var listEndToken = getCloseTokenForOpenToken(listStartToken);
|
|
143684
|
-
if (listEndToken !== 0 /* Unknown */ && formattingScanner.isOnToken()) {
|
|
143749
|
+
if (listEndToken !== 0 /* Unknown */ && formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) {
|
|
143685
143750
|
var tokenInfo = formattingScanner.readTokenInfo(parent);
|
|
143686
143751
|
if (tokenInfo.token.kind === 27 /* CommaToken */ && ts.isCallLikeExpression(parent)) {
|
|
143687
143752
|
var commaTokenLine = sourceFile.getLineAndCharacterOfPosition(tokenInfo.token.pos).line;
|
|
@@ -143812,24 +143877,26 @@ var ts;
|
|
|
143812
143877
|
// win in a conflict with lower priority rules.
|
|
143813
143878
|
ts.forEachRight(rules, function (rule) {
|
|
143814
143879
|
lineAction = applyRuleEdits(rule, previousItem, previousStartLine, currentItem, currentStartLine);
|
|
143815
|
-
|
|
143816
|
-
|
|
143817
|
-
|
|
143818
|
-
|
|
143819
|
-
|
|
143820
|
-
|
|
143821
|
-
|
|
143822
|
-
|
|
143823
|
-
|
|
143824
|
-
|
|
143825
|
-
|
|
143826
|
-
|
|
143827
|
-
|
|
143828
|
-
|
|
143829
|
-
|
|
143830
|
-
|
|
143831
|
-
|
|
143832
|
-
|
|
143880
|
+
if (dynamicIndentation) {
|
|
143881
|
+
switch (lineAction) {
|
|
143882
|
+
case 2 /* LineRemoved */:
|
|
143883
|
+
// Handle the case where the next line is moved to be the end of this line.
|
|
143884
|
+
// In this case we don't indent the next line in the next pass.
|
|
143885
|
+
if (currentParent.getStart(sourceFile) === currentItem.pos) {
|
|
143886
|
+
dynamicIndentation.recomputeIndentation(/*lineAddedByFormatting*/ false, contextNode);
|
|
143887
|
+
}
|
|
143888
|
+
break;
|
|
143889
|
+
case 1 /* LineAdded */:
|
|
143890
|
+
// Handle the case where token2 is moved to the new line.
|
|
143891
|
+
// In this case we indent token2 in the next pass but we set
|
|
143892
|
+
// sameLineIndent flag to notify the indenter that the indentation is within the line.
|
|
143893
|
+
if (currentParent.getStart(sourceFile) === currentItem.pos) {
|
|
143894
|
+
dynamicIndentation.recomputeIndentation(/*lineAddedByFormatting*/ true, contextNode);
|
|
143895
|
+
}
|
|
143896
|
+
break;
|
|
143897
|
+
default:
|
|
143898
|
+
ts.Debug.assert(lineAction === 0 /* None */);
|
|
143899
|
+
}
|
|
143833
143900
|
}
|
|
143834
143901
|
// We need to trim trailing whitespace between the tokens if they were on different lines, and no rule was applied to put them on the same line
|
|
143835
143902
|
trimTrailingWhitespaces = trimTrailingWhitespaces && !(rule.action & 16 /* DeleteSpace */) && rule.flags !== 1 /* CanDeleteNewLines */;
|
|
@@ -146307,7 +146374,7 @@ var ts;
|
|
|
146307
146374
|
var errorCodes = [ts.Diagnostics.Conversion_of_type_0_to_type_1_may_be_a_mistake_because_neither_type_sufficiently_overlaps_with_the_other_If_this_was_intentional_convert_the_expression_to_unknown_first.code];
|
|
146308
146375
|
codefix.registerCodeFix({
|
|
146309
146376
|
errorCodes: errorCodes,
|
|
146310
|
-
getCodeActions: function (context) {
|
|
146377
|
+
getCodeActions: function getCodeActionsToAddConvertToUnknownForNonOverlappingTypes(context) {
|
|
146311
146378
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return makeChange(t, context.sourceFile, context.span.start); });
|
|
146312
146379
|
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_unknown_conversion_for_non_overlapping_types, fixId, ts.Diagnostics.Add_unknown_to_all_conversions_of_non_overlapping_types)];
|
|
146313
146380
|
},
|
|
@@ -146334,7 +146401,7 @@ var ts;
|
|
|
146334
146401
|
ts.Diagnostics.await_expressions_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module.code,
|
|
146335
146402
|
ts.Diagnostics.for_await_loops_are_only_allowed_at_the_top_level_of_a_file_when_that_file_is_a_module_but_this_file_has_no_imports_or_exports_Consider_adding_an_empty_export_to_make_this_file_a_module.code,
|
|
146336
146403
|
],
|
|
146337
|
-
getCodeActions: function (context) {
|
|
146404
|
+
getCodeActions: function getCodeActionsToAddEmptyExportDeclaration(context) {
|
|
146338
146405
|
var sourceFile = context.sourceFile;
|
|
146339
146406
|
var changes = ts.textChanges.ChangeTracker.with(context, function (changes) {
|
|
146340
146407
|
var exportDeclaration = ts.factory.createExportDeclaration(
|
|
@@ -146363,7 +146430,7 @@ var ts;
|
|
|
146363
146430
|
codefix.registerCodeFix({
|
|
146364
146431
|
fixIds: [fixId],
|
|
146365
146432
|
errorCodes: errorCodes,
|
|
146366
|
-
getCodeActions: function (context) {
|
|
146433
|
+
getCodeActions: function getCodeActionsToAddMissingAsync(context) {
|
|
146367
146434
|
var sourceFile = context.sourceFile, errorCode = context.errorCode, cancellationToken = context.cancellationToken, program = context.program, span = context.span;
|
|
146368
146435
|
var diagnostic = ts.find(program.getDiagnosticsProducingTypeChecker().getDiagnostics(sourceFile, cancellationToken), getIsMatchingAsyncError(span, errorCode));
|
|
146369
146436
|
var directSpan = diagnostic && diagnostic.relatedInformation && ts.find(diagnostic.relatedInformation, function (r) { return r.code === ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async.code; });
|
|
@@ -146460,7 +146527,7 @@ var ts;
|
|
|
146460
146527
|
codefix.registerCodeFix({
|
|
146461
146528
|
fixIds: [fixId],
|
|
146462
146529
|
errorCodes: errorCodes,
|
|
146463
|
-
getCodeActions: function (context) {
|
|
146530
|
+
getCodeActions: function getCodeActionsToAddMissingAwait(context) {
|
|
146464
146531
|
var sourceFile = context.sourceFile, errorCode = context.errorCode, span = context.span, cancellationToken = context.cancellationToken, program = context.program;
|
|
146465
146532
|
var expression = getAwaitErrorSpanExpression(sourceFile, errorCode, span, cancellationToken, program);
|
|
146466
146533
|
if (!expression) {
|
|
@@ -146692,7 +146759,7 @@ var ts;
|
|
|
146692
146759
|
];
|
|
146693
146760
|
codefix.registerCodeFix({
|
|
146694
146761
|
errorCodes: errorCodes,
|
|
146695
|
-
getCodeActions: function (context) {
|
|
146762
|
+
getCodeActions: function getCodeActionsToAddMissingConst(context) {
|
|
146696
146763
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return makeChange(t, context.sourceFile, context.span.start, context.program); });
|
|
146697
146764
|
if (changes.length > 0) {
|
|
146698
146765
|
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_const_to_unresolved_variable, fixId, ts.Diagnostics.Add_const_to_all_unresolved_variables)];
|
|
@@ -146792,7 +146859,7 @@ var ts;
|
|
|
146792
146859
|
];
|
|
146793
146860
|
codefix.registerCodeFix({
|
|
146794
146861
|
errorCodes: errorCodes,
|
|
146795
|
-
getCodeActions: function (context) {
|
|
146862
|
+
getCodeActions: function getCodeActionsToAddMissingDeclareOnProperty(context) {
|
|
146796
146863
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return makeChange(t, context.sourceFile, context.span.start); });
|
|
146797
146864
|
if (changes.length > 0) {
|
|
146798
146865
|
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Prefix_with_declare, fixId, ts.Diagnostics.Prefix_all_incorrect_property_declarations_with_declare)];
|
|
@@ -146826,7 +146893,7 @@ var ts;
|
|
|
146826
146893
|
var errorCodes = [ts.Diagnostics._0_accepts_too_few_arguments_to_be_used_as_a_decorator_here_Did_you_mean_to_call_it_first_and_write_0.code];
|
|
146827
146894
|
codefix.registerCodeFix({
|
|
146828
146895
|
errorCodes: errorCodes,
|
|
146829
|
-
getCodeActions: function (context) {
|
|
146896
|
+
getCodeActions: function getCodeActionsToAddMissingInvocationForDecorator(context) {
|
|
146830
146897
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return makeChange(t, context.sourceFile, context.span.start); });
|
|
146831
146898
|
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Call_decorator_expression, fixId, ts.Diagnostics.Add_to_all_uncalled_decorators)];
|
|
146832
146899
|
},
|
|
@@ -146851,7 +146918,7 @@ var ts;
|
|
|
146851
146918
|
var errorCodes = [ts.Diagnostics.Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1.code];
|
|
146852
146919
|
codefix.registerCodeFix({
|
|
146853
146920
|
errorCodes: errorCodes,
|
|
146854
|
-
getCodeActions: function (context) {
|
|
146921
|
+
getCodeActions: function getCodeActionsToAddNameToNamelessParameter(context) {
|
|
146855
146922
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return makeChange(t, context.sourceFile, context.span.start); });
|
|
146856
146923
|
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_parameter_name, fixId, ts.Diagnostics.Add_names_to_all_parameters_without_names)];
|
|
146857
146924
|
},
|
|
@@ -148653,14 +148720,14 @@ var ts;
|
|
|
148653
148720
|
var fixId = "convertToTypeOnlyExport";
|
|
148654
148721
|
codefix.registerCodeFix({
|
|
148655
148722
|
errorCodes: errorCodes,
|
|
148656
|
-
getCodeActions: function (context) {
|
|
148723
|
+
getCodeActions: function getCodeActionsToConvertToTypeOnlyExport(context) {
|
|
148657
148724
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return fixSingleExportDeclaration(t, getExportSpecifierForDiagnosticSpan(context.span, context.sourceFile), context); });
|
|
148658
148725
|
if (changes.length) {
|
|
148659
148726
|
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Convert_to_type_only_export, fixId, ts.Diagnostics.Convert_all_re_exported_types_to_type_only_exports)];
|
|
148660
148727
|
}
|
|
148661
148728
|
},
|
|
148662
148729
|
fixIds: [fixId],
|
|
148663
|
-
getAllCodeActions: function (context) {
|
|
148730
|
+
getAllCodeActions: function getAllCodeActionsToConvertToTypeOnlyExport(context) {
|
|
148664
148731
|
var fixedExportDeclarations = new ts.Map();
|
|
148665
148732
|
return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
|
|
148666
148733
|
var exportSpecifier = getExportSpecifierForDiagnosticSpan(diag, context.sourceFile);
|
|
@@ -148721,7 +148788,7 @@ var ts;
|
|
|
148721
148788
|
var fixId = "convertToTypeOnlyImport";
|
|
148722
148789
|
codefix.registerCodeFix({
|
|
148723
148790
|
errorCodes: errorCodes,
|
|
148724
|
-
getCodeActions: function (context) {
|
|
148791
|
+
getCodeActions: function getCodeActionsToConvertToTypeOnlyImport(context) {
|
|
148725
148792
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) {
|
|
148726
148793
|
var importDeclaration = getImportDeclarationForDiagnosticSpan(context.span, context.sourceFile);
|
|
148727
148794
|
fixSingleImportDeclaration(t, importDeclaration, context);
|
|
@@ -148731,7 +148798,7 @@ var ts;
|
|
|
148731
148798
|
}
|
|
148732
148799
|
},
|
|
148733
148800
|
fixIds: [fixId],
|
|
148734
|
-
getAllCodeActions: function (context) {
|
|
148801
|
+
getAllCodeActions: function getAllCodeActionsToConvertToTypeOnlyImport(context) {
|
|
148735
148802
|
return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
|
|
148736
148803
|
var importDeclaration = getImportDeclarationForDiagnosticSpan(diag, context.sourceFile);
|
|
148737
148804
|
fixSingleImportDeclaration(changes, importDeclaration, context);
|
|
@@ -148770,7 +148837,7 @@ var ts;
|
|
|
148770
148837
|
var errorCodes = [ts.Diagnostics._0_only_refers_to_a_type_but_is_being_used_as_a_value_here_Did_you_mean_to_use_1_in_0.code];
|
|
148771
148838
|
codefix.registerCodeFix({
|
|
148772
148839
|
errorCodes: errorCodes,
|
|
148773
|
-
getCodeActions: function (context) {
|
|
148840
|
+
getCodeActions: function getCodeActionsToConvertLiteralTypeToMappedType(context) {
|
|
148774
148841
|
var sourceFile = context.sourceFile, span = context.span;
|
|
148775
148842
|
var info = getInfo(sourceFile, span.start);
|
|
148776
148843
|
if (!info) {
|
|
@@ -149914,7 +149981,7 @@ var ts;
|
|
|
149914
149981
|
_a);
|
|
149915
149982
|
codefix.registerCodeFix({
|
|
149916
149983
|
errorCodes: errorCodes,
|
|
149917
|
-
getCodeActions: function (context) {
|
|
149984
|
+
getCodeActions: function getCodeActionsToFixOverrideModifierIssues(context) {
|
|
149918
149985
|
var errorCode = context.errorCode, span = context.span;
|
|
149919
149986
|
var info = errorCodeFixIdMap[errorCode];
|
|
149920
149987
|
if (!info)
|
|
@@ -150110,7 +150177,7 @@ var ts;
|
|
|
150110
150177
|
];
|
|
150111
150178
|
codefix.registerCodeFix({
|
|
150112
150179
|
errorCodes: errorCodes,
|
|
150113
|
-
getCodeActions: function (context) {
|
|
150180
|
+
getCodeActions: function getCodeActionsToFixIncorrectNamedTupleSyntax(context) {
|
|
150114
150181
|
var sourceFile = context.sourceFile, span = context.span;
|
|
150115
150182
|
var namedTupleMember = getNamedTupleMember(sourceFile, span.start);
|
|
150116
150183
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, namedTupleMember); });
|
|
@@ -150309,7 +150376,7 @@ var ts;
|
|
|
150309
150376
|
codefix.registerCodeFix({
|
|
150310
150377
|
errorCodes: errorCodes,
|
|
150311
150378
|
fixIds: [fixIdAddReturnStatement, fixRemoveBracesFromArrowFunctionBody, fixIdWrapTheBlockWithParen],
|
|
150312
|
-
getCodeActions: function (context) {
|
|
150379
|
+
getCodeActions: function getCodeActionsToCorrectReturnValue(context) {
|
|
150313
150380
|
var program = context.program, sourceFile = context.sourceFile, start = context.span.start, errorCode = context.errorCode;
|
|
150314
150381
|
var info = getInfo(program.getTypeChecker(), sourceFile, start, errorCode);
|
|
150315
150382
|
if (!info)
|
|
@@ -151059,7 +151126,7 @@ var ts;
|
|
|
151059
151126
|
];
|
|
151060
151127
|
codefix.registerCodeFix({
|
|
151061
151128
|
errorCodes: errorCodes,
|
|
151062
|
-
getCodeActions: function (context) {
|
|
151129
|
+
getCodeActions: function getCodeActionsToFixNotFoundModule(context) {
|
|
151063
151130
|
var host = context.host, sourceFile = context.sourceFile, start = context.span.start;
|
|
151064
151131
|
var packageName = tryGetImportedPackageName(sourceFile, start);
|
|
151065
151132
|
if (packageName === undefined)
|
|
@@ -151120,7 +151187,7 @@ var ts;
|
|
|
151120
151187
|
var fixId = "fixClassDoesntImplementInheritedAbstractMember";
|
|
151121
151188
|
codefix.registerCodeFix({
|
|
151122
151189
|
errorCodes: errorCodes,
|
|
151123
|
-
getCodeActions: function (context) {
|
|
151190
|
+
getCodeActions: function getCodeActionsToFixClassNotImplementingInheritedMembers(context) {
|
|
151124
151191
|
var sourceFile = context.sourceFile, span = context.span;
|
|
151125
151192
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) {
|
|
151126
151193
|
return addMissingMembers(getClass(sourceFile, span.start), sourceFile, context, t, context.preferences);
|
|
@@ -151128,7 +151195,7 @@ var ts;
|
|
|
151128
151195
|
return changes.length === 0 ? undefined : [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Implement_inherited_abstract_class, fixId, ts.Diagnostics.Implement_all_inherited_abstract_classes)];
|
|
151129
151196
|
},
|
|
151130
151197
|
fixIds: [fixId],
|
|
151131
|
-
getAllCodeActions: function (context) {
|
|
151198
|
+
getAllCodeActions: function getAllCodeActionsToFixClassDoesntImplementInheritedAbstractMember(context) {
|
|
151132
151199
|
var seenClassDeclarations = new ts.Map();
|
|
151133
151200
|
return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
|
|
151134
151201
|
var classDeclaration = getClass(diag.file, diag.start);
|
|
@@ -151261,7 +151328,7 @@ var ts;
|
|
|
151261
151328
|
];
|
|
151262
151329
|
codefix.registerCodeFix({
|
|
151263
151330
|
errorCodes: errorCodes,
|
|
151264
|
-
getCodeActions: function (context) {
|
|
151331
|
+
getCodeActions: function getCodeActionsToEnableExperimentalDecorators(context) {
|
|
151265
151332
|
var configFile = context.program.getCompilerOptions().configFile;
|
|
151266
151333
|
if (configFile === undefined) {
|
|
151267
151334
|
return undefined;
|
|
@@ -151292,7 +151359,7 @@ var ts;
|
|
|
151292
151359
|
var errorCodes = [ts.Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided.code];
|
|
151293
151360
|
codefix.registerCodeFix({
|
|
151294
151361
|
errorCodes: errorCodes,
|
|
151295
|
-
getCodeActions: function (context) {
|
|
151362
|
+
getCodeActions: function getCodeActionsToFixEnableJsxFlag(context) {
|
|
151296
151363
|
var configFile = context.program.getCompilerOptions().configFile;
|
|
151297
151364
|
if (configFile === undefined) {
|
|
151298
151365
|
return undefined;
|
|
@@ -151330,7 +151397,7 @@ var ts;
|
|
|
151330
151397
|
ts.Diagnostics.Top_level_await_expressions_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher.code,
|
|
151331
151398
|
ts.Diagnostics.Top_level_for_await_loops_are_only_allowed_when_the_module_option_is_set_to_es2022_esnext_system_or_nodenext_and_the_target_option_is_set_to_es2017_or_higher.code,
|
|
151332
151399
|
],
|
|
151333
|
-
getCodeActions: function (context) {
|
|
151400
|
+
getCodeActions: function getCodeActionsToFixModuleAndTarget(context) {
|
|
151334
151401
|
var compilerOptions = context.program.getCompilerOptions();
|
|
151335
151402
|
var configFile = compilerOptions.configFile;
|
|
151336
151403
|
if (configFile === undefined) {
|
|
@@ -152102,7 +152169,7 @@ var ts;
|
|
|
152102
152169
|
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_async_modifier_to_containing_function, fixId, ts.Diagnostics.Add_all_missing_async_modifiers)];
|
|
152103
152170
|
},
|
|
152104
152171
|
fixIds: [fixId],
|
|
152105
|
-
getAllCodeActions: function (context) {
|
|
152172
|
+
getAllCodeActions: function getAllCodeActionsToFixAwaitInSyncFunction(context) {
|
|
152106
152173
|
var seen = new ts.Map();
|
|
152107
152174
|
return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
|
|
152108
152175
|
var nodes = getNodes(diag.file, diag.start);
|
|
@@ -153224,7 +153291,7 @@ var ts;
|
|
|
153224
153291
|
codefix.registerCodeFix({
|
|
153225
153292
|
errorCodes: errorCodes,
|
|
153226
153293
|
fixIds: [fixId],
|
|
153227
|
-
getCodeActions: function (context) {
|
|
153294
|
+
getCodeActions: function getCodeActionsToFixReturnTypeInAsyncFunction(context) {
|
|
153228
153295
|
var sourceFile = context.sourceFile, program = context.program, span = context.span;
|
|
153229
153296
|
var checker = program.getTypeChecker();
|
|
153230
153297
|
var info = getInfo(sourceFile, program.getTypeChecker(), span.start);
|
|
@@ -153278,7 +153345,7 @@ var ts;
|
|
|
153278
153345
|
});
|
|
153279
153346
|
codefix.registerCodeFix({
|
|
153280
153347
|
errorCodes: errorCodes,
|
|
153281
|
-
getCodeActions: function (context) {
|
|
153348
|
+
getCodeActions: function getCodeActionsToDisableJsDiagnostics(context) {
|
|
153282
153349
|
var sourceFile = context.sourceFile, program = context.program, span = context.span, host = context.host, formatContext = context.formatContext;
|
|
153283
153350
|
if (!ts.isInJSFile(sourceFile) || !ts.isCheckJsEnabledForFile(sourceFile, program.getCompilerOptions())) {
|
|
153284
153351
|
return undefined;
|
|
@@ -154047,7 +154114,7 @@ var ts;
|
|
|
154047
154114
|
var errorCodes = [ts.Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor.code];
|
|
154048
154115
|
codefix.registerCodeFix({
|
|
154049
154116
|
errorCodes: errorCodes,
|
|
154050
|
-
getCodeActions: function (context) {
|
|
154117
|
+
getCodeActions: function getCodeActionsForStrictClassInitializationErrors(context) {
|
|
154051
154118
|
var propertyDeclaration = getPropertyDeclaration(context.sourceFile, context.span.start);
|
|
154052
154119
|
if (!propertyDeclaration)
|
|
154053
154120
|
return;
|
|
@@ -154270,7 +154337,7 @@ var ts;
|
|
|
154270
154337
|
];
|
|
154271
154338
|
codefix.registerCodeFix({
|
|
154272
154339
|
errorCodes: errorCodes,
|
|
154273
|
-
getCodeActions: function (context) {
|
|
154340
|
+
getCodeActions: function getCodeActionsToUseBigintLiteral(context) {
|
|
154274
154341
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return makeChange(t, context.sourceFile, context.span); });
|
|
154275
154342
|
if (changes.length > 0) {
|
|
154276
154343
|
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Convert_to_a_bigint_numeric_literal, fixId, ts.Diagnostics.Convert_all_to_bigint_numeric_literals)];
|
|
@@ -154302,7 +154369,7 @@ var ts;
|
|
|
154302
154369
|
var errorCodes = [ts.Diagnostics.Module_0_does_not_refer_to_a_type_but_is_used_as_a_type_here_Did_you_mean_typeof_import_0.code];
|
|
154303
154370
|
codefix.registerCodeFix({
|
|
154304
154371
|
errorCodes: errorCodes,
|
|
154305
|
-
getCodeActions: function (context) {
|
|
154372
|
+
getCodeActions: function getCodeActionsToAddMissingTypeof(context) {
|
|
154306
154373
|
var sourceFile = context.sourceFile, span = context.span;
|
|
154307
154374
|
var importType = getImportTypeNode(sourceFile, span.start);
|
|
154308
154375
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, importType); });
|
|
@@ -154334,7 +154401,7 @@ var ts;
|
|
|
154334
154401
|
var errorCodes = [ts.Diagnostics.JSX_expressions_must_have_one_parent_element.code];
|
|
154335
154402
|
codefix.registerCodeFix({
|
|
154336
154403
|
errorCodes: errorCodes,
|
|
154337
|
-
getCodeActions: function (context) {
|
|
154404
|
+
getCodeActions: function getCodeActionsToWrapJsxInFragment(context) {
|
|
154338
154405
|
var sourceFile = context.sourceFile, span = context.span;
|
|
154339
154406
|
var node = findNodeToFix(sourceFile, span.start);
|
|
154340
154407
|
if (!node)
|
|
@@ -154406,12 +154473,11 @@ var ts;
|
|
|
154406
154473
|
(function (ts) {
|
|
154407
154474
|
var codefix;
|
|
154408
154475
|
(function (codefix) {
|
|
154409
|
-
var
|
|
154410
|
-
var fixId = fixIdAddMissingTypeof;
|
|
154476
|
+
var fixId = "fixConvertToMappedObjectType";
|
|
154411
154477
|
var errorCodes = [ts.Diagnostics.An_index_signature_parameter_type_cannot_be_a_literal_type_or_generic_type_Consider_using_a_mapped_object_type_instead.code];
|
|
154412
154478
|
codefix.registerCodeFix({
|
|
154413
154479
|
errorCodes: errorCodes,
|
|
154414
|
-
getCodeActions: function (context) {
|
|
154480
|
+
getCodeActions: function getCodeActionsToConvertToMappedTypeObject(context) {
|
|
154415
154481
|
var sourceFile = context.sourceFile, span = context.span;
|
|
154416
154482
|
var info = getInfo(sourceFile, span.start);
|
|
154417
154483
|
if (!info)
|
|
@@ -154490,7 +154556,7 @@ var ts;
|
|
|
154490
154556
|
];
|
|
154491
154557
|
codefix.registerCodeFix({
|
|
154492
154558
|
errorCodes: errorCodes,
|
|
154493
|
-
getCodeActions: function (context) {
|
|
154559
|
+
getCodeActions: function getCodeActionsToRemoveUnnecessaryAwait(context) {
|
|
154494
154560
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return makeChange(t, context.sourceFile, context.span); });
|
|
154495
154561
|
if (changes.length > 0) {
|
|
154496
154562
|
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Remove_unnecessary_await, fixId, ts.Diagnostics.Remove_all_unnecessary_uses_of_await)];
|
|
@@ -154532,7 +154598,7 @@ var ts;
|
|
|
154532
154598
|
codefix.registerCodeFix({
|
|
154533
154599
|
errorCodes: errorCodes,
|
|
154534
154600
|
fixIds: [fixId],
|
|
154535
|
-
getCodeActions: function (context) {
|
|
154601
|
+
getCodeActions: function getCodeActionsToSplitTypeOnlyImport(context) {
|
|
154536
154602
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) {
|
|
154537
154603
|
return splitTypeOnlyImport(t, getImportDeclaration(context.sourceFile, context.span), context);
|
|
154538
154604
|
});
|
|
@@ -154568,7 +154634,7 @@ var ts;
|
|
|
154568
154634
|
var errorCodes = [ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_constant.code];
|
|
154569
154635
|
codefix.registerCodeFix({
|
|
154570
154636
|
errorCodes: errorCodes,
|
|
154571
|
-
getCodeActions: function (context) {
|
|
154637
|
+
getCodeActions: function getCodeActionsToConvertConstToLet(context) {
|
|
154572
154638
|
var sourceFile = context.sourceFile, span = context.span, program = context.program;
|
|
154573
154639
|
var range = getConstTokenRange(sourceFile, span.start, program);
|
|
154574
154640
|
if (range === undefined)
|