typescript 4.6.0-dev.20211126 → 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 +56 -15
- package/lib/tsserver.js +158 -91
- package/lib/tsserverlibrary.js +158 -91
- package/lib/typescript.js +158 -91
- package/lib/typescriptServices.js +158 -91
- package/lib/typingsInstaller.js +66 -18
- package/package.json +1 -1
package/lib/tsserverlibrary.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) {
|
|
@@ -91104,11 +91104,10 @@ var ts;
|
|
|
91104
91104
|
// we can safely elide the parentheses here, as a new synthetic
|
|
91105
91105
|
// ParenthesizedExpression will be inserted if we remove parentheses too
|
|
91106
91106
|
// aggressively.
|
|
91107
|
-
//
|
|
91108
|
-
//
|
|
91109
|
-
|
|
91110
|
-
|
|
91111
|
-
}
|
|
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.
|
|
91112
91111
|
return factory.createPartiallyEmittedExpression(expression, node);
|
|
91113
91112
|
}
|
|
91114
91113
|
return ts.visitEachChild(node, visitor, context);
|
|
@@ -95056,11 +95055,11 @@ var ts;
|
|
|
95056
95055
|
}
|
|
95057
95056
|
function visitOptionalExpression(node, captureThisArg, isDelete) {
|
|
95058
95057
|
var _a = flattenChain(node), expression = _a.expression, chain = _a.chain;
|
|
95059
|
-
var left = visitNonOptionalExpression(expression, ts.isCallChain(chain[0]), /*isDelete*/ false);
|
|
95058
|
+
var left = visitNonOptionalExpression(ts.skipPartiallyEmittedExpressions(expression), ts.isCallChain(chain[0]), /*isDelete*/ false);
|
|
95060
95059
|
var leftThisArg = ts.isSyntheticReference(left) ? left.thisArg : undefined;
|
|
95061
|
-
var
|
|
95062
|
-
var
|
|
95063
|
-
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)) {
|
|
95064
95063
|
capturedLeft = factory.createTempVariable(hoistVariableDeclaration);
|
|
95065
95064
|
leftExpression = factory.createAssignment(capturedLeft, leftExpression);
|
|
95066
95065
|
}
|
|
@@ -95086,6 +95085,10 @@ var ts;
|
|
|
95086
95085
|
break;
|
|
95087
95086
|
case 207 /* CallExpression */:
|
|
95088
95087
|
if (i === 0 && leftThisArg) {
|
|
95088
|
+
if (!ts.isGeneratedIdentifier(leftThisArg)) {
|
|
95089
|
+
leftThisArg = factory.cloneNode(leftThisArg);
|
|
95090
|
+
ts.addEmitFlags(leftThisArg, 1536 /* NoComments */);
|
|
95091
|
+
}
|
|
95089
95092
|
rightExpression = factory.createFunctionCallCall(rightExpression, leftThisArg.kind === 106 /* SuperKeyword */ ? factory.createThis() : leftThisArg, ts.visitNodes(segment.arguments, visitor, ts.isExpression));
|
|
95090
95093
|
}
|
|
95091
95094
|
else {
|
|
@@ -109868,7 +109871,7 @@ var ts;
|
|
|
109868
109871
|
function emitYieldExpression(node) {
|
|
109869
109872
|
emitTokenWithComment(125 /* YieldKeyword */, node.pos, writeKeyword, node);
|
|
109870
109873
|
emit(node.asteriskToken);
|
|
109871
|
-
emitExpressionWithLeadingSpace(node.expression
|
|
109874
|
+
emitExpressionWithLeadingSpace(node.expression && parenthesizeExpressionForNoAsi(node.expression), parenthesizeExpressionForNoAsiAndDisallowedComma);
|
|
109872
109875
|
}
|
|
109873
109876
|
function emitSpreadElement(node) {
|
|
109874
109877
|
emitTokenWithComment(25 /* DotDotDotToken */, node.pos, writePunctuation, node);
|
|
@@ -110065,9 +110068,49 @@ var ts;
|
|
|
110065
110068
|
}
|
|
110066
110069
|
return pos;
|
|
110067
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
|
+
}
|
|
110068
110111
|
function emitReturnStatement(node) {
|
|
110069
110112
|
emitTokenWithComment(105 /* ReturnKeyword */, node.pos, writeKeyword, /*contextNode*/ node);
|
|
110070
|
-
emitExpressionWithLeadingSpace(node.expression);
|
|
110113
|
+
emitExpressionWithLeadingSpace(node.expression && parenthesizeExpressionForNoAsi(node.expression), parenthesizeExpressionForNoAsi);
|
|
110071
110114
|
writeTrailingSemicolon();
|
|
110072
110115
|
}
|
|
110073
110116
|
function emitWithStatement(node) {
|
|
@@ -110095,7 +110138,7 @@ var ts;
|
|
|
110095
110138
|
}
|
|
110096
110139
|
function emitThrowStatement(node) {
|
|
110097
110140
|
emitTokenWithComment(109 /* ThrowKeyword */, node.pos, writeKeyword, node);
|
|
110098
|
-
emitExpressionWithLeadingSpace(node.expression);
|
|
110141
|
+
emitExpressionWithLeadingSpace(parenthesizeExpressionForNoAsi(node.expression), parenthesizeExpressionForNoAsi);
|
|
110099
110142
|
writeTrailingSemicolon();
|
|
110100
110143
|
}
|
|
110101
110144
|
function emitTryStatement(node) {
|
|
@@ -110939,7 +110982,14 @@ var ts;
|
|
|
110939
110982
|
}
|
|
110940
110983
|
// Transformation nodes
|
|
110941
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
|
+
}
|
|
110942
110989
|
emitExpression(node.expression);
|
|
110990
|
+
if (!(emitFlags & 1024 /* NoTrailingComments */) && node.end !== node.expression.end) {
|
|
110991
|
+
emitLeadingCommentsOfPosition(node.expression.end);
|
|
110992
|
+
}
|
|
110943
110993
|
}
|
|
110944
110994
|
function emitCommaList(node) {
|
|
110945
110995
|
emitExpressionList(node, node.elements, 528 /* CommaListElements */, /*parenthesizerRule*/ undefined);
|
|
@@ -111303,10 +111353,8 @@ var ts;
|
|
|
111303
111353
|
// Emit this child.
|
|
111304
111354
|
previousSourceFileTextKind = recordBundleFileInternalSectionStart(child);
|
|
111305
111355
|
if (shouldEmitInterveningComments) {
|
|
111306
|
-
|
|
111307
|
-
|
|
111308
|
-
emitTrailingCommentsOfPosition(commentRange.pos);
|
|
111309
|
-
}
|
|
111356
|
+
var commentRange = ts.getCommentRange(child);
|
|
111357
|
+
emitTrailingCommentsOfPosition(commentRange.pos);
|
|
111310
111358
|
}
|
|
111311
111359
|
else {
|
|
111312
111360
|
shouldEmitInterveningComments = mayEmitInterveningComments;
|
|
@@ -111627,7 +111675,7 @@ var ts;
|
|
|
111627
111675
|
function writeLineSeparatorsAndIndentBefore(node, parent) {
|
|
111628
111676
|
var leadingNewlines = preserveSourceNewlines && getLeadingLineTerminatorCount(parent, [node], 0 /* None */);
|
|
111629
111677
|
if (leadingNewlines) {
|
|
111630
|
-
writeLinesAndIndent(leadingNewlines, /*
|
|
111678
|
+
writeLinesAndIndent(leadingNewlines, /*writeSpaceIfNotIndenting*/ false);
|
|
111631
111679
|
}
|
|
111632
111680
|
return !!leadingNewlines;
|
|
111633
111681
|
}
|
|
@@ -126005,7 +126053,6 @@ var ts;
|
|
|
126005
126053
|
|| kind === 165 /* PropertySignature */
|
|
126006
126054
|
|| kind === 167 /* MethodSignature */;
|
|
126007
126055
|
}
|
|
126008
|
-
ts.syntaxRequiresTrailingCommaOrSemicolonOrASI = syntaxRequiresTrailingCommaOrSemicolonOrASI;
|
|
126009
126056
|
function syntaxRequiresTrailingFunctionBlockOrSemicolonOrASI(kind) {
|
|
126010
126057
|
return kind === 255 /* FunctionDeclaration */
|
|
126011
126058
|
|| kind === 170 /* Constructor */
|
|
@@ -126013,11 +126060,9 @@ var ts;
|
|
|
126013
126060
|
|| kind === 171 /* GetAccessor */
|
|
126014
126061
|
|| kind === 172 /* SetAccessor */;
|
|
126015
126062
|
}
|
|
126016
|
-
ts.syntaxRequiresTrailingFunctionBlockOrSemicolonOrASI = syntaxRequiresTrailingFunctionBlockOrSemicolonOrASI;
|
|
126017
126063
|
function syntaxRequiresTrailingModuleBlockOrSemicolonOrASI(kind) {
|
|
126018
126064
|
return kind === 260 /* ModuleDeclaration */;
|
|
126019
126065
|
}
|
|
126020
|
-
ts.syntaxRequiresTrailingModuleBlockOrSemicolonOrASI = syntaxRequiresTrailingModuleBlockOrSemicolonOrASI;
|
|
126021
126066
|
function syntaxRequiresTrailingSemicolonOrASI(kind) {
|
|
126022
126067
|
return kind === 236 /* VariableStatement */
|
|
126023
126068
|
|| kind === 237 /* ExpressionStatement */
|
|
@@ -126092,19 +126137,34 @@ var ts;
|
|
|
126092
126137
|
ts.forEachChild(sourceFile, function visit(node) {
|
|
126093
126138
|
if (syntaxRequiresTrailingSemicolonOrASI(node.kind)) {
|
|
126094
126139
|
var lastToken = node.getLastToken(sourceFile);
|
|
126095
|
-
if (lastToken
|
|
126140
|
+
if ((lastToken === null || lastToken === void 0 ? void 0 : lastToken.kind) === 26 /* SemicolonToken */) {
|
|
126096
126141
|
withSemicolon++;
|
|
126097
126142
|
}
|
|
126098
126143
|
else {
|
|
126099
126144
|
withoutSemicolon++;
|
|
126100
126145
|
}
|
|
126101
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
|
+
}
|
|
126102
126162
|
if (withSemicolon + withoutSemicolon >= nStatementsToObserve) {
|
|
126103
126163
|
return true;
|
|
126104
126164
|
}
|
|
126105
126165
|
return ts.forEachChild(node, visit);
|
|
126106
126166
|
});
|
|
126107
|
-
// One statement missing a semicolon isn
|
|
126167
|
+
// One statement missing a semicolon isn't sufficient evidence to say the user
|
|
126108
126168
|
// doesn’t want semicolons, because they may not even be done writing that statement.
|
|
126109
126169
|
if (withSemicolon === 0 && withoutSemicolon <= 1) {
|
|
126110
126170
|
return true;
|
|
@@ -141970,6 +142030,7 @@ var ts;
|
|
|
141970
142030
|
lastTrailingTriviaWasNewLine: function () { return wasNewLine; },
|
|
141971
142031
|
skipToEndOf: skipToEndOf,
|
|
141972
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(); },
|
|
141973
142034
|
});
|
|
141974
142035
|
lastTokenInfo = undefined;
|
|
141975
142036
|
scanner.setText(undefined);
|
|
@@ -142143,8 +142204,7 @@ var ts;
|
|
|
142143
142204
|
}
|
|
142144
142205
|
function isOnToken() {
|
|
142145
142206
|
var current = lastTokenInfo ? lastTokenInfo.token.kind : scanner.getToken();
|
|
142146
|
-
|
|
142147
|
-
return startPos < endPos && current !== 1 /* EndOfFileToken */ && !ts.isTrivia(current);
|
|
142207
|
+
return current !== 1 /* EndOfFileToken */ && !ts.isTrivia(current);
|
|
142148
142208
|
}
|
|
142149
142209
|
function isOnEOF() {
|
|
142150
142210
|
var current = lastTokenInfo ? lastTokenInfo.token.kind : scanner.getToken();
|
|
@@ -143332,7 +143392,7 @@ var ts;
|
|
|
143332
143392
|
return 0;
|
|
143333
143393
|
}
|
|
143334
143394
|
function formatNodeGivenIndentation(node, sourceFileLike, languageVariant, initialIndentation, delta, formatContext) {
|
|
143335
|
-
var range = { pos:
|
|
143395
|
+
var range = { pos: node.pos, end: node.end };
|
|
143336
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
|
|
143337
143397
|
sourceFileLike); });
|
|
143338
143398
|
}
|
|
@@ -143383,6 +143443,15 @@ var ts;
|
|
|
143383
143443
|
}
|
|
143384
143444
|
}
|
|
143385
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
|
+
}
|
|
143386
143455
|
return edits;
|
|
143387
143456
|
// local functions
|
|
143388
143457
|
/** Tries to compute the indentation for a list element.
|
|
@@ -143565,19 +143634,13 @@ var ts;
|
|
|
143565
143634
|
processChildNodes(nodes, node, nodeStartLine, nodeDynamicIndentation);
|
|
143566
143635
|
});
|
|
143567
143636
|
// proceed any tokens in the node that are located after child nodes
|
|
143568
|
-
while (formattingScanner.isOnToken()) {
|
|
143637
|
+
while (formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) {
|
|
143569
143638
|
var tokenInfo = formattingScanner.readTokenInfo(node);
|
|
143570
|
-
if (tokenInfo.token.end > node.end) {
|
|
143639
|
+
if (tokenInfo.token.end > Math.min(node.end, originalRange.end)) {
|
|
143571
143640
|
break;
|
|
143572
143641
|
}
|
|
143573
143642
|
consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation, node);
|
|
143574
143643
|
}
|
|
143575
|
-
if (!node.parent && formattingScanner.isOnEOF()) {
|
|
143576
|
-
var token = formattingScanner.readEOFTokenRange();
|
|
143577
|
-
if (token.end <= node.end && previousRange) {
|
|
143578
|
-
processPair(token, sourceFile.getLineAndCharacterOfPosition(token.pos).line, node, previousRange, previousRangeStartLine, previousParent, contextNode, nodeDynamicIndentation);
|
|
143579
|
-
}
|
|
143580
|
-
}
|
|
143581
143644
|
function processChildNode(child, inheritedIndentation, parent, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem, isFirstListItem) {
|
|
143582
143645
|
var childStartPos = child.getStart(sourceFile);
|
|
143583
143646
|
var childStartLine = sourceFile.getLineAndCharacterOfPosition(childStartPos).line;
|
|
@@ -143603,9 +143666,12 @@ var ts;
|
|
|
143603
143666
|
if (child.getFullWidth() === 0) {
|
|
143604
143667
|
return inheritedIndentation;
|
|
143605
143668
|
}
|
|
143606
|
-
while (formattingScanner.isOnToken()) {
|
|
143669
|
+
while (formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) {
|
|
143607
143670
|
// proceed any parent tokens that are located prior to child.getStart()
|
|
143608
143671
|
var tokenInfo = formattingScanner.readTokenInfo(node);
|
|
143672
|
+
if (tokenInfo.token.end > originalRange.end) {
|
|
143673
|
+
return inheritedIndentation;
|
|
143674
|
+
}
|
|
143609
143675
|
if (tokenInfo.token.end > childStartPos) {
|
|
143610
143676
|
if (tokenInfo.token.pos > childStartPos) {
|
|
143611
143677
|
formattingScanner.skipToStartOf(child);
|
|
@@ -143615,7 +143681,7 @@ var ts;
|
|
|
143615
143681
|
}
|
|
143616
143682
|
consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, node);
|
|
143617
143683
|
}
|
|
143618
|
-
if (!formattingScanner.isOnToken()) {
|
|
143684
|
+
if (!formattingScanner.isOnToken() || formattingScanner.getStartPos() >= originalRange.end) {
|
|
143619
143685
|
return inheritedIndentation;
|
|
143620
143686
|
}
|
|
143621
143687
|
if (ts.isToken(child)) {
|
|
@@ -143644,7 +143710,7 @@ var ts;
|
|
|
143644
143710
|
var startLine = parentStartLine;
|
|
143645
143711
|
if (listStartToken !== 0 /* Unknown */) {
|
|
143646
143712
|
// introduce a new indentation scope for lists (including list start and end tokens)
|
|
143647
|
-
while (formattingScanner.isOnToken()) {
|
|
143713
|
+
while (formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) {
|
|
143648
143714
|
var tokenInfo = formattingScanner.readTokenInfo(parent);
|
|
143649
143715
|
if (tokenInfo.token.end > nodes.pos) {
|
|
143650
143716
|
// stop when formatting scanner moves past the beginning of node list
|
|
@@ -143680,7 +143746,7 @@ var ts;
|
|
|
143680
143746
|
inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, startLine, startLine, /*isListItem*/ true, /*isFirstListItem*/ i === 0);
|
|
143681
143747
|
}
|
|
143682
143748
|
var listEndToken = getCloseTokenForOpenToken(listStartToken);
|
|
143683
|
-
if (listEndToken !== 0 /* Unknown */ && formattingScanner.isOnToken()) {
|
|
143749
|
+
if (listEndToken !== 0 /* Unknown */ && formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) {
|
|
143684
143750
|
var tokenInfo = formattingScanner.readTokenInfo(parent);
|
|
143685
143751
|
if (tokenInfo.token.kind === 27 /* CommaToken */ && ts.isCallLikeExpression(parent)) {
|
|
143686
143752
|
var commaTokenLine = sourceFile.getLineAndCharacterOfPosition(tokenInfo.token.pos).line;
|
|
@@ -143811,24 +143877,26 @@ var ts;
|
|
|
143811
143877
|
// win in a conflict with lower priority rules.
|
|
143812
143878
|
ts.forEachRight(rules, function (rule) {
|
|
143813
143879
|
lineAction = applyRuleEdits(rule, previousItem, previousStartLine, currentItem, currentStartLine);
|
|
143814
|
-
|
|
143815
|
-
|
|
143816
|
-
|
|
143817
|
-
|
|
143818
|
-
|
|
143819
|
-
|
|
143820
|
-
|
|
143821
|
-
|
|
143822
|
-
|
|
143823
|
-
|
|
143824
|
-
|
|
143825
|
-
|
|
143826
|
-
|
|
143827
|
-
|
|
143828
|
-
|
|
143829
|
-
|
|
143830
|
-
|
|
143831
|
-
|
|
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
|
+
}
|
|
143832
143900
|
}
|
|
143833
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
|
|
143834
143902
|
trimTrailingWhitespaces = trimTrailingWhitespaces && !(rule.action & 16 /* DeleteSpace */) && rule.flags !== 1 /* CanDeleteNewLines */;
|
|
@@ -146306,7 +146374,7 @@ var ts;
|
|
|
146306
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];
|
|
146307
146375
|
codefix.registerCodeFix({
|
|
146308
146376
|
errorCodes: errorCodes,
|
|
146309
|
-
getCodeActions: function (context) {
|
|
146377
|
+
getCodeActions: function getCodeActionsToAddConvertToUnknownForNonOverlappingTypes(context) {
|
|
146310
146378
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return makeChange(t, context.sourceFile, context.span.start); });
|
|
146311
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)];
|
|
146312
146380
|
},
|
|
@@ -146333,7 +146401,7 @@ var ts;
|
|
|
146333
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,
|
|
146334
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,
|
|
146335
146403
|
],
|
|
146336
|
-
getCodeActions: function (context) {
|
|
146404
|
+
getCodeActions: function getCodeActionsToAddEmptyExportDeclaration(context) {
|
|
146337
146405
|
var sourceFile = context.sourceFile;
|
|
146338
146406
|
var changes = ts.textChanges.ChangeTracker.with(context, function (changes) {
|
|
146339
146407
|
var exportDeclaration = ts.factory.createExportDeclaration(
|
|
@@ -146362,7 +146430,7 @@ var ts;
|
|
|
146362
146430
|
codefix.registerCodeFix({
|
|
146363
146431
|
fixIds: [fixId],
|
|
146364
146432
|
errorCodes: errorCodes,
|
|
146365
|
-
getCodeActions: function (context) {
|
|
146433
|
+
getCodeActions: function getCodeActionsToAddMissingAsync(context) {
|
|
146366
146434
|
var sourceFile = context.sourceFile, errorCode = context.errorCode, cancellationToken = context.cancellationToken, program = context.program, span = context.span;
|
|
146367
146435
|
var diagnostic = ts.find(program.getDiagnosticsProducingTypeChecker().getDiagnostics(sourceFile, cancellationToken), getIsMatchingAsyncError(span, errorCode));
|
|
146368
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; });
|
|
@@ -146459,7 +146527,7 @@ var ts;
|
|
|
146459
146527
|
codefix.registerCodeFix({
|
|
146460
146528
|
fixIds: [fixId],
|
|
146461
146529
|
errorCodes: errorCodes,
|
|
146462
|
-
getCodeActions: function (context) {
|
|
146530
|
+
getCodeActions: function getCodeActionsToAddMissingAwait(context) {
|
|
146463
146531
|
var sourceFile = context.sourceFile, errorCode = context.errorCode, span = context.span, cancellationToken = context.cancellationToken, program = context.program;
|
|
146464
146532
|
var expression = getAwaitErrorSpanExpression(sourceFile, errorCode, span, cancellationToken, program);
|
|
146465
146533
|
if (!expression) {
|
|
@@ -146691,7 +146759,7 @@ var ts;
|
|
|
146691
146759
|
];
|
|
146692
146760
|
codefix.registerCodeFix({
|
|
146693
146761
|
errorCodes: errorCodes,
|
|
146694
|
-
getCodeActions: function (context) {
|
|
146762
|
+
getCodeActions: function getCodeActionsToAddMissingConst(context) {
|
|
146695
146763
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return makeChange(t, context.sourceFile, context.span.start, context.program); });
|
|
146696
146764
|
if (changes.length > 0) {
|
|
146697
146765
|
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_const_to_unresolved_variable, fixId, ts.Diagnostics.Add_const_to_all_unresolved_variables)];
|
|
@@ -146791,7 +146859,7 @@ var ts;
|
|
|
146791
146859
|
];
|
|
146792
146860
|
codefix.registerCodeFix({
|
|
146793
146861
|
errorCodes: errorCodes,
|
|
146794
|
-
getCodeActions: function (context) {
|
|
146862
|
+
getCodeActions: function getCodeActionsToAddMissingDeclareOnProperty(context) {
|
|
146795
146863
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return makeChange(t, context.sourceFile, context.span.start); });
|
|
146796
146864
|
if (changes.length > 0) {
|
|
146797
146865
|
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Prefix_with_declare, fixId, ts.Diagnostics.Prefix_all_incorrect_property_declarations_with_declare)];
|
|
@@ -146825,7 +146893,7 @@ var ts;
|
|
|
146825
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];
|
|
146826
146894
|
codefix.registerCodeFix({
|
|
146827
146895
|
errorCodes: errorCodes,
|
|
146828
|
-
getCodeActions: function (context) {
|
|
146896
|
+
getCodeActions: function getCodeActionsToAddMissingInvocationForDecorator(context) {
|
|
146829
146897
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return makeChange(t, context.sourceFile, context.span.start); });
|
|
146830
146898
|
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Call_decorator_expression, fixId, ts.Diagnostics.Add_to_all_uncalled_decorators)];
|
|
146831
146899
|
},
|
|
@@ -146850,7 +146918,7 @@ var ts;
|
|
|
146850
146918
|
var errorCodes = [ts.Diagnostics.Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1.code];
|
|
146851
146919
|
codefix.registerCodeFix({
|
|
146852
146920
|
errorCodes: errorCodes,
|
|
146853
|
-
getCodeActions: function (context) {
|
|
146921
|
+
getCodeActions: function getCodeActionsToAddNameToNamelessParameter(context) {
|
|
146854
146922
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return makeChange(t, context.sourceFile, context.span.start); });
|
|
146855
146923
|
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_parameter_name, fixId, ts.Diagnostics.Add_names_to_all_parameters_without_names)];
|
|
146856
146924
|
},
|
|
@@ -148652,14 +148720,14 @@ var ts;
|
|
|
148652
148720
|
var fixId = "convertToTypeOnlyExport";
|
|
148653
148721
|
codefix.registerCodeFix({
|
|
148654
148722
|
errorCodes: errorCodes,
|
|
148655
|
-
getCodeActions: function (context) {
|
|
148723
|
+
getCodeActions: function getCodeActionsToConvertToTypeOnlyExport(context) {
|
|
148656
148724
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return fixSingleExportDeclaration(t, getExportSpecifierForDiagnosticSpan(context.span, context.sourceFile), context); });
|
|
148657
148725
|
if (changes.length) {
|
|
148658
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)];
|
|
148659
148727
|
}
|
|
148660
148728
|
},
|
|
148661
148729
|
fixIds: [fixId],
|
|
148662
|
-
getAllCodeActions: function (context) {
|
|
148730
|
+
getAllCodeActions: function getAllCodeActionsToConvertToTypeOnlyExport(context) {
|
|
148663
148731
|
var fixedExportDeclarations = new ts.Map();
|
|
148664
148732
|
return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
|
|
148665
148733
|
var exportSpecifier = getExportSpecifierForDiagnosticSpan(diag, context.sourceFile);
|
|
@@ -148720,7 +148788,7 @@ var ts;
|
|
|
148720
148788
|
var fixId = "convertToTypeOnlyImport";
|
|
148721
148789
|
codefix.registerCodeFix({
|
|
148722
148790
|
errorCodes: errorCodes,
|
|
148723
|
-
getCodeActions: function (context) {
|
|
148791
|
+
getCodeActions: function getCodeActionsToConvertToTypeOnlyImport(context) {
|
|
148724
148792
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) {
|
|
148725
148793
|
var importDeclaration = getImportDeclarationForDiagnosticSpan(context.span, context.sourceFile);
|
|
148726
148794
|
fixSingleImportDeclaration(t, importDeclaration, context);
|
|
@@ -148730,7 +148798,7 @@ var ts;
|
|
|
148730
148798
|
}
|
|
148731
148799
|
},
|
|
148732
148800
|
fixIds: [fixId],
|
|
148733
|
-
getAllCodeActions: function (context) {
|
|
148801
|
+
getAllCodeActions: function getAllCodeActionsToConvertToTypeOnlyImport(context) {
|
|
148734
148802
|
return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
|
|
148735
148803
|
var importDeclaration = getImportDeclarationForDiagnosticSpan(diag, context.sourceFile);
|
|
148736
148804
|
fixSingleImportDeclaration(changes, importDeclaration, context);
|
|
@@ -148769,7 +148837,7 @@ var ts;
|
|
|
148769
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];
|
|
148770
148838
|
codefix.registerCodeFix({
|
|
148771
148839
|
errorCodes: errorCodes,
|
|
148772
|
-
getCodeActions: function (context) {
|
|
148840
|
+
getCodeActions: function getCodeActionsToConvertLiteralTypeToMappedType(context) {
|
|
148773
148841
|
var sourceFile = context.sourceFile, span = context.span;
|
|
148774
148842
|
var info = getInfo(sourceFile, span.start);
|
|
148775
148843
|
if (!info) {
|
|
@@ -149913,7 +149981,7 @@ var ts;
|
|
|
149913
149981
|
_a);
|
|
149914
149982
|
codefix.registerCodeFix({
|
|
149915
149983
|
errorCodes: errorCodes,
|
|
149916
|
-
getCodeActions: function (context) {
|
|
149984
|
+
getCodeActions: function getCodeActionsToFixOverrideModifierIssues(context) {
|
|
149917
149985
|
var errorCode = context.errorCode, span = context.span;
|
|
149918
149986
|
var info = errorCodeFixIdMap[errorCode];
|
|
149919
149987
|
if (!info)
|
|
@@ -150109,7 +150177,7 @@ var ts;
|
|
|
150109
150177
|
];
|
|
150110
150178
|
codefix.registerCodeFix({
|
|
150111
150179
|
errorCodes: errorCodes,
|
|
150112
|
-
getCodeActions: function (context) {
|
|
150180
|
+
getCodeActions: function getCodeActionsToFixIncorrectNamedTupleSyntax(context) {
|
|
150113
150181
|
var sourceFile = context.sourceFile, span = context.span;
|
|
150114
150182
|
var namedTupleMember = getNamedTupleMember(sourceFile, span.start);
|
|
150115
150183
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, namedTupleMember); });
|
|
@@ -150308,7 +150376,7 @@ var ts;
|
|
|
150308
150376
|
codefix.registerCodeFix({
|
|
150309
150377
|
errorCodes: errorCodes,
|
|
150310
150378
|
fixIds: [fixIdAddReturnStatement, fixRemoveBracesFromArrowFunctionBody, fixIdWrapTheBlockWithParen],
|
|
150311
|
-
getCodeActions: function (context) {
|
|
150379
|
+
getCodeActions: function getCodeActionsToCorrectReturnValue(context) {
|
|
150312
150380
|
var program = context.program, sourceFile = context.sourceFile, start = context.span.start, errorCode = context.errorCode;
|
|
150313
150381
|
var info = getInfo(program.getTypeChecker(), sourceFile, start, errorCode);
|
|
150314
150382
|
if (!info)
|
|
@@ -151058,7 +151126,7 @@ var ts;
|
|
|
151058
151126
|
];
|
|
151059
151127
|
codefix.registerCodeFix({
|
|
151060
151128
|
errorCodes: errorCodes,
|
|
151061
|
-
getCodeActions: function (context) {
|
|
151129
|
+
getCodeActions: function getCodeActionsToFixNotFoundModule(context) {
|
|
151062
151130
|
var host = context.host, sourceFile = context.sourceFile, start = context.span.start;
|
|
151063
151131
|
var packageName = tryGetImportedPackageName(sourceFile, start);
|
|
151064
151132
|
if (packageName === undefined)
|
|
@@ -151119,7 +151187,7 @@ var ts;
|
|
|
151119
151187
|
var fixId = "fixClassDoesntImplementInheritedAbstractMember";
|
|
151120
151188
|
codefix.registerCodeFix({
|
|
151121
151189
|
errorCodes: errorCodes,
|
|
151122
|
-
getCodeActions: function (context) {
|
|
151190
|
+
getCodeActions: function getCodeActionsToFixClassNotImplementingInheritedMembers(context) {
|
|
151123
151191
|
var sourceFile = context.sourceFile, span = context.span;
|
|
151124
151192
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) {
|
|
151125
151193
|
return addMissingMembers(getClass(sourceFile, span.start), sourceFile, context, t, context.preferences);
|
|
@@ -151127,7 +151195,7 @@ var ts;
|
|
|
151127
151195
|
return changes.length === 0 ? undefined : [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Implement_inherited_abstract_class, fixId, ts.Diagnostics.Implement_all_inherited_abstract_classes)];
|
|
151128
151196
|
},
|
|
151129
151197
|
fixIds: [fixId],
|
|
151130
|
-
getAllCodeActions: function (context) {
|
|
151198
|
+
getAllCodeActions: function getAllCodeActionsToFixClassDoesntImplementInheritedAbstractMember(context) {
|
|
151131
151199
|
var seenClassDeclarations = new ts.Map();
|
|
151132
151200
|
return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
|
|
151133
151201
|
var classDeclaration = getClass(diag.file, diag.start);
|
|
@@ -151260,7 +151328,7 @@ var ts;
|
|
|
151260
151328
|
];
|
|
151261
151329
|
codefix.registerCodeFix({
|
|
151262
151330
|
errorCodes: errorCodes,
|
|
151263
|
-
getCodeActions: function (context) {
|
|
151331
|
+
getCodeActions: function getCodeActionsToEnableExperimentalDecorators(context) {
|
|
151264
151332
|
var configFile = context.program.getCompilerOptions().configFile;
|
|
151265
151333
|
if (configFile === undefined) {
|
|
151266
151334
|
return undefined;
|
|
@@ -151291,7 +151359,7 @@ var ts;
|
|
|
151291
151359
|
var errorCodes = [ts.Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided.code];
|
|
151292
151360
|
codefix.registerCodeFix({
|
|
151293
151361
|
errorCodes: errorCodes,
|
|
151294
|
-
getCodeActions: function (context) {
|
|
151362
|
+
getCodeActions: function getCodeActionsToFixEnableJsxFlag(context) {
|
|
151295
151363
|
var configFile = context.program.getCompilerOptions().configFile;
|
|
151296
151364
|
if (configFile === undefined) {
|
|
151297
151365
|
return undefined;
|
|
@@ -151329,7 +151397,7 @@ var ts;
|
|
|
151329
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,
|
|
151330
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,
|
|
151331
151399
|
],
|
|
151332
|
-
getCodeActions: function (context) {
|
|
151400
|
+
getCodeActions: function getCodeActionsToFixModuleAndTarget(context) {
|
|
151333
151401
|
var compilerOptions = context.program.getCompilerOptions();
|
|
151334
151402
|
var configFile = compilerOptions.configFile;
|
|
151335
151403
|
if (configFile === undefined) {
|
|
@@ -152101,7 +152169,7 @@ var ts;
|
|
|
152101
152169
|
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_async_modifier_to_containing_function, fixId, ts.Diagnostics.Add_all_missing_async_modifiers)];
|
|
152102
152170
|
},
|
|
152103
152171
|
fixIds: [fixId],
|
|
152104
|
-
getAllCodeActions: function (context) {
|
|
152172
|
+
getAllCodeActions: function getAllCodeActionsToFixAwaitInSyncFunction(context) {
|
|
152105
152173
|
var seen = new ts.Map();
|
|
152106
152174
|
return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
|
|
152107
152175
|
var nodes = getNodes(diag.file, diag.start);
|
|
@@ -153223,7 +153291,7 @@ var ts;
|
|
|
153223
153291
|
codefix.registerCodeFix({
|
|
153224
153292
|
errorCodes: errorCodes,
|
|
153225
153293
|
fixIds: [fixId],
|
|
153226
|
-
getCodeActions: function (context) {
|
|
153294
|
+
getCodeActions: function getCodeActionsToFixReturnTypeInAsyncFunction(context) {
|
|
153227
153295
|
var sourceFile = context.sourceFile, program = context.program, span = context.span;
|
|
153228
153296
|
var checker = program.getTypeChecker();
|
|
153229
153297
|
var info = getInfo(sourceFile, program.getTypeChecker(), span.start);
|
|
@@ -153277,7 +153345,7 @@ var ts;
|
|
|
153277
153345
|
});
|
|
153278
153346
|
codefix.registerCodeFix({
|
|
153279
153347
|
errorCodes: errorCodes,
|
|
153280
|
-
getCodeActions: function (context) {
|
|
153348
|
+
getCodeActions: function getCodeActionsToDisableJsDiagnostics(context) {
|
|
153281
153349
|
var sourceFile = context.sourceFile, program = context.program, span = context.span, host = context.host, formatContext = context.formatContext;
|
|
153282
153350
|
if (!ts.isInJSFile(sourceFile) || !ts.isCheckJsEnabledForFile(sourceFile, program.getCompilerOptions())) {
|
|
153283
153351
|
return undefined;
|
|
@@ -154046,7 +154114,7 @@ var ts;
|
|
|
154046
154114
|
var errorCodes = [ts.Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor.code];
|
|
154047
154115
|
codefix.registerCodeFix({
|
|
154048
154116
|
errorCodes: errorCodes,
|
|
154049
|
-
getCodeActions: function (context) {
|
|
154117
|
+
getCodeActions: function getCodeActionsForStrictClassInitializationErrors(context) {
|
|
154050
154118
|
var propertyDeclaration = getPropertyDeclaration(context.sourceFile, context.span.start);
|
|
154051
154119
|
if (!propertyDeclaration)
|
|
154052
154120
|
return;
|
|
@@ -154269,7 +154337,7 @@ var ts;
|
|
|
154269
154337
|
];
|
|
154270
154338
|
codefix.registerCodeFix({
|
|
154271
154339
|
errorCodes: errorCodes,
|
|
154272
|
-
getCodeActions: function (context) {
|
|
154340
|
+
getCodeActions: function getCodeActionsToUseBigintLiteral(context) {
|
|
154273
154341
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return makeChange(t, context.sourceFile, context.span); });
|
|
154274
154342
|
if (changes.length > 0) {
|
|
154275
154343
|
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Convert_to_a_bigint_numeric_literal, fixId, ts.Diagnostics.Convert_all_to_bigint_numeric_literals)];
|
|
@@ -154301,7 +154369,7 @@ var ts;
|
|
|
154301
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];
|
|
154302
154370
|
codefix.registerCodeFix({
|
|
154303
154371
|
errorCodes: errorCodes,
|
|
154304
|
-
getCodeActions: function (context) {
|
|
154372
|
+
getCodeActions: function getCodeActionsToAddMissingTypeof(context) {
|
|
154305
154373
|
var sourceFile = context.sourceFile, span = context.span;
|
|
154306
154374
|
var importType = getImportTypeNode(sourceFile, span.start);
|
|
154307
154375
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, importType); });
|
|
@@ -154333,7 +154401,7 @@ var ts;
|
|
|
154333
154401
|
var errorCodes = [ts.Diagnostics.JSX_expressions_must_have_one_parent_element.code];
|
|
154334
154402
|
codefix.registerCodeFix({
|
|
154335
154403
|
errorCodes: errorCodes,
|
|
154336
|
-
getCodeActions: function (context) {
|
|
154404
|
+
getCodeActions: function getCodeActionsToWrapJsxInFragment(context) {
|
|
154337
154405
|
var sourceFile = context.sourceFile, span = context.span;
|
|
154338
154406
|
var node = findNodeToFix(sourceFile, span.start);
|
|
154339
154407
|
if (!node)
|
|
@@ -154405,12 +154473,11 @@ var ts;
|
|
|
154405
154473
|
(function (ts) {
|
|
154406
154474
|
var codefix;
|
|
154407
154475
|
(function (codefix) {
|
|
154408
|
-
var
|
|
154409
|
-
var fixId = fixIdAddMissingTypeof;
|
|
154476
|
+
var fixId = "fixConvertToMappedObjectType";
|
|
154410
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];
|
|
154411
154478
|
codefix.registerCodeFix({
|
|
154412
154479
|
errorCodes: errorCodes,
|
|
154413
|
-
getCodeActions: function (context) {
|
|
154480
|
+
getCodeActions: function getCodeActionsToConvertToMappedTypeObject(context) {
|
|
154414
154481
|
var sourceFile = context.sourceFile, span = context.span;
|
|
154415
154482
|
var info = getInfo(sourceFile, span.start);
|
|
154416
154483
|
if (!info)
|
|
@@ -154489,7 +154556,7 @@ var ts;
|
|
|
154489
154556
|
];
|
|
154490
154557
|
codefix.registerCodeFix({
|
|
154491
154558
|
errorCodes: errorCodes,
|
|
154492
|
-
getCodeActions: function (context) {
|
|
154559
|
+
getCodeActions: function getCodeActionsToRemoveUnnecessaryAwait(context) {
|
|
154493
154560
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return makeChange(t, context.sourceFile, context.span); });
|
|
154494
154561
|
if (changes.length > 0) {
|
|
154495
154562
|
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Remove_unnecessary_await, fixId, ts.Diagnostics.Remove_all_unnecessary_uses_of_await)];
|
|
@@ -154531,7 +154598,7 @@ var ts;
|
|
|
154531
154598
|
codefix.registerCodeFix({
|
|
154532
154599
|
errorCodes: errorCodes,
|
|
154533
154600
|
fixIds: [fixId],
|
|
154534
|
-
getCodeActions: function (context) {
|
|
154601
|
+
getCodeActions: function getCodeActionsToSplitTypeOnlyImport(context) {
|
|
154535
154602
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) {
|
|
154536
154603
|
return splitTypeOnlyImport(t, getImportDeclaration(context.sourceFile, context.span), context);
|
|
154537
154604
|
});
|
|
@@ -154567,7 +154634,7 @@ var ts;
|
|
|
154567
154634
|
var errorCodes = [ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_constant.code];
|
|
154568
154635
|
codefix.registerCodeFix({
|
|
154569
154636
|
errorCodes: errorCodes,
|
|
154570
|
-
getCodeActions: function (context) {
|
|
154637
|
+
getCodeActions: function getCodeActionsToConvertConstToLet(context) {
|
|
154571
154638
|
var sourceFile = context.sourceFile, span = context.span, program = context.program;
|
|
154572
154639
|
var range = getConstTokenRange(sourceFile, span.start, program);
|
|
154573
154640
|
if (range === undefined)
|