typescript 4.6.0-dev.20211115 → 4.6.0-dev.20211119
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 +54 -46
- package/lib/tsserver.js +197 -140
- package/lib/tsserverlibrary.d.ts +3 -3
- package/lib/tsserverlibrary.js +197 -140
- package/lib/typescript.d.ts +3 -3
- package/lib/typescript.js +193 -136
- package/lib/typescriptServices.d.ts +3 -3
- package/lib/typescriptServices.js +193 -136
- package/lib/typingsInstaller.js +64 -68
- 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.20211119";
|
|
104
104
|
/* @internal */
|
|
105
105
|
var Comparison;
|
|
106
106
|
(function (Comparison) {
|
|
@@ -162,26 +162,6 @@ var ts;
|
|
|
162
162
|
ts.emptyArray = [];
|
|
163
163
|
ts.emptyMap = new ts.Map();
|
|
164
164
|
ts.emptySet = new ts.Set();
|
|
165
|
-
function createMap() {
|
|
166
|
-
return new ts.Map();
|
|
167
|
-
}
|
|
168
|
-
ts.createMap = createMap;
|
|
169
|
-
/**
|
|
170
|
-
* Create a new map from a template object is provided, the map will copy entries from it.
|
|
171
|
-
* @deprecated Use `new Map(getEntries(template))` instead.
|
|
172
|
-
*/
|
|
173
|
-
function createMapFromTemplate(template) {
|
|
174
|
-
var map = new ts.Map();
|
|
175
|
-
// Copies keys/values from template. Note that for..in will not throw if
|
|
176
|
-
// template is undefined, and instead will just exit the loop.
|
|
177
|
-
for (var key in template) {
|
|
178
|
-
if (hasOwnProperty.call(template, key)) {
|
|
179
|
-
map.set(key, template[key]);
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
return map;
|
|
183
|
-
}
|
|
184
|
-
ts.createMapFromTemplate = createMapFromTemplate;
|
|
185
165
|
function length(array) {
|
|
186
166
|
return array ? array.length : 0;
|
|
187
167
|
}
|
|
@@ -2416,11 +2396,6 @@ var ts;
|
|
|
2416
2396
|
return value;
|
|
2417
2397
|
}
|
|
2418
2398
|
Debug.checkDefined = checkDefined;
|
|
2419
|
-
/**
|
|
2420
|
-
* @deprecated Use `checkDefined` to check whether a value is defined inline. Use `assertIsDefined` to check whether
|
|
2421
|
-
* a value is defined at the statement level.
|
|
2422
|
-
*/
|
|
2423
|
-
Debug.assertDefined = checkDefined;
|
|
2424
2399
|
function assertEachIsDefined(value, message, stackCrawlMark) {
|
|
2425
2400
|
for (var _i = 0, value_1 = value; _i < value_1.length; _i++) {
|
|
2426
2401
|
var v = value_1[_i];
|
|
@@ -2433,11 +2408,6 @@ var ts;
|
|
|
2433
2408
|
return value;
|
|
2434
2409
|
}
|
|
2435
2410
|
Debug.checkEachDefined = checkEachDefined;
|
|
2436
|
-
/**
|
|
2437
|
-
* @deprecated Use `checkEachDefined` to check whether the elements of an array are defined inline. Use `assertEachIsDefined` to check whether
|
|
2438
|
-
* the elements of an array are defined at the statement level.
|
|
2439
|
-
*/
|
|
2440
|
-
Debug.assertEachDefined = checkEachDefined;
|
|
2441
2411
|
function assertNever(member, message, stackCrawlMark) {
|
|
2442
2412
|
if (message === void 0) { message = "Illegal value:"; }
|
|
2443
2413
|
var detail = typeof member === "object" && ts.hasProperty(member, "kind") && ts.hasProperty(member, "pos") && formatSyntaxKind ? "SyntaxKind: " + formatSyntaxKind(member.kind) : JSON.stringify(member);
|
|
@@ -13897,21 +13867,6 @@ var ts;
|
|
|
13897
13867
|
return undefined;
|
|
13898
13868
|
}
|
|
13899
13869
|
ts.getDeclarationOfKind = getDeclarationOfKind;
|
|
13900
|
-
/**
|
|
13901
|
-
* Create a new escaped identifier map.
|
|
13902
|
-
* @deprecated Use `new Map<__String, T>()` instead.
|
|
13903
|
-
*/
|
|
13904
|
-
function createUnderscoreEscapedMap() {
|
|
13905
|
-
return new ts.Map();
|
|
13906
|
-
}
|
|
13907
|
-
ts.createUnderscoreEscapedMap = createUnderscoreEscapedMap;
|
|
13908
|
-
/**
|
|
13909
|
-
* @deprecated Use `!!map?.size` instead
|
|
13910
|
-
*/
|
|
13911
|
-
function hasEntries(map) {
|
|
13912
|
-
return !!map && !!map.size;
|
|
13913
|
-
}
|
|
13914
|
-
ts.hasEntries = hasEntries;
|
|
13915
13870
|
function createSymbolTable(symbols) {
|
|
13916
13871
|
var result = new ts.Map();
|
|
13917
13872
|
if (symbols) {
|
|
@@ -26504,7 +26459,7 @@ var ts;
|
|
|
26504
26459
|
sourceMapText = mapTextOrStripInternal;
|
|
26505
26460
|
}
|
|
26506
26461
|
var node = oldFileOfCurrentEmit ?
|
|
26507
|
-
parseOldFileOfCurrentEmit(ts.Debug.
|
|
26462
|
+
parseOldFileOfCurrentEmit(ts.Debug.checkDefined(bundleFileInfo)) :
|
|
26508
26463
|
parseUnparsedSourceFile(bundleFileInfo, stripInternal, length);
|
|
26509
26464
|
node.fileName = fileName;
|
|
26510
26465
|
node.sourceMapPath = sourceMapPath;
|
|
@@ -26651,13 +26606,13 @@ var ts;
|
|
|
26651
26606
|
};
|
|
26652
26607
|
node.javascriptPath = declarationTextOrJavascriptPath;
|
|
26653
26608
|
node.javascriptMapPath = javascriptMapPath;
|
|
26654
|
-
node.declarationPath = ts.Debug.
|
|
26609
|
+
node.declarationPath = ts.Debug.checkDefined(javascriptMapTextOrDeclarationPath);
|
|
26655
26610
|
node.declarationMapPath = declarationMapPath;
|
|
26656
26611
|
node.buildInfoPath = declarationMapTextOrBuildInfoPath;
|
|
26657
26612
|
Object.defineProperties(node, {
|
|
26658
26613
|
javascriptText: { get: function () { return definedTextGetter_1(declarationTextOrJavascriptPath); } },
|
|
26659
26614
|
javascriptMapText: { get: function () { return textGetter_1(javascriptMapPath); } },
|
|
26660
|
-
declarationText: { get: function () { return definedTextGetter_1(ts.Debug.
|
|
26615
|
+
declarationText: { get: function () { return definedTextGetter_1(ts.Debug.checkDefined(javascriptMapTextOrDeclarationPath)); } },
|
|
26661
26616
|
declarationMapText: { get: function () { return textGetter_1(declarationMapPath); } },
|
|
26662
26617
|
buildInfo: { get: function () { return getAndCacheBuildInfo_1(function () { return textGetter_1(declarationMapTextOrBuildInfoPath); }); } }
|
|
26663
26618
|
});
|
|
@@ -51666,8 +51621,8 @@ var ts;
|
|
|
51666
51621
|
var expandedParams = getExpandedParameters(signature, /*skipUnionExpanding*/ true)[0];
|
|
51667
51622
|
// If the expanded parameter list had a variadic in a non-trailing position, don't expand it
|
|
51668
51623
|
var parameters = (ts.some(expandedParams, function (p) { return p !== expandedParams[expandedParams.length - 1] && !!(ts.getCheckFlags(p) & 32768 /* RestParameter */); }) ? signature.parameters : expandedParams).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 170 /* Constructor */, options === null || options === void 0 ? void 0 : options.privateSymbolVisitor, options === null || options === void 0 ? void 0 : options.bundledImports); });
|
|
51669
|
-
|
|
51670
|
-
|
|
51624
|
+
var thisParameter = tryGetThisParameterDeclaration(signature, context);
|
|
51625
|
+
if (thisParameter) {
|
|
51671
51626
|
parameters.unshift(thisParameter);
|
|
51672
51627
|
}
|
|
51673
51628
|
var returnTypeNode;
|
|
@@ -51716,6 +51671,21 @@ var ts;
|
|
|
51716
51671
|
}
|
|
51717
51672
|
return node;
|
|
51718
51673
|
}
|
|
51674
|
+
function tryGetThisParameterDeclaration(signature, context) {
|
|
51675
|
+
if (signature.thisParameter) {
|
|
51676
|
+
return symbolToParameterDeclaration(signature.thisParameter, context);
|
|
51677
|
+
}
|
|
51678
|
+
if (signature.declaration) {
|
|
51679
|
+
var thisTag = ts.getJSDocThisTag(signature.declaration);
|
|
51680
|
+
if (thisTag && thisTag.typeExpression) {
|
|
51681
|
+
return ts.factory.createParameterDeclaration(
|
|
51682
|
+
/* decorators */ undefined,
|
|
51683
|
+
/* modifiers */ undefined,
|
|
51684
|
+
/* dotDotDotToken */ undefined, "this",
|
|
51685
|
+
/* questionToken */ undefined, typeToTypeNodeHelper(getTypeFromTypeNode(thisTag.typeExpression), context));
|
|
51686
|
+
}
|
|
51687
|
+
}
|
|
51688
|
+
}
|
|
51719
51689
|
function typeParameterToDeclarationWithConstraint(type, context, constraintNode) {
|
|
51720
51690
|
var savedContextFlags = context.flags;
|
|
51721
51691
|
context.flags &= ~512 /* WriteTypeParametersInQualifiedName */; // Avoids potential infinite loop when building for a claimspace with a generic
|
|
@@ -52157,10 +52127,8 @@ var ts;
|
|
|
52157
52127
|
firstChar = symbolName.charCodeAt(0);
|
|
52158
52128
|
}
|
|
52159
52129
|
var expression = void 0;
|
|
52160
|
-
if (ts.isSingleOrDoubleQuote(firstChar)) {
|
|
52161
|
-
expression = ts.factory.createStringLiteral(symbolName
|
|
52162
|
-
.substring(1, symbolName.length - 1)
|
|
52163
|
-
.replace(/\\./g, function (s) { return s.substring(1); }), firstChar === 39 /* singleQuote */);
|
|
52130
|
+
if (ts.isSingleOrDoubleQuote(firstChar) && !(symbol.flags & 8 /* EnumMember */)) {
|
|
52131
|
+
expression = ts.factory.createStringLiteral(ts.stripQuotes(symbolName).replace(/\\./g, function (s) { return s.substring(1); }), firstChar === 39 /* singleQuote */);
|
|
52164
52132
|
}
|
|
52165
52133
|
else if (("" + +symbolName) === symbolName) {
|
|
52166
52134
|
expression = ts.factory.createNumericLiteral(+symbolName);
|
|
@@ -94153,7 +94121,7 @@ var ts;
|
|
|
94153
94121
|
function visitYieldExpression(node) {
|
|
94154
94122
|
if (enclosingFunctionFlags & 2 /* Async */ && enclosingFunctionFlags & 1 /* Generator */) {
|
|
94155
94123
|
if (node.asteriskToken) {
|
|
94156
|
-
var expression = ts.visitNode(ts.Debug.
|
|
94124
|
+
var expression = ts.visitNode(ts.Debug.checkDefined(node.expression), visitor, ts.isExpression);
|
|
94157
94125
|
return ts.setOriginalNode(ts.setTextRange(factory.createYieldExpression(
|
|
94158
94126
|
/*asteriskToken*/ undefined, emitHelpers().createAwaitHelper(factory.updateYieldExpression(node, node.asteriskToken, ts.setTextRange(emitHelpers().createAsyncDelegatorHelper(ts.setTextRange(emitHelpers().createAsyncValuesHelper(expression), expression)), expression)))), node), node);
|
|
94159
94127
|
}
|
|
@@ -95078,11 +95046,11 @@ var ts;
|
|
|
95078
95046
|
return existing.name;
|
|
95079
95047
|
}
|
|
95080
95048
|
if (!currentFileState.utilizedImplicitRuntimeImports) {
|
|
95081
|
-
currentFileState.utilizedImplicitRuntimeImports = ts.
|
|
95049
|
+
currentFileState.utilizedImplicitRuntimeImports = new ts.Map();
|
|
95082
95050
|
}
|
|
95083
95051
|
var specifierSourceImports = currentFileState.utilizedImplicitRuntimeImports.get(importSource);
|
|
95084
95052
|
if (!specifierSourceImports) {
|
|
95085
|
-
specifierSourceImports = ts.
|
|
95053
|
+
specifierSourceImports = new ts.Map();
|
|
95086
95054
|
currentFileState.utilizedImplicitRuntimeImports.set(importSource, specifierSourceImports);
|
|
95087
95055
|
}
|
|
95088
95056
|
var generatedName = factory.createUniqueName("_" + name, 16 /* Optimistic */ | 32 /* FileLevel */ | 64 /* AllowNameSubstitution */);
|
|
@@ -108677,6 +108645,7 @@ var ts;
|
|
|
108677
108645
|
return emitJSDocSignature(node);
|
|
108678
108646
|
case 325 /* JSDocTag */:
|
|
108679
108647
|
case 330 /* JSDocClassTag */:
|
|
108648
|
+
case 335 /* JSDocOverrideTag */:
|
|
108680
108649
|
return emitJSDocSimpleTag(node);
|
|
108681
108650
|
case 326 /* JSDocAugmentsTag */:
|
|
108682
108651
|
case 327 /* JSDocImplementsTag */:
|
|
@@ -108689,7 +108658,6 @@ var ts;
|
|
|
108689
108658
|
case 332 /* JSDocPrivateTag */:
|
|
108690
108659
|
case 333 /* JSDocProtectedTag */:
|
|
108691
108660
|
case 334 /* JSDocReadonlyTag */:
|
|
108692
|
-
case 335 /* JSDocOverrideTag */:
|
|
108693
108661
|
return;
|
|
108694
108662
|
case 336 /* JSDocCallbackTag */:
|
|
108695
108663
|
return emitJSDocCallbackTag(node);
|
|
@@ -113609,6 +113577,24 @@ var ts;
|
|
|
113609
113577
|
}
|
|
113610
113578
|
}
|
|
113611
113579
|
ts.getImpliedNodeFormatForFile = getImpliedNodeFormatForFile;
|
|
113580
|
+
/** @internal */
|
|
113581
|
+
ts.plainJSErrors = new ts.Set([
|
|
113582
|
+
ts.Diagnostics.Cannot_redeclare_block_scoped_variable_0.code,
|
|
113583
|
+
ts.Diagnostics.A_module_cannot_have_multiple_default_exports.code,
|
|
113584
|
+
ts.Diagnostics.Another_export_default_is_here.code,
|
|
113585
|
+
ts.Diagnostics.The_first_export_default_is_here.code,
|
|
113586
|
+
ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_at_the_top_level_of_a_module.code,
|
|
113587
|
+
ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_in_strict_mode_Modules_are_automatically_in_strict_mode.code,
|
|
113588
|
+
ts.Diagnostics.Identifier_expected_0_is_a_reserved_word_that_cannot_be_used_here.code,
|
|
113589
|
+
ts.Diagnostics.constructor_is_a_reserved_word.code,
|
|
113590
|
+
ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode.code,
|
|
113591
|
+
ts.Diagnostics.Code_contained_in_a_class_is_evaluated_in_JavaScript_s_strict_mode_which_does_not_allow_this_use_of_0_For_more_information_see_https_Colon_Slash_Slashdeveloper_mozilla_org_Slashen_US_Slashdocs_SlashWeb_SlashJavaScript_SlashReference_SlashStrict_mode.code,
|
|
113592
|
+
ts.Diagnostics.Invalid_use_of_0_Modules_are_automatically_in_strict_mode.code,
|
|
113593
|
+
ts.Diagnostics.Invalid_use_of_0_in_strict_mode.code,
|
|
113594
|
+
ts.Diagnostics.A_label_is_not_allowed_here.code,
|
|
113595
|
+
ts.Diagnostics.Octal_literals_are_not_allowed_in_strict_mode.code,
|
|
113596
|
+
ts.Diagnostics.with_statements_are_not_allowed_in_strict_mode.code,
|
|
113597
|
+
]);
|
|
113612
113598
|
/**
|
|
113613
113599
|
* Determine if source file needs to be re-created even if its text hasn't changed
|
|
113614
113600
|
*/
|
|
@@ -114269,6 +114255,7 @@ var ts;
|
|
|
114269
114255
|
newSourceFile.originalFileName = oldSourceFile.originalFileName;
|
|
114270
114256
|
newSourceFile.resolvedPath = oldSourceFile.resolvedPath;
|
|
114271
114257
|
newSourceFile.fileName = oldSourceFile.fileName;
|
|
114258
|
+
newSourceFile.impliedNodeFormat = oldSourceFile.impliedNodeFormat;
|
|
114272
114259
|
var packageName = oldProgram.sourceFileToPackageName.get(oldSourceFile.path);
|
|
114273
114260
|
if (packageName !== undefined) {
|
|
114274
114261
|
// If there are 2 different source files for the same package name and at least one of them changes,
|
|
@@ -114625,14 +114612,23 @@ var ts;
|
|
|
114625
114612
|
}
|
|
114626
114613
|
var typeChecker = getDiagnosticsProducingTypeChecker();
|
|
114627
114614
|
ts.Debug.assert(!!sourceFile.bindDiagnostics);
|
|
114628
|
-
var
|
|
114615
|
+
var isJs = sourceFile.scriptKind === 1 /* JS */ || sourceFile.scriptKind === 2 /* JSX */;
|
|
114616
|
+
var isCheckJs = isJs && ts.isCheckJsEnabledForFile(sourceFile, options);
|
|
114617
|
+
var isPlainJs = isJs && !sourceFile.checkJsDirective && options.checkJs === undefined;
|
|
114629
114618
|
var isTsNoCheck = !!sourceFile.checkJsDirective && sourceFile.checkJsDirective.enabled === false;
|
|
114630
|
-
// By default, only type-check .ts, .tsx,
|
|
114619
|
+
// By default, only type-check .ts, .tsx, Deferred, plain JS, checked JS and External
|
|
114620
|
+
// - plain JS: .js files with no // ts-check and checkJs: undefined
|
|
114621
|
+
// - check JS: .js files with either // ts-check or checkJs: true
|
|
114622
|
+
// - external: files that are added by plugins
|
|
114631
114623
|
var includeBindAndCheckDiagnostics = !isTsNoCheck && (sourceFile.scriptKind === 3 /* TS */ || sourceFile.scriptKind === 4 /* TSX */
|
|
114632
|
-
|| sourceFile.scriptKind === 5 /* External */ || isCheckJs || sourceFile.scriptKind === 7 /* Deferred */);
|
|
114624
|
+
|| sourceFile.scriptKind === 5 /* External */ || isPlainJs || isCheckJs || sourceFile.scriptKind === 7 /* Deferred */);
|
|
114633
114625
|
var bindDiagnostics = includeBindAndCheckDiagnostics ? sourceFile.bindDiagnostics : ts.emptyArray;
|
|
114634
|
-
var checkDiagnostics = includeBindAndCheckDiagnostics ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : ts.emptyArray;
|
|
114635
|
-
|
|
114626
|
+
var checkDiagnostics = includeBindAndCheckDiagnostics && !isPlainJs ? typeChecker.getDiagnostics(sourceFile, cancellationToken) : ts.emptyArray;
|
|
114627
|
+
if (isPlainJs) {
|
|
114628
|
+
bindDiagnostics = ts.filter(bindDiagnostics, function (d) { return ts.plainJSErrors.has(d.code); });
|
|
114629
|
+
}
|
|
114630
|
+
// skip ts-expect-error errors in plain JS files, and skip JSDoc errors except in checked JS
|
|
114631
|
+
return getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics && !isPlainJs, bindDiagnostics, checkDiagnostics, isCheckJs ? sourceFile.jsDocDiagnostics : undefined);
|
|
114636
114632
|
});
|
|
114637
114633
|
}
|
|
114638
114634
|
function getMergedBindAndCheckDiagnostics(sourceFile, includeBindAndCheckDiagnostics) {
|
|
@@ -115646,7 +115642,7 @@ var ts;
|
|
|
115646
115642
|
return resolvedRef;
|
|
115647
115643
|
}
|
|
115648
115644
|
function verifyCompilerOptions() {
|
|
115649
|
-
var isNightly = ts.stringContains(ts.version, "-dev");
|
|
115645
|
+
var isNightly = ts.stringContains(ts.version, "-dev") || ts.stringContains(ts.version, "-insiders");
|
|
115650
115646
|
if (!isNightly) {
|
|
115651
115647
|
if (ts.getEmitModuleKind(options) === ts.ModuleKind.Node12) {
|
|
115652
115648
|
createOptionValueDiagnostic("module", ts.Diagnostics.Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next, "module", "node12");
|
|
@@ -118541,7 +118537,7 @@ var ts;
|
|
|
118541
118537
|
function watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, filePath, getResolutionWithResolvedFileName) {
|
|
118542
118538
|
if (resolution.refCount) {
|
|
118543
118539
|
resolution.refCount++;
|
|
118544
|
-
ts.Debug.
|
|
118540
|
+
ts.Debug.assertIsDefined(resolution.files);
|
|
118545
118541
|
}
|
|
118546
118542
|
else {
|
|
118547
118543
|
resolution.refCount = 1;
|
|
@@ -118609,7 +118605,7 @@ var ts;
|
|
|
118609
118605
|
}
|
|
118610
118606
|
}
|
|
118611
118607
|
function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName) {
|
|
118612
|
-
ts.unorderedRemoveItem(ts.Debug.
|
|
118608
|
+
ts.unorderedRemoveItem(ts.Debug.checkDefined(resolution.files), filePath);
|
|
118613
118609
|
resolution.refCount--;
|
|
118614
118610
|
if (resolution.refCount) {
|
|
118615
118611
|
return;
|
|
@@ -118701,7 +118697,7 @@ var ts;
|
|
|
118701
118697
|
if (resolution.isInvalidated || !canInvalidate(resolution))
|
|
118702
118698
|
continue;
|
|
118703
118699
|
resolution.isInvalidated = invalidated = true;
|
|
118704
|
-
for (var _a = 0, _b = ts.Debug.
|
|
118700
|
+
for (var _a = 0, _b = ts.Debug.checkDefined(resolution.files); _a < _b.length; _a++) {
|
|
118705
118701
|
var containingFilePath = _b[_a];
|
|
118706
118702
|
(filesWithInvalidatedResolutions || (filesWithInvalidatedResolutions = new ts.Set())).add(containingFilePath);
|
|
118707
118703
|
// When its a file with inferred types resolution, invalidate type reference directive resolution
|
|
@@ -135589,14 +135585,17 @@ var ts;
|
|
|
135589
135585
|
if (node === sourceFile) {
|
|
135590
135586
|
return undefined;
|
|
135591
135587
|
}
|
|
135592
|
-
var symbol =
|
|
135588
|
+
var symbol = getSymbol(node, typeChecker);
|
|
135593
135589
|
if (!symbol)
|
|
135594
135590
|
return undefined;
|
|
135595
135591
|
var typeAtLocation = typeChecker.getTypeOfSymbolAtLocation(symbol, node);
|
|
135596
135592
|
var returnType = tryGetReturnTypeOfFunction(symbol, typeAtLocation, typeChecker);
|
|
135597
135593
|
var fromReturnType = returnType && definitionFromType(returnType, typeChecker, node);
|
|
135598
135594
|
// If a function returns 'void' or some other type with no definition, just return the function definition.
|
|
135599
|
-
|
|
135595
|
+
var typeDefinitions = fromReturnType && fromReturnType.length !== 0 ? fromReturnType : definitionFromType(typeAtLocation, typeChecker, node);
|
|
135596
|
+
return typeDefinitions.length ? typeDefinitions
|
|
135597
|
+
: !(symbol.flags & 111551 /* Value */) && symbol.flags & 788968 /* Type */ ? getDefinitionFromSymbol(typeChecker, ts.skipAlias(symbol, typeChecker), node)
|
|
135598
|
+
: undefined;
|
|
135600
135599
|
}
|
|
135601
135600
|
GoToDefinition.getTypeDefinitionAtPosition = getTypeDefinitionAtPosition;
|
|
135602
135601
|
function definitionFromType(type, checker, node) {
|
|
@@ -144584,6 +144583,26 @@ var ts;
|
|
|
144584
144583
|
var indent = sourceFile.text.slice(startPosition, fnStart);
|
|
144585
144584
|
this.insertNodeAt(sourceFile, fnStart, tag, { preserveLeadingWhitespace: false, suffix: this.newLineCharacter + indent });
|
|
144586
144585
|
};
|
|
144586
|
+
ChangeTracker.prototype.addJSDocTags = function (sourceFile, parent, newTags) {
|
|
144587
|
+
var comments = ts.flatMap(parent.jsDoc, function (j) { return typeof j.comment === "string" ? ts.factory.createJSDocText(j.comment) : j.comment; });
|
|
144588
|
+
var oldTags = ts.flatMapToMutable(parent.jsDoc, function (j) { return j.tags; });
|
|
144589
|
+
var unmergedNewTags = newTags.filter(function (newTag) { return !oldTags.some(function (tag, i) {
|
|
144590
|
+
var merged = tryMergeJsdocTags(tag, newTag);
|
|
144591
|
+
if (merged)
|
|
144592
|
+
oldTags[i] = merged;
|
|
144593
|
+
return !!merged;
|
|
144594
|
+
}); });
|
|
144595
|
+
var tag = ts.factory.createJSDocComment(ts.factory.createNodeArray(ts.intersperse(comments, ts.factory.createJSDocText("\n"))), ts.factory.createNodeArray(__spreadArray(__spreadArray([], oldTags, true), unmergedNewTags, true)));
|
|
144596
|
+
var host = updateJSDocHost(parent);
|
|
144597
|
+
this.insertJsdocCommentBefore(sourceFile, host, tag);
|
|
144598
|
+
};
|
|
144599
|
+
ChangeTracker.prototype.filterJSDocTags = function (sourceFile, parent, predicate) {
|
|
144600
|
+
var comments = ts.flatMap(parent.jsDoc, function (j) { return typeof j.comment === "string" ? ts.factory.createJSDocText(j.comment) : j.comment; });
|
|
144601
|
+
var oldTags = ts.flatMapToMutable(parent.jsDoc, function (j) { return j.tags; });
|
|
144602
|
+
var tag = ts.factory.createJSDocComment(ts.factory.createNodeArray(ts.intersperse(comments, ts.factory.createJSDocText("\n"))), ts.factory.createNodeArray(__spreadArray([], (ts.filter(oldTags, predicate) || ts.emptyArray), true)));
|
|
144603
|
+
var host = updateJSDocHost(parent);
|
|
144604
|
+
this.insertJsdocCommentBefore(sourceFile, host, tag);
|
|
144605
|
+
};
|
|
144587
144606
|
ChangeTracker.prototype.replaceRangeWithText = function (sourceFile, range, text) {
|
|
144588
144607
|
this.changes.push({ kind: ChangeKind.Text, sourceFile: sourceFile, range: range, text: text });
|
|
144589
144608
|
};
|
|
@@ -144978,6 +144997,33 @@ var ts;
|
|
|
144978
144997
|
return ChangeTracker;
|
|
144979
144998
|
}());
|
|
144980
144999
|
textChanges_3.ChangeTracker = ChangeTracker;
|
|
145000
|
+
function updateJSDocHost(parent) {
|
|
145001
|
+
if (parent.kind !== 213 /* ArrowFunction */) {
|
|
145002
|
+
return parent;
|
|
145003
|
+
}
|
|
145004
|
+
var jsDocNode = parent.parent.kind === 166 /* PropertyDeclaration */ ?
|
|
145005
|
+
parent.parent :
|
|
145006
|
+
parent.parent.parent;
|
|
145007
|
+
jsDocNode.jsDoc = parent.jsDoc;
|
|
145008
|
+
jsDocNode.jsDocCache = parent.jsDocCache;
|
|
145009
|
+
return jsDocNode;
|
|
145010
|
+
}
|
|
145011
|
+
function tryMergeJsdocTags(oldTag, newTag) {
|
|
145012
|
+
if (oldTag.kind !== newTag.kind) {
|
|
145013
|
+
return undefined;
|
|
145014
|
+
}
|
|
145015
|
+
switch (oldTag.kind) {
|
|
145016
|
+
case 338 /* JSDocParameterTag */: {
|
|
145017
|
+
var oldParam = oldTag;
|
|
145018
|
+
var newParam = newTag;
|
|
145019
|
+
return ts.isIdentifier(oldParam.name) && ts.isIdentifier(newParam.name) && oldParam.name.escapedText === newParam.name.escapedText
|
|
145020
|
+
? ts.factory.createJSDocParameterTag(/*tagName*/ undefined, newParam.name, /*isBracketed*/ false, newParam.typeExpression, newParam.isNameFirst, oldParam.comment)
|
|
145021
|
+
: undefined;
|
|
145022
|
+
}
|
|
145023
|
+
case 339 /* JSDocReturnTag */:
|
|
145024
|
+
return ts.factory.createJSDocReturnTag(/*tagName*/ undefined, newTag.typeExpression, oldTag.comment);
|
|
145025
|
+
}
|
|
145026
|
+
}
|
|
144981
145027
|
// find first non-whitespace position in the leading trivia of the node
|
|
144982
145028
|
function startPositionToDeleteNodeInList(sourceFile, node) {
|
|
144983
145029
|
return ts.skipTrivia(sourceFile.text, getAdjustedStartPosition(sourceFile, node, { leadingTriviaOption: LeadingTriviaOption.IncludeAll }), /*stopAfterLineBreak*/ false, /*stopAtComments*/ true);
|
|
@@ -149226,35 +149272,72 @@ var ts;
|
|
|
149226
149272
|
ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class.code,
|
|
149227
149273
|
ts.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0.code,
|
|
149228
149274
|
ts.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0.code,
|
|
149229
|
-
ts.Diagnostics.This_parameter_property_must_have_an_override_modifier_because_it_overrides_a_member_in_base_class_0.code
|
|
149275
|
+
ts.Diagnostics.This_parameter_property_must_have_an_override_modifier_because_it_overrides_a_member_in_base_class_0.code,
|
|
149276
|
+
ts.Diagnostics.This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0.code,
|
|
149277
|
+
ts.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class.code,
|
|
149278
|
+
ts.Diagnostics.This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0.code,
|
|
149279
|
+
ts.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0.code,
|
|
149230
149280
|
];
|
|
149231
149281
|
var errorCodeFixIdMap = (_a = {},
|
|
149232
|
-
|
|
149233
|
-
|
|
149234
|
-
|
|
149235
|
-
|
|
149236
|
-
ts.Diagnostics.
|
|
149237
|
-
|
|
149238
|
-
_a[ts.Diagnostics.
|
|
149239
|
-
ts.Diagnostics.Add_override_modifier,
|
|
149240
|
-
|
|
149241
|
-
|
|
149242
|
-
|
|
149243
|
-
|
|
149244
|
-
_a[ts.Diagnostics.
|
|
149245
|
-
ts.Diagnostics.Remove_override_modifier,
|
|
149246
|
-
|
|
149282
|
+
// case #1:
|
|
149283
|
+
_a[ts.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0.code] = {
|
|
149284
|
+
descriptions: ts.Diagnostics.Add_override_modifier,
|
|
149285
|
+
fixId: fixAddOverrideId,
|
|
149286
|
+
fixAllDescriptions: ts.Diagnostics.Add_all_missing_override_modifiers,
|
|
149287
|
+
},
|
|
149288
|
+
_a[ts.Diagnostics.This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0.code] = {
|
|
149289
|
+
descriptions: ts.Diagnostics.Add_override_modifier,
|
|
149290
|
+
fixId: fixAddOverrideId,
|
|
149291
|
+
fixAllDescriptions: ts.Diagnostics.Add_all_missing_override_modifiers
|
|
149292
|
+
},
|
|
149293
|
+
// case #2:
|
|
149294
|
+
_a[ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class.code] = {
|
|
149295
|
+
descriptions: ts.Diagnostics.Remove_override_modifier,
|
|
149296
|
+
fixId: fixRemoveOverrideId,
|
|
149297
|
+
fixAllDescriptions: ts.Diagnostics.Remove_all_unnecessary_override_modifiers,
|
|
149298
|
+
},
|
|
149299
|
+
_a[ts.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class.code] = {
|
|
149300
|
+
descriptions: ts.Diagnostics.Remove_override_modifier,
|
|
149301
|
+
fixId: fixRemoveOverrideId,
|
|
149302
|
+
fixAllDescriptions: ts.Diagnostics.Remove_override_modifier
|
|
149303
|
+
},
|
|
149304
|
+
// case #3:
|
|
149305
|
+
_a[ts.Diagnostics.This_parameter_property_must_have_an_override_modifier_because_it_overrides_a_member_in_base_class_0.code] = {
|
|
149306
|
+
descriptions: ts.Diagnostics.Add_override_modifier,
|
|
149307
|
+
fixId: fixAddOverrideId,
|
|
149308
|
+
fixAllDescriptions: ts.Diagnostics.Add_all_missing_override_modifiers,
|
|
149309
|
+
},
|
|
149310
|
+
_a[ts.Diagnostics.This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0.code] = {
|
|
149311
|
+
descriptions: ts.Diagnostics.Add_override_modifier,
|
|
149312
|
+
fixId: fixAddOverrideId,
|
|
149313
|
+
fixAllDescriptions: ts.Diagnostics.Add_all_missing_override_modifiers,
|
|
149314
|
+
},
|
|
149315
|
+
// case #4:
|
|
149316
|
+
_a[ts.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0.code] = {
|
|
149317
|
+
descriptions: ts.Diagnostics.Add_override_modifier,
|
|
149318
|
+
fixId: fixAddOverrideId,
|
|
149319
|
+
fixAllDescriptions: ts.Diagnostics.Remove_all_unnecessary_override_modifiers,
|
|
149320
|
+
},
|
|
149321
|
+
// case #5:
|
|
149322
|
+
_a[ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0.code] = {
|
|
149323
|
+
descriptions: ts.Diagnostics.Remove_override_modifier,
|
|
149324
|
+
fixId: fixRemoveOverrideId,
|
|
149325
|
+
fixAllDescriptions: ts.Diagnostics.Remove_all_unnecessary_override_modifiers,
|
|
149326
|
+
},
|
|
149327
|
+
_a[ts.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0.code] = {
|
|
149328
|
+
descriptions: ts.Diagnostics.Remove_override_modifier,
|
|
149329
|
+
fixId: fixRemoveOverrideId,
|
|
149330
|
+
fixAllDescriptions: ts.Diagnostics.Remove_all_unnecessary_override_modifiers,
|
|
149331
|
+
},
|
|
149247
149332
|
_a);
|
|
149248
149333
|
codefix.registerCodeFix({
|
|
149249
149334
|
errorCodes: errorCodes,
|
|
149250
149335
|
getCodeActions: function (context) {
|
|
149251
|
-
var errorCode = context.errorCode, span = context.span
|
|
149336
|
+
var errorCode = context.errorCode, span = context.span;
|
|
149252
149337
|
var info = errorCodeFixIdMap[errorCode];
|
|
149253
149338
|
if (!info)
|
|
149254
149339
|
return ts.emptyArray;
|
|
149255
|
-
var descriptions = info
|
|
149256
|
-
if (ts.isSourceFileJS(sourceFile))
|
|
149257
|
-
return ts.emptyArray;
|
|
149340
|
+
var descriptions = info.descriptions, fixId = info.fixId, fixAllDescriptions = info.fixAllDescriptions;
|
|
149258
149341
|
var changes = ts.textChanges.ChangeTracker.with(context, function (changes) { return dispatchChanges(changes, context, errorCode, span.start); });
|
|
149259
149342
|
return [
|
|
149260
149343
|
codefix.createCodeFixActionMaybeFixAll(fixName, changes, descriptions, fixId, fixAllDescriptions)
|
|
@@ -149263,9 +149346,9 @@ var ts;
|
|
|
149263
149346
|
fixIds: [fixName, fixAddOverrideId, fixRemoveOverrideId],
|
|
149264
149347
|
getAllCodeActions: function (context) {
|
|
149265
149348
|
return codefix.codeFixAll(context, errorCodes, function (changes, diag) {
|
|
149266
|
-
var code = diag.code, start = diag.start
|
|
149349
|
+
var code = diag.code, start = diag.start;
|
|
149267
149350
|
var info = errorCodeFixIdMap[code];
|
|
149268
|
-
if (!info || info
|
|
149351
|
+
if (!info || info.fixId !== context.fixId) {
|
|
149269
149352
|
return;
|
|
149270
149353
|
}
|
|
149271
149354
|
dispatchChanges(changes, context, code, start);
|
|
@@ -149275,11 +149358,15 @@ var ts;
|
|
|
149275
149358
|
function dispatchChanges(changeTracker, context, errorCode, pos) {
|
|
149276
149359
|
switch (errorCode) {
|
|
149277
149360
|
case ts.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0.code:
|
|
149361
|
+
case ts.Diagnostics.This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0.code:
|
|
149278
149362
|
case ts.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0.code:
|
|
149279
149363
|
case ts.Diagnostics.This_parameter_property_must_have_an_override_modifier_because_it_overrides_a_member_in_base_class_0.code:
|
|
149364
|
+
case ts.Diagnostics.This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0.code:
|
|
149280
149365
|
return doAddOverrideModifierChange(changeTracker, context.sourceFile, pos);
|
|
149281
149366
|
case ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0.code:
|
|
149367
|
+
case ts.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0.code:
|
|
149282
149368
|
case ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class.code:
|
|
149369
|
+
case ts.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class.code:
|
|
149283
149370
|
return doRemoveOverrideModifierChange(changeTracker, context.sourceFile, pos);
|
|
149284
149371
|
default:
|
|
149285
149372
|
ts.Debug.fail("Unexpected error code: " + errorCode);
|
|
@@ -149287,6 +149374,10 @@ var ts;
|
|
|
149287
149374
|
}
|
|
149288
149375
|
function doAddOverrideModifierChange(changeTracker, sourceFile, pos) {
|
|
149289
149376
|
var classElement = findContainerClassElementLike(sourceFile, pos);
|
|
149377
|
+
if (ts.isSourceFileJS(sourceFile)) {
|
|
149378
|
+
changeTracker.addJSDocTags(sourceFile, classElement, [ts.factory.createJSDocOverrideTag(ts.factory.createIdentifier("override"))]);
|
|
149379
|
+
return;
|
|
149380
|
+
}
|
|
149290
149381
|
var modifiers = classElement.modifiers || ts.emptyArray;
|
|
149291
149382
|
var staticModifier = ts.find(modifiers, ts.isStaticModifier);
|
|
149292
149383
|
var abstractModifier = ts.find(modifiers, ts.isAbstractModifier);
|
|
@@ -149300,6 +149391,10 @@ var ts;
|
|
|
149300
149391
|
}
|
|
149301
149392
|
function doRemoveOverrideModifierChange(changeTracker, sourceFile, pos) {
|
|
149302
149393
|
var classElement = findContainerClassElementLike(sourceFile, pos);
|
|
149394
|
+
if (ts.isSourceFileJS(sourceFile)) {
|
|
149395
|
+
changeTracker.filterJSDocTags(sourceFile, classElement, ts.not(ts.isJSDocOverrideTag));
|
|
149396
|
+
return;
|
|
149397
|
+
}
|
|
149303
149398
|
var overrideModifier = classElement.modifiers && ts.find(classElement.modifiers, function (modifier) { return modifier.kind === 158 /* OverrideKeyword */; });
|
|
149304
149399
|
ts.Debug.assertIsDefined(overrideModifier);
|
|
149305
149400
|
changeTracker.deleteModifier(sourceFile, overrideModifier);
|
|
@@ -149393,9 +149488,9 @@ var ts;
|
|
|
149393
149488
|
if (!ts.isFunctionDeclaration(fn) && !ts.isFunctionExpression(fn))
|
|
149394
149489
|
return undefined;
|
|
149395
149490
|
if (!ts.isSourceFile(ts.getThisContainer(fn, /*includeArrowFunctions*/ false))) { // 'this' is defined outside, convert to arrow function
|
|
149396
|
-
var fnKeyword = ts.Debug.
|
|
149491
|
+
var fnKeyword = ts.Debug.checkDefined(ts.findChildOfKind(fn, 98 /* FunctionKeyword */, sourceFile));
|
|
149397
149492
|
var name = fn.name;
|
|
149398
|
-
var body = ts.Debug.
|
|
149493
|
+
var body = ts.Debug.checkDefined(fn.body); // Should be defined because the function contained a 'this' expression
|
|
149399
149494
|
if (ts.isFunctionExpression(fn)) {
|
|
149400
149495
|
if (name && ts.FindAllReferences.Core.isSymbolReferencedInFile(name, checker, sourceFile, body)) {
|
|
149401
149496
|
// Function expression references itself. To fix we would have to extract it to a const.
|
|
@@ -151663,7 +151758,7 @@ var ts;
|
|
|
151663
151758
|
if (typeNode) {
|
|
151664
151759
|
// Note that the codefix will never fire with an existing `@type` tag, so there is no need to merge tags
|
|
151665
151760
|
var typeTag = ts.factory.createJSDocTypeTag(/*tagName*/ undefined, ts.factory.createJSDocTypeExpression(typeNode), /*comment*/ undefined);
|
|
151666
|
-
addJSDocTags(
|
|
151761
|
+
changes.addJSDocTags(sourceFile, ts.cast(parent.parent.parent, ts.isExpressionStatement), [typeTag]);
|
|
151667
151762
|
}
|
|
151668
151763
|
importAdder.writeFixes(changes);
|
|
151669
151764
|
return parent;
|
|
@@ -151774,7 +151869,7 @@ var ts;
|
|
|
151774
151869
|
}
|
|
151775
151870
|
}
|
|
151776
151871
|
function annotateJSDocThis(changes, sourceFile, containingFunction, typeNode) {
|
|
151777
|
-
addJSDocTags(
|
|
151872
|
+
changes.addJSDocTags(sourceFile, containingFunction, [
|
|
151778
151873
|
ts.factory.createJSDocThisTag(/*tagName*/ undefined, ts.factory.createJSDocTypeExpression(typeNode)),
|
|
151779
151874
|
]);
|
|
151780
151875
|
}
|
|
@@ -151803,7 +151898,7 @@ var ts;
|
|
|
151803
151898
|
}
|
|
151804
151899
|
var typeExpression = ts.factory.createJSDocTypeExpression(typeNode);
|
|
151805
151900
|
var typeTag = ts.isGetAccessorDeclaration(declaration) ? ts.factory.createJSDocReturnTag(/*tagName*/ undefined, typeExpression, /*comment*/ undefined) : ts.factory.createJSDocTypeTag(/*tagName*/ undefined, typeExpression, /*comment*/ undefined);
|
|
151806
|
-
addJSDocTags(
|
|
151901
|
+
changes.addJSDocTags(sourceFile, parent, [typeTag]);
|
|
151807
151902
|
}
|
|
151808
151903
|
else if (!tryReplaceImportTypeNodeWithAutoImport(typeNode, declaration, sourceFile, changes, importAdder, ts.getEmitScriptTarget(program.getCompilerOptions()))) {
|
|
151809
151904
|
changes.tryInsertTypeAnnotation(sourceFile, declaration, typeNode);
|
|
@@ -151859,45 +151954,7 @@ var ts;
|
|
|
151859
151954
|
var name = _a.name, typeNode = _a.typeNode, isOptional = _a.isOptional;
|
|
151860
151955
|
return ts.factory.createJSDocParameterTag(/*tagName*/ undefined, name, /*isBracketed*/ !!isOptional, ts.factory.createJSDocTypeExpression(typeNode), /* isNameFirst */ false, /*comment*/ undefined);
|
|
151861
151956
|
});
|
|
151862
|
-
addJSDocTags(
|
|
151863
|
-
}
|
|
151864
|
-
}
|
|
151865
|
-
function addJSDocTags(changes, sourceFile, parent, newTags) {
|
|
151866
|
-
var comments = ts.flatMap(parent.jsDoc, function (j) { return typeof j.comment === "string" ? ts.factory.createJSDocText(j.comment) : j.comment; });
|
|
151867
|
-
var oldTags = ts.flatMapToMutable(parent.jsDoc, function (j) { return j.tags; });
|
|
151868
|
-
var unmergedNewTags = newTags.filter(function (newTag) { return !oldTags || !oldTags.some(function (tag, i) {
|
|
151869
|
-
var merged = tryMergeJsdocTags(tag, newTag);
|
|
151870
|
-
if (merged)
|
|
151871
|
-
oldTags[i] = merged;
|
|
151872
|
-
return !!merged;
|
|
151873
|
-
}); });
|
|
151874
|
-
var tag = ts.factory.createJSDocComment(ts.factory.createNodeArray(ts.intersperse(comments, ts.factory.createJSDocText("\n"))), ts.factory.createNodeArray(__spreadArray(__spreadArray([], (oldTags || ts.emptyArray), true), unmergedNewTags, true)));
|
|
151875
|
-
var jsDocNode = parent.kind === 213 /* ArrowFunction */ ? getJsDocNodeForArrowFunction(parent) : parent;
|
|
151876
|
-
jsDocNode.jsDoc = parent.jsDoc;
|
|
151877
|
-
jsDocNode.jsDocCache = parent.jsDocCache;
|
|
151878
|
-
changes.insertJsdocCommentBefore(sourceFile, jsDocNode, tag);
|
|
151879
|
-
}
|
|
151880
|
-
codefix.addJSDocTags = addJSDocTags;
|
|
151881
|
-
function getJsDocNodeForArrowFunction(signature) {
|
|
151882
|
-
if (signature.parent.kind === 166 /* PropertyDeclaration */) {
|
|
151883
|
-
return signature.parent;
|
|
151884
|
-
}
|
|
151885
|
-
return signature.parent.parent;
|
|
151886
|
-
}
|
|
151887
|
-
function tryMergeJsdocTags(oldTag, newTag) {
|
|
151888
|
-
if (oldTag.kind !== newTag.kind) {
|
|
151889
|
-
return undefined;
|
|
151890
|
-
}
|
|
151891
|
-
switch (oldTag.kind) {
|
|
151892
|
-
case 338 /* JSDocParameterTag */: {
|
|
151893
|
-
var oldParam = oldTag;
|
|
151894
|
-
var newParam = newTag;
|
|
151895
|
-
return ts.isIdentifier(oldParam.name) && ts.isIdentifier(newParam.name) && oldParam.name.escapedText === newParam.name.escapedText
|
|
151896
|
-
? ts.factory.createJSDocParameterTag(/*tagName*/ undefined, newParam.name, /*isBracketed*/ false, newParam.typeExpression, newParam.isNameFirst, oldParam.comment)
|
|
151897
|
-
: undefined;
|
|
151898
|
-
}
|
|
151899
|
-
case 339 /* JSDocReturnTag */:
|
|
151900
|
-
return ts.factory.createJSDocReturnTag(/*tagName*/ undefined, newTag.typeExpression, oldTag.comment);
|
|
151957
|
+
changes.addJSDocTags(sourceFile, signature, paramTags);
|
|
151901
151958
|
}
|
|
151902
151959
|
}
|
|
151903
151960
|
function getReferences(token, program, cancellationToken) {
|
|
@@ -165850,15 +165907,15 @@ var ts;
|
|
|
165850
165907
|
if (!resolution.resolvedFileName)
|
|
165851
165908
|
continue;
|
|
165852
165909
|
var resolvedFileName = resolution.resolvedFileName, originalPath = resolution.originalPath;
|
|
165910
|
+
if (originalPath) {
|
|
165911
|
+
symlinkCache.setSymlinkedDirectoryFromSymlinkedFile(originalPath, resolvedFileName);
|
|
165912
|
+
}
|
|
165853
165913
|
if (!program.getSourceFile(resolvedFileName) && (!originalPath || !program.getSourceFile(originalPath))) {
|
|
165854
165914
|
rootNames = ts.append(rootNames, resolvedFileName);
|
|
165855
165915
|
// Avoid creating a large project that would significantly slow down time to editor interactivity
|
|
165856
165916
|
if (dependencySelection === 2 /* Auto */ && rootNames.length > this.maxDependencies) {
|
|
165857
165917
|
return ts.emptyArray;
|
|
165858
165918
|
}
|
|
165859
|
-
if (originalPath) {
|
|
165860
|
-
symlinkCache.setSymlinkedDirectoryFromSymlinkedFile(originalPath, resolvedFileName);
|
|
165861
|
-
}
|
|
165862
165919
|
}
|
|
165863
165920
|
}
|
|
165864
165921
|
}
|
|
@@ -171859,7 +171916,7 @@ var ts;
|
|
|
171859
171916
|
Session.prototype.getFullNavigateToItems = function (args) {
|
|
171860
171917
|
var currentFileOnly = args.currentFileOnly, searchValue = args.searchValue, maxResultCount = args.maxResultCount, projectFileName = args.projectFileName;
|
|
171861
171918
|
if (currentFileOnly) {
|
|
171862
|
-
ts.Debug.
|
|
171919
|
+
ts.Debug.assertIsDefined(args.file);
|
|
171863
171920
|
var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;
|
|
171864
171921
|
return [{ project: project, result: project.getLanguageService().getNavigateToItems(searchValue, maxResultCount, file) }];
|
|
171865
171922
|
}
|