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/tsserver.js
CHANGED
|
@@ -100,7 +100,7 @@ var ts;
|
|
|
100
100
|
// The following is baselined as a literal template type without intervention
|
|
101
101
|
/** The version of the TypeScript compiler release */
|
|
102
102
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
103
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
103
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20211130";
|
|
104
104
|
/* @internal */
|
|
105
105
|
var Comparison;
|
|
106
106
|
(function (Comparison) {
|
|
@@ -90910,11 +90910,10 @@ var ts;
|
|
|
90910
90910
|
// we can safely elide the parentheses here, as a new synthetic
|
|
90911
90911
|
// ParenthesizedExpression will be inserted if we remove parentheses too
|
|
90912
90912
|
// aggressively.
|
|
90913
|
-
//
|
|
90914
|
-
//
|
|
90915
|
-
|
|
90916
|
-
|
|
90917
|
-
}
|
|
90913
|
+
//
|
|
90914
|
+
// If there are leading comments on the expression itself, the emitter will handle ASI
|
|
90915
|
+
// for return, throw, and yield by re-introducing parenthesis during emit on an as-need
|
|
90916
|
+
// basis.
|
|
90918
90917
|
return factory.createPartiallyEmittedExpression(expression, node);
|
|
90919
90918
|
}
|
|
90920
90919
|
return ts.visitEachChild(node, visitor, context);
|
|
@@ -94862,11 +94861,11 @@ var ts;
|
|
|
94862
94861
|
}
|
|
94863
94862
|
function visitOptionalExpression(node, captureThisArg, isDelete) {
|
|
94864
94863
|
var _a = flattenChain(node), expression = _a.expression, chain = _a.chain;
|
|
94865
|
-
var left = visitNonOptionalExpression(expression, ts.isCallChain(chain[0]), /*isDelete*/ false);
|
|
94864
|
+
var left = visitNonOptionalExpression(ts.skipPartiallyEmittedExpressions(expression), ts.isCallChain(chain[0]), /*isDelete*/ false);
|
|
94866
94865
|
var leftThisArg = ts.isSyntheticReference(left) ? left.thisArg : undefined;
|
|
94867
|
-
var
|
|
94868
|
-
var
|
|
94869
|
-
if (!ts.isSimpleCopiableExpression(
|
|
94866
|
+
var capturedLeft = ts.isSyntheticReference(left) ? left.expression : left;
|
|
94867
|
+
var leftExpression = factory.restoreOuterExpressions(expression, capturedLeft, 8 /* PartiallyEmittedExpressions */);
|
|
94868
|
+
if (!ts.isSimpleCopiableExpression(capturedLeft)) {
|
|
94870
94869
|
capturedLeft = factory.createTempVariable(hoistVariableDeclaration);
|
|
94871
94870
|
leftExpression = factory.createAssignment(capturedLeft, leftExpression);
|
|
94872
94871
|
}
|
|
@@ -94892,6 +94891,10 @@ var ts;
|
|
|
94892
94891
|
break;
|
|
94893
94892
|
case 207 /* CallExpression */:
|
|
94894
94893
|
if (i === 0 && leftThisArg) {
|
|
94894
|
+
if (!ts.isGeneratedIdentifier(leftThisArg)) {
|
|
94895
|
+
leftThisArg = factory.cloneNode(leftThisArg);
|
|
94896
|
+
ts.addEmitFlags(leftThisArg, 1536 /* NoComments */);
|
|
94897
|
+
}
|
|
94895
94898
|
rightExpression = factory.createFunctionCallCall(rightExpression, leftThisArg.kind === 106 /* SuperKeyword */ ? factory.createThis() : leftThisArg, ts.visitNodes(segment.arguments, visitor, ts.isExpression));
|
|
94896
94899
|
}
|
|
94897
94900
|
else {
|
|
@@ -109674,7 +109677,7 @@ var ts;
|
|
|
109674
109677
|
function emitYieldExpression(node) {
|
|
109675
109678
|
emitTokenWithComment(125 /* YieldKeyword */, node.pos, writeKeyword, node);
|
|
109676
109679
|
emit(node.asteriskToken);
|
|
109677
|
-
emitExpressionWithLeadingSpace(node.expression
|
|
109680
|
+
emitExpressionWithLeadingSpace(node.expression && parenthesizeExpressionForNoAsi(node.expression), parenthesizeExpressionForNoAsiAndDisallowedComma);
|
|
109678
109681
|
}
|
|
109679
109682
|
function emitSpreadElement(node) {
|
|
109680
109683
|
emitTokenWithComment(25 /* DotDotDotToken */, node.pos, writePunctuation, node);
|
|
@@ -109871,9 +109874,49 @@ var ts;
|
|
|
109871
109874
|
}
|
|
109872
109875
|
return pos;
|
|
109873
109876
|
}
|
|
109877
|
+
function commentWillEmitNewLine(node) {
|
|
109878
|
+
return node.kind === 2 /* SingleLineCommentTrivia */ || !!node.hasTrailingNewLine;
|
|
109879
|
+
}
|
|
109880
|
+
function willEmitLeadingNewLine(node) {
|
|
109881
|
+
if (!currentSourceFile)
|
|
109882
|
+
return false;
|
|
109883
|
+
if (ts.some(ts.getLeadingCommentRanges(currentSourceFile.text, node.pos), commentWillEmitNewLine))
|
|
109884
|
+
return true;
|
|
109885
|
+
if (ts.some(ts.getSyntheticLeadingComments(node), commentWillEmitNewLine))
|
|
109886
|
+
return true;
|
|
109887
|
+
if (ts.isPartiallyEmittedExpression(node)) {
|
|
109888
|
+
if (node.pos !== node.expression.pos) {
|
|
109889
|
+
if (ts.some(ts.getTrailingCommentRanges(currentSourceFile.text, node.expression.pos), commentWillEmitNewLine))
|
|
109890
|
+
return true;
|
|
109891
|
+
}
|
|
109892
|
+
return willEmitLeadingNewLine(node.expression);
|
|
109893
|
+
}
|
|
109894
|
+
return false;
|
|
109895
|
+
}
|
|
109896
|
+
/**
|
|
109897
|
+
* Wraps an expression in parens if we would emit a leading comment that would introduce a line separator
|
|
109898
|
+
* between the node and its parent.
|
|
109899
|
+
*/
|
|
109900
|
+
function parenthesizeExpressionForNoAsi(node) {
|
|
109901
|
+
if (!commentsDisabled && ts.isPartiallyEmittedExpression(node) && willEmitLeadingNewLine(node)) {
|
|
109902
|
+
var parseNode = ts.getParseTreeNode(node);
|
|
109903
|
+
if (parseNode && ts.isParenthesizedExpression(parseNode)) {
|
|
109904
|
+
// If the original node was a parenthesized expression, restore it to preserve comment and source map emit
|
|
109905
|
+
var parens = ts.factory.createParenthesizedExpression(node.expression);
|
|
109906
|
+
ts.setOriginalNode(parens, node);
|
|
109907
|
+
ts.setTextRange(parens, parseNode);
|
|
109908
|
+
return parens;
|
|
109909
|
+
}
|
|
109910
|
+
return ts.factory.createParenthesizedExpression(node);
|
|
109911
|
+
}
|
|
109912
|
+
return node;
|
|
109913
|
+
}
|
|
109914
|
+
function parenthesizeExpressionForNoAsiAndDisallowedComma(node) {
|
|
109915
|
+
return parenthesizeExpressionForNoAsi(parenthesizer.parenthesizeExpressionForDisallowedComma(node));
|
|
109916
|
+
}
|
|
109874
109917
|
function emitReturnStatement(node) {
|
|
109875
109918
|
emitTokenWithComment(105 /* ReturnKeyword */, node.pos, writeKeyword, /*contextNode*/ node);
|
|
109876
|
-
emitExpressionWithLeadingSpace(node.expression);
|
|
109919
|
+
emitExpressionWithLeadingSpace(node.expression && parenthesizeExpressionForNoAsi(node.expression), parenthesizeExpressionForNoAsi);
|
|
109877
109920
|
writeTrailingSemicolon();
|
|
109878
109921
|
}
|
|
109879
109922
|
function emitWithStatement(node) {
|
|
@@ -109901,7 +109944,7 @@ var ts;
|
|
|
109901
109944
|
}
|
|
109902
109945
|
function emitThrowStatement(node) {
|
|
109903
109946
|
emitTokenWithComment(109 /* ThrowKeyword */, node.pos, writeKeyword, node);
|
|
109904
|
-
emitExpressionWithLeadingSpace(node.expression);
|
|
109947
|
+
emitExpressionWithLeadingSpace(parenthesizeExpressionForNoAsi(node.expression), parenthesizeExpressionForNoAsi);
|
|
109905
109948
|
writeTrailingSemicolon();
|
|
109906
109949
|
}
|
|
109907
109950
|
function emitTryStatement(node) {
|
|
@@ -110745,7 +110788,14 @@ var ts;
|
|
|
110745
110788
|
}
|
|
110746
110789
|
// Transformation nodes
|
|
110747
110790
|
function emitPartiallyEmittedExpression(node) {
|
|
110791
|
+
var emitFlags = ts.getEmitFlags(node);
|
|
110792
|
+
if (!(emitFlags & 512 /* NoLeadingComments */) && node.pos !== node.expression.pos) {
|
|
110793
|
+
emitTrailingCommentsOfPosition(node.expression.pos);
|
|
110794
|
+
}
|
|
110748
110795
|
emitExpression(node.expression);
|
|
110796
|
+
if (!(emitFlags & 1024 /* NoTrailingComments */) && node.end !== node.expression.end) {
|
|
110797
|
+
emitLeadingCommentsOfPosition(node.expression.end);
|
|
110798
|
+
}
|
|
110749
110799
|
}
|
|
110750
110800
|
function emitCommaList(node) {
|
|
110751
110801
|
emitExpressionList(node, node.elements, 528 /* CommaListElements */, /*parenthesizerRule*/ undefined);
|
|
@@ -111109,10 +111159,8 @@ var ts;
|
|
|
111109
111159
|
// Emit this child.
|
|
111110
111160
|
previousSourceFileTextKind = recordBundleFileInternalSectionStart(child);
|
|
111111
111161
|
if (shouldEmitInterveningComments) {
|
|
111112
|
-
|
|
111113
|
-
|
|
111114
|
-
emitTrailingCommentsOfPosition(commentRange.pos);
|
|
111115
|
-
}
|
|
111162
|
+
var commentRange = ts.getCommentRange(child);
|
|
111163
|
+
emitTrailingCommentsOfPosition(commentRange.pos);
|
|
111116
111164
|
}
|
|
111117
111165
|
else {
|
|
111118
111166
|
shouldEmitInterveningComments = mayEmitInterveningComments;
|
|
@@ -111433,7 +111481,7 @@ var ts;
|
|
|
111433
111481
|
function writeLineSeparatorsAndIndentBefore(node, parent) {
|
|
111434
111482
|
var leadingNewlines = preserveSourceNewlines && getLeadingLineTerminatorCount(parent, [node], 0 /* None */);
|
|
111435
111483
|
if (leadingNewlines) {
|
|
111436
|
-
writeLinesAndIndent(leadingNewlines, /*
|
|
111484
|
+
writeLinesAndIndent(leadingNewlines, /*writeSpaceIfNotIndenting*/ false);
|
|
111437
111485
|
}
|
|
111438
111486
|
return !!leadingNewlines;
|
|
111439
111487
|
}
|
|
@@ -125423,7 +125471,6 @@ var ts;
|
|
|
125423
125471
|
|| kind === 165 /* PropertySignature */
|
|
125424
125472
|
|| kind === 167 /* MethodSignature */;
|
|
125425
125473
|
}
|
|
125426
|
-
ts.syntaxRequiresTrailingCommaOrSemicolonOrASI = syntaxRequiresTrailingCommaOrSemicolonOrASI;
|
|
125427
125474
|
function syntaxRequiresTrailingFunctionBlockOrSemicolonOrASI(kind) {
|
|
125428
125475
|
return kind === 255 /* FunctionDeclaration */
|
|
125429
125476
|
|| kind === 170 /* Constructor */
|
|
@@ -125431,11 +125478,9 @@ var ts;
|
|
|
125431
125478
|
|| kind === 171 /* GetAccessor */
|
|
125432
125479
|
|| kind === 172 /* SetAccessor */;
|
|
125433
125480
|
}
|
|
125434
|
-
ts.syntaxRequiresTrailingFunctionBlockOrSemicolonOrASI = syntaxRequiresTrailingFunctionBlockOrSemicolonOrASI;
|
|
125435
125481
|
function syntaxRequiresTrailingModuleBlockOrSemicolonOrASI(kind) {
|
|
125436
125482
|
return kind === 260 /* ModuleDeclaration */;
|
|
125437
125483
|
}
|
|
125438
|
-
ts.syntaxRequiresTrailingModuleBlockOrSemicolonOrASI = syntaxRequiresTrailingModuleBlockOrSemicolonOrASI;
|
|
125439
125484
|
function syntaxRequiresTrailingSemicolonOrASI(kind) {
|
|
125440
125485
|
return kind === 236 /* VariableStatement */
|
|
125441
125486
|
|| kind === 237 /* ExpressionStatement */
|
|
@@ -125510,19 +125555,34 @@ var ts;
|
|
|
125510
125555
|
ts.forEachChild(sourceFile, function visit(node) {
|
|
125511
125556
|
if (syntaxRequiresTrailingSemicolonOrASI(node.kind)) {
|
|
125512
125557
|
var lastToken = node.getLastToken(sourceFile);
|
|
125513
|
-
if (lastToken
|
|
125558
|
+
if ((lastToken === null || lastToken === void 0 ? void 0 : lastToken.kind) === 26 /* SemicolonToken */) {
|
|
125514
125559
|
withSemicolon++;
|
|
125515
125560
|
}
|
|
125516
125561
|
else {
|
|
125517
125562
|
withoutSemicolon++;
|
|
125518
125563
|
}
|
|
125519
125564
|
}
|
|
125565
|
+
else if (syntaxRequiresTrailingCommaOrSemicolonOrASI(node.kind)) {
|
|
125566
|
+
var lastToken = node.getLastToken(sourceFile);
|
|
125567
|
+
if ((lastToken === null || lastToken === void 0 ? void 0 : lastToken.kind) === 26 /* SemicolonToken */) {
|
|
125568
|
+
withSemicolon++;
|
|
125569
|
+
}
|
|
125570
|
+
else if (lastToken && lastToken.kind !== 27 /* CommaToken */) {
|
|
125571
|
+
var lastTokenLine = ts.getLineAndCharacterOfPosition(sourceFile, lastToken.getStart(sourceFile)).line;
|
|
125572
|
+
var nextTokenLine = ts.getLineAndCharacterOfPosition(sourceFile, ts.getSpanOfTokenAtPosition(sourceFile, lastToken.end).start).line;
|
|
125573
|
+
// Avoid counting missing semicolon in single-line objects:
|
|
125574
|
+
// `function f(p: { x: string /*no semicolon here is insignificant*/ }) {`
|
|
125575
|
+
if (lastTokenLine !== nextTokenLine) {
|
|
125576
|
+
withoutSemicolon++;
|
|
125577
|
+
}
|
|
125578
|
+
}
|
|
125579
|
+
}
|
|
125520
125580
|
if (withSemicolon + withoutSemicolon >= nStatementsToObserve) {
|
|
125521
125581
|
return true;
|
|
125522
125582
|
}
|
|
125523
125583
|
return ts.forEachChild(node, visit);
|
|
125524
125584
|
});
|
|
125525
|
-
// One statement missing a semicolon isn
|
|
125585
|
+
// One statement missing a semicolon isn't sufficient evidence to say the user
|
|
125526
125586
|
// doesn’t want semicolons, because they may not even be done writing that statement.
|
|
125527
125587
|
if (withSemicolon === 0 && withoutSemicolon <= 1) {
|
|
125528
125588
|
return true;
|
|
@@ -141388,6 +141448,7 @@ var ts;
|
|
|
141388
141448
|
lastTrailingTriviaWasNewLine: function () { return wasNewLine; },
|
|
141389
141449
|
skipToEndOf: skipToEndOf,
|
|
141390
141450
|
skipToStartOf: skipToStartOf,
|
|
141451
|
+
getStartPos: function () { var _a; return (_a = lastTokenInfo === null || lastTokenInfo === void 0 ? void 0 : lastTokenInfo.token.pos) !== null && _a !== void 0 ? _a : scanner.getTokenPos(); },
|
|
141391
141452
|
});
|
|
141392
141453
|
lastTokenInfo = undefined;
|
|
141393
141454
|
scanner.setText(undefined);
|
|
@@ -141561,8 +141622,7 @@ var ts;
|
|
|
141561
141622
|
}
|
|
141562
141623
|
function isOnToken() {
|
|
141563
141624
|
var current = lastTokenInfo ? lastTokenInfo.token.kind : scanner.getToken();
|
|
141564
|
-
|
|
141565
|
-
return startPos < endPos && current !== 1 /* EndOfFileToken */ && !ts.isTrivia(current);
|
|
141625
|
+
return current !== 1 /* EndOfFileToken */ && !ts.isTrivia(current);
|
|
141566
141626
|
}
|
|
141567
141627
|
function isOnEOF() {
|
|
141568
141628
|
var current = lastTokenInfo ? lastTokenInfo.token.kind : scanner.getToken();
|
|
@@ -142750,7 +142810,7 @@ var ts;
|
|
|
142750
142810
|
return 0;
|
|
142751
142811
|
}
|
|
142752
142812
|
function formatNodeGivenIndentation(node, sourceFileLike, languageVariant, initialIndentation, delta, formatContext) {
|
|
142753
|
-
var range = { pos:
|
|
142813
|
+
var range = { pos: node.pos, end: node.end };
|
|
142754
142814
|
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
|
|
142755
142815
|
sourceFileLike); });
|
|
142756
142816
|
}
|
|
@@ -142801,6 +142861,15 @@ var ts;
|
|
|
142801
142861
|
}
|
|
142802
142862
|
}
|
|
142803
142863
|
}
|
|
142864
|
+
if (previousRange && formattingScanner.getStartPos() >= originalRange.end) {
|
|
142865
|
+
var token = formattingScanner.isOnEOF() ? formattingScanner.readEOFTokenRange() :
|
|
142866
|
+
formattingScanner.isOnToken() ? formattingScanner.readTokenInfo(enclosingNode).token :
|
|
142867
|
+
undefined;
|
|
142868
|
+
if (token) {
|
|
142869
|
+
processPair(token, sourceFile.getLineAndCharacterOfPosition(token.pos).line, enclosingNode, previousRange, previousRangeStartLine, previousParent, enclosingNode,
|
|
142870
|
+
/*dynamicIndentation*/ undefined);
|
|
142871
|
+
}
|
|
142872
|
+
}
|
|
142804
142873
|
return edits;
|
|
142805
142874
|
// local functions
|
|
142806
142875
|
/** Tries to compute the indentation for a list element.
|
|
@@ -142983,19 +143052,13 @@ var ts;
|
|
|
142983
143052
|
processChildNodes(nodes, node, nodeStartLine, nodeDynamicIndentation);
|
|
142984
143053
|
});
|
|
142985
143054
|
// proceed any tokens in the node that are located after child nodes
|
|
142986
|
-
while (formattingScanner.isOnToken()) {
|
|
143055
|
+
while (formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) {
|
|
142987
143056
|
var tokenInfo = formattingScanner.readTokenInfo(node);
|
|
142988
|
-
if (tokenInfo.token.end > node.end) {
|
|
143057
|
+
if (tokenInfo.token.end > Math.min(node.end, originalRange.end)) {
|
|
142989
143058
|
break;
|
|
142990
143059
|
}
|
|
142991
143060
|
consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation, node);
|
|
142992
143061
|
}
|
|
142993
|
-
if (!node.parent && formattingScanner.isOnEOF()) {
|
|
142994
|
-
var token = formattingScanner.readEOFTokenRange();
|
|
142995
|
-
if (token.end <= node.end && previousRange) {
|
|
142996
|
-
processPair(token, sourceFile.getLineAndCharacterOfPosition(token.pos).line, node, previousRange, previousRangeStartLine, previousParent, contextNode, nodeDynamicIndentation);
|
|
142997
|
-
}
|
|
142998
|
-
}
|
|
142999
143062
|
function processChildNode(child, inheritedIndentation, parent, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem, isFirstListItem) {
|
|
143000
143063
|
var childStartPos = child.getStart(sourceFile);
|
|
143001
143064
|
var childStartLine = sourceFile.getLineAndCharacterOfPosition(childStartPos).line;
|
|
@@ -143021,9 +143084,12 @@ var ts;
|
|
|
143021
143084
|
if (child.getFullWidth() === 0) {
|
|
143022
143085
|
return inheritedIndentation;
|
|
143023
143086
|
}
|
|
143024
|
-
while (formattingScanner.isOnToken()) {
|
|
143087
|
+
while (formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) {
|
|
143025
143088
|
// proceed any parent tokens that are located prior to child.getStart()
|
|
143026
143089
|
var tokenInfo = formattingScanner.readTokenInfo(node);
|
|
143090
|
+
if (tokenInfo.token.end > originalRange.end) {
|
|
143091
|
+
return inheritedIndentation;
|
|
143092
|
+
}
|
|
143027
143093
|
if (tokenInfo.token.end > childStartPos) {
|
|
143028
143094
|
if (tokenInfo.token.pos > childStartPos) {
|
|
143029
143095
|
formattingScanner.skipToStartOf(child);
|
|
@@ -143033,7 +143099,7 @@ var ts;
|
|
|
143033
143099
|
}
|
|
143034
143100
|
consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, node);
|
|
143035
143101
|
}
|
|
143036
|
-
if (!formattingScanner.isOnToken()) {
|
|
143102
|
+
if (!formattingScanner.isOnToken() || formattingScanner.getStartPos() >= originalRange.end) {
|
|
143037
143103
|
return inheritedIndentation;
|
|
143038
143104
|
}
|
|
143039
143105
|
if (ts.isToken(child)) {
|
|
@@ -143062,7 +143128,7 @@ var ts;
|
|
|
143062
143128
|
var startLine = parentStartLine;
|
|
143063
143129
|
if (listStartToken !== 0 /* Unknown */) {
|
|
143064
143130
|
// introduce a new indentation scope for lists (including list start and end tokens)
|
|
143065
|
-
while (formattingScanner.isOnToken()) {
|
|
143131
|
+
while (formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) {
|
|
143066
143132
|
var tokenInfo = formattingScanner.readTokenInfo(parent);
|
|
143067
143133
|
if (tokenInfo.token.end > nodes.pos) {
|
|
143068
143134
|
// stop when formatting scanner moves past the beginning of node list
|
|
@@ -143098,7 +143164,7 @@ var ts;
|
|
|
143098
143164
|
inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, startLine, startLine, /*isListItem*/ true, /*isFirstListItem*/ i === 0);
|
|
143099
143165
|
}
|
|
143100
143166
|
var listEndToken = getCloseTokenForOpenToken(listStartToken);
|
|
143101
|
-
if (listEndToken !== 0 /* Unknown */ && formattingScanner.isOnToken()) {
|
|
143167
|
+
if (listEndToken !== 0 /* Unknown */ && formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) {
|
|
143102
143168
|
var tokenInfo = formattingScanner.readTokenInfo(parent);
|
|
143103
143169
|
if (tokenInfo.token.kind === 27 /* CommaToken */ && ts.isCallLikeExpression(parent)) {
|
|
143104
143170
|
var commaTokenLine = sourceFile.getLineAndCharacterOfPosition(tokenInfo.token.pos).line;
|
|
@@ -143229,24 +143295,26 @@ var ts;
|
|
|
143229
143295
|
// win in a conflict with lower priority rules.
|
|
143230
143296
|
ts.forEachRight(rules, function (rule) {
|
|
143231
143297
|
lineAction = applyRuleEdits(rule, previousItem, previousStartLine, currentItem, currentStartLine);
|
|
143232
|
-
|
|
143233
|
-
|
|
143234
|
-
|
|
143235
|
-
|
|
143236
|
-
|
|
143237
|
-
|
|
143238
|
-
|
|
143239
|
-
|
|
143240
|
-
|
|
143241
|
-
|
|
143242
|
-
|
|
143243
|
-
|
|
143244
|
-
|
|
143245
|
-
|
|
143246
|
-
|
|
143247
|
-
|
|
143248
|
-
|
|
143249
|
-
|
|
143298
|
+
if (dynamicIndentation) {
|
|
143299
|
+
switch (lineAction) {
|
|
143300
|
+
case 2 /* LineRemoved */:
|
|
143301
|
+
// Handle the case where the next line is moved to be the end of this line.
|
|
143302
|
+
// In this case we don't indent the next line in the next pass.
|
|
143303
|
+
if (currentParent.getStart(sourceFile) === currentItem.pos) {
|
|
143304
|
+
dynamicIndentation.recomputeIndentation(/*lineAddedByFormatting*/ false, contextNode);
|
|
143305
|
+
}
|
|
143306
|
+
break;
|
|
143307
|
+
case 1 /* LineAdded */:
|
|
143308
|
+
// Handle the case where token2 is moved to the new line.
|
|
143309
|
+
// In this case we indent token2 in the next pass but we set
|
|
143310
|
+
// sameLineIndent flag to notify the indenter that the indentation is within the line.
|
|
143311
|
+
if (currentParent.getStart(sourceFile) === currentItem.pos) {
|
|
143312
|
+
dynamicIndentation.recomputeIndentation(/*lineAddedByFormatting*/ true, contextNode);
|
|
143313
|
+
}
|
|
143314
|
+
break;
|
|
143315
|
+
default:
|
|
143316
|
+
ts.Debug.assert(lineAction === 0 /* None */);
|
|
143317
|
+
}
|
|
143250
143318
|
}
|
|
143251
143319
|
// 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
|
|
143252
143320
|
trimTrailingWhitespaces = trimTrailingWhitespaces && !(rule.action & 16 /* DeleteSpace */) && rule.flags !== 1 /* CanDeleteNewLines */;
|
|
@@ -145724,7 +145792,7 @@ var ts;
|
|
|
145724
145792
|
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];
|
|
145725
145793
|
codefix.registerCodeFix({
|
|
145726
145794
|
errorCodes: errorCodes,
|
|
145727
|
-
getCodeActions: function (context) {
|
|
145795
|
+
getCodeActions: function getCodeActionsToAddConvertToUnknownForNonOverlappingTypes(context) {
|
|
145728
145796
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return makeChange(t, context.sourceFile, context.span.start); });
|
|
145729
145797
|
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)];
|
|
145730
145798
|
},
|
|
@@ -145751,7 +145819,7 @@ var ts;
|
|
|
145751
145819
|
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,
|
|
145752
145820
|
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,
|
|
145753
145821
|
],
|
|
145754
|
-
getCodeActions: function (context) {
|
|
145822
|
+
getCodeActions: function getCodeActionsToAddEmptyExportDeclaration(context) {
|
|
145755
145823
|
var sourceFile = context.sourceFile;
|
|
145756
145824
|
var changes = ts.textChanges.ChangeTracker.with(context, function (changes) {
|
|
145757
145825
|
var exportDeclaration = ts.factory.createExportDeclaration(
|
|
@@ -145780,7 +145848,7 @@ var ts;
|
|
|
145780
145848
|
codefix.registerCodeFix({
|
|
145781
145849
|
fixIds: [fixId],
|
|
145782
145850
|
errorCodes: errorCodes,
|
|
145783
|
-
getCodeActions: function (context) {
|
|
145851
|
+
getCodeActions: function getCodeActionsToAddMissingAsync(context) {
|
|
145784
145852
|
var sourceFile = context.sourceFile, errorCode = context.errorCode, cancellationToken = context.cancellationToken, program = context.program, span = context.span;
|
|
145785
145853
|
var diagnostic = ts.find(program.getDiagnosticsProducingTypeChecker().getDiagnostics(sourceFile, cancellationToken), getIsMatchingAsyncError(span, errorCode));
|
|
145786
145854
|
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; });
|
|
@@ -145877,7 +145945,7 @@ var ts;
|
|
|
145877
145945
|
codefix.registerCodeFix({
|
|
145878
145946
|
fixIds: [fixId],
|
|
145879
145947
|
errorCodes: errorCodes,
|
|
145880
|
-
getCodeActions: function (context) {
|
|
145948
|
+
getCodeActions: function getCodeActionsToAddMissingAwait(context) {
|
|
145881
145949
|
var sourceFile = context.sourceFile, errorCode = context.errorCode, span = context.span, cancellationToken = context.cancellationToken, program = context.program;
|
|
145882
145950
|
var expression = getAwaitErrorSpanExpression(sourceFile, errorCode, span, cancellationToken, program);
|
|
145883
145951
|
if (!expression) {
|
|
@@ -146109,7 +146177,7 @@ var ts;
|
|
|
146109
146177
|
];
|
|
146110
146178
|
codefix.registerCodeFix({
|
|
146111
146179
|
errorCodes: errorCodes,
|
|
146112
|
-
getCodeActions: function (context) {
|
|
146180
|
+
getCodeActions: function getCodeActionsToAddMissingConst(context) {
|
|
146113
146181
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return makeChange(t, context.sourceFile, context.span.start, context.program); });
|
|
146114
146182
|
if (changes.length > 0) {
|
|
146115
146183
|
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_const_to_unresolved_variable, fixId, ts.Diagnostics.Add_const_to_all_unresolved_variables)];
|
|
@@ -146209,7 +146277,7 @@ var ts;
|
|
|
146209
146277
|
];
|
|
146210
146278
|
codefix.registerCodeFix({
|
|
146211
146279
|
errorCodes: errorCodes,
|
|
146212
|
-
getCodeActions: function (context) {
|
|
146280
|
+
getCodeActions: function getCodeActionsToAddMissingDeclareOnProperty(context) {
|
|
146213
146281
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return makeChange(t, context.sourceFile, context.span.start); });
|
|
146214
146282
|
if (changes.length > 0) {
|
|
146215
146283
|
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Prefix_with_declare, fixId, ts.Diagnostics.Prefix_all_incorrect_property_declarations_with_declare)];
|
|
@@ -146243,7 +146311,7 @@ var ts;
|
|
|
146243
146311
|
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];
|
|
146244
146312
|
codefix.registerCodeFix({
|
|
146245
146313
|
errorCodes: errorCodes,
|
|
146246
|
-
getCodeActions: function (context) {
|
|
146314
|
+
getCodeActions: function getCodeActionsToAddMissingInvocationForDecorator(context) {
|
|
146247
146315
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return makeChange(t, context.sourceFile, context.span.start); });
|
|
146248
146316
|
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Call_decorator_expression, fixId, ts.Diagnostics.Add_to_all_uncalled_decorators)];
|
|
146249
146317
|
},
|
|
@@ -146268,7 +146336,7 @@ var ts;
|
|
|
146268
146336
|
var errorCodes = [ts.Diagnostics.Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1.code];
|
|
146269
146337
|
codefix.registerCodeFix({
|
|
146270
146338
|
errorCodes: errorCodes,
|
|
146271
|
-
getCodeActions: function (context) {
|
|
146339
|
+
getCodeActions: function getCodeActionsToAddNameToNamelessParameter(context) {
|
|
146272
146340
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return makeChange(t, context.sourceFile, context.span.start); });
|
|
146273
146341
|
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_parameter_name, fixId, ts.Diagnostics.Add_names_to_all_parameters_without_names)];
|
|
146274
146342
|
},
|
|
@@ -148070,14 +148138,14 @@ var ts;
|
|
|
148070
148138
|
var fixId = "convertToTypeOnlyExport";
|
|
148071
148139
|
codefix.registerCodeFix({
|
|
148072
148140
|
errorCodes: errorCodes,
|
|
148073
|
-
getCodeActions: function (context) {
|
|
148141
|
+
getCodeActions: function getCodeActionsToConvertToTypeOnlyExport(context) {
|
|
148074
148142
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return fixSingleExportDeclaration(t, getExportSpecifierForDiagnosticSpan(context.span, context.sourceFile), context); });
|
|
148075
148143
|
if (changes.length) {
|
|
148076
148144
|
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Convert_to_type_only_export, fixId, ts.Diagnostics.Convert_all_re_exported_types_to_type_only_exports)];
|
|
148077
148145
|
}
|
|
148078
148146
|
},
|
|
148079
148147
|
fixIds: [fixId],
|
|
148080
|
-
getAllCodeActions: function (context) {
|
|
148148
|
+
getAllCodeActions: function getAllCodeActionsToConvertToTypeOnlyExport(context) {
|
|
148081
148149
|
var fixedExportDeclarations = new ts.Map();
|
|
148082
148150
|
return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
|
|
148083
148151
|
var exportSpecifier = getExportSpecifierForDiagnosticSpan(diag, context.sourceFile);
|
|
@@ -148138,7 +148206,7 @@ var ts;
|
|
|
148138
148206
|
var fixId = "convertToTypeOnlyImport";
|
|
148139
148207
|
codefix.registerCodeFix({
|
|
148140
148208
|
errorCodes: errorCodes,
|
|
148141
|
-
getCodeActions: function (context) {
|
|
148209
|
+
getCodeActions: function getCodeActionsToConvertToTypeOnlyImport(context) {
|
|
148142
148210
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) {
|
|
148143
148211
|
var importDeclaration = getImportDeclarationForDiagnosticSpan(context.span, context.sourceFile);
|
|
148144
148212
|
fixSingleImportDeclaration(t, importDeclaration, context);
|
|
@@ -148148,7 +148216,7 @@ var ts;
|
|
|
148148
148216
|
}
|
|
148149
148217
|
},
|
|
148150
148218
|
fixIds: [fixId],
|
|
148151
|
-
getAllCodeActions: function (context) {
|
|
148219
|
+
getAllCodeActions: function getAllCodeActionsToConvertToTypeOnlyImport(context) {
|
|
148152
148220
|
return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
|
|
148153
148221
|
var importDeclaration = getImportDeclarationForDiagnosticSpan(diag, context.sourceFile);
|
|
148154
148222
|
fixSingleImportDeclaration(changes, importDeclaration, context);
|
|
@@ -148187,7 +148255,7 @@ var ts;
|
|
|
148187
148255
|
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];
|
|
148188
148256
|
codefix.registerCodeFix({
|
|
148189
148257
|
errorCodes: errorCodes,
|
|
148190
|
-
getCodeActions: function (context) {
|
|
148258
|
+
getCodeActions: function getCodeActionsToConvertLiteralTypeToMappedType(context) {
|
|
148191
148259
|
var sourceFile = context.sourceFile, span = context.span;
|
|
148192
148260
|
var info = getInfo(sourceFile, span.start);
|
|
148193
148261
|
if (!info) {
|
|
@@ -149331,7 +149399,7 @@ var ts;
|
|
|
149331
149399
|
_a);
|
|
149332
149400
|
codefix.registerCodeFix({
|
|
149333
149401
|
errorCodes: errorCodes,
|
|
149334
|
-
getCodeActions: function (context) {
|
|
149402
|
+
getCodeActions: function getCodeActionsToFixOverrideModifierIssues(context) {
|
|
149335
149403
|
var errorCode = context.errorCode, span = context.span;
|
|
149336
149404
|
var info = errorCodeFixIdMap[errorCode];
|
|
149337
149405
|
if (!info)
|
|
@@ -149527,7 +149595,7 @@ var ts;
|
|
|
149527
149595
|
];
|
|
149528
149596
|
codefix.registerCodeFix({
|
|
149529
149597
|
errorCodes: errorCodes,
|
|
149530
|
-
getCodeActions: function (context) {
|
|
149598
|
+
getCodeActions: function getCodeActionsToFixIncorrectNamedTupleSyntax(context) {
|
|
149531
149599
|
var sourceFile = context.sourceFile, span = context.span;
|
|
149532
149600
|
var namedTupleMember = getNamedTupleMember(sourceFile, span.start);
|
|
149533
149601
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, namedTupleMember); });
|
|
@@ -149726,7 +149794,7 @@ var ts;
|
|
|
149726
149794
|
codefix.registerCodeFix({
|
|
149727
149795
|
errorCodes: errorCodes,
|
|
149728
149796
|
fixIds: [fixIdAddReturnStatement, fixRemoveBracesFromArrowFunctionBody, fixIdWrapTheBlockWithParen],
|
|
149729
|
-
getCodeActions: function (context) {
|
|
149797
|
+
getCodeActions: function getCodeActionsToCorrectReturnValue(context) {
|
|
149730
149798
|
var program = context.program, sourceFile = context.sourceFile, start = context.span.start, errorCode = context.errorCode;
|
|
149731
149799
|
var info = getInfo(program.getTypeChecker(), sourceFile, start, errorCode);
|
|
149732
149800
|
if (!info)
|
|
@@ -150476,7 +150544,7 @@ var ts;
|
|
|
150476
150544
|
];
|
|
150477
150545
|
codefix.registerCodeFix({
|
|
150478
150546
|
errorCodes: errorCodes,
|
|
150479
|
-
getCodeActions: function (context) {
|
|
150547
|
+
getCodeActions: function getCodeActionsToFixNotFoundModule(context) {
|
|
150480
150548
|
var host = context.host, sourceFile = context.sourceFile, start = context.span.start;
|
|
150481
150549
|
var packageName = tryGetImportedPackageName(sourceFile, start);
|
|
150482
150550
|
if (packageName === undefined)
|
|
@@ -150537,7 +150605,7 @@ var ts;
|
|
|
150537
150605
|
var fixId = "fixClassDoesntImplementInheritedAbstractMember";
|
|
150538
150606
|
codefix.registerCodeFix({
|
|
150539
150607
|
errorCodes: errorCodes,
|
|
150540
|
-
getCodeActions: function (context) {
|
|
150608
|
+
getCodeActions: function getCodeActionsToFixClassNotImplementingInheritedMembers(context) {
|
|
150541
150609
|
var sourceFile = context.sourceFile, span = context.span;
|
|
150542
150610
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) {
|
|
150543
150611
|
return addMissingMembers(getClass(sourceFile, span.start), sourceFile, context, t, context.preferences);
|
|
@@ -150545,7 +150613,7 @@ var ts;
|
|
|
150545
150613
|
return changes.length === 0 ? undefined : [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Implement_inherited_abstract_class, fixId, ts.Diagnostics.Implement_all_inherited_abstract_classes)];
|
|
150546
150614
|
},
|
|
150547
150615
|
fixIds: [fixId],
|
|
150548
|
-
getAllCodeActions: function (context) {
|
|
150616
|
+
getAllCodeActions: function getAllCodeActionsToFixClassDoesntImplementInheritedAbstractMember(context) {
|
|
150549
150617
|
var seenClassDeclarations = new ts.Map();
|
|
150550
150618
|
return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
|
|
150551
150619
|
var classDeclaration = getClass(diag.file, diag.start);
|
|
@@ -150678,7 +150746,7 @@ var ts;
|
|
|
150678
150746
|
];
|
|
150679
150747
|
codefix.registerCodeFix({
|
|
150680
150748
|
errorCodes: errorCodes,
|
|
150681
|
-
getCodeActions: function (context) {
|
|
150749
|
+
getCodeActions: function getCodeActionsToEnableExperimentalDecorators(context) {
|
|
150682
150750
|
var configFile = context.program.getCompilerOptions().configFile;
|
|
150683
150751
|
if (configFile === undefined) {
|
|
150684
150752
|
return undefined;
|
|
@@ -150709,7 +150777,7 @@ var ts;
|
|
|
150709
150777
|
var errorCodes = [ts.Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided.code];
|
|
150710
150778
|
codefix.registerCodeFix({
|
|
150711
150779
|
errorCodes: errorCodes,
|
|
150712
|
-
getCodeActions: function (context) {
|
|
150780
|
+
getCodeActions: function getCodeActionsToFixEnableJsxFlag(context) {
|
|
150713
150781
|
var configFile = context.program.getCompilerOptions().configFile;
|
|
150714
150782
|
if (configFile === undefined) {
|
|
150715
150783
|
return undefined;
|
|
@@ -150747,7 +150815,7 @@ var ts;
|
|
|
150747
150815
|
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,
|
|
150748
150816
|
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,
|
|
150749
150817
|
],
|
|
150750
|
-
getCodeActions: function (context) {
|
|
150818
|
+
getCodeActions: function getCodeActionsToFixModuleAndTarget(context) {
|
|
150751
150819
|
var compilerOptions = context.program.getCompilerOptions();
|
|
150752
150820
|
var configFile = compilerOptions.configFile;
|
|
150753
150821
|
if (configFile === undefined) {
|
|
@@ -151519,7 +151587,7 @@ var ts;
|
|
|
151519
151587
|
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_async_modifier_to_containing_function, fixId, ts.Diagnostics.Add_all_missing_async_modifiers)];
|
|
151520
151588
|
},
|
|
151521
151589
|
fixIds: [fixId],
|
|
151522
|
-
getAllCodeActions: function (context) {
|
|
151590
|
+
getAllCodeActions: function getAllCodeActionsToFixAwaitInSyncFunction(context) {
|
|
151523
151591
|
var seen = new ts.Map();
|
|
151524
151592
|
return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
|
|
151525
151593
|
var nodes = getNodes(diag.file, diag.start);
|
|
@@ -152641,7 +152709,7 @@ var ts;
|
|
|
152641
152709
|
codefix.registerCodeFix({
|
|
152642
152710
|
errorCodes: errorCodes,
|
|
152643
152711
|
fixIds: [fixId],
|
|
152644
|
-
getCodeActions: function (context) {
|
|
152712
|
+
getCodeActions: function getCodeActionsToFixReturnTypeInAsyncFunction(context) {
|
|
152645
152713
|
var sourceFile = context.sourceFile, program = context.program, span = context.span;
|
|
152646
152714
|
var checker = program.getTypeChecker();
|
|
152647
152715
|
var info = getInfo(sourceFile, program.getTypeChecker(), span.start);
|
|
@@ -152695,7 +152763,7 @@ var ts;
|
|
|
152695
152763
|
});
|
|
152696
152764
|
codefix.registerCodeFix({
|
|
152697
152765
|
errorCodes: errorCodes,
|
|
152698
|
-
getCodeActions: function (context) {
|
|
152766
|
+
getCodeActions: function getCodeActionsToDisableJsDiagnostics(context) {
|
|
152699
152767
|
var sourceFile = context.sourceFile, program = context.program, span = context.span, host = context.host, formatContext = context.formatContext;
|
|
152700
152768
|
if (!ts.isInJSFile(sourceFile) || !ts.isCheckJsEnabledForFile(sourceFile, program.getCompilerOptions())) {
|
|
152701
152769
|
return undefined;
|
|
@@ -153464,7 +153532,7 @@ var ts;
|
|
|
153464
153532
|
var errorCodes = [ts.Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor.code];
|
|
153465
153533
|
codefix.registerCodeFix({
|
|
153466
153534
|
errorCodes: errorCodes,
|
|
153467
|
-
getCodeActions: function (context) {
|
|
153535
|
+
getCodeActions: function getCodeActionsForStrictClassInitializationErrors(context) {
|
|
153468
153536
|
var propertyDeclaration = getPropertyDeclaration(context.sourceFile, context.span.start);
|
|
153469
153537
|
if (!propertyDeclaration)
|
|
153470
153538
|
return;
|
|
@@ -153687,7 +153755,7 @@ var ts;
|
|
|
153687
153755
|
];
|
|
153688
153756
|
codefix.registerCodeFix({
|
|
153689
153757
|
errorCodes: errorCodes,
|
|
153690
|
-
getCodeActions: function (context) {
|
|
153758
|
+
getCodeActions: function getCodeActionsToUseBigintLiteral(context) {
|
|
153691
153759
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return makeChange(t, context.sourceFile, context.span); });
|
|
153692
153760
|
if (changes.length > 0) {
|
|
153693
153761
|
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Convert_to_a_bigint_numeric_literal, fixId, ts.Diagnostics.Convert_all_to_bigint_numeric_literals)];
|
|
@@ -153719,7 +153787,7 @@ var ts;
|
|
|
153719
153787
|
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];
|
|
153720
153788
|
codefix.registerCodeFix({
|
|
153721
153789
|
errorCodes: errorCodes,
|
|
153722
|
-
getCodeActions: function (context) {
|
|
153790
|
+
getCodeActions: function getCodeActionsToAddMissingTypeof(context) {
|
|
153723
153791
|
var sourceFile = context.sourceFile, span = context.span;
|
|
153724
153792
|
var importType = getImportTypeNode(sourceFile, span.start);
|
|
153725
153793
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, importType); });
|
|
@@ -153751,7 +153819,7 @@ var ts;
|
|
|
153751
153819
|
var errorCodes = [ts.Diagnostics.JSX_expressions_must_have_one_parent_element.code];
|
|
153752
153820
|
codefix.registerCodeFix({
|
|
153753
153821
|
errorCodes: errorCodes,
|
|
153754
|
-
getCodeActions: function (context) {
|
|
153822
|
+
getCodeActions: function getCodeActionsToWrapJsxInFragment(context) {
|
|
153755
153823
|
var sourceFile = context.sourceFile, span = context.span;
|
|
153756
153824
|
var node = findNodeToFix(sourceFile, span.start);
|
|
153757
153825
|
if (!node)
|
|
@@ -153823,12 +153891,11 @@ var ts;
|
|
|
153823
153891
|
(function (ts) {
|
|
153824
153892
|
var codefix;
|
|
153825
153893
|
(function (codefix) {
|
|
153826
|
-
var
|
|
153827
|
-
var fixId = fixIdAddMissingTypeof;
|
|
153894
|
+
var fixId = "fixConvertToMappedObjectType";
|
|
153828
153895
|
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];
|
|
153829
153896
|
codefix.registerCodeFix({
|
|
153830
153897
|
errorCodes: errorCodes,
|
|
153831
|
-
getCodeActions: function (context) {
|
|
153898
|
+
getCodeActions: function getCodeActionsToConvertToMappedTypeObject(context) {
|
|
153832
153899
|
var sourceFile = context.sourceFile, span = context.span;
|
|
153833
153900
|
var info = getInfo(sourceFile, span.start);
|
|
153834
153901
|
if (!info)
|
|
@@ -153907,7 +153974,7 @@ var ts;
|
|
|
153907
153974
|
];
|
|
153908
153975
|
codefix.registerCodeFix({
|
|
153909
153976
|
errorCodes: errorCodes,
|
|
153910
|
-
getCodeActions: function (context) {
|
|
153977
|
+
getCodeActions: function getCodeActionsToRemoveUnnecessaryAwait(context) {
|
|
153911
153978
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return makeChange(t, context.sourceFile, context.span); });
|
|
153912
153979
|
if (changes.length > 0) {
|
|
153913
153980
|
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Remove_unnecessary_await, fixId, ts.Diagnostics.Remove_all_unnecessary_uses_of_await)];
|
|
@@ -153949,7 +154016,7 @@ var ts;
|
|
|
153949
154016
|
codefix.registerCodeFix({
|
|
153950
154017
|
errorCodes: errorCodes,
|
|
153951
154018
|
fixIds: [fixId],
|
|
153952
|
-
getCodeActions: function (context) {
|
|
154019
|
+
getCodeActions: function getCodeActionsToSplitTypeOnlyImport(context) {
|
|
153953
154020
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) {
|
|
153954
154021
|
return splitTypeOnlyImport(t, getImportDeclaration(context.sourceFile, context.span), context);
|
|
153955
154022
|
});
|
|
@@ -153985,7 +154052,7 @@ var ts;
|
|
|
153985
154052
|
var errorCodes = [ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_constant.code];
|
|
153986
154053
|
codefix.registerCodeFix({
|
|
153987
154054
|
errorCodes: errorCodes,
|
|
153988
|
-
getCodeActions: function (context) {
|
|
154055
|
+
getCodeActions: function getCodeActionsToConvertConstToLet(context) {
|
|
153989
154056
|
var sourceFile = context.sourceFile, span = context.span, program = context.program;
|
|
153990
154057
|
var range = getConstTokenRange(sourceFile, span.start, program);
|
|
153991
154058
|
if (range === undefined)
|