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/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) {
|
|
@@ -83455,9 +83455,8 @@ var ts;
|
|
|
83455
83455
|
var enclosingFile = ts.getSourceFileOfNode(node);
|
|
83456
83456
|
var links = getNodeLinks(enclosingFile);
|
|
83457
83457
|
if (!(links.flags & 1 /* TypeChecked */)) {
|
|
83458
|
-
links.deferredNodes
|
|
83459
|
-
|
|
83460
|
-
links.deferredNodes.set(id, node);
|
|
83458
|
+
links.deferredNodes || (links.deferredNodes = new ts.Set());
|
|
83459
|
+
links.deferredNodes.add(node);
|
|
83461
83460
|
}
|
|
83462
83461
|
}
|
|
83463
83462
|
function checkDeferredNodes(context) {
|
|
@@ -90911,11 +90910,10 @@ var ts;
|
|
|
90911
90910
|
// we can safely elide the parentheses here, as a new synthetic
|
|
90912
90911
|
// ParenthesizedExpression will be inserted if we remove parentheses too
|
|
90913
90912
|
// aggressively.
|
|
90914
|
-
//
|
|
90915
|
-
//
|
|
90916
|
-
|
|
90917
|
-
|
|
90918
|
-
}
|
|
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.
|
|
90919
90917
|
return factory.createPartiallyEmittedExpression(expression, node);
|
|
90920
90918
|
}
|
|
90921
90919
|
return ts.visitEachChild(node, visitor, context);
|
|
@@ -94863,11 +94861,11 @@ var ts;
|
|
|
94863
94861
|
}
|
|
94864
94862
|
function visitOptionalExpression(node, captureThisArg, isDelete) {
|
|
94865
94863
|
var _a = flattenChain(node), expression = _a.expression, chain = _a.chain;
|
|
94866
|
-
var left = visitNonOptionalExpression(expression, ts.isCallChain(chain[0]), /*isDelete*/ false);
|
|
94864
|
+
var left = visitNonOptionalExpression(ts.skipPartiallyEmittedExpressions(expression), ts.isCallChain(chain[0]), /*isDelete*/ false);
|
|
94867
94865
|
var leftThisArg = ts.isSyntheticReference(left) ? left.thisArg : undefined;
|
|
94868
|
-
var
|
|
94869
|
-
var
|
|
94870
|
-
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)) {
|
|
94871
94869
|
capturedLeft = factory.createTempVariable(hoistVariableDeclaration);
|
|
94872
94870
|
leftExpression = factory.createAssignment(capturedLeft, leftExpression);
|
|
94873
94871
|
}
|
|
@@ -94893,6 +94891,10 @@ var ts;
|
|
|
94893
94891
|
break;
|
|
94894
94892
|
case 207 /* CallExpression */:
|
|
94895
94893
|
if (i === 0 && leftThisArg) {
|
|
94894
|
+
if (!ts.isGeneratedIdentifier(leftThisArg)) {
|
|
94895
|
+
leftThisArg = factory.cloneNode(leftThisArg);
|
|
94896
|
+
ts.addEmitFlags(leftThisArg, 1536 /* NoComments */);
|
|
94897
|
+
}
|
|
94896
94898
|
rightExpression = factory.createFunctionCallCall(rightExpression, leftThisArg.kind === 106 /* SuperKeyword */ ? factory.createThis() : leftThisArg, ts.visitNodes(segment.arguments, visitor, ts.isExpression));
|
|
94897
94899
|
}
|
|
94898
94900
|
else {
|
|
@@ -109675,7 +109677,7 @@ var ts;
|
|
|
109675
109677
|
function emitYieldExpression(node) {
|
|
109676
109678
|
emitTokenWithComment(125 /* YieldKeyword */, node.pos, writeKeyword, node);
|
|
109677
109679
|
emit(node.asteriskToken);
|
|
109678
|
-
emitExpressionWithLeadingSpace(node.expression
|
|
109680
|
+
emitExpressionWithLeadingSpace(node.expression && parenthesizeExpressionForNoAsi(node.expression), parenthesizeExpressionForNoAsiAndDisallowedComma);
|
|
109679
109681
|
}
|
|
109680
109682
|
function emitSpreadElement(node) {
|
|
109681
109683
|
emitTokenWithComment(25 /* DotDotDotToken */, node.pos, writePunctuation, node);
|
|
@@ -109872,9 +109874,49 @@ var ts;
|
|
|
109872
109874
|
}
|
|
109873
109875
|
return pos;
|
|
109874
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
|
+
}
|
|
109875
109917
|
function emitReturnStatement(node) {
|
|
109876
109918
|
emitTokenWithComment(105 /* ReturnKeyword */, node.pos, writeKeyword, /*contextNode*/ node);
|
|
109877
|
-
emitExpressionWithLeadingSpace(node.expression);
|
|
109919
|
+
emitExpressionWithLeadingSpace(node.expression && parenthesizeExpressionForNoAsi(node.expression), parenthesizeExpressionForNoAsi);
|
|
109878
109920
|
writeTrailingSemicolon();
|
|
109879
109921
|
}
|
|
109880
109922
|
function emitWithStatement(node) {
|
|
@@ -109902,7 +109944,7 @@ var ts;
|
|
|
109902
109944
|
}
|
|
109903
109945
|
function emitThrowStatement(node) {
|
|
109904
109946
|
emitTokenWithComment(109 /* ThrowKeyword */, node.pos, writeKeyword, node);
|
|
109905
|
-
emitExpressionWithLeadingSpace(node.expression);
|
|
109947
|
+
emitExpressionWithLeadingSpace(parenthesizeExpressionForNoAsi(node.expression), parenthesizeExpressionForNoAsi);
|
|
109906
109948
|
writeTrailingSemicolon();
|
|
109907
109949
|
}
|
|
109908
109950
|
function emitTryStatement(node) {
|
|
@@ -110746,7 +110788,14 @@ var ts;
|
|
|
110746
110788
|
}
|
|
110747
110789
|
// Transformation nodes
|
|
110748
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
|
+
}
|
|
110749
110795
|
emitExpression(node.expression);
|
|
110796
|
+
if (!(emitFlags & 1024 /* NoTrailingComments */) && node.end !== node.expression.end) {
|
|
110797
|
+
emitLeadingCommentsOfPosition(node.expression.end);
|
|
110798
|
+
}
|
|
110750
110799
|
}
|
|
110751
110800
|
function emitCommaList(node) {
|
|
110752
110801
|
emitExpressionList(node, node.elements, 528 /* CommaListElements */, /*parenthesizerRule*/ undefined);
|
|
@@ -111110,10 +111159,8 @@ var ts;
|
|
|
111110
111159
|
// Emit this child.
|
|
111111
111160
|
previousSourceFileTextKind = recordBundleFileInternalSectionStart(child);
|
|
111112
111161
|
if (shouldEmitInterveningComments) {
|
|
111113
|
-
|
|
111114
|
-
|
|
111115
|
-
emitTrailingCommentsOfPosition(commentRange.pos);
|
|
111116
|
-
}
|
|
111162
|
+
var commentRange = ts.getCommentRange(child);
|
|
111163
|
+
emitTrailingCommentsOfPosition(commentRange.pos);
|
|
111117
111164
|
}
|
|
111118
111165
|
else {
|
|
111119
111166
|
shouldEmitInterveningComments = mayEmitInterveningComments;
|
|
@@ -111434,7 +111481,7 @@ var ts;
|
|
|
111434
111481
|
function writeLineSeparatorsAndIndentBefore(node, parent) {
|
|
111435
111482
|
var leadingNewlines = preserveSourceNewlines && getLeadingLineTerminatorCount(parent, [node], 0 /* None */);
|
|
111436
111483
|
if (leadingNewlines) {
|
|
111437
|
-
writeLinesAndIndent(leadingNewlines, /*
|
|
111484
|
+
writeLinesAndIndent(leadingNewlines, /*writeSpaceIfNotIndenting*/ false);
|
|
111438
111485
|
}
|
|
111439
111486
|
return !!leadingNewlines;
|
|
111440
111487
|
}
|
|
@@ -125424,7 +125471,6 @@ var ts;
|
|
|
125424
125471
|
|| kind === 165 /* PropertySignature */
|
|
125425
125472
|
|| kind === 167 /* MethodSignature */;
|
|
125426
125473
|
}
|
|
125427
|
-
ts.syntaxRequiresTrailingCommaOrSemicolonOrASI = syntaxRequiresTrailingCommaOrSemicolonOrASI;
|
|
125428
125474
|
function syntaxRequiresTrailingFunctionBlockOrSemicolonOrASI(kind) {
|
|
125429
125475
|
return kind === 255 /* FunctionDeclaration */
|
|
125430
125476
|
|| kind === 170 /* Constructor */
|
|
@@ -125432,11 +125478,9 @@ var ts;
|
|
|
125432
125478
|
|| kind === 171 /* GetAccessor */
|
|
125433
125479
|
|| kind === 172 /* SetAccessor */;
|
|
125434
125480
|
}
|
|
125435
|
-
ts.syntaxRequiresTrailingFunctionBlockOrSemicolonOrASI = syntaxRequiresTrailingFunctionBlockOrSemicolonOrASI;
|
|
125436
125481
|
function syntaxRequiresTrailingModuleBlockOrSemicolonOrASI(kind) {
|
|
125437
125482
|
return kind === 260 /* ModuleDeclaration */;
|
|
125438
125483
|
}
|
|
125439
|
-
ts.syntaxRequiresTrailingModuleBlockOrSemicolonOrASI = syntaxRequiresTrailingModuleBlockOrSemicolonOrASI;
|
|
125440
125484
|
function syntaxRequiresTrailingSemicolonOrASI(kind) {
|
|
125441
125485
|
return kind === 236 /* VariableStatement */
|
|
125442
125486
|
|| kind === 237 /* ExpressionStatement */
|
|
@@ -125511,19 +125555,34 @@ var ts;
|
|
|
125511
125555
|
ts.forEachChild(sourceFile, function visit(node) {
|
|
125512
125556
|
if (syntaxRequiresTrailingSemicolonOrASI(node.kind)) {
|
|
125513
125557
|
var lastToken = node.getLastToken(sourceFile);
|
|
125514
|
-
if (lastToken
|
|
125558
|
+
if ((lastToken === null || lastToken === void 0 ? void 0 : lastToken.kind) === 26 /* SemicolonToken */) {
|
|
125515
125559
|
withSemicolon++;
|
|
125516
125560
|
}
|
|
125517
125561
|
else {
|
|
125518
125562
|
withoutSemicolon++;
|
|
125519
125563
|
}
|
|
125520
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
|
+
}
|
|
125521
125580
|
if (withSemicolon + withoutSemicolon >= nStatementsToObserve) {
|
|
125522
125581
|
return true;
|
|
125523
125582
|
}
|
|
125524
125583
|
return ts.forEachChild(node, visit);
|
|
125525
125584
|
});
|
|
125526
|
-
// One statement missing a semicolon isn
|
|
125585
|
+
// One statement missing a semicolon isn't sufficient evidence to say the user
|
|
125527
125586
|
// doesn’t want semicolons, because they may not even be done writing that statement.
|
|
125528
125587
|
if (withSemicolon === 0 && withoutSemicolon <= 1) {
|
|
125529
125588
|
return true;
|
|
@@ -141389,6 +141448,7 @@ var ts;
|
|
|
141389
141448
|
lastTrailingTriviaWasNewLine: function () { return wasNewLine; },
|
|
141390
141449
|
skipToEndOf: skipToEndOf,
|
|
141391
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(); },
|
|
141392
141452
|
});
|
|
141393
141453
|
lastTokenInfo = undefined;
|
|
141394
141454
|
scanner.setText(undefined);
|
|
@@ -141562,8 +141622,7 @@ var ts;
|
|
|
141562
141622
|
}
|
|
141563
141623
|
function isOnToken() {
|
|
141564
141624
|
var current = lastTokenInfo ? lastTokenInfo.token.kind : scanner.getToken();
|
|
141565
|
-
|
|
141566
|
-
return startPos < endPos && current !== 1 /* EndOfFileToken */ && !ts.isTrivia(current);
|
|
141625
|
+
return current !== 1 /* EndOfFileToken */ && !ts.isTrivia(current);
|
|
141567
141626
|
}
|
|
141568
141627
|
function isOnEOF() {
|
|
141569
141628
|
var current = lastTokenInfo ? lastTokenInfo.token.kind : scanner.getToken();
|
|
@@ -142751,7 +142810,7 @@ var ts;
|
|
|
142751
142810
|
return 0;
|
|
142752
142811
|
}
|
|
142753
142812
|
function formatNodeGivenIndentation(node, sourceFileLike, languageVariant, initialIndentation, delta, formatContext) {
|
|
142754
|
-
var range = { pos:
|
|
142813
|
+
var range = { pos: node.pos, end: node.end };
|
|
142755
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
|
|
142756
142815
|
sourceFileLike); });
|
|
142757
142816
|
}
|
|
@@ -142802,6 +142861,15 @@ var ts;
|
|
|
142802
142861
|
}
|
|
142803
142862
|
}
|
|
142804
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
|
+
}
|
|
142805
142873
|
return edits;
|
|
142806
142874
|
// local functions
|
|
142807
142875
|
/** Tries to compute the indentation for a list element.
|
|
@@ -142984,19 +143052,13 @@ var ts;
|
|
|
142984
143052
|
processChildNodes(nodes, node, nodeStartLine, nodeDynamicIndentation);
|
|
142985
143053
|
});
|
|
142986
143054
|
// proceed any tokens in the node that are located after child nodes
|
|
142987
|
-
while (formattingScanner.isOnToken()) {
|
|
143055
|
+
while (formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) {
|
|
142988
143056
|
var tokenInfo = formattingScanner.readTokenInfo(node);
|
|
142989
|
-
if (tokenInfo.token.end > node.end) {
|
|
143057
|
+
if (tokenInfo.token.end > Math.min(node.end, originalRange.end)) {
|
|
142990
143058
|
break;
|
|
142991
143059
|
}
|
|
142992
143060
|
consumeTokenAndAdvanceScanner(tokenInfo, node, nodeDynamicIndentation, node);
|
|
142993
143061
|
}
|
|
142994
|
-
if (!node.parent && formattingScanner.isOnEOF()) {
|
|
142995
|
-
var token = formattingScanner.readEOFTokenRange();
|
|
142996
|
-
if (token.end <= node.end && previousRange) {
|
|
142997
|
-
processPair(token, sourceFile.getLineAndCharacterOfPosition(token.pos).line, node, previousRange, previousRangeStartLine, previousParent, contextNode, nodeDynamicIndentation);
|
|
142998
|
-
}
|
|
142999
|
-
}
|
|
143000
143062
|
function processChildNode(child, inheritedIndentation, parent, parentDynamicIndentation, parentStartLine, undecoratedParentStartLine, isListItem, isFirstListItem) {
|
|
143001
143063
|
var childStartPos = child.getStart(sourceFile);
|
|
143002
143064
|
var childStartLine = sourceFile.getLineAndCharacterOfPosition(childStartPos).line;
|
|
@@ -143022,9 +143084,12 @@ var ts;
|
|
|
143022
143084
|
if (child.getFullWidth() === 0) {
|
|
143023
143085
|
return inheritedIndentation;
|
|
143024
143086
|
}
|
|
143025
|
-
while (formattingScanner.isOnToken()) {
|
|
143087
|
+
while (formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) {
|
|
143026
143088
|
// proceed any parent tokens that are located prior to child.getStart()
|
|
143027
143089
|
var tokenInfo = formattingScanner.readTokenInfo(node);
|
|
143090
|
+
if (tokenInfo.token.end > originalRange.end) {
|
|
143091
|
+
return inheritedIndentation;
|
|
143092
|
+
}
|
|
143028
143093
|
if (tokenInfo.token.end > childStartPos) {
|
|
143029
143094
|
if (tokenInfo.token.pos > childStartPos) {
|
|
143030
143095
|
formattingScanner.skipToStartOf(child);
|
|
@@ -143034,7 +143099,7 @@ var ts;
|
|
|
143034
143099
|
}
|
|
143035
143100
|
consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, node);
|
|
143036
143101
|
}
|
|
143037
|
-
if (!formattingScanner.isOnToken()) {
|
|
143102
|
+
if (!formattingScanner.isOnToken() || formattingScanner.getStartPos() >= originalRange.end) {
|
|
143038
143103
|
return inheritedIndentation;
|
|
143039
143104
|
}
|
|
143040
143105
|
if (ts.isToken(child)) {
|
|
@@ -143063,7 +143128,7 @@ var ts;
|
|
|
143063
143128
|
var startLine = parentStartLine;
|
|
143064
143129
|
if (listStartToken !== 0 /* Unknown */) {
|
|
143065
143130
|
// introduce a new indentation scope for lists (including list start and end tokens)
|
|
143066
|
-
while (formattingScanner.isOnToken()) {
|
|
143131
|
+
while (formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) {
|
|
143067
143132
|
var tokenInfo = formattingScanner.readTokenInfo(parent);
|
|
143068
143133
|
if (tokenInfo.token.end > nodes.pos) {
|
|
143069
143134
|
// stop when formatting scanner moves past the beginning of node list
|
|
@@ -143099,7 +143164,7 @@ var ts;
|
|
|
143099
143164
|
inheritedIndentation = processChildNode(child, inheritedIndentation, node, listDynamicIndentation, startLine, startLine, /*isListItem*/ true, /*isFirstListItem*/ i === 0);
|
|
143100
143165
|
}
|
|
143101
143166
|
var listEndToken = getCloseTokenForOpenToken(listStartToken);
|
|
143102
|
-
if (listEndToken !== 0 /* Unknown */ && formattingScanner.isOnToken()) {
|
|
143167
|
+
if (listEndToken !== 0 /* Unknown */ && formattingScanner.isOnToken() && formattingScanner.getStartPos() < originalRange.end) {
|
|
143103
143168
|
var tokenInfo = formattingScanner.readTokenInfo(parent);
|
|
143104
143169
|
if (tokenInfo.token.kind === 27 /* CommaToken */ && ts.isCallLikeExpression(parent)) {
|
|
143105
143170
|
var commaTokenLine = sourceFile.getLineAndCharacterOfPosition(tokenInfo.token.pos).line;
|
|
@@ -143230,24 +143295,26 @@ var ts;
|
|
|
143230
143295
|
// win in a conflict with lower priority rules.
|
|
143231
143296
|
ts.forEachRight(rules, function (rule) {
|
|
143232
143297
|
lineAction = applyRuleEdits(rule, previousItem, previousStartLine, currentItem, currentStartLine);
|
|
143233
|
-
|
|
143234
|
-
|
|
143235
|
-
|
|
143236
|
-
|
|
143237
|
-
|
|
143238
|
-
|
|
143239
|
-
|
|
143240
|
-
|
|
143241
|
-
|
|
143242
|
-
|
|
143243
|
-
|
|
143244
|
-
|
|
143245
|
-
|
|
143246
|
-
|
|
143247
|
-
|
|
143248
|
-
|
|
143249
|
-
|
|
143250
|
-
|
|
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
|
+
}
|
|
143251
143318
|
}
|
|
143252
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
|
|
143253
143320
|
trimTrailingWhitespaces = trimTrailingWhitespaces && !(rule.action & 16 /* DeleteSpace */) && rule.flags !== 1 /* CanDeleteNewLines */;
|
|
@@ -145725,7 +145792,7 @@ var ts;
|
|
|
145725
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];
|
|
145726
145793
|
codefix.registerCodeFix({
|
|
145727
145794
|
errorCodes: errorCodes,
|
|
145728
|
-
getCodeActions: function (context) {
|
|
145795
|
+
getCodeActions: function getCodeActionsToAddConvertToUnknownForNonOverlappingTypes(context) {
|
|
145729
145796
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return makeChange(t, context.sourceFile, context.span.start); });
|
|
145730
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)];
|
|
145731
145798
|
},
|
|
@@ -145752,7 +145819,7 @@ var ts;
|
|
|
145752
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,
|
|
145753
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,
|
|
145754
145821
|
],
|
|
145755
|
-
getCodeActions: function (context) {
|
|
145822
|
+
getCodeActions: function getCodeActionsToAddEmptyExportDeclaration(context) {
|
|
145756
145823
|
var sourceFile = context.sourceFile;
|
|
145757
145824
|
var changes = ts.textChanges.ChangeTracker.with(context, function (changes) {
|
|
145758
145825
|
var exportDeclaration = ts.factory.createExportDeclaration(
|
|
@@ -145781,7 +145848,7 @@ var ts;
|
|
|
145781
145848
|
codefix.registerCodeFix({
|
|
145782
145849
|
fixIds: [fixId],
|
|
145783
145850
|
errorCodes: errorCodes,
|
|
145784
|
-
getCodeActions: function (context) {
|
|
145851
|
+
getCodeActions: function getCodeActionsToAddMissingAsync(context) {
|
|
145785
145852
|
var sourceFile = context.sourceFile, errorCode = context.errorCode, cancellationToken = context.cancellationToken, program = context.program, span = context.span;
|
|
145786
145853
|
var diagnostic = ts.find(program.getDiagnosticsProducingTypeChecker().getDiagnostics(sourceFile, cancellationToken), getIsMatchingAsyncError(span, errorCode));
|
|
145787
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; });
|
|
@@ -145878,7 +145945,7 @@ var ts;
|
|
|
145878
145945
|
codefix.registerCodeFix({
|
|
145879
145946
|
fixIds: [fixId],
|
|
145880
145947
|
errorCodes: errorCodes,
|
|
145881
|
-
getCodeActions: function (context) {
|
|
145948
|
+
getCodeActions: function getCodeActionsToAddMissingAwait(context) {
|
|
145882
145949
|
var sourceFile = context.sourceFile, errorCode = context.errorCode, span = context.span, cancellationToken = context.cancellationToken, program = context.program;
|
|
145883
145950
|
var expression = getAwaitErrorSpanExpression(sourceFile, errorCode, span, cancellationToken, program);
|
|
145884
145951
|
if (!expression) {
|
|
@@ -146110,7 +146177,7 @@ var ts;
|
|
|
146110
146177
|
];
|
|
146111
146178
|
codefix.registerCodeFix({
|
|
146112
146179
|
errorCodes: errorCodes,
|
|
146113
|
-
getCodeActions: function (context) {
|
|
146180
|
+
getCodeActions: function getCodeActionsToAddMissingConst(context) {
|
|
146114
146181
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return makeChange(t, context.sourceFile, context.span.start, context.program); });
|
|
146115
146182
|
if (changes.length > 0) {
|
|
146116
146183
|
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_const_to_unresolved_variable, fixId, ts.Diagnostics.Add_const_to_all_unresolved_variables)];
|
|
@@ -146210,7 +146277,7 @@ var ts;
|
|
|
146210
146277
|
];
|
|
146211
146278
|
codefix.registerCodeFix({
|
|
146212
146279
|
errorCodes: errorCodes,
|
|
146213
|
-
getCodeActions: function (context) {
|
|
146280
|
+
getCodeActions: function getCodeActionsToAddMissingDeclareOnProperty(context) {
|
|
146214
146281
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return makeChange(t, context.sourceFile, context.span.start); });
|
|
146215
146282
|
if (changes.length > 0) {
|
|
146216
146283
|
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Prefix_with_declare, fixId, ts.Diagnostics.Prefix_all_incorrect_property_declarations_with_declare)];
|
|
@@ -146244,7 +146311,7 @@ var ts;
|
|
|
146244
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];
|
|
146245
146312
|
codefix.registerCodeFix({
|
|
146246
146313
|
errorCodes: errorCodes,
|
|
146247
|
-
getCodeActions: function (context) {
|
|
146314
|
+
getCodeActions: function getCodeActionsToAddMissingInvocationForDecorator(context) {
|
|
146248
146315
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return makeChange(t, context.sourceFile, context.span.start); });
|
|
146249
146316
|
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Call_decorator_expression, fixId, ts.Diagnostics.Add_to_all_uncalled_decorators)];
|
|
146250
146317
|
},
|
|
@@ -146269,7 +146336,7 @@ var ts;
|
|
|
146269
146336
|
var errorCodes = [ts.Diagnostics.Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1.code];
|
|
146270
146337
|
codefix.registerCodeFix({
|
|
146271
146338
|
errorCodes: errorCodes,
|
|
146272
|
-
getCodeActions: function (context) {
|
|
146339
|
+
getCodeActions: function getCodeActionsToAddNameToNamelessParameter(context) {
|
|
146273
146340
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return makeChange(t, context.sourceFile, context.span.start); });
|
|
146274
146341
|
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_parameter_name, fixId, ts.Diagnostics.Add_names_to_all_parameters_without_names)];
|
|
146275
146342
|
},
|
|
@@ -148071,14 +148138,14 @@ var ts;
|
|
|
148071
148138
|
var fixId = "convertToTypeOnlyExport";
|
|
148072
148139
|
codefix.registerCodeFix({
|
|
148073
148140
|
errorCodes: errorCodes,
|
|
148074
|
-
getCodeActions: function (context) {
|
|
148141
|
+
getCodeActions: function getCodeActionsToConvertToTypeOnlyExport(context) {
|
|
148075
148142
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return fixSingleExportDeclaration(t, getExportSpecifierForDiagnosticSpan(context.span, context.sourceFile), context); });
|
|
148076
148143
|
if (changes.length) {
|
|
148077
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)];
|
|
148078
148145
|
}
|
|
148079
148146
|
},
|
|
148080
148147
|
fixIds: [fixId],
|
|
148081
|
-
getAllCodeActions: function (context) {
|
|
148148
|
+
getAllCodeActions: function getAllCodeActionsToConvertToTypeOnlyExport(context) {
|
|
148082
148149
|
var fixedExportDeclarations = new ts.Map();
|
|
148083
148150
|
return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
|
|
148084
148151
|
var exportSpecifier = getExportSpecifierForDiagnosticSpan(diag, context.sourceFile);
|
|
@@ -148139,7 +148206,7 @@ var ts;
|
|
|
148139
148206
|
var fixId = "convertToTypeOnlyImport";
|
|
148140
148207
|
codefix.registerCodeFix({
|
|
148141
148208
|
errorCodes: errorCodes,
|
|
148142
|
-
getCodeActions: function (context) {
|
|
148209
|
+
getCodeActions: function getCodeActionsToConvertToTypeOnlyImport(context) {
|
|
148143
148210
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) {
|
|
148144
148211
|
var importDeclaration = getImportDeclarationForDiagnosticSpan(context.span, context.sourceFile);
|
|
148145
148212
|
fixSingleImportDeclaration(t, importDeclaration, context);
|
|
@@ -148149,7 +148216,7 @@ var ts;
|
|
|
148149
148216
|
}
|
|
148150
148217
|
},
|
|
148151
148218
|
fixIds: [fixId],
|
|
148152
|
-
getAllCodeActions: function (context) {
|
|
148219
|
+
getAllCodeActions: function getAllCodeActionsToConvertToTypeOnlyImport(context) {
|
|
148153
148220
|
return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
|
|
148154
148221
|
var importDeclaration = getImportDeclarationForDiagnosticSpan(diag, context.sourceFile);
|
|
148155
148222
|
fixSingleImportDeclaration(changes, importDeclaration, context);
|
|
@@ -148188,7 +148255,7 @@ var ts;
|
|
|
148188
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];
|
|
148189
148256
|
codefix.registerCodeFix({
|
|
148190
148257
|
errorCodes: errorCodes,
|
|
148191
|
-
getCodeActions: function (context) {
|
|
148258
|
+
getCodeActions: function getCodeActionsToConvertLiteralTypeToMappedType(context) {
|
|
148192
148259
|
var sourceFile = context.sourceFile, span = context.span;
|
|
148193
148260
|
var info = getInfo(sourceFile, span.start);
|
|
148194
148261
|
if (!info) {
|
|
@@ -149332,7 +149399,7 @@ var ts;
|
|
|
149332
149399
|
_a);
|
|
149333
149400
|
codefix.registerCodeFix({
|
|
149334
149401
|
errorCodes: errorCodes,
|
|
149335
|
-
getCodeActions: function (context) {
|
|
149402
|
+
getCodeActions: function getCodeActionsToFixOverrideModifierIssues(context) {
|
|
149336
149403
|
var errorCode = context.errorCode, span = context.span;
|
|
149337
149404
|
var info = errorCodeFixIdMap[errorCode];
|
|
149338
149405
|
if (!info)
|
|
@@ -149528,7 +149595,7 @@ var ts;
|
|
|
149528
149595
|
];
|
|
149529
149596
|
codefix.registerCodeFix({
|
|
149530
149597
|
errorCodes: errorCodes,
|
|
149531
|
-
getCodeActions: function (context) {
|
|
149598
|
+
getCodeActions: function getCodeActionsToFixIncorrectNamedTupleSyntax(context) {
|
|
149532
149599
|
var sourceFile = context.sourceFile, span = context.span;
|
|
149533
149600
|
var namedTupleMember = getNamedTupleMember(sourceFile, span.start);
|
|
149534
149601
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, namedTupleMember); });
|
|
@@ -149727,7 +149794,7 @@ var ts;
|
|
|
149727
149794
|
codefix.registerCodeFix({
|
|
149728
149795
|
errorCodes: errorCodes,
|
|
149729
149796
|
fixIds: [fixIdAddReturnStatement, fixRemoveBracesFromArrowFunctionBody, fixIdWrapTheBlockWithParen],
|
|
149730
|
-
getCodeActions: function (context) {
|
|
149797
|
+
getCodeActions: function getCodeActionsToCorrectReturnValue(context) {
|
|
149731
149798
|
var program = context.program, sourceFile = context.sourceFile, start = context.span.start, errorCode = context.errorCode;
|
|
149732
149799
|
var info = getInfo(program.getTypeChecker(), sourceFile, start, errorCode);
|
|
149733
149800
|
if (!info)
|
|
@@ -150477,7 +150544,7 @@ var ts;
|
|
|
150477
150544
|
];
|
|
150478
150545
|
codefix.registerCodeFix({
|
|
150479
150546
|
errorCodes: errorCodes,
|
|
150480
|
-
getCodeActions: function (context) {
|
|
150547
|
+
getCodeActions: function getCodeActionsToFixNotFoundModule(context) {
|
|
150481
150548
|
var host = context.host, sourceFile = context.sourceFile, start = context.span.start;
|
|
150482
150549
|
var packageName = tryGetImportedPackageName(sourceFile, start);
|
|
150483
150550
|
if (packageName === undefined)
|
|
@@ -150538,7 +150605,7 @@ var ts;
|
|
|
150538
150605
|
var fixId = "fixClassDoesntImplementInheritedAbstractMember";
|
|
150539
150606
|
codefix.registerCodeFix({
|
|
150540
150607
|
errorCodes: errorCodes,
|
|
150541
|
-
getCodeActions: function (context) {
|
|
150608
|
+
getCodeActions: function getCodeActionsToFixClassNotImplementingInheritedMembers(context) {
|
|
150542
150609
|
var sourceFile = context.sourceFile, span = context.span;
|
|
150543
150610
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) {
|
|
150544
150611
|
return addMissingMembers(getClass(sourceFile, span.start), sourceFile, context, t, context.preferences);
|
|
@@ -150546,7 +150613,7 @@ var ts;
|
|
|
150546
150613
|
return changes.length === 0 ? undefined : [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Implement_inherited_abstract_class, fixId, ts.Diagnostics.Implement_all_inherited_abstract_classes)];
|
|
150547
150614
|
},
|
|
150548
150615
|
fixIds: [fixId],
|
|
150549
|
-
getAllCodeActions: function (context) {
|
|
150616
|
+
getAllCodeActions: function getAllCodeActionsToFixClassDoesntImplementInheritedAbstractMember(context) {
|
|
150550
150617
|
var seenClassDeclarations = new ts.Map();
|
|
150551
150618
|
return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
|
|
150552
150619
|
var classDeclaration = getClass(diag.file, diag.start);
|
|
@@ -150679,7 +150746,7 @@ var ts;
|
|
|
150679
150746
|
];
|
|
150680
150747
|
codefix.registerCodeFix({
|
|
150681
150748
|
errorCodes: errorCodes,
|
|
150682
|
-
getCodeActions: function (context) {
|
|
150749
|
+
getCodeActions: function getCodeActionsToEnableExperimentalDecorators(context) {
|
|
150683
150750
|
var configFile = context.program.getCompilerOptions().configFile;
|
|
150684
150751
|
if (configFile === undefined) {
|
|
150685
150752
|
return undefined;
|
|
@@ -150710,7 +150777,7 @@ var ts;
|
|
|
150710
150777
|
var errorCodes = [ts.Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided.code];
|
|
150711
150778
|
codefix.registerCodeFix({
|
|
150712
150779
|
errorCodes: errorCodes,
|
|
150713
|
-
getCodeActions: function (context) {
|
|
150780
|
+
getCodeActions: function getCodeActionsToFixEnableJsxFlag(context) {
|
|
150714
150781
|
var configFile = context.program.getCompilerOptions().configFile;
|
|
150715
150782
|
if (configFile === undefined) {
|
|
150716
150783
|
return undefined;
|
|
@@ -150748,7 +150815,7 @@ var ts;
|
|
|
150748
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,
|
|
150749
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,
|
|
150750
150817
|
],
|
|
150751
|
-
getCodeActions: function (context) {
|
|
150818
|
+
getCodeActions: function getCodeActionsToFixModuleAndTarget(context) {
|
|
150752
150819
|
var compilerOptions = context.program.getCompilerOptions();
|
|
150753
150820
|
var configFile = compilerOptions.configFile;
|
|
150754
150821
|
if (configFile === undefined) {
|
|
@@ -151520,7 +151587,7 @@ var ts;
|
|
|
151520
151587
|
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_async_modifier_to_containing_function, fixId, ts.Diagnostics.Add_all_missing_async_modifiers)];
|
|
151521
151588
|
},
|
|
151522
151589
|
fixIds: [fixId],
|
|
151523
|
-
getAllCodeActions: function (context) {
|
|
151590
|
+
getAllCodeActions: function getAllCodeActionsToFixAwaitInSyncFunction(context) {
|
|
151524
151591
|
var seen = new ts.Map();
|
|
151525
151592
|
return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
|
|
151526
151593
|
var nodes = getNodes(diag.file, diag.start);
|
|
@@ -152642,7 +152709,7 @@ var ts;
|
|
|
152642
152709
|
codefix.registerCodeFix({
|
|
152643
152710
|
errorCodes: errorCodes,
|
|
152644
152711
|
fixIds: [fixId],
|
|
152645
|
-
getCodeActions: function (context) {
|
|
152712
|
+
getCodeActions: function getCodeActionsToFixReturnTypeInAsyncFunction(context) {
|
|
152646
152713
|
var sourceFile = context.sourceFile, program = context.program, span = context.span;
|
|
152647
152714
|
var checker = program.getTypeChecker();
|
|
152648
152715
|
var info = getInfo(sourceFile, program.getTypeChecker(), span.start);
|
|
@@ -152696,7 +152763,7 @@ var ts;
|
|
|
152696
152763
|
});
|
|
152697
152764
|
codefix.registerCodeFix({
|
|
152698
152765
|
errorCodes: errorCodes,
|
|
152699
|
-
getCodeActions: function (context) {
|
|
152766
|
+
getCodeActions: function getCodeActionsToDisableJsDiagnostics(context) {
|
|
152700
152767
|
var sourceFile = context.sourceFile, program = context.program, span = context.span, host = context.host, formatContext = context.formatContext;
|
|
152701
152768
|
if (!ts.isInJSFile(sourceFile) || !ts.isCheckJsEnabledForFile(sourceFile, program.getCompilerOptions())) {
|
|
152702
152769
|
return undefined;
|
|
@@ -153465,7 +153532,7 @@ var ts;
|
|
|
153465
153532
|
var errorCodes = [ts.Diagnostics.Property_0_has_no_initializer_and_is_not_definitely_assigned_in_the_constructor.code];
|
|
153466
153533
|
codefix.registerCodeFix({
|
|
153467
153534
|
errorCodes: errorCodes,
|
|
153468
|
-
getCodeActions: function (context) {
|
|
153535
|
+
getCodeActions: function getCodeActionsForStrictClassInitializationErrors(context) {
|
|
153469
153536
|
var propertyDeclaration = getPropertyDeclaration(context.sourceFile, context.span.start);
|
|
153470
153537
|
if (!propertyDeclaration)
|
|
153471
153538
|
return;
|
|
@@ -153688,7 +153755,7 @@ var ts;
|
|
|
153688
153755
|
];
|
|
153689
153756
|
codefix.registerCodeFix({
|
|
153690
153757
|
errorCodes: errorCodes,
|
|
153691
|
-
getCodeActions: function (context) {
|
|
153758
|
+
getCodeActions: function getCodeActionsToUseBigintLiteral(context) {
|
|
153692
153759
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return makeChange(t, context.sourceFile, context.span); });
|
|
153693
153760
|
if (changes.length > 0) {
|
|
153694
153761
|
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Convert_to_a_bigint_numeric_literal, fixId, ts.Diagnostics.Convert_all_to_bigint_numeric_literals)];
|
|
@@ -153720,7 +153787,7 @@ var ts;
|
|
|
153720
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];
|
|
153721
153788
|
codefix.registerCodeFix({
|
|
153722
153789
|
errorCodes: errorCodes,
|
|
153723
|
-
getCodeActions: function (context) {
|
|
153790
|
+
getCodeActions: function getCodeActionsToAddMissingTypeof(context) {
|
|
153724
153791
|
var sourceFile = context.sourceFile, span = context.span;
|
|
153725
153792
|
var importType = getImportTypeNode(sourceFile, span.start);
|
|
153726
153793
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, sourceFile, importType); });
|
|
@@ -153752,7 +153819,7 @@ var ts;
|
|
|
153752
153819
|
var errorCodes = [ts.Diagnostics.JSX_expressions_must_have_one_parent_element.code];
|
|
153753
153820
|
codefix.registerCodeFix({
|
|
153754
153821
|
errorCodes: errorCodes,
|
|
153755
|
-
getCodeActions: function (context) {
|
|
153822
|
+
getCodeActions: function getCodeActionsToWrapJsxInFragment(context) {
|
|
153756
153823
|
var sourceFile = context.sourceFile, span = context.span;
|
|
153757
153824
|
var node = findNodeToFix(sourceFile, span.start);
|
|
153758
153825
|
if (!node)
|
|
@@ -153824,12 +153891,11 @@ var ts;
|
|
|
153824
153891
|
(function (ts) {
|
|
153825
153892
|
var codefix;
|
|
153826
153893
|
(function (codefix) {
|
|
153827
|
-
var
|
|
153828
|
-
var fixId = fixIdAddMissingTypeof;
|
|
153894
|
+
var fixId = "fixConvertToMappedObjectType";
|
|
153829
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];
|
|
153830
153896
|
codefix.registerCodeFix({
|
|
153831
153897
|
errorCodes: errorCodes,
|
|
153832
|
-
getCodeActions: function (context) {
|
|
153898
|
+
getCodeActions: function getCodeActionsToConvertToMappedTypeObject(context) {
|
|
153833
153899
|
var sourceFile = context.sourceFile, span = context.span;
|
|
153834
153900
|
var info = getInfo(sourceFile, span.start);
|
|
153835
153901
|
if (!info)
|
|
@@ -153908,7 +153974,7 @@ var ts;
|
|
|
153908
153974
|
];
|
|
153909
153975
|
codefix.registerCodeFix({
|
|
153910
153976
|
errorCodes: errorCodes,
|
|
153911
|
-
getCodeActions: function (context) {
|
|
153977
|
+
getCodeActions: function getCodeActionsToRemoveUnnecessaryAwait(context) {
|
|
153912
153978
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return makeChange(t, context.sourceFile, context.span); });
|
|
153913
153979
|
if (changes.length > 0) {
|
|
153914
153980
|
return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Remove_unnecessary_await, fixId, ts.Diagnostics.Remove_all_unnecessary_uses_of_await)];
|
|
@@ -153950,7 +154016,7 @@ var ts;
|
|
|
153950
154016
|
codefix.registerCodeFix({
|
|
153951
154017
|
errorCodes: errorCodes,
|
|
153952
154018
|
fixIds: [fixId],
|
|
153953
|
-
getCodeActions: function (context) {
|
|
154019
|
+
getCodeActions: function getCodeActionsToSplitTypeOnlyImport(context) {
|
|
153954
154020
|
var changes = ts.textChanges.ChangeTracker.with(context, function (t) {
|
|
153955
154021
|
return splitTypeOnlyImport(t, getImportDeclaration(context.sourceFile, context.span), context);
|
|
153956
154022
|
});
|
|
@@ -153986,7 +154052,7 @@ var ts;
|
|
|
153986
154052
|
var errorCodes = [ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_constant.code];
|
|
153987
154053
|
codefix.registerCodeFix({
|
|
153988
154054
|
errorCodes: errorCodes,
|
|
153989
|
-
getCodeActions: function (context) {
|
|
154055
|
+
getCodeActions: function getCodeActionsToConvertConstToLet(context) {
|
|
153990
154056
|
var sourceFile = context.sourceFile, span = context.span, program = context.program;
|
|
153991
154057
|
var range = getConstTokenRange(sourceFile, span.start, program);
|
|
153992
154058
|
if (range === undefined)
|