typescript 4.5.0-dev.20211029 → 4.6.0-dev.20211102
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/cs/diagnosticMessages.generated.json +1 -0
- package/lib/de/diagnosticMessages.generated.json +1 -0
- package/lib/fr/diagnosticMessages.generated.json +1 -0
- package/lib/it/diagnosticMessages.generated.json +1 -0
- package/lib/tsc.js +79 -18
- package/lib/tsserver.js +150 -84
- package/lib/tsserverlibrary.d.ts +1 -1
- package/lib/tsserverlibrary.js +150 -84
- package/lib/typescript.d.ts +1 -1
- package/lib/typescript.js +146 -84
- package/lib/typescriptServices.d.ts +1 -1
- package/lib/typescriptServices.js +146 -84
- package/lib/typingsInstaller.js +86 -21
- package/lib/zh-cn/diagnosticMessages.generated.json +1 -0
- package/package.json +1 -1
package/lib/tsserver.js
CHANGED
|
@@ -96,11 +96,11 @@ var ts;
|
|
|
96
96
|
(function (ts) {
|
|
97
97
|
// WARNING: The script `configurePrerelease.ts` uses a regexp to parse out these values.
|
|
98
98
|
// If changing the text in this section, be sure to test `configurePrerelease` too.
|
|
99
|
-
ts.versionMajorMinor = "4.
|
|
99
|
+
ts.versionMajorMinor = "4.6";
|
|
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.20211102";
|
|
104
104
|
/* @internal */
|
|
105
105
|
var Comparison;
|
|
106
106
|
(function (Comparison) {
|
|
@@ -5126,7 +5126,7 @@ var ts;
|
|
|
5126
5126
|
(function (ModuleResolutionKind) {
|
|
5127
5127
|
ModuleResolutionKind[ModuleResolutionKind["Classic"] = 1] = "Classic";
|
|
5128
5128
|
ModuleResolutionKind[ModuleResolutionKind["NodeJs"] = 2] = "NodeJs";
|
|
5129
|
-
// Starting with node12, node's module resolver has significant departures from
|
|
5129
|
+
// Starting with node12, node's module resolver has significant departures from traditional cjs resolution
|
|
5130
5130
|
// to better support ecmascript modules and their use within node - more features are still being added, so
|
|
5131
5131
|
// we can expect it to change over time, and as such, offer both a `NodeNext` moving resolution target, and a `Node12`
|
|
5132
5132
|
// version-anchored resolution target
|
|
@@ -8704,6 +8704,8 @@ var ts;
|
|
|
8704
8704
|
Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext: diag(2821, ts.DiagnosticCategory.Error, "Import_assertions_are_only_supported_when_the_module_option_is_set_to_esnext_2821", "Import assertions are only supported when the '--module' option is set to 'esnext'."),
|
|
8705
8705
|
Import_assertions_cannot_be_used_with_type_only_imports_or_exports: diag(2822, ts.DiagnosticCategory.Error, "Import_assertions_cannot_be_used_with_type_only_imports_or_exports_2822", "Import assertions cannot be used with type-only imports or exports."),
|
|
8706
8706
|
Cannot_find_namespace_0_Did_you_mean_1: diag(2833, ts.DiagnosticCategory.Error, "Cannot_find_namespace_0_Did_you_mean_1_2833", "Cannot find namespace '{0}'. Did you mean '{1}'?"),
|
|
8707
|
+
Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Consider_adding_an_extension_to_the_import_path: diag(2834, ts.DiagnosticCategory.Error, "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2834", "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Consider adding an extension to the import path."),
|
|
8708
|
+
Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Did_you_mean_0: diag(2835, ts.DiagnosticCategory.Error, "Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_n_2835", "Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node12' or 'nodenext'. Did you mean '{0}'?"),
|
|
8707
8709
|
Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
|
|
8708
8710
|
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
|
|
8709
8711
|
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
|
|
@@ -8810,6 +8812,7 @@ var ts;
|
|
|
8810
8812
|
This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class: diag(4121, ts.DiagnosticCategory.Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_4121", "This member cannot have a JSDoc comment with an '@override' tag because its containing class '{0}' does not extend another class."),
|
|
8811
8813
|
This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0: diag(4122, ts.DiagnosticCategory.Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4122", "This member cannot have a JSDoc comment with an '@override' tag because it is not declared in the base class '{0}'."),
|
|
8812
8814
|
This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1: diag(4123, ts.DiagnosticCategory.Error, "This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base__4123", "This member cannot have a JSDoc comment with an 'override' tag because it is not declared in the base class '{0}'. Did you mean '{1}'?"),
|
|
8815
|
+
Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_with_npm_install_D_typescript_next: diag(4124, ts.DiagnosticCategory.Error, "Compiler_option_0_of_value_1_is_unstable_Use_nightly_TypeScript_to_silence_this_error_Try_updating_w_4124", "Compiler option '{0}' of value '{1}' is unstable. Use nightly TypeScript to silence this error. Try updating with 'npm install -D typescript@next'."),
|
|
8813
8816
|
The_current_host_does_not_support_the_0_option: diag(5001, ts.DiagnosticCategory.Error, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."),
|
|
8814
8817
|
Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, ts.DiagnosticCategory.Error, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
|
|
8815
8818
|
File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, ts.DiagnosticCategory.Error, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
|
|
@@ -9467,6 +9470,7 @@ var ts;
|
|
|
9467
9470
|
Remove_unused_destructuring_declaration: diag(90039, ts.DiagnosticCategory.Message, "Remove_unused_destructuring_declaration_90039", "Remove unused destructuring declaration"),
|
|
9468
9471
|
Remove_unused_declarations_for_Colon_0: diag(90041, ts.DiagnosticCategory.Message, "Remove_unused_declarations_for_Colon_0_90041", "Remove unused declarations for: '{0}'"),
|
|
9469
9472
|
Declare_a_private_field_named_0: diag(90053, ts.DiagnosticCategory.Message, "Declare_a_private_field_named_0_90053", "Declare a private field named '{0}'."),
|
|
9473
|
+
Includes_imports_of_types_referenced_by_0: diag(90054, ts.DiagnosticCategory.Message, "Includes_imports_of_types_referenced_by_0_90054", "Includes imports of types referenced by '{0}'"),
|
|
9470
9474
|
Convert_function_to_an_ES2015_class: diag(95001, ts.DiagnosticCategory.Message, "Convert_function_to_an_ES2015_class_95001", "Convert function to an ES2015 class"),
|
|
9471
9475
|
Convert_0_to_1_in_0: diag(95003, ts.DiagnosticCategory.Message, "Convert_0_to_1_in_0_95003", "Convert '{0}' to '{1} in {0}'"),
|
|
9472
9476
|
Extract_to_0_in_1: diag(95004, ts.DiagnosticCategory.Message, "Extract_to_0_in_1_95004", "Extract to {0} in {1}"),
|
|
@@ -47368,6 +47372,21 @@ var ts;
|
|
|
47368
47372
|
var enumRelation = new ts.Map();
|
|
47369
47373
|
var builtinGlobals = ts.createSymbolTable();
|
|
47370
47374
|
builtinGlobals.set(undefinedSymbol.escapedName, undefinedSymbol);
|
|
47375
|
+
// Extensions suggested for path imports when module resolution is node12 or higher.
|
|
47376
|
+
// The first element of each tuple is the extension a file has.
|
|
47377
|
+
// The second element of each tuple is the extension that should be used in a path import.
|
|
47378
|
+
// e.g. if we want to import file `foo.mts`, we should write `import {} from "./foo.mjs".
|
|
47379
|
+
var suggestedExtensions = [
|
|
47380
|
+
[".mts", ".mjs"],
|
|
47381
|
+
[".ts", ".js"],
|
|
47382
|
+
[".cts", ".cjs"],
|
|
47383
|
+
[".mjs", ".mjs"],
|
|
47384
|
+
[".js", ".js"],
|
|
47385
|
+
[".cjs", ".cjs"],
|
|
47386
|
+
[".tsx", compilerOptions.jsx === 1 /* Preserve */ ? ".jsx" : ".js"],
|
|
47387
|
+
[".jsx", ".jsx"],
|
|
47388
|
+
[".json", ".json"],
|
|
47389
|
+
];
|
|
47371
47390
|
initializeTypeChecker();
|
|
47372
47391
|
return checker;
|
|
47373
47392
|
function getJsxNamespace(location) {
|
|
@@ -49583,7 +49602,7 @@ var ts;
|
|
|
49583
49602
|
: undefined;
|
|
49584
49603
|
}
|
|
49585
49604
|
function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation) {
|
|
49586
|
-
var _a, _b, _c, _d, _e, _f;
|
|
49605
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
49587
49606
|
if (isForAugmentation === void 0) { isForAugmentation = false; }
|
|
49588
49607
|
if (ts.startsWith(moduleReference, "@types/")) {
|
|
49589
49608
|
var diag = ts.Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
@@ -49604,7 +49623,7 @@ var ts;
|
|
|
49604
49623
|
((_e = (ts.isModuleDeclaration(location) ? location : location.parent && ts.isModuleDeclaration(location.parent) && location.parent.name === location ? location.parent : undefined)) === null || _e === void 0 ? void 0 : _e.name) ||
|
|
49605
49624
|
((_f = (ts.isLiteralImportTypeNode(location) ? location : undefined)) === null || _f === void 0 ? void 0 : _f.argument.literal);
|
|
49606
49625
|
var mode = contextSpecifier && ts.isStringLiteralLike(contextSpecifier) ? ts.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
49607
|
-
var resolvedModule = ts.getResolvedModule(currentSourceFile, moduleReference, mode);
|
|
49626
|
+
var resolvedModule = ts.getResolvedModule(currentSourceFile, moduleReference, mode);
|
|
49608
49627
|
var resolutionDiagnostic = resolvedModule && ts.getResolutionDiagnostic(compilerOptions, resolvedModule);
|
|
49609
49628
|
var sourceFile = resolvedModule && !resolutionDiagnostic && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
49610
49629
|
if (sourceFile) {
|
|
@@ -49670,6 +49689,10 @@ var ts;
|
|
|
49670
49689
|
}
|
|
49671
49690
|
else {
|
|
49672
49691
|
var tsExtension = ts.tryExtractTSExtension(moduleReference);
|
|
49692
|
+
var isExtensionlessRelativePathImport = ts.pathIsRelative(moduleReference) && !ts.hasExtension(moduleReference);
|
|
49693
|
+
var moduleResolutionKind = ts.getEmitModuleResolutionKind(compilerOptions);
|
|
49694
|
+
var resolutionIsNode12OrNext = moduleResolutionKind === ts.ModuleResolutionKind.Node12 ||
|
|
49695
|
+
moduleResolutionKind === ts.ModuleResolutionKind.NodeNext;
|
|
49673
49696
|
if (tsExtension) {
|
|
49674
49697
|
var diag = ts.Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead;
|
|
49675
49698
|
var importSourceWithoutExtension = ts.removeExtension(moduleReference, tsExtension);
|
|
@@ -49689,6 +49712,19 @@ var ts;
|
|
|
49689
49712
|
ts.hasJsonModuleEmitEnabled(compilerOptions)) {
|
|
49690
49713
|
error(errorNode, ts.Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
49691
49714
|
}
|
|
49715
|
+
else if (mode === ts.ModuleKind.ESNext && resolutionIsNode12OrNext && isExtensionlessRelativePathImport) {
|
|
49716
|
+
var absoluteRef_1 = ts.getNormalizedAbsolutePath(moduleReference, ts.getDirectoryPath(currentSourceFile.path));
|
|
49717
|
+
var suggestedExt = (_g = suggestedExtensions.find(function (_a) {
|
|
49718
|
+
var actualExt = _a[0], _importExt = _a[1];
|
|
49719
|
+
return host.fileExists(absoluteRef_1 + actualExt);
|
|
49720
|
+
})) === null || _g === void 0 ? void 0 : _g[1];
|
|
49721
|
+
if (suggestedExt) {
|
|
49722
|
+
error(errorNode, ts.Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Did_you_mean_0, moduleReference + suggestedExt);
|
|
49723
|
+
}
|
|
49724
|
+
else {
|
|
49725
|
+
error(errorNode, ts.Diagnostics.Relative_import_paths_need_explicit_file_extensions_in_EcmaScript_imports_when_moduleResolution_is_node12_or_nodenext_Consider_adding_an_extension_to_the_import_path);
|
|
49726
|
+
}
|
|
49727
|
+
}
|
|
49692
49728
|
else {
|
|
49693
49729
|
error(errorNode, moduleNotFoundError, moduleReference);
|
|
49694
49730
|
}
|
|
@@ -61601,7 +61637,8 @@ var ts;
|
|
|
61601
61637
|
if (t.flags & (3 /* AnyOrUnknown */ | 58982400 /* InstantiableNonPrimitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && t !== wildcardType && !isErrorType(t)) {
|
|
61602
61638
|
if (!type.declaration.nameType) {
|
|
61603
61639
|
var constraint = void 0;
|
|
61604
|
-
if (isArrayType(t) ||
|
|
61640
|
+
if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 &&
|
|
61641
|
+
(constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, ts.or(isArrayType, isTupleType))) {
|
|
61605
61642
|
return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
|
|
61606
61643
|
}
|
|
61607
61644
|
if (isGenericTupleType(t)) {
|
|
@@ -78320,7 +78357,9 @@ var ts;
|
|
|
78320
78357
|
var typeReferenceNode = ts.tryCast(node.parent, ts.isTypeReferenceType);
|
|
78321
78358
|
if (!typeReferenceNode)
|
|
78322
78359
|
return undefined;
|
|
78323
|
-
var typeParameters = getTypeParametersForTypeReference(typeReferenceNode);
|
|
78360
|
+
var typeParameters = getTypeParametersForTypeReference(typeReferenceNode);
|
|
78361
|
+
if (!typeParameters)
|
|
78362
|
+
return undefined;
|
|
78324
78363
|
var constraint = getConstraintOfTypeParameter(typeParameters[typeReferenceNode.typeArguments.indexOf(node)]);
|
|
78325
78364
|
return constraint && instantiateType(constraint, createTypeMapper(typeParameters, getEffectiveTypeArguments(typeReferenceNode, typeParameters)));
|
|
78326
78365
|
}
|
|
@@ -94904,11 +94943,11 @@ var ts;
|
|
|
94904
94943
|
currentFileState.filenameDeclaration = declaration;
|
|
94905
94944
|
return currentFileState.filenameDeclaration.name;
|
|
94906
94945
|
}
|
|
94907
|
-
function getJsxFactoryCalleePrimitive(
|
|
94908
|
-
return compilerOptions.jsx === 5 /* ReactJSXDev */ ? "jsxDEV" :
|
|
94946
|
+
function getJsxFactoryCalleePrimitive(isStaticChildren) {
|
|
94947
|
+
return compilerOptions.jsx === 5 /* ReactJSXDev */ ? "jsxDEV" : isStaticChildren ? "jsxs" : "jsx";
|
|
94909
94948
|
}
|
|
94910
|
-
function getJsxFactoryCallee(
|
|
94911
|
-
var type = getJsxFactoryCalleePrimitive(
|
|
94949
|
+
function getJsxFactoryCallee(isStaticChildren) {
|
|
94950
|
+
var type = getJsxFactoryCalleePrimitive(isStaticChildren);
|
|
94912
94951
|
return getImplicitImportForName(type);
|
|
94913
94952
|
}
|
|
94914
94953
|
function getImplicitJsxFragmentReference() {
|
|
@@ -95060,7 +95099,7 @@ var ts;
|
|
|
95060
95099
|
}
|
|
95061
95100
|
function convertJsxChildrenToChildrenPropAssignment(children) {
|
|
95062
95101
|
var nonWhitespaceChildren = ts.getSemanticJsxChildren(children);
|
|
95063
|
-
if (ts.length(nonWhitespaceChildren) === 1) {
|
|
95102
|
+
if (ts.length(nonWhitespaceChildren) === 1 && !nonWhitespaceChildren[0].dotDotDotToken) {
|
|
95064
95103
|
var result_12 = transformJsxChildToExpression(nonWhitespaceChildren[0]);
|
|
95065
95104
|
return result_12 && factory.createPropertyAssignment("children", result_12);
|
|
95066
95105
|
}
|
|
@@ -95074,15 +95113,18 @@ var ts;
|
|
|
95074
95113
|
var attrs = keyAttr ? ts.filter(node.attributes.properties, function (p) { return p !== keyAttr; }) : node.attributes.properties;
|
|
95075
95114
|
var objectProperties = ts.length(attrs) ? transformJsxAttributesToObjectProps(attrs, childrenProp) :
|
|
95076
95115
|
factory.createObjectLiteralExpression(childrenProp ? [childrenProp] : ts.emptyArray); // When there are no attributes, React wants {}
|
|
95077
|
-
return visitJsxOpeningLikeElementOrFragmentJSX(tagName, objectProperties, keyAttr,
|
|
95116
|
+
return visitJsxOpeningLikeElementOrFragmentJSX(tagName, objectProperties, keyAttr, children || ts.emptyArray, isChild, location);
|
|
95078
95117
|
}
|
|
95079
|
-
function visitJsxOpeningLikeElementOrFragmentJSX(tagName, objectProperties, keyAttr,
|
|
95118
|
+
function visitJsxOpeningLikeElementOrFragmentJSX(tagName, objectProperties, keyAttr, children, isChild, location) {
|
|
95119
|
+
var _a;
|
|
95120
|
+
var nonWhitespaceChildren = ts.getSemanticJsxChildren(children);
|
|
95121
|
+
var isStaticChildren = ts.length(nonWhitespaceChildren) > 1 || !!((_a = nonWhitespaceChildren[0]) === null || _a === void 0 ? void 0 : _a.dotDotDotToken);
|
|
95080
95122
|
var args = [tagName, objectProperties, !keyAttr ? factory.createVoidZero() : transformJsxAttributeInitializer(keyAttr.initializer)];
|
|
95081
95123
|
if (compilerOptions.jsx === 5 /* ReactJSXDev */) {
|
|
95082
95124
|
var originalFile = ts.getOriginalNode(currentSourceFile);
|
|
95083
95125
|
if (originalFile && ts.isSourceFile(originalFile)) {
|
|
95084
95126
|
// isStaticChildren development flag
|
|
95085
|
-
args.push(
|
|
95127
|
+
args.push(isStaticChildren ? factory.createTrue() : factory.createFalse());
|
|
95086
95128
|
// __source development flag
|
|
95087
95129
|
var lineCol = ts.getLineAndCharacterOfPosition(originalFile, location.pos);
|
|
95088
95130
|
args.push(factory.createObjectLiteralExpression([
|
|
@@ -95094,7 +95136,7 @@ var ts;
|
|
|
95094
95136
|
args.push(factory.createThis());
|
|
95095
95137
|
}
|
|
95096
95138
|
}
|
|
95097
|
-
var element = ts.setTextRange(factory.createCallExpression(getJsxFactoryCallee(
|
|
95139
|
+
var element = ts.setTextRange(factory.createCallExpression(getJsxFactoryCallee(isStaticChildren), /*typeArguments*/ undefined, args), location);
|
|
95098
95140
|
if (isChild) {
|
|
95099
95141
|
ts.startOnNewLine(element);
|
|
95100
95142
|
}
|
|
@@ -95124,7 +95166,7 @@ var ts;
|
|
|
95124
95166
|
}
|
|
95125
95167
|
}
|
|
95126
95168
|
return visitJsxOpeningLikeElementOrFragmentJSX(getImplicitJsxFragmentReference(), childrenProps || factory.createObjectLiteralExpression([]),
|
|
95127
|
-
/*keyAttr*/ undefined,
|
|
95169
|
+
/*keyAttr*/ undefined, children, isChild, location);
|
|
95128
95170
|
}
|
|
95129
95171
|
function visitJsxOpeningFragmentCreateElement(node, children, isChild, location) {
|
|
95130
95172
|
var element = ts.createExpressionForJsxFragment(factory, context.getEmitResolver().getJsxFactoryEntity(currentSourceFile), context.getEmitResolver().getJsxFragmentFactoryEntity(currentSourceFile), compilerOptions.reactNamespace, // TODO: GH#18217
|
|
@@ -114200,8 +114242,8 @@ var ts;
|
|
|
114200
114242
|
var typesReferenceDirectives = ts.map(newSourceFile.typeReferenceDirectives, function (ref) { return ts.toFileNameLowerCase(ref.fileName); });
|
|
114201
114243
|
var typeReferenceResolutions = resolveTypeReferenceDirectiveNamesWorker(typesReferenceDirectives, newSourceFile);
|
|
114202
114244
|
// ensure that types resolutions are still correct
|
|
114203
|
-
var
|
|
114204
|
-
if (
|
|
114245
|
+
var typeReferenceResolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, oldSourceFile, ts.typeDirectiveIsEqualTo);
|
|
114246
|
+
if (typeReferenceResolutionsChanged) {
|
|
114205
114247
|
structureIsReused = 1 /* SafeModules */;
|
|
114206
114248
|
newSourceFile.resolvedTypeReferenceDirectiveNames = ts.zipToModeAwareCache(newSourceFile, typesReferenceDirectives, typeReferenceResolutions);
|
|
114207
114249
|
}
|
|
@@ -115489,6 +115531,21 @@ var ts;
|
|
|
115489
115531
|
return resolvedRef;
|
|
115490
115532
|
}
|
|
115491
115533
|
function verifyCompilerOptions() {
|
|
115534
|
+
var isNightly = ts.stringContains(ts.version, "-dev");
|
|
115535
|
+
if (!isNightly) {
|
|
115536
|
+
if (ts.getEmitModuleKind(options) === ts.ModuleKind.Node12) {
|
|
115537
|
+
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");
|
|
115538
|
+
}
|
|
115539
|
+
else if (ts.getEmitModuleKind(options) === ts.ModuleKind.NodeNext) {
|
|
115540
|
+
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", "nodenext");
|
|
115541
|
+
}
|
|
115542
|
+
else if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node12) {
|
|
115543
|
+
createOptionValueDiagnostic("moduleResolution", 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, "moduleResolution", "node12");
|
|
115544
|
+
}
|
|
115545
|
+
else if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
|
|
115546
|
+
createOptionValueDiagnostic("moduleResolution", 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, "moduleResolution", "nodenext");
|
|
115547
|
+
}
|
|
115548
|
+
}
|
|
115492
115549
|
if (options.strictPropertyInitialization && !ts.getStrictOptionValue(options, "strictNullChecks")) {
|
|
115493
115550
|
createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "strictPropertyInitialization", "strictNullChecks");
|
|
115494
115551
|
}
|
|
@@ -115967,8 +116024,8 @@ var ts;
|
|
|
115967
116024
|
function createDiagnosticForOptionName(message, option1, option2, option3) {
|
|
115968
116025
|
createDiagnosticForOption(/*onKey*/ true, option1, option2, message, option1, option2, option3);
|
|
115969
116026
|
}
|
|
115970
|
-
function createOptionValueDiagnostic(option1, message, arg0) {
|
|
115971
|
-
createDiagnosticForOption(/*onKey*/ false, option1, /*option2*/ undefined, message, arg0);
|
|
116027
|
+
function createOptionValueDiagnostic(option1, message, arg0, arg1) {
|
|
116028
|
+
createDiagnosticForOption(/*onKey*/ false, option1, /*option2*/ undefined, message, arg0, arg1);
|
|
115972
116029
|
}
|
|
115973
116030
|
function createDiagnosticForReference(sourceFile, index, message, arg0, arg1) {
|
|
115974
116031
|
var referencesSyntax = ts.firstDefined(ts.getTsConfigPropArray(sourceFile || options.configFile, "references"), function (property) { return ts.isArrayLiteralExpression(property.initializer) ? property.initializer : undefined; });
|
|
@@ -118212,6 +118269,9 @@ var ts;
|
|
|
118212
118269
|
else {
|
|
118213
118270
|
resolution = loader(name, containingFile, compilerOptions, ((_c = resolutionHost.getCompilerHost) === null || _c === void 0 ? void 0 : _c.call(resolutionHost)) || resolutionHost, redirectedReference, containingSourceFile);
|
|
118214
118271
|
perDirectoryResolution.set(name, mode, resolution);
|
|
118272
|
+
if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
|
|
118273
|
+
resolutionHost.onDiscoveredSymlink();
|
|
118274
|
+
}
|
|
118215
118275
|
}
|
|
118216
118276
|
resolutionsInFile.set(name, mode, resolution);
|
|
118217
118277
|
watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName);
|
|
@@ -118680,6 +118740,11 @@ var ts;
|
|
|
118680
118740
|
}
|
|
118681
118741
|
}
|
|
118682
118742
|
ts.createResolutionCache = createResolutionCache;
|
|
118743
|
+
function resolutionIsSymlink(resolution) {
|
|
118744
|
+
var _a, _b;
|
|
118745
|
+
return !!(((_a = resolution.resolvedModule) === null || _a === void 0 ? void 0 : _a.originalPath) ||
|
|
118746
|
+
((_b = resolution.resolvedTypeReferenceDirective) === null || _b === void 0 ? void 0 : _b.originalPath));
|
|
118747
|
+
}
|
|
118683
118748
|
})(ts || (ts = {}));
|
|
118684
118749
|
// Used by importFixes, getEditsForFileRename, and declaration emit to synthesize import module specifiers.
|
|
118685
118750
|
/* @internal */
|
|
@@ -125738,6 +125803,12 @@ var ts;
|
|
|
125738
125803
|
return newLineCharacter === "\n" ? 1 /* LineFeed */ : 0 /* CarriageReturnLineFeed */;
|
|
125739
125804
|
}
|
|
125740
125805
|
ts.getNewLineKind = getNewLineKind;
|
|
125806
|
+
function diagnosticToString(diag) {
|
|
125807
|
+
return ts.isArray(diag)
|
|
125808
|
+
? ts.formatStringFromArgs(ts.getLocaleSpecificMessage(diag[0]), diag.slice(1))
|
|
125809
|
+
: ts.getLocaleSpecificMessage(diag);
|
|
125810
|
+
}
|
|
125811
|
+
ts.diagnosticToString = diagnosticToString;
|
|
125741
125812
|
// #endregion
|
|
125742
125813
|
})(ts || (ts = {}));
|
|
125743
125814
|
/*@internal*/
|
|
@@ -128084,6 +128155,8 @@ var ts;
|
|
|
128084
128155
|
(function (CompletionSource) {
|
|
128085
128156
|
/** Completions that require `this.` insertion text */
|
|
128086
128157
|
CompletionSource["ThisProperty"] = "ThisProperty/";
|
|
128158
|
+
/** Auto-import that comes attached to a class member snippet */
|
|
128159
|
+
CompletionSource["ClassMemberSnippet"] = "ClassMemberSnippet/";
|
|
128087
128160
|
})(CompletionSource = Completions.CompletionSource || (Completions.CompletionSource = {}));
|
|
128088
128161
|
var SymbolOriginInfoKind;
|
|
128089
128162
|
(function (SymbolOriginInfoKind) {
|
|
@@ -128446,6 +128519,7 @@ var ts;
|
|
|
128446
128519
|
var replacementSpan = ts.getReplacementSpanForContextToken(replacementToken);
|
|
128447
128520
|
var data;
|
|
128448
128521
|
var isSnippet;
|
|
128522
|
+
var source = getSourceFromOrigin(origin);
|
|
128449
128523
|
var sourceDisplay;
|
|
128450
128524
|
var hasAction;
|
|
128451
128525
|
var typeChecker = program.getTypeChecker();
|
|
@@ -128503,7 +128577,12 @@ var ts;
|
|
|
128503
128577
|
preferences.includeCompletionsWithInsertText &&
|
|
128504
128578
|
completionKind === 3 /* MemberLike */ &&
|
|
128505
128579
|
isClassLikeMemberCompletion(symbol, location)) {
|
|
128506
|
-
|
|
128580
|
+
var importAdder = void 0;
|
|
128581
|
+
(_b = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, contextToken), insertText = _b.insertText, isSnippet = _b.isSnippet, importAdder = _b.importAdder);
|
|
128582
|
+
if (importAdder === null || importAdder === void 0 ? void 0 : importAdder.hasFixes()) {
|
|
128583
|
+
hasAction = true;
|
|
128584
|
+
source = CompletionSource.ClassMemberSnippet;
|
|
128585
|
+
}
|
|
128507
128586
|
}
|
|
128508
128587
|
var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, location);
|
|
128509
128588
|
if (kind === "JSX attribute" /* jsxAttribute */ && preferences.includeCompletionsWithSnippetText && preferences.jsxAttributeCompletionStyle && preferences.jsxAttributeCompletionStyle !== "none") {
|
|
@@ -128550,7 +128629,7 @@ var ts;
|
|
|
128550
128629
|
kind: kind,
|
|
128551
128630
|
kindModifiers: ts.SymbolDisplay.getSymbolModifiers(typeChecker, symbol),
|
|
128552
128631
|
sortText: sortText,
|
|
128553
|
-
source:
|
|
128632
|
+
source: source,
|
|
128554
128633
|
hasAction: hasAction ? true : undefined,
|
|
128555
128634
|
isRecommended: isRecommendedCompletionMatch(symbol, recommendedCompletion, typeChecker) || undefined,
|
|
128556
128635
|
insertText: insertText,
|
|
@@ -128619,15 +128698,14 @@ var ts;
|
|
|
128619
128698
|
});
|
|
128620
128699
|
var importAdder = ts.codefix.createImportAdder(sourceFile, program, preferences, host);
|
|
128621
128700
|
var body;
|
|
128622
|
-
var tabstopStart = 1;
|
|
128623
128701
|
if (preferences.includeCompletionsWithSnippetText) {
|
|
128624
128702
|
isSnippet = true;
|
|
128625
|
-
// We are adding a
|
|
128703
|
+
// We are adding a tabstop (i.e. `$0`) in the body of the suggested member,
|
|
128704
|
+
// if it has one, so that the cursor ends up in the body once the completion is inserted.
|
|
128626
128705
|
// Note: this assumes we won't have more than one body in the completion nodes, which should be the case.
|
|
128627
|
-
var
|
|
128628
|
-
ts.setSnippetElement(
|
|
128629
|
-
|
|
128630
|
-
body = ts.factory.createBlock([emptyStatement1], /* multiline */ true);
|
|
128706
|
+
var emptyStatement = ts.factory.createExpressionStatement(ts.factory.createIdentifier(""));
|
|
128707
|
+
ts.setSnippetElement(emptyStatement, { kind: 0 /* TabStop */, order: 0 });
|
|
128708
|
+
body = ts.factory.createBlock([emptyStatement], /* multiline */ true);
|
|
128631
128709
|
}
|
|
128632
128710
|
else {
|
|
128633
128711
|
body = ts.factory.createBlock([], /* multiline */ true);
|
|
@@ -128673,12 +128751,9 @@ var ts;
|
|
|
128673
128751
|
completionNodes.push(node);
|
|
128674
128752
|
}, body, isAbstract);
|
|
128675
128753
|
if (completionNodes.length) {
|
|
128676
|
-
if (preferences.includeCompletionsWithSnippetText) {
|
|
128677
|
-
addSnippets(completionNodes, tabstopStart);
|
|
128678
|
-
}
|
|
128679
128754
|
insertText = printer.printSnippetList(1 /* MultiLine */, ts.factory.createNodeArray(completionNodes), sourceFile);
|
|
128680
128755
|
}
|
|
128681
|
-
return { insertText: insertText, isSnippet: isSnippet };
|
|
128756
|
+
return { insertText: insertText, isSnippet: isSnippet, importAdder: importAdder };
|
|
128682
128757
|
}
|
|
128683
128758
|
function getPresentModifiers(contextToken) {
|
|
128684
128759
|
var modifiers = 0 /* None */;
|
|
@@ -128719,33 +128794,6 @@ var ts;
|
|
|
128719
128794
|
}
|
|
128720
128795
|
return undefined;
|
|
128721
128796
|
}
|
|
128722
|
-
function addSnippets(nodes, orderStart) {
|
|
128723
|
-
var order = orderStart;
|
|
128724
|
-
for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {
|
|
128725
|
-
var node = nodes_1[_i];
|
|
128726
|
-
addSnippetsWorker(node, /*parent*/ undefined);
|
|
128727
|
-
}
|
|
128728
|
-
function addSnippetsWorker(node, parent) {
|
|
128729
|
-
if (ts.isVariableLike(node) && node.kind === 163 /* Parameter */) {
|
|
128730
|
-
// Placeholder
|
|
128731
|
-
ts.setSnippetElement(node.name, { kind: 1 /* Placeholder */, order: order });
|
|
128732
|
-
order += 1;
|
|
128733
|
-
if (node.type) {
|
|
128734
|
-
ts.setSnippetElement(node.type, { kind: 1 /* Placeholder */, order: order });
|
|
128735
|
-
order += 1;
|
|
128736
|
-
}
|
|
128737
|
-
}
|
|
128738
|
-
else if (ts.isTypeNode(node) && parent && ts.isFunctionLikeDeclaration(parent)) {
|
|
128739
|
-
ts.setSnippetElement(node, { kind: 1 /* Placeholder */, order: order });
|
|
128740
|
-
order += 1;
|
|
128741
|
-
}
|
|
128742
|
-
else if (ts.isTypeParameterDeclaration(node) && parent && ts.isFunctionLikeDeclaration(parent)) {
|
|
128743
|
-
ts.setSnippetElement(node, { kind: 1 /* Placeholder */, order: order });
|
|
128744
|
-
order += 1;
|
|
128745
|
-
}
|
|
128746
|
-
ts.forEachChild(node, function (child) { return addSnippetsWorker(child, node); });
|
|
128747
|
-
}
|
|
128748
|
-
}
|
|
128749
128797
|
function createSnippetPrinter(printerOptions) {
|
|
128750
128798
|
var printer = ts.createPrinter(printerOptions);
|
|
128751
128799
|
var baseWriter = ts.createTextWriter(ts.getNewLineCharacter(printerOptions));
|
|
@@ -128967,11 +129015,13 @@ var ts;
|
|
|
128967
129015
|
if (entryId.data) {
|
|
128968
129016
|
var autoImport = getAutoImportSymbolFromCompletionEntryData(entryId.name, entryId.data, program, host);
|
|
128969
129017
|
if (autoImport) {
|
|
129018
|
+
var _a = getRelevantTokens(position, sourceFile), contextToken_1 = _a.contextToken, previousToken_1 = _a.previousToken;
|
|
128970
129019
|
return {
|
|
128971
129020
|
type: "symbol",
|
|
128972
129021
|
symbol: autoImport.symbol,
|
|
128973
129022
|
location: ts.getTouchingPropertyName(sourceFile, position),
|
|
128974
|
-
previousToken:
|
|
129023
|
+
previousToken: previousToken_1,
|
|
129024
|
+
contextToken: contextToken_1,
|
|
128975
129025
|
isJsxInitializer: false,
|
|
128976
129026
|
isTypeOnlyLocation: false,
|
|
128977
129027
|
origin: autoImport.origin,
|
|
@@ -128986,7 +129036,7 @@ var ts;
|
|
|
128986
129036
|
if (completionData.kind !== 0 /* Data */) {
|
|
128987
129037
|
return { type: "request", request: completionData };
|
|
128988
129038
|
}
|
|
128989
|
-
var symbols = completionData.symbols, literals = completionData.literals, location = completionData.location, completionKind = completionData.completionKind, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, previousToken = completionData.previousToken, isJsxInitializer = completionData.isJsxInitializer, isTypeOnlyLocation = completionData.isTypeOnlyLocation;
|
|
129039
|
+
var symbols = completionData.symbols, literals = completionData.literals, location = completionData.location, completionKind = completionData.completionKind, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, contextToken = completionData.contextToken, previousToken = completionData.previousToken, isJsxInitializer = completionData.isJsxInitializer, isTypeOnlyLocation = completionData.isTypeOnlyLocation;
|
|
128990
129040
|
var literal = ts.find(literals, function (l) { return completionNameForLiteral(sourceFile, preferences, l) === entryId.name; });
|
|
128991
129041
|
if (literal !== undefined)
|
|
128992
129042
|
return { type: "literal", literal: literal };
|
|
@@ -128997,15 +129047,15 @@ var ts;
|
|
|
128997
129047
|
return ts.firstDefined(symbols, function (symbol, index) {
|
|
128998
129048
|
var origin = symbolToOriginInfoMap[index];
|
|
128999
129049
|
var info = getCompletionEntryDisplayNameForSymbol(symbol, ts.getEmitScriptTarget(compilerOptions), origin, completionKind, completionData.isJsxIdentifierExpected);
|
|
129000
|
-
return info && info.name === entryId.name && getSourceFromOrigin(origin) === entryId.source
|
|
129001
|
-
? { type: "symbol", symbol: symbol, location: location, origin: origin, previousToken: previousToken, isJsxInitializer: isJsxInitializer, isTypeOnlyLocation: isTypeOnlyLocation }
|
|
129050
|
+
return info && info.name === entryId.name && (entryId.source === CompletionSource.ClassMemberSnippet && symbol.flags & 106500 /* ClassMember */ || getSourceFromOrigin(origin) === entryId.source)
|
|
129051
|
+
? { type: "symbol", symbol: symbol, location: location, origin: origin, contextToken: contextToken, previousToken: previousToken, isJsxInitializer: isJsxInitializer, isTypeOnlyLocation: isTypeOnlyLocation }
|
|
129002
129052
|
: undefined;
|
|
129003
129053
|
}) || { type: "none" };
|
|
129004
129054
|
}
|
|
129005
129055
|
function getCompletionEntryDetails(program, log, sourceFile, position, entryId, host, formatContext, preferences, cancellationToken) {
|
|
129006
129056
|
var typeChecker = program.getTypeChecker();
|
|
129007
129057
|
var compilerOptions = program.getCompilerOptions();
|
|
129008
|
-
var name = entryId.name;
|
|
129058
|
+
var name = entryId.name, source = entryId.source, data = entryId.data;
|
|
129009
129059
|
var contextToken = ts.findPrecedingToken(position, sourceFile);
|
|
129010
129060
|
if (ts.isInString(sourceFile, position, contextToken)) {
|
|
129011
129061
|
return Completions.StringCompletions.getStringLiteralCompletionDetails(name, sourceFile, position, contextToken, typeChecker, compilerOptions, host, cancellationToken, preferences);
|
|
@@ -129029,8 +129079,8 @@ var ts;
|
|
|
129029
129079
|
}
|
|
129030
129080
|
}
|
|
129031
129081
|
case "symbol": {
|
|
129032
|
-
var symbol = symbolCompletion.symbol, location = symbolCompletion.location, origin = symbolCompletion.origin, previousToken = symbolCompletion.previousToken;
|
|
129033
|
-
var _a = getCompletionEntryCodeActionsAndSourceDisplay(origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences,
|
|
129082
|
+
var symbol = symbolCompletion.symbol, location = symbolCompletion.location, contextToken_2 = symbolCompletion.contextToken, origin = symbolCompletion.origin, previousToken = symbolCompletion.previousToken;
|
|
129083
|
+
var _a = getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken_2, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source), codeActions = _a.codeActions, sourceDisplay = _a.sourceDisplay;
|
|
129034
129084
|
return createCompletionDetailsForSymbol(symbol, typeChecker, sourceFile, location, cancellationToken, codeActions, sourceDisplay); // TODO: GH#18217
|
|
129035
129085
|
}
|
|
129036
129086
|
case "literal": {
|
|
@@ -129059,14 +129109,27 @@ var ts;
|
|
|
129059
129109
|
return { name: name, kindModifiers: kindModifiers, kind: kind, displayParts: displayParts, documentation: documentation, tags: tags, codeActions: codeActions, source: source, sourceDisplay: source };
|
|
129060
129110
|
}
|
|
129061
129111
|
Completions.createCompletionDetails = createCompletionDetails;
|
|
129062
|
-
function getCompletionEntryCodeActionsAndSourceDisplay(origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data) {
|
|
129112
|
+
function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source) {
|
|
129063
129113
|
if (data === null || data === void 0 ? void 0 : data.moduleSpecifier) {
|
|
129064
|
-
var _a = getRelevantTokens(position, sourceFile),
|
|
129065
|
-
if (
|
|
129114
|
+
var _a = getRelevantTokens(position, sourceFile), contextToken_3 = _a.contextToken, previousToken_2 = _a.previousToken;
|
|
129115
|
+
if (previousToken_2 && getImportStatementCompletionInfo(contextToken_3 || previousToken_2).replacementNode) {
|
|
129066
129116
|
// Import statement completion: 'import c|'
|
|
129067
129117
|
return { codeActions: undefined, sourceDisplay: [ts.textPart(data.moduleSpecifier)] };
|
|
129068
129118
|
}
|
|
129069
129119
|
}
|
|
129120
|
+
if (source === CompletionSource.ClassMemberSnippet) {
|
|
129121
|
+
var importAdder = getEntryForMemberCompletion(host, program, compilerOptions, preferences, name, symbol, location, contextToken).importAdder;
|
|
129122
|
+
if (importAdder) {
|
|
129123
|
+
var changes = ts.textChanges.ChangeTracker.with({ host: host, formatContext: formatContext, preferences: preferences }, importAdder.writeFixes);
|
|
129124
|
+
return {
|
|
129125
|
+
sourceDisplay: undefined,
|
|
129126
|
+
codeActions: [{
|
|
129127
|
+
changes: changes,
|
|
129128
|
+
description: ts.diagnosticToString([ts.Diagnostics.Includes_imports_of_types_referenced_by_0, name]),
|
|
129129
|
+
}],
|
|
129130
|
+
};
|
|
129131
|
+
}
|
|
129132
|
+
}
|
|
129070
129133
|
if (!origin || !(originIsExport(origin) || originIsResolvedExport(origin))) {
|
|
129071
129134
|
return { codeActions: undefined, sourceDisplay: undefined };
|
|
129072
129135
|
}
|
|
@@ -134228,7 +134291,8 @@ var ts;
|
|
|
134228
134291
|
}
|
|
134229
134292
|
}
|
|
134230
134293
|
else {
|
|
134231
|
-
return
|
|
134294
|
+
return ts.isNoSubstitutionTemplateLiteral(ref) && !ts.rangeIsOnSingleLine(ref, sourceFile) ? undefined :
|
|
134295
|
+
nodeEntry(ref, 2 /* StringLiteral */);
|
|
134232
134296
|
}
|
|
134233
134297
|
}
|
|
134234
134298
|
});
|
|
@@ -144266,8 +144330,8 @@ var ts;
|
|
|
144266
144330
|
ChangeTracker.prototype.deleteNodes = function (sourceFile, nodes, options, hasTrailingComment) {
|
|
144267
144331
|
if (options === void 0) { options = { leadingTriviaOption: LeadingTriviaOption.IncludeAll }; }
|
|
144268
144332
|
// When deleting multiple nodes we need to track if the end position is including multiline trailing comments.
|
|
144269
|
-
for (var _i = 0,
|
|
144270
|
-
var node =
|
|
144333
|
+
for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {
|
|
144334
|
+
var node = nodes_1[_i];
|
|
144271
144335
|
var pos = getAdjustedStartPosition(sourceFile, node, options, hasTrailingComment);
|
|
144272
144336
|
var end = getAdjustedEndPosition(sourceFile, node, options);
|
|
144273
144337
|
this.deleteRange(sourceFile, { pos: pos, end: end });
|
|
@@ -145372,21 +145436,16 @@ var ts;
|
|
|
145372
145436
|
(function (codefix) {
|
|
145373
145437
|
var errorCodeToFixes = ts.createMultiMap();
|
|
145374
145438
|
var fixIdToRegistration = new ts.Map();
|
|
145375
|
-
function diagnosticToString(diag) {
|
|
145376
|
-
return ts.isArray(diag)
|
|
145377
|
-
? ts.formatStringFromArgs(ts.getLocaleSpecificMessage(diag[0]), diag.slice(1))
|
|
145378
|
-
: ts.getLocaleSpecificMessage(diag);
|
|
145379
|
-
}
|
|
145380
145439
|
function createCodeFixActionWithoutFixAll(fixName, changes, description) {
|
|
145381
|
-
return createCodeFixActionWorker(fixName, diagnosticToString(description), changes, /*fixId*/ undefined, /*fixAllDescription*/ undefined);
|
|
145440
|
+
return createCodeFixActionWorker(fixName, ts.diagnosticToString(description), changes, /*fixId*/ undefined, /*fixAllDescription*/ undefined);
|
|
145382
145441
|
}
|
|
145383
145442
|
codefix.createCodeFixActionWithoutFixAll = createCodeFixActionWithoutFixAll;
|
|
145384
145443
|
function createCodeFixAction(fixName, changes, description, fixId, fixAllDescription, command) {
|
|
145385
|
-
return createCodeFixActionWorker(fixName, diagnosticToString(description), changes, fixId, diagnosticToString(fixAllDescription), command);
|
|
145444
|
+
return createCodeFixActionWorker(fixName, ts.diagnosticToString(description), changes, fixId, ts.diagnosticToString(fixAllDescription), command);
|
|
145386
145445
|
}
|
|
145387
145446
|
codefix.createCodeFixAction = createCodeFixAction;
|
|
145388
145447
|
function createCodeFixActionMaybeFixAll(fixName, changes, description, fixId, fixAllDescription, command) {
|
|
145389
|
-
return createCodeFixActionWorker(fixName, diagnosticToString(description), changes, fixId, fixAllDescription && diagnosticToString(fixAllDescription), command);
|
|
145448
|
+
return createCodeFixActionWorker(fixName, ts.diagnosticToString(description), changes, fixId, fixAllDescription && ts.diagnosticToString(fixAllDescription), command);
|
|
145390
145449
|
}
|
|
145391
145450
|
codefix.createCodeFixActionMaybeFixAll = createCodeFixActionMaybeFixAll;
|
|
145392
145451
|
function createCodeFixActionWorker(fixName, description, changes, fixId, fixAllDescription, command) {
|
|
@@ -148147,7 +148206,7 @@ var ts;
|
|
|
148147
148206
|
var addToExisting = new ts.Map();
|
|
148148
148207
|
/** Use `getNewImportEntry` for access */
|
|
148149
148208
|
var newImports = new ts.Map();
|
|
148150
|
-
return { addImportFromDiagnostic: addImportFromDiagnostic, addImportFromExportedSymbol: addImportFromExportedSymbol, writeFixes: writeFixes };
|
|
148209
|
+
return { addImportFromDiagnostic: addImportFromDiagnostic, addImportFromExportedSymbol: addImportFromExportedSymbol, writeFixes: writeFixes, hasFixes: hasFixes };
|
|
148151
148210
|
function addImportFromDiagnostic(diagnostic, context) {
|
|
148152
148211
|
var info = getFixesInfo(context, diagnostic.code, diagnostic.start, useAutoImportProvider);
|
|
148153
148212
|
if (!info || !info.fixes.length)
|
|
@@ -148298,6 +148357,9 @@ var ts;
|
|
|
148298
148357
|
ts.insertImports(changeTracker, sourceFile, newDeclarations, /*blankLineBetween*/ true);
|
|
148299
148358
|
}
|
|
148300
148359
|
}
|
|
148360
|
+
function hasFixes() {
|
|
148361
|
+
return addToNamespace.length > 0 || importType.length > 0 || addToExisting.size > 0 || newImports.size > 0;
|
|
148362
|
+
}
|
|
148301
148363
|
}
|
|
148302
148364
|
// Sorted with the preferred fix coming first.
|
|
148303
148365
|
var ImportFixKind;
|
|
@@ -158819,8 +158881,8 @@ var ts;
|
|
|
158819
158881
|
var list = createNode(346 /* SyntaxList */, nodes.pos, nodes.end, parent);
|
|
158820
158882
|
list._children = [];
|
|
158821
158883
|
var pos = nodes.pos;
|
|
158822
|
-
for (var _i = 0,
|
|
158823
|
-
var node =
|
|
158884
|
+
for (var _i = 0, nodes_2 = nodes; _i < nodes_2.length; _i++) {
|
|
158885
|
+
var node = nodes_2[_i];
|
|
158824
158886
|
addSyntheticNodes(list._children, pos, node.pos, parent);
|
|
158825
158887
|
list._children.push(node);
|
|
158826
158888
|
pos = node.end;
|
|
@@ -164844,6 +164906,10 @@ var ts;
|
|
|
164844
164906
|
this.hasAddedOrRemovedSymlinks = true;
|
|
164845
164907
|
}
|
|
164846
164908
|
};
|
|
164909
|
+
/* @internal */
|
|
164910
|
+
Project.prototype.onDiscoveredSymlink = function () {
|
|
164911
|
+
this.hasAddedOrRemovedSymlinks = true;
|
|
164912
|
+
};
|
|
164847
164913
|
/**
|
|
164848
164914
|
* Updates set of files that contribute to this project
|
|
164849
164915
|
* @returns: true if set of files in the project stays the same and false - otherwise.
|
package/lib/tsserverlibrary.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ and limitations under the License.
|
|
|
14
14
|
***************************************************************************** */
|
|
15
15
|
|
|
16
16
|
declare namespace ts {
|
|
17
|
-
const versionMajorMinor = "4.
|
|
17
|
+
const versionMajorMinor = "4.6";
|
|
18
18
|
/** The version of the TypeScript compiler release */
|
|
19
19
|
const version: string;
|
|
20
20
|
/**
|