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