typescript 4.5.0-dev.20211028 → 4.5.0-dev.20211101
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/es/diagnosticMessages.generated.json +1 -0
- package/lib/fr/diagnosticMessages.generated.json +1 -0
- package/lib/it/diagnosticMessages.generated.json +1 -0
- package/lib/ja/diagnosticMessages.generated.json +1 -0
- package/lib/ko/diagnosticMessages.generated.json +1 -0
- package/lib/lib.dom.d.ts +186 -92
- package/lib/lib.dom.iterable.d.ts +1 -7
- package/lib/lib.webworker.d.ts +60 -19
- package/lib/lib.webworker.iterable.d.ts +0 -7
- package/lib/pl/diagnosticMessages.generated.json +1 -0
- package/lib/protocol.d.ts +7 -0
- package/lib/pt-br/diagnosticMessages.generated.json +1 -0
- package/lib/ru/diagnosticMessages.generated.json +1 -0
- package/lib/tr/diagnosticMessages.generated.json +1 -0
- package/lib/tsc.js +200 -52
- package/lib/tsserver.js +528 -117
- package/lib/tsserverlibrary.d.ts +8 -0
- package/lib/tsserverlibrary.js +528 -117
- package/lib/typescript.d.ts +1 -0
- package/lib/typescript.js +524 -117
- package/lib/typescriptServices.d.ts +1 -0
- package/lib/typescriptServices.js +524 -117
- package/lib/typingsInstaller.js +256 -54
- package/lib/zh-cn/diagnosticMessages.generated.json +1 -0
- package/lib/zh-tw/diagnosticMessages.generated.json +1 -0
- 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.20211101";
|
|
104
104
|
/* @internal */
|
|
105
105
|
var Comparison;
|
|
106
106
|
(function (Comparison) {
|
|
@@ -2551,6 +2551,10 @@ var ts;
|
|
|
2551
2551
|
return formatEnum(kind, ts.SyntaxKind, /*isFlags*/ false);
|
|
2552
2552
|
}
|
|
2553
2553
|
Debug.formatSyntaxKind = formatSyntaxKind;
|
|
2554
|
+
function formatSnippetKind(kind) {
|
|
2555
|
+
return formatEnum(kind, ts.SnippetKind, /*isFlags*/ false);
|
|
2556
|
+
}
|
|
2557
|
+
Debug.formatSnippetKind = formatSnippetKind;
|
|
2554
2558
|
function formatNodeFlags(flags) {
|
|
2555
2559
|
return formatEnum(flags, ts.NodeFlags, /*isFlags*/ true);
|
|
2556
2560
|
}
|
|
@@ -4467,6 +4471,13 @@ var ts;
|
|
|
4467
4471
|
ExitStatus[ExitStatus["ProjectReferenceCycle_OutputsSkupped"] = 4] = "ProjectReferenceCycle_OutputsSkupped";
|
|
4468
4472
|
})(ExitStatus = ts.ExitStatus || (ts.ExitStatus = {}));
|
|
4469
4473
|
/* @internal */
|
|
4474
|
+
var MemberOverrideStatus;
|
|
4475
|
+
(function (MemberOverrideStatus) {
|
|
4476
|
+
MemberOverrideStatus[MemberOverrideStatus["Ok"] = 0] = "Ok";
|
|
4477
|
+
MemberOverrideStatus[MemberOverrideStatus["NeedsOverride"] = 1] = "NeedsOverride";
|
|
4478
|
+
MemberOverrideStatus[MemberOverrideStatus["HasInvalidOverride"] = 2] = "HasInvalidOverride";
|
|
4479
|
+
})(MemberOverrideStatus = ts.MemberOverrideStatus || (ts.MemberOverrideStatus = {}));
|
|
4480
|
+
/* @internal */
|
|
4470
4481
|
var UnionReduction;
|
|
4471
4482
|
(function (UnionReduction) {
|
|
4472
4483
|
UnionReduction[UnionReduction["None"] = 0] = "None";
|
|
@@ -5115,7 +5126,7 @@ var ts;
|
|
|
5115
5126
|
(function (ModuleResolutionKind) {
|
|
5116
5127
|
ModuleResolutionKind[ModuleResolutionKind["Classic"] = 1] = "Classic";
|
|
5117
5128
|
ModuleResolutionKind[ModuleResolutionKind["NodeJs"] = 2] = "NodeJs";
|
|
5118
|
-
// 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
|
|
5119
5130
|
// to better support ecmascript modules and their use within node - more features are still being added, so
|
|
5120
5131
|
// we can expect it to change over time, and as such, offer both a `NodeNext` moving resolution target, and a `Node12`
|
|
5121
5132
|
// version-anchored resolution target
|
|
@@ -5448,6 +5459,15 @@ var ts;
|
|
|
5448
5459
|
// Masks
|
|
5449
5460
|
// - Additional bitmasks
|
|
5450
5461
|
})(TransformFlags = ts.TransformFlags || (ts.TransformFlags = {}));
|
|
5462
|
+
// Reference: https://code.visualstudio.com/docs/editor/userdefinedsnippets#_snippet-syntax
|
|
5463
|
+
/* @internal */
|
|
5464
|
+
var SnippetKind;
|
|
5465
|
+
(function (SnippetKind) {
|
|
5466
|
+
SnippetKind[SnippetKind["TabStop"] = 0] = "TabStop";
|
|
5467
|
+
SnippetKind[SnippetKind["Placeholder"] = 1] = "Placeholder";
|
|
5468
|
+
SnippetKind[SnippetKind["Choice"] = 2] = "Choice";
|
|
5469
|
+
SnippetKind[SnippetKind["Variable"] = 3] = "Variable";
|
|
5470
|
+
})(SnippetKind = ts.SnippetKind || (ts.SnippetKind = {}));
|
|
5451
5471
|
var EmitFlags;
|
|
5452
5472
|
(function (EmitFlags) {
|
|
5453
5473
|
EmitFlags[EmitFlags["None"] = 0] = "None";
|
|
@@ -8684,6 +8704,8 @@ var ts;
|
|
|
8684
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'."),
|
|
8685
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."),
|
|
8686
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}'?"),
|
|
8687
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}'."),
|
|
8688
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}'."),
|
|
8689
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}'."),
|
|
@@ -8790,6 +8812,7 @@ var ts;
|
|
|
8790
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."),
|
|
8791
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}'."),
|
|
8792
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'."),
|
|
8793
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."),
|
|
8794
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."),
|
|
8795
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}'."),
|
|
@@ -9447,6 +9470,7 @@ var ts;
|
|
|
9447
9470
|
Remove_unused_destructuring_declaration: diag(90039, ts.DiagnosticCategory.Message, "Remove_unused_destructuring_declaration_90039", "Remove unused destructuring declaration"),
|
|
9448
9471
|
Remove_unused_declarations_for_Colon_0: diag(90041, ts.DiagnosticCategory.Message, "Remove_unused_declarations_for_Colon_0_90041", "Remove unused declarations for: '{0}'"),
|
|
9449
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}'"),
|
|
9450
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"),
|
|
9451
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}'"),
|
|
9452
9476
|
Extract_to_0_in_1: diag(95004, ts.DiagnosticCategory.Message, "Extract_to_0_in_1_95004", "Extract to {0} in {1}"),
|
|
@@ -20753,6 +20777,10 @@ var ts;
|
|
|
20753
20777
|
return node.kind === 212 /* FunctionExpression */ || node.kind === 213 /* ArrowFunction */;
|
|
20754
20778
|
}
|
|
20755
20779
|
ts.isFunctionExpressionOrArrowFunction = isFunctionExpressionOrArrowFunction;
|
|
20780
|
+
function escapeSnippetText(text) {
|
|
20781
|
+
return text.replace(/\$/gm, "\\$");
|
|
20782
|
+
}
|
|
20783
|
+
ts.escapeSnippetText = escapeSnippetText;
|
|
20756
20784
|
})(ts || (ts = {}));
|
|
20757
20785
|
/* @internal */
|
|
20758
20786
|
var ts;
|
|
@@ -26956,6 +26984,25 @@ var ts;
|
|
|
26956
26984
|
}
|
|
26957
26985
|
}
|
|
26958
26986
|
ts.moveEmitHelpers = moveEmitHelpers;
|
|
26987
|
+
/**
|
|
26988
|
+
* Gets the SnippetElement of a node.
|
|
26989
|
+
*/
|
|
26990
|
+
/* @internal */
|
|
26991
|
+
function getSnippetElement(node) {
|
|
26992
|
+
var _a;
|
|
26993
|
+
return (_a = node.emitNode) === null || _a === void 0 ? void 0 : _a.snippetElement;
|
|
26994
|
+
}
|
|
26995
|
+
ts.getSnippetElement = getSnippetElement;
|
|
26996
|
+
/**
|
|
26997
|
+
* Sets the SnippetElement of a node.
|
|
26998
|
+
*/
|
|
26999
|
+
/* @internal */
|
|
27000
|
+
function setSnippetElement(node, snippet) {
|
|
27001
|
+
var emitNode = getOrCreateEmitNode(node);
|
|
27002
|
+
emitNode.snippetElement = snippet;
|
|
27003
|
+
return node;
|
|
27004
|
+
}
|
|
27005
|
+
ts.setSnippetElement = setSnippetElement;
|
|
26959
27006
|
/* @internal */
|
|
26960
27007
|
function ignoreSourceNewlines(node) {
|
|
26961
27008
|
getOrCreateEmitNode(node).flags |= 134217728 /* IgnoreSourceNewlines */;
|
|
@@ -47081,6 +47128,7 @@ var ts;
|
|
|
47081
47128
|
isDeclarationVisible: isDeclarationVisible,
|
|
47082
47129
|
isPropertyAccessible: isPropertyAccessible,
|
|
47083
47130
|
getTypeOnlyAliasDeclaration: getTypeOnlyAliasDeclaration,
|
|
47131
|
+
getMemberOverrideModifierStatus: getMemberOverrideModifierStatus,
|
|
47084
47132
|
};
|
|
47085
47133
|
function getResolvedSignatureWorker(nodeIn, candidatesOutArray, argumentCount, checkMode) {
|
|
47086
47134
|
var node = ts.getParseTreeNode(nodeIn, ts.isCallLikeExpression);
|
|
@@ -47324,6 +47372,21 @@ var ts;
|
|
|
47324
47372
|
var enumRelation = new ts.Map();
|
|
47325
47373
|
var builtinGlobals = ts.createSymbolTable();
|
|
47326
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
|
+
];
|
|
47327
47390
|
initializeTypeChecker();
|
|
47328
47391
|
return checker;
|
|
47329
47392
|
function getJsxNamespace(location) {
|
|
@@ -49539,7 +49602,7 @@ var ts;
|
|
|
49539
49602
|
: undefined;
|
|
49540
49603
|
}
|
|
49541
49604
|
function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation) {
|
|
49542
|
-
var _a, _b, _c, _d, _e, _f;
|
|
49605
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
49543
49606
|
if (isForAugmentation === void 0) { isForAugmentation = false; }
|
|
49544
49607
|
if (ts.startsWith(moduleReference, "@types/")) {
|
|
49545
49608
|
var diag = ts.Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
@@ -49560,7 +49623,7 @@ var ts;
|
|
|
49560
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) ||
|
|
49561
49624
|
((_f = (ts.isLiteralImportTypeNode(location) ? location : undefined)) === null || _f === void 0 ? void 0 : _f.argument.literal);
|
|
49562
49625
|
var mode = contextSpecifier && ts.isStringLiteralLike(contextSpecifier) ? ts.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
49563
|
-
var resolvedModule = ts.getResolvedModule(currentSourceFile, moduleReference, mode);
|
|
49626
|
+
var resolvedModule = ts.getResolvedModule(currentSourceFile, moduleReference, mode);
|
|
49564
49627
|
var resolutionDiagnostic = resolvedModule && ts.getResolutionDiagnostic(compilerOptions, resolvedModule);
|
|
49565
49628
|
var sourceFile = resolvedModule && !resolutionDiagnostic && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
49566
49629
|
if (sourceFile) {
|
|
@@ -49626,6 +49689,10 @@ var ts;
|
|
|
49626
49689
|
}
|
|
49627
49690
|
else {
|
|
49628
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;
|
|
49629
49696
|
if (tsExtension) {
|
|
49630
49697
|
var diag = ts.Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead;
|
|
49631
49698
|
var importSourceWithoutExtension = ts.removeExtension(moduleReference, tsExtension);
|
|
@@ -49645,6 +49712,19 @@ var ts;
|
|
|
49645
49712
|
ts.hasJsonModuleEmitEnabled(compilerOptions)) {
|
|
49646
49713
|
error(errorNode, ts.Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
49647
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
|
+
}
|
|
49648
49728
|
else {
|
|
49649
49729
|
error(errorNode, moduleNotFoundError, moduleReference);
|
|
49650
49730
|
}
|
|
@@ -61557,7 +61637,8 @@ var ts;
|
|
|
61557
61637
|
if (t.flags & (3 /* AnyOrUnknown */ | 58982400 /* InstantiableNonPrimitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && t !== wildcardType && !isErrorType(t)) {
|
|
61558
61638
|
if (!type.declaration.nameType) {
|
|
61559
61639
|
var constraint = void 0;
|
|
61560
|
-
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))) {
|
|
61561
61642
|
return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
|
|
61562
61643
|
}
|
|
61563
61644
|
if (isGenericTupleType(t)) {
|
|
@@ -81656,7 +81737,7 @@ var ts;
|
|
|
81656
81737
|
checkKindsOfPropertyMemberOverrides(type, baseType_1);
|
|
81657
81738
|
}
|
|
81658
81739
|
}
|
|
81659
|
-
|
|
81740
|
+
checkMembersForOverrideModifier(node, type, typeWithThis, staticType);
|
|
81660
81741
|
var implementedTypeNodes = ts.getEffectiveImplementsTypeNodes(node);
|
|
81661
81742
|
if (implementedTypeNodes) {
|
|
81662
81743
|
for (var _b = 0, implementedTypeNodes_1 = implementedTypeNodes; _b < implementedTypeNodes_1.length; _b++) {
|
|
@@ -81691,8 +81772,7 @@ var ts;
|
|
|
81691
81772
|
checkPropertyInitialization(node);
|
|
81692
81773
|
}
|
|
81693
81774
|
}
|
|
81694
|
-
function
|
|
81695
|
-
var nodeInAmbientContext = !!(node.flags & 8388608 /* Ambient */);
|
|
81775
|
+
function checkMembersForOverrideModifier(node, type, typeWithThis, staticType) {
|
|
81696
81776
|
var baseTypeNode = ts.getEffectiveBaseTypeNode(node);
|
|
81697
81777
|
var baseTypes = baseTypeNode && getBaseTypes(type);
|
|
81698
81778
|
var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
|
|
@@ -81704,46 +81784,71 @@ var ts;
|
|
|
81704
81784
|
if (ts.isConstructorDeclaration(member)) {
|
|
81705
81785
|
ts.forEach(member.parameters, function (param) {
|
|
81706
81786
|
if (ts.isParameterPropertyDeclaration(param, member)) {
|
|
81707
|
-
|
|
81787
|
+
checkExistingMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, param,
|
|
81788
|
+
/* memberIsParameterProperty */ true);
|
|
81708
81789
|
}
|
|
81709
81790
|
});
|
|
81710
81791
|
}
|
|
81711
|
-
|
|
81792
|
+
checkExistingMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, member,
|
|
81793
|
+
/* memberIsParameterProperty */ false);
|
|
81712
81794
|
};
|
|
81713
81795
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
81714
81796
|
var member = _a[_i];
|
|
81715
81797
|
_loop_29(member);
|
|
81716
81798
|
}
|
|
81717
|
-
|
|
81718
|
-
|
|
81719
|
-
|
|
81720
|
-
|
|
81721
|
-
|
|
81722
|
-
|
|
81723
|
-
|
|
81724
|
-
|
|
81725
|
-
|
|
81726
|
-
|
|
81727
|
-
|
|
81728
|
-
|
|
81729
|
-
|
|
81730
|
-
|
|
81731
|
-
|
|
81732
|
-
|
|
81799
|
+
}
|
|
81800
|
+
/**
|
|
81801
|
+
* @param member Existing member node to be checked.
|
|
81802
|
+
* Note: `member` cannot be a synthetic node.
|
|
81803
|
+
*/
|
|
81804
|
+
function checkExistingMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, member, memberIsParameterProperty, reportErrors) {
|
|
81805
|
+
if (reportErrors === void 0) { reportErrors = true; }
|
|
81806
|
+
var declaredProp = member.name
|
|
81807
|
+
&& getSymbolAtLocation(member.name)
|
|
81808
|
+
|| getSymbolAtLocation(member);
|
|
81809
|
+
if (!declaredProp) {
|
|
81810
|
+
return 0 /* Ok */;
|
|
81811
|
+
}
|
|
81812
|
+
return checkMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, ts.hasOverrideModifier(member), ts.hasAbstractModifier(member), ts.isStatic(member), memberIsParameterProperty, ts.symbolName(declaredProp), reportErrors ? member : undefined);
|
|
81813
|
+
}
|
|
81814
|
+
/**
|
|
81815
|
+
* Checks a class member declaration for either a missing or an invalid `override` modifier.
|
|
81816
|
+
* Note: this function can be used for speculative checking,
|
|
81817
|
+
* i.e. checking a member that does not yet exist in the program.
|
|
81818
|
+
* An example of that would be to call this function in a completions scenario,
|
|
81819
|
+
* when offering a method declaration as completion.
|
|
81820
|
+
* @param errorNode The node where we should report an error, or undefined if we should not report errors.
|
|
81821
|
+
*/
|
|
81822
|
+
function checkMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, memberHasOverrideModifier, memberHasAbstractModifier, memberIsStatic, memberIsParameterProperty, memberName, errorNode) {
|
|
81823
|
+
var isJs = ts.isInJSFile(node);
|
|
81824
|
+
var nodeInAmbientContext = !!(node.flags & 8388608 /* Ambient */);
|
|
81825
|
+
if (baseWithThis && (memberHasOverrideModifier || compilerOptions.noImplicitOverride)) {
|
|
81826
|
+
var memberEscapedName = ts.escapeLeadingUnderscores(memberName);
|
|
81827
|
+
var thisType = memberIsStatic ? staticType : typeWithThis;
|
|
81828
|
+
var baseType = memberIsStatic ? baseStaticType : baseWithThis;
|
|
81829
|
+
var prop = getPropertyOfType(thisType, memberEscapedName);
|
|
81830
|
+
var baseProp = getPropertyOfType(baseType, memberEscapedName);
|
|
81831
|
+
var baseClassName = typeToString(baseWithThis);
|
|
81832
|
+
if (prop && !baseProp && memberHasOverrideModifier) {
|
|
81833
|
+
if (errorNode) {
|
|
81834
|
+
var suggestion = getSuggestedSymbolForNonexistentClassMember(memberName, baseType); // Again, using symbol name: note that's different from `symbol.escapedName`
|
|
81733
81835
|
suggestion ?
|
|
81734
|
-
error(
|
|
81836
|
+
error(errorNode, isJs ?
|
|
81735
81837
|
ts.Diagnostics.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 :
|
|
81736
81838
|
ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0_Did_you_mean_1, baseClassName, symbolToString(suggestion)) :
|
|
81737
|
-
error(
|
|
81839
|
+
error(errorNode, isJs ?
|
|
81738
81840
|
ts.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0 :
|
|
81739
81841
|
ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0, baseClassName);
|
|
81740
81842
|
}
|
|
81741
|
-
|
|
81742
|
-
|
|
81743
|
-
|
|
81744
|
-
|
|
81745
|
-
|
|
81746
|
-
|
|
81843
|
+
return 2 /* HasInvalidOverride */;
|
|
81844
|
+
}
|
|
81845
|
+
else if (prop && (baseProp === null || baseProp === void 0 ? void 0 : baseProp.declarations) && compilerOptions.noImplicitOverride && !nodeInAmbientContext) {
|
|
81846
|
+
var baseHasAbstract = ts.some(baseProp.declarations, ts.hasAbstractModifier);
|
|
81847
|
+
if (memberHasOverrideModifier) {
|
|
81848
|
+
return 0 /* Ok */;
|
|
81849
|
+
}
|
|
81850
|
+
if (!baseHasAbstract) {
|
|
81851
|
+
if (errorNode) {
|
|
81747
81852
|
var diag = memberIsParameterProperty ?
|
|
81748
81853
|
isJs ?
|
|
81749
81854
|
ts.Diagnostics.This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0 :
|
|
@@ -81751,20 +81856,28 @@ var ts;
|
|
|
81751
81856
|
isJs ?
|
|
81752
81857
|
ts.Diagnostics.This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0 :
|
|
81753
81858
|
ts.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0;
|
|
81754
|
-
error(
|
|
81859
|
+
error(errorNode, diag, baseClassName);
|
|
81755
81860
|
}
|
|
81756
|
-
|
|
81757
|
-
|
|
81861
|
+
return 1 /* NeedsOverride */;
|
|
81862
|
+
}
|
|
81863
|
+
else if (memberHasAbstractModifier && baseHasAbstract) {
|
|
81864
|
+
if (errorNode) {
|
|
81865
|
+
error(errorNode, ts.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_an_abstract_method_that_is_declared_in_the_base_class_0, baseClassName);
|
|
81758
81866
|
}
|
|
81867
|
+
return 1 /* NeedsOverride */;
|
|
81759
81868
|
}
|
|
81760
81869
|
}
|
|
81761
|
-
|
|
81870
|
+
}
|
|
81871
|
+
else if (memberHasOverrideModifier) {
|
|
81872
|
+
if (errorNode) {
|
|
81762
81873
|
var className = typeToString(type);
|
|
81763
|
-
error(
|
|
81874
|
+
error(errorNode, isJs ?
|
|
81764
81875
|
ts.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class :
|
|
81765
81876
|
ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class, className);
|
|
81766
81877
|
}
|
|
81878
|
+
return 2 /* HasInvalidOverride */;
|
|
81767
81879
|
}
|
|
81880
|
+
return 0 /* Ok */;
|
|
81768
81881
|
}
|
|
81769
81882
|
function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
|
|
81770
81883
|
// iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible
|
|
@@ -81807,6 +81920,31 @@ var ts;
|
|
|
81807
81920
|
}
|
|
81808
81921
|
}
|
|
81809
81922
|
}
|
|
81923
|
+
/**
|
|
81924
|
+
* Checks a member declaration node to see if has a missing or invalid `override` modifier.
|
|
81925
|
+
* @param node Class-like node where the member is declared.
|
|
81926
|
+
* @param member Member declaration node.
|
|
81927
|
+
* Note: `member` can be a synthetic node without a parent.
|
|
81928
|
+
*/
|
|
81929
|
+
function getMemberOverrideModifierStatus(node, member) {
|
|
81930
|
+
if (!member.name) {
|
|
81931
|
+
return 0 /* Ok */;
|
|
81932
|
+
}
|
|
81933
|
+
var symbol = getSymbolOfNode(node);
|
|
81934
|
+
var type = getDeclaredTypeOfSymbol(symbol);
|
|
81935
|
+
var typeWithThis = getTypeWithThisArgument(type);
|
|
81936
|
+
var staticType = getTypeOfSymbol(symbol);
|
|
81937
|
+
var baseTypeNode = ts.getEffectiveBaseTypeNode(node);
|
|
81938
|
+
var baseTypes = baseTypeNode && getBaseTypes(type);
|
|
81939
|
+
var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
|
|
81940
|
+
var baseStaticType = getBaseConstructorTypeOfClass(type);
|
|
81941
|
+
var memberHasOverrideModifier = member.parent
|
|
81942
|
+
? ts.hasOverrideModifier(member)
|
|
81943
|
+
: ts.hasSyntacticModifier(member, 16384 /* Override */);
|
|
81944
|
+
var memberName = ts.unescapeLeadingUnderscores(ts.getTextOfPropertyName(member.name));
|
|
81945
|
+
return checkMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, memberHasOverrideModifier, ts.hasAbstractModifier(member), ts.isStatic(member),
|
|
81946
|
+
/* memberIsParameterProperty */ false, memberName);
|
|
81947
|
+
}
|
|
81810
81948
|
function getTargetSymbol(s) {
|
|
81811
81949
|
// if symbol is instantiated its flags are not copied from the 'target'
|
|
81812
81950
|
// so we'll need to get back original 'target' symbol to work with correct set of flags
|
|
@@ -94803,11 +94941,11 @@ var ts;
|
|
|
94803
94941
|
currentFileState.filenameDeclaration = declaration;
|
|
94804
94942
|
return currentFileState.filenameDeclaration.name;
|
|
94805
94943
|
}
|
|
94806
|
-
function getJsxFactoryCalleePrimitive(
|
|
94807
|
-
return compilerOptions.jsx === 5 /* ReactJSXDev */ ? "jsxDEV" :
|
|
94944
|
+
function getJsxFactoryCalleePrimitive(isStaticChildren) {
|
|
94945
|
+
return compilerOptions.jsx === 5 /* ReactJSXDev */ ? "jsxDEV" : isStaticChildren ? "jsxs" : "jsx";
|
|
94808
94946
|
}
|
|
94809
|
-
function getJsxFactoryCallee(
|
|
94810
|
-
var type = getJsxFactoryCalleePrimitive(
|
|
94947
|
+
function getJsxFactoryCallee(isStaticChildren) {
|
|
94948
|
+
var type = getJsxFactoryCalleePrimitive(isStaticChildren);
|
|
94811
94949
|
return getImplicitImportForName(type);
|
|
94812
94950
|
}
|
|
94813
94951
|
function getImplicitJsxFragmentReference() {
|
|
@@ -94959,7 +95097,7 @@ var ts;
|
|
|
94959
95097
|
}
|
|
94960
95098
|
function convertJsxChildrenToChildrenPropAssignment(children) {
|
|
94961
95099
|
var nonWhitespaceChildren = ts.getSemanticJsxChildren(children);
|
|
94962
|
-
if (ts.length(nonWhitespaceChildren) === 1) {
|
|
95100
|
+
if (ts.length(nonWhitespaceChildren) === 1 && !nonWhitespaceChildren[0].dotDotDotToken) {
|
|
94963
95101
|
var result_12 = transformJsxChildToExpression(nonWhitespaceChildren[0]);
|
|
94964
95102
|
return result_12 && factory.createPropertyAssignment("children", result_12);
|
|
94965
95103
|
}
|
|
@@ -94973,15 +95111,18 @@ var ts;
|
|
|
94973
95111
|
var attrs = keyAttr ? ts.filter(node.attributes.properties, function (p) { return p !== keyAttr; }) : node.attributes.properties;
|
|
94974
95112
|
var objectProperties = ts.length(attrs) ? transformJsxAttributesToObjectProps(attrs, childrenProp) :
|
|
94975
95113
|
factory.createObjectLiteralExpression(childrenProp ? [childrenProp] : ts.emptyArray); // When there are no attributes, React wants {}
|
|
94976
|
-
return visitJsxOpeningLikeElementOrFragmentJSX(tagName, objectProperties, keyAttr,
|
|
95114
|
+
return visitJsxOpeningLikeElementOrFragmentJSX(tagName, objectProperties, keyAttr, children || ts.emptyArray, isChild, location);
|
|
94977
95115
|
}
|
|
94978
|
-
function visitJsxOpeningLikeElementOrFragmentJSX(tagName, objectProperties, keyAttr,
|
|
95116
|
+
function visitJsxOpeningLikeElementOrFragmentJSX(tagName, objectProperties, keyAttr, children, isChild, location) {
|
|
95117
|
+
var _a;
|
|
95118
|
+
var nonWhitespaceChildren = ts.getSemanticJsxChildren(children);
|
|
95119
|
+
var isStaticChildren = ts.length(nonWhitespaceChildren) > 1 || !!((_a = nonWhitespaceChildren[0]) === null || _a === void 0 ? void 0 : _a.dotDotDotToken);
|
|
94979
95120
|
var args = [tagName, objectProperties, !keyAttr ? factory.createVoidZero() : transformJsxAttributeInitializer(keyAttr.initializer)];
|
|
94980
95121
|
if (compilerOptions.jsx === 5 /* ReactJSXDev */) {
|
|
94981
95122
|
var originalFile = ts.getOriginalNode(currentSourceFile);
|
|
94982
95123
|
if (originalFile && ts.isSourceFile(originalFile)) {
|
|
94983
95124
|
// isStaticChildren development flag
|
|
94984
|
-
args.push(
|
|
95125
|
+
args.push(isStaticChildren ? factory.createTrue() : factory.createFalse());
|
|
94985
95126
|
// __source development flag
|
|
94986
95127
|
var lineCol = ts.getLineAndCharacterOfPosition(originalFile, location.pos);
|
|
94987
95128
|
args.push(factory.createObjectLiteralExpression([
|
|
@@ -94993,7 +95134,7 @@ var ts;
|
|
|
94993
95134
|
args.push(factory.createThis());
|
|
94994
95135
|
}
|
|
94995
95136
|
}
|
|
94996
|
-
var element = ts.setTextRange(factory.createCallExpression(getJsxFactoryCallee(
|
|
95137
|
+
var element = ts.setTextRange(factory.createCallExpression(getJsxFactoryCallee(isStaticChildren), /*typeArguments*/ undefined, args), location);
|
|
94997
95138
|
if (isChild) {
|
|
94998
95139
|
ts.startOnNewLine(element);
|
|
94999
95140
|
}
|
|
@@ -95023,7 +95164,7 @@ var ts;
|
|
|
95023
95164
|
}
|
|
95024
95165
|
}
|
|
95025
95166
|
return visitJsxOpeningLikeElementOrFragmentJSX(getImplicitJsxFragmentReference(), childrenProps || factory.createObjectLiteralExpression([]),
|
|
95026
|
-
/*keyAttr*/ undefined,
|
|
95167
|
+
/*keyAttr*/ undefined, children, isChild, location);
|
|
95027
95168
|
}
|
|
95028
95169
|
function visitJsxOpeningFragmentCreateElement(node, children, isChild, location) {
|
|
95029
95170
|
var element = ts.createExpressionForJsxFragment(factory, context.getEmitResolver().getJsxFactoryEntity(currentSourceFile), context.getEmitResolver().getJsxFragmentFactoryEntity(currentSourceFile), compilerOptions.reactNamespace, // TODO: GH#18217
|
|
@@ -108111,7 +108252,14 @@ var ts;
|
|
|
108111
108252
|
// clear the parenthesizer rule as we ascend
|
|
108112
108253
|
currentParenthesizerRule = undefined;
|
|
108113
108254
|
}
|
|
108114
|
-
function pipelineEmitWithHintWorker(hint, node) {
|
|
108255
|
+
function pipelineEmitWithHintWorker(hint, node, allowSnippets) {
|
|
108256
|
+
if (allowSnippets === void 0) { allowSnippets = true; }
|
|
108257
|
+
if (allowSnippets) {
|
|
108258
|
+
var snippet = ts.getSnippetElement(node);
|
|
108259
|
+
if (snippet) {
|
|
108260
|
+
return emitSnippetNode(hint, node, snippet);
|
|
108261
|
+
}
|
|
108262
|
+
}
|
|
108115
108263
|
if (hint === 0 /* SourceFile */)
|
|
108116
108264
|
return emitSourceFile(ts.cast(node, ts.isSourceFile));
|
|
108117
108265
|
if (hint === 2 /* IdentifierName */)
|
|
@@ -108720,6 +108868,28 @@ var ts;
|
|
|
108720
108868
|
}
|
|
108721
108869
|
}
|
|
108722
108870
|
//
|
|
108871
|
+
// Snippet Elements
|
|
108872
|
+
//
|
|
108873
|
+
function emitSnippetNode(hint, node, snippet) {
|
|
108874
|
+
switch (snippet.kind) {
|
|
108875
|
+
case 1 /* Placeholder */:
|
|
108876
|
+
emitPlaceholder(hint, node, snippet);
|
|
108877
|
+
break;
|
|
108878
|
+
case 0 /* TabStop */:
|
|
108879
|
+
emitTabStop(snippet);
|
|
108880
|
+
break;
|
|
108881
|
+
}
|
|
108882
|
+
}
|
|
108883
|
+
function emitPlaceholder(hint, node, snippet) {
|
|
108884
|
+
nonEscapingWrite("${" + snippet.order + ":"); // `${2:`
|
|
108885
|
+
pipelineEmitWithHintWorker(hint, node, /*allowSnippets*/ false); // `...`
|
|
108886
|
+
nonEscapingWrite("}"); // `}`
|
|
108887
|
+
// `${2:...}`
|
|
108888
|
+
}
|
|
108889
|
+
function emitTabStop(snippet) {
|
|
108890
|
+
nonEscapingWrite("$" + snippet.order);
|
|
108891
|
+
}
|
|
108892
|
+
//
|
|
108723
108893
|
// Identifiers
|
|
108724
108894
|
//
|
|
108725
108895
|
function emitIdentifier(node) {
|
|
@@ -110958,6 +111128,15 @@ var ts;
|
|
|
110958
111128
|
function writeProperty(s) {
|
|
110959
111129
|
writer.writeProperty(s);
|
|
110960
111130
|
}
|
|
111131
|
+
function nonEscapingWrite(s) {
|
|
111132
|
+
// This should be defined in a snippet-escaping text writer.
|
|
111133
|
+
if (writer.nonEscapingWrite) {
|
|
111134
|
+
writer.nonEscapingWrite(s);
|
|
111135
|
+
}
|
|
111136
|
+
else {
|
|
111137
|
+
writer.write(s);
|
|
111138
|
+
}
|
|
111139
|
+
}
|
|
110961
111140
|
function writeLine(count) {
|
|
110962
111141
|
if (count === void 0) { count = 1; }
|
|
110963
111142
|
for (var i = 0; i < count; i++) {
|
|
@@ -114061,8 +114240,8 @@ var ts;
|
|
|
114061
114240
|
var typesReferenceDirectives = ts.map(newSourceFile.typeReferenceDirectives, function (ref) { return ts.toFileNameLowerCase(ref.fileName); });
|
|
114062
114241
|
var typeReferenceResolutions = resolveTypeReferenceDirectiveNamesWorker(typesReferenceDirectives, newSourceFile);
|
|
114063
114242
|
// ensure that types resolutions are still correct
|
|
114064
|
-
var
|
|
114065
|
-
if (
|
|
114243
|
+
var typeReferenceResolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, oldSourceFile, ts.typeDirectiveIsEqualTo);
|
|
114244
|
+
if (typeReferenceResolutionsChanged) {
|
|
114066
114245
|
structureIsReused = 1 /* SafeModules */;
|
|
114067
114246
|
newSourceFile.resolvedTypeReferenceDirectiveNames = ts.zipToModeAwareCache(newSourceFile, typesReferenceDirectives, typeReferenceResolutions);
|
|
114068
114247
|
}
|
|
@@ -115350,6 +115529,21 @@ var ts;
|
|
|
115350
115529
|
return resolvedRef;
|
|
115351
115530
|
}
|
|
115352
115531
|
function verifyCompilerOptions() {
|
|
115532
|
+
var isNightly = ts.stringContains(ts.version, "-dev");
|
|
115533
|
+
if (!isNightly) {
|
|
115534
|
+
if (ts.getEmitModuleKind(options) === ts.ModuleKind.Node12) {
|
|
115535
|
+
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");
|
|
115536
|
+
}
|
|
115537
|
+
else if (ts.getEmitModuleKind(options) === ts.ModuleKind.NodeNext) {
|
|
115538
|
+
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");
|
|
115539
|
+
}
|
|
115540
|
+
else if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node12) {
|
|
115541
|
+
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");
|
|
115542
|
+
}
|
|
115543
|
+
else if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
|
|
115544
|
+
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");
|
|
115545
|
+
}
|
|
115546
|
+
}
|
|
115353
115547
|
if (options.strictPropertyInitialization && !ts.getStrictOptionValue(options, "strictNullChecks")) {
|
|
115354
115548
|
createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "strictPropertyInitialization", "strictNullChecks");
|
|
115355
115549
|
}
|
|
@@ -115828,8 +116022,8 @@ var ts;
|
|
|
115828
116022
|
function createDiagnosticForOptionName(message, option1, option2, option3) {
|
|
115829
116023
|
createDiagnosticForOption(/*onKey*/ true, option1, option2, message, option1, option2, option3);
|
|
115830
116024
|
}
|
|
115831
|
-
function createOptionValueDiagnostic(option1, message, arg0) {
|
|
115832
|
-
createDiagnosticForOption(/*onKey*/ false, option1, /*option2*/ undefined, message, arg0);
|
|
116025
|
+
function createOptionValueDiagnostic(option1, message, arg0, arg1) {
|
|
116026
|
+
createDiagnosticForOption(/*onKey*/ false, option1, /*option2*/ undefined, message, arg0, arg1);
|
|
115833
116027
|
}
|
|
115834
116028
|
function createDiagnosticForReference(sourceFile, index, message, arg0, arg1) {
|
|
115835
116029
|
var referencesSyntax = ts.firstDefined(ts.getTsConfigPropArray(sourceFile || options.configFile, "references"), function (property) { return ts.isArrayLiteralExpression(property.initializer) ? property.initializer : undefined; });
|
|
@@ -118073,6 +118267,9 @@ var ts;
|
|
|
118073
118267
|
else {
|
|
118074
118268
|
resolution = loader(name, containingFile, compilerOptions, ((_c = resolutionHost.getCompilerHost) === null || _c === void 0 ? void 0 : _c.call(resolutionHost)) || resolutionHost, redirectedReference, containingSourceFile);
|
|
118075
118269
|
perDirectoryResolution.set(name, mode, resolution);
|
|
118270
|
+
if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
|
|
118271
|
+
resolutionHost.onDiscoveredSymlink();
|
|
118272
|
+
}
|
|
118076
118273
|
}
|
|
118077
118274
|
resolutionsInFile.set(name, mode, resolution);
|
|
118078
118275
|
watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName);
|
|
@@ -118541,6 +118738,11 @@ var ts;
|
|
|
118541
118738
|
}
|
|
118542
118739
|
}
|
|
118543
118740
|
ts.createResolutionCache = createResolutionCache;
|
|
118741
|
+
function resolutionIsSymlink(resolution) {
|
|
118742
|
+
var _a, _b;
|
|
118743
|
+
return !!(((_a = resolution.resolvedModule) === null || _a === void 0 ? void 0 : _a.originalPath) ||
|
|
118744
|
+
((_b = resolution.resolvedTypeReferenceDirective) === null || _b === void 0 ? void 0 : _b.originalPath));
|
|
118745
|
+
}
|
|
118544
118746
|
})(ts || (ts = {}));
|
|
118545
118747
|
// Used by importFixes, getEditsForFileRename, and declaration emit to synthesize import module specifiers.
|
|
118546
118748
|
/* @internal */
|
|
@@ -125595,6 +125797,16 @@ var ts;
|
|
|
125595
125797
|
return decisionFromFile !== null && decisionFromFile !== void 0 ? decisionFromFile : program.usesUriStyleNodeCoreModules;
|
|
125596
125798
|
}
|
|
125597
125799
|
ts.shouldUseUriStyleNodeCoreModules = shouldUseUriStyleNodeCoreModules;
|
|
125800
|
+
function getNewLineKind(newLineCharacter) {
|
|
125801
|
+
return newLineCharacter === "\n" ? 1 /* LineFeed */ : 0 /* CarriageReturnLineFeed */;
|
|
125802
|
+
}
|
|
125803
|
+
ts.getNewLineKind = getNewLineKind;
|
|
125804
|
+
function diagnosticToString(diag) {
|
|
125805
|
+
return ts.isArray(diag)
|
|
125806
|
+
? ts.formatStringFromArgs(ts.getLocaleSpecificMessage(diag[0]), diag.slice(1))
|
|
125807
|
+
: ts.getLocaleSpecificMessage(diag);
|
|
125808
|
+
}
|
|
125809
|
+
ts.diagnosticToString = diagnosticToString;
|
|
125598
125810
|
// #endregion
|
|
125599
125811
|
})(ts || (ts = {}));
|
|
125600
125812
|
/*@internal*/
|
|
@@ -127192,7 +127404,7 @@ var ts;
|
|
|
127192
127404
|
(function (Completions) {
|
|
127193
127405
|
var StringCompletions;
|
|
127194
127406
|
(function (StringCompletions) {
|
|
127195
|
-
function getStringLiteralCompletions(sourceFile, position, contextToken,
|
|
127407
|
+
function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences) {
|
|
127196
127408
|
if (ts.isInReferenceComment(sourceFile, position)) {
|
|
127197
127409
|
var entries = getTripleSlashReferenceCompletion(sourceFile, position, options, host);
|
|
127198
127410
|
return entries && convertPathCompletions(entries);
|
|
@@ -127200,12 +127412,12 @@ var ts;
|
|
|
127200
127412
|
if (ts.isInString(sourceFile, position, contextToken)) {
|
|
127201
127413
|
if (!contextToken || !ts.isStringLiteralLike(contextToken))
|
|
127202
127414
|
return undefined;
|
|
127203
|
-
var entries = getStringLiteralCompletionEntries(sourceFile, contextToken, position,
|
|
127204
|
-
return convertStringLiteralCompletions(entries, contextToken, sourceFile,
|
|
127415
|
+
var entries = getStringLiteralCompletionEntries(sourceFile, contextToken, position, program.getTypeChecker(), options, host, preferences);
|
|
127416
|
+
return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program, log, options, preferences);
|
|
127205
127417
|
}
|
|
127206
127418
|
}
|
|
127207
127419
|
StringCompletions.getStringLiteralCompletions = getStringLiteralCompletions;
|
|
127208
|
-
function convertStringLiteralCompletions(completion, contextToken, sourceFile,
|
|
127420
|
+
function convertStringLiteralCompletions(completion, contextToken, sourceFile, host, program, log, options, preferences) {
|
|
127209
127421
|
if (completion === undefined) {
|
|
127210
127422
|
return undefined;
|
|
127211
127423
|
}
|
|
@@ -127215,7 +127427,7 @@ var ts;
|
|
|
127215
127427
|
return convertPathCompletions(completion.paths);
|
|
127216
127428
|
case 1 /* Properties */: {
|
|
127217
127429
|
var entries = [];
|
|
127218
|
-
Completions.getCompletionEntriesFromSymbols(completion.symbols, entries, contextToken, contextToken, sourceFile, sourceFile,
|
|
127430
|
+
Completions.getCompletionEntriesFromSymbols(completion.symbols, entries, contextToken, contextToken, sourceFile, sourceFile, host, program, 99 /* ESNext */, log, 4 /* String */, preferences, options); // Target will not be used, so arbitrary
|
|
127219
127431
|
return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: completion.hasIndexSignature, optionalReplacementSpan: optionalReplacementSpan, entries: entries };
|
|
127220
127432
|
}
|
|
127221
127433
|
case 2 /* Types */: {
|
|
@@ -127941,6 +128153,8 @@ var ts;
|
|
|
127941
128153
|
(function (CompletionSource) {
|
|
127942
128154
|
/** Completions that require `this.` insertion text */
|
|
127943
128155
|
CompletionSource["ThisProperty"] = "ThisProperty/";
|
|
128156
|
+
/** Auto-import that comes attached to a class member snippet */
|
|
128157
|
+
CompletionSource["ClassMemberSnippet"] = "ClassMemberSnippet/";
|
|
127944
128158
|
})(CompletionSource = Completions.CompletionSource || (Completions.CompletionSource = {}));
|
|
127945
128159
|
var SymbolOriginInfoKind;
|
|
127946
128160
|
(function (SymbolOriginInfoKind) {
|
|
@@ -128049,7 +128263,6 @@ var ts;
|
|
|
128049
128263
|
}
|
|
128050
128264
|
// If the request is a continuation of an earlier `isIncomplete` response,
|
|
128051
128265
|
// we can continue it from the cached previous response.
|
|
128052
|
-
var typeChecker = program.getTypeChecker();
|
|
128053
128266
|
var compilerOptions = program.getCompilerOptions();
|
|
128054
128267
|
var incompleteCompletionsCache = preferences.allowIncompleteCompletions ? (_a = host.getIncompleteCompletionsCache) === null || _a === void 0 ? void 0 : _a.call(host) : undefined;
|
|
128055
128268
|
if (incompleteCompletionsCache && completionKind === 3 /* TriggerForIncompleteCompletions */ && previousToken && ts.isIdentifier(previousToken)) {
|
|
@@ -128061,7 +128274,7 @@ var ts;
|
|
|
128061
128274
|
else {
|
|
128062
128275
|
incompleteCompletionsCache === null || incompleteCompletionsCache === void 0 ? void 0 : incompleteCompletionsCache.clear();
|
|
128063
128276
|
}
|
|
128064
|
-
var stringCompletions = Completions.StringCompletions.getStringLiteralCompletions(sourceFile, position, previousToken,
|
|
128277
|
+
var stringCompletions = Completions.StringCompletions.getStringLiteralCompletions(sourceFile, position, previousToken, compilerOptions, host, program, log, preferences);
|
|
128065
128278
|
if (stringCompletions) {
|
|
128066
128279
|
return stringCompletions;
|
|
128067
128280
|
}
|
|
@@ -128075,7 +128288,7 @@ var ts;
|
|
|
128075
128288
|
}
|
|
128076
128289
|
switch (completionData.kind) {
|
|
128077
128290
|
case 0 /* Data */:
|
|
128078
|
-
var response = completionInfoFromData(sourceFile,
|
|
128291
|
+
var response = completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences);
|
|
128079
128292
|
if (response === null || response === void 0 ? void 0 : response.isIncomplete) {
|
|
128080
128293
|
incompleteCompletionsCache === null || incompleteCompletionsCache === void 0 ? void 0 : incompleteCompletionsCache.set(response);
|
|
128081
128294
|
}
|
|
@@ -128172,7 +128385,7 @@ var ts;
|
|
|
128172
128385
|
// StringLiteralLike locations are handled separately in stringCompletions.ts
|
|
128173
128386
|
return (location === null || location === void 0 ? void 0 : location.kind) === 79 /* Identifier */ ? ts.createTextSpanFromNode(location) : undefined;
|
|
128174
128387
|
}
|
|
128175
|
-
function completionInfoFromData(sourceFile,
|
|
128388
|
+
function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences) {
|
|
128176
128389
|
var symbols = completionData.symbols, contextToken = completionData.contextToken, completionKind = completionData.completionKind, isInSnippetScope = completionData.isInSnippetScope, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, propertyAccessToConvert = completionData.propertyAccessToConvert, keywordFilters = completionData.keywordFilters, literals = completionData.literals, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, recommendedCompletion = completionData.recommendedCompletion, isJsxInitializer = completionData.isJsxInitializer, isTypeOnlyLocation = completionData.isTypeOnlyLocation, isJsxIdentifierExpected = completionData.isJsxIdentifierExpected, importCompletionNode = completionData.importCompletionNode, insideJsDocTagTypeExpression = completionData.insideJsDocTagTypeExpression, symbolToSortTextIdMap = completionData.symbolToSortTextIdMap, hasUnresolvedAutoImports = completionData.hasUnresolvedAutoImports;
|
|
128177
128390
|
// Verify if the file is JSX language variant
|
|
128178
128391
|
if (ts.getLanguageVariant(sourceFile.scriptKind) === 1 /* JSX */) {
|
|
@@ -128184,7 +128397,7 @@ var ts;
|
|
|
128184
128397
|
var entries = [];
|
|
128185
128398
|
if (isUncheckedFile(sourceFile, compilerOptions)) {
|
|
128186
128399
|
var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries,
|
|
128187
|
-
/*replacementToken*/ undefined, contextToken, location, sourceFile,
|
|
128400
|
+
/*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextIdMap);
|
|
128188
128401
|
getJSCompletionEntries(sourceFile, location.pos, uniqueNames, ts.getEmitScriptTarget(compilerOptions), entries); // TODO: GH#18217
|
|
128189
128402
|
}
|
|
128190
128403
|
else {
|
|
@@ -128192,7 +128405,7 @@ var ts;
|
|
|
128192
128405
|
return undefined;
|
|
128193
128406
|
}
|
|
128194
128407
|
getCompletionEntriesFromSymbols(symbols, entries,
|
|
128195
|
-
/*replacementToken*/ undefined, contextToken, location, sourceFile,
|
|
128408
|
+
/*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextIdMap);
|
|
128196
128409
|
}
|
|
128197
128410
|
if (keywordFilters !== 0 /* None */) {
|
|
128198
128411
|
var entryNames = new ts.Set(entries.map(function (e) { return e.name; }));
|
|
@@ -128298,14 +128511,16 @@ var ts;
|
|
|
128298
128511
|
function createCompletionEntryForLiteral(sourceFile, preferences, literal) {
|
|
128299
128512
|
return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: SortText.LocationPriority };
|
|
128300
128513
|
}
|
|
128301
|
-
function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile,
|
|
128302
|
-
var _a;
|
|
128514
|
+
function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importCompletionNode, useSemicolons, options, preferences, completionKind) {
|
|
128515
|
+
var _a, _b;
|
|
128303
128516
|
var insertText;
|
|
128304
128517
|
var replacementSpan = ts.getReplacementSpanForContextToken(replacementToken);
|
|
128305
128518
|
var data;
|
|
128306
128519
|
var isSnippet;
|
|
128520
|
+
var source = getSourceFromOrigin(origin);
|
|
128307
128521
|
var sourceDisplay;
|
|
128308
128522
|
var hasAction;
|
|
128523
|
+
var typeChecker = program.getTypeChecker();
|
|
128309
128524
|
var insertQuestionDot = origin && originIsNullableMember(origin);
|
|
128310
128525
|
var useBraces = origin && originIsSymbolMember(origin) || needsConvertPropertyAccess;
|
|
128311
128526
|
if (origin && originIsThisType(origin)) {
|
|
@@ -128356,12 +128571,16 @@ var ts;
|
|
|
128356
128571
|
isSnippet = preferences.includeCompletionsWithSnippetText ? true : undefined;
|
|
128357
128572
|
}
|
|
128358
128573
|
}
|
|
128359
|
-
if (
|
|
128360
|
-
|
|
128361
|
-
|
|
128362
|
-
|
|
128363
|
-
|
|
128364
|
-
|
|
128574
|
+
if (preferences.includeCompletionsWithClassMemberSnippets &&
|
|
128575
|
+
preferences.includeCompletionsWithInsertText &&
|
|
128576
|
+
completionKind === 3 /* MemberLike */ &&
|
|
128577
|
+
isClassLikeMemberCompletion(symbol, location)) {
|
|
128578
|
+
var importAdder = void 0;
|
|
128579
|
+
(_b = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, contextToken), insertText = _b.insertText, isSnippet = _b.isSnippet, importAdder = _b.importAdder);
|
|
128580
|
+
if (importAdder === null || importAdder === void 0 ? void 0 : importAdder.hasFixes()) {
|
|
128581
|
+
hasAction = true;
|
|
128582
|
+
source = CompletionSource.ClassMemberSnippet;
|
|
128583
|
+
}
|
|
128365
128584
|
}
|
|
128366
128585
|
var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, location);
|
|
128367
128586
|
if (kind === "JSX attribute" /* jsxAttribute */ && preferences.includeCompletionsWithSnippetText && preferences.jsxAttributeCompletionStyle && preferences.jsxAttributeCompletionStyle !== "none") {
|
|
@@ -128373,7 +128592,7 @@ var ts;
|
|
|
128373
128592
|
&& !(type.flags & 1048576 /* Union */ && ts.find(type.types, function (type) { return !!(type.flags & 528 /* BooleanLike */); }))) {
|
|
128374
128593
|
if (type.flags & 402653316 /* StringLike */ || (type.flags & 1048576 /* Union */ && ts.every(type.types, function (type) { return !!(type.flags & (402653316 /* StringLike */ | 32768 /* Undefined */)); }))) {
|
|
128375
128594
|
// If is string like or undefined use quotes
|
|
128376
|
-
insertText = escapeSnippetText(name) + "=" + ts.quote(sourceFile, preferences, "$1");
|
|
128595
|
+
insertText = ts.escapeSnippetText(name) + "=" + ts.quote(sourceFile, preferences, "$1");
|
|
128377
128596
|
isSnippet = true;
|
|
128378
128597
|
}
|
|
128379
128598
|
else {
|
|
@@ -128382,13 +128601,20 @@ var ts;
|
|
|
128382
128601
|
}
|
|
128383
128602
|
}
|
|
128384
128603
|
if (useBraces_1) {
|
|
128385
|
-
insertText = escapeSnippetText(name) + "={$1}";
|
|
128604
|
+
insertText = ts.escapeSnippetText(name) + "={$1}";
|
|
128386
128605
|
isSnippet = true;
|
|
128387
128606
|
}
|
|
128388
128607
|
if (isSnippet) {
|
|
128389
128608
|
replacementSpan = ts.createTextSpanFromNode(location, sourceFile);
|
|
128390
128609
|
}
|
|
128391
128610
|
}
|
|
128611
|
+
if (insertText !== undefined && !preferences.includeCompletionsWithInsertText) {
|
|
128612
|
+
return undefined;
|
|
128613
|
+
}
|
|
128614
|
+
if (originIsExport(origin) || originIsResolvedExport(origin)) {
|
|
128615
|
+
data = originToCompletionEntryData(origin);
|
|
128616
|
+
hasAction = !importCompletionNode;
|
|
128617
|
+
}
|
|
128392
128618
|
// TODO(drosen): Right now we just permit *all* semantic meanings when calling
|
|
128393
128619
|
// 'getSymbolKind' which is permissible given that it is backwards compatible; but
|
|
128394
128620
|
// really we should consider passing the meaning for the node so that we don't report
|
|
@@ -128401,7 +128627,7 @@ var ts;
|
|
|
128401
128627
|
kind: kind,
|
|
128402
128628
|
kindModifiers: ts.SymbolDisplay.getSymbolModifiers(typeChecker, symbol),
|
|
128403
128629
|
sortText: sortText,
|
|
128404
|
-
source:
|
|
128630
|
+
source: source,
|
|
128405
128631
|
hasAction: hasAction ? true : undefined,
|
|
128406
128632
|
isRecommended: isRecommendedCompletionMatch(symbol, recommendedCompletion, typeChecker) || undefined,
|
|
128407
128633
|
insertText: insertText,
|
|
@@ -128413,8 +128639,172 @@ var ts;
|
|
|
128413
128639
|
data: data,
|
|
128414
128640
|
};
|
|
128415
128641
|
}
|
|
128416
|
-
function
|
|
128417
|
-
|
|
128642
|
+
function isClassLikeMemberCompletion(symbol, location) {
|
|
128643
|
+
// TODO: support JS files.
|
|
128644
|
+
if (ts.isInJSFile(location)) {
|
|
128645
|
+
return false;
|
|
128646
|
+
}
|
|
128647
|
+
// Completion symbol must be for a class member.
|
|
128648
|
+
var memberFlags = 106500 /* ClassMember */
|
|
128649
|
+
& 900095 /* EnumMemberExcludes */;
|
|
128650
|
+
/* In
|
|
128651
|
+
`class C {
|
|
128652
|
+
|
|
|
128653
|
+
}`
|
|
128654
|
+
`location` is a class-like declaration.
|
|
128655
|
+
In
|
|
128656
|
+
`class C {
|
|
128657
|
+
m|
|
|
128658
|
+
}`
|
|
128659
|
+
`location` is an identifier,
|
|
128660
|
+
`location.parent` is a class element declaration,
|
|
128661
|
+
and `location.parent.parent` is a class-like declaration.
|
|
128662
|
+
In
|
|
128663
|
+
`abstract class C {
|
|
128664
|
+
abstract
|
|
128665
|
+
abstract m|
|
|
128666
|
+
}`
|
|
128667
|
+
`location` is a syntax list (with modifiers as children),
|
|
128668
|
+
and `location.parent` is a class-like declaration.
|
|
128669
|
+
*/
|
|
128670
|
+
return !!(symbol.flags & memberFlags) &&
|
|
128671
|
+
(ts.isClassLike(location) ||
|
|
128672
|
+
(location.parent &&
|
|
128673
|
+
location.parent.parent &&
|
|
128674
|
+
ts.isClassElement(location.parent) &&
|
|
128675
|
+
location === location.parent.name &&
|
|
128676
|
+
ts.isClassLike(location.parent.parent)) ||
|
|
128677
|
+
(location.parent &&
|
|
128678
|
+
ts.isSyntaxList(location) &&
|
|
128679
|
+
ts.isClassLike(location.parent)));
|
|
128680
|
+
}
|
|
128681
|
+
function getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, contextToken) {
|
|
128682
|
+
var classLikeDeclaration = ts.findAncestor(location, ts.isClassLike);
|
|
128683
|
+
if (!classLikeDeclaration) {
|
|
128684
|
+
return { insertText: name };
|
|
128685
|
+
}
|
|
128686
|
+
var isSnippet;
|
|
128687
|
+
var insertText = name;
|
|
128688
|
+
var checker = program.getTypeChecker();
|
|
128689
|
+
var sourceFile = location.getSourceFile();
|
|
128690
|
+
var printer = createSnippetPrinter({
|
|
128691
|
+
removeComments: true,
|
|
128692
|
+
module: options.module,
|
|
128693
|
+
target: options.target,
|
|
128694
|
+
omitTrailingSemicolon: true,
|
|
128695
|
+
newLine: ts.getNewLineKind(ts.getNewLineCharacter(options, ts.maybeBind(host, host.getNewLine))),
|
|
128696
|
+
});
|
|
128697
|
+
var importAdder = ts.codefix.createImportAdder(sourceFile, program, preferences, host);
|
|
128698
|
+
var body;
|
|
128699
|
+
if (preferences.includeCompletionsWithSnippetText) {
|
|
128700
|
+
isSnippet = true;
|
|
128701
|
+
// We are adding a tabstop (i.e. `$0`) in the body of the suggested member,
|
|
128702
|
+
// if it has one, so that the cursor ends up in the body once the completion is inserted.
|
|
128703
|
+
// Note: this assumes we won't have more than one body in the completion nodes, which should be the case.
|
|
128704
|
+
var emptyStatement = ts.factory.createExpressionStatement(ts.factory.createIdentifier(""));
|
|
128705
|
+
ts.setSnippetElement(emptyStatement, { kind: 0 /* TabStop */, order: 0 });
|
|
128706
|
+
body = ts.factory.createBlock([emptyStatement], /* multiline */ true);
|
|
128707
|
+
}
|
|
128708
|
+
else {
|
|
128709
|
+
body = ts.factory.createBlock([], /* multiline */ true);
|
|
128710
|
+
}
|
|
128711
|
+
var modifiers = 0 /* None */;
|
|
128712
|
+
// Whether the suggested member should be abstract.
|
|
128713
|
+
// e.g. in `abstract class C { abstract | }`, we should offer abstract method signatures at position `|`.
|
|
128714
|
+
// Note: We are relying on checking if the context token is `abstract`,
|
|
128715
|
+
// since other visibility modifiers (e.g. `protected`) should come *before* `abstract`.
|
|
128716
|
+
// However, that is not true for the e.g. `override` modifier, so this check has its limitations.
|
|
128717
|
+
var isAbstract = contextToken && isModifierLike(contextToken) === 126 /* AbstractKeyword */;
|
|
128718
|
+
var completionNodes = [];
|
|
128719
|
+
ts.codefix.addNewNodeForMemberSymbol(symbol, classLikeDeclaration, sourceFile, { program: program, host: host }, preferences, importAdder,
|
|
128720
|
+
// `addNewNodeForMemberSymbol` calls this callback function for each new member node
|
|
128721
|
+
// it adds for the given member symbol.
|
|
128722
|
+
// We store these member nodes in the `completionNodes` array.
|
|
128723
|
+
// Note: there might be:
|
|
128724
|
+
// - No nodes if `addNewNodeForMemberSymbol` cannot figure out a node for the member;
|
|
128725
|
+
// - One node;
|
|
128726
|
+
// - More than one node if the member is overloaded (e.g. a method with overload signatures).
|
|
128727
|
+
function (node) {
|
|
128728
|
+
var requiredModifiers = 0 /* None */;
|
|
128729
|
+
if (isAbstract) {
|
|
128730
|
+
requiredModifiers |= 128 /* Abstract */;
|
|
128731
|
+
}
|
|
128732
|
+
if (ts.isClassElement(node)
|
|
128733
|
+
&& checker.getMemberOverrideModifierStatus(classLikeDeclaration, node) === 1 /* NeedsOverride */) {
|
|
128734
|
+
requiredModifiers |= 16384 /* Override */;
|
|
128735
|
+
}
|
|
128736
|
+
var presentModifiers = 0 /* None */;
|
|
128737
|
+
if (!completionNodes.length) {
|
|
128738
|
+
// Omit already present modifiers from the first completion node/signature.
|
|
128739
|
+
if (contextToken) {
|
|
128740
|
+
presentModifiers = getPresentModifiers(contextToken);
|
|
128741
|
+
}
|
|
128742
|
+
// Keep track of added missing required modifiers and modifiers already present.
|
|
128743
|
+
// This is needed when we have overloaded signatures,
|
|
128744
|
+
// so this callback will be called for multiple nodes/signatures,
|
|
128745
|
+
// and we need to make sure the modifiers are uniform for all nodes/signatures.
|
|
128746
|
+
modifiers = node.modifierFlagsCache | requiredModifiers | presentModifiers;
|
|
128747
|
+
}
|
|
128748
|
+
node = ts.factory.updateModifiers(node, modifiers & (~presentModifiers));
|
|
128749
|
+
completionNodes.push(node);
|
|
128750
|
+
}, body, isAbstract);
|
|
128751
|
+
if (completionNodes.length) {
|
|
128752
|
+
insertText = printer.printSnippetList(1 /* MultiLine */, ts.factory.createNodeArray(completionNodes), sourceFile);
|
|
128753
|
+
}
|
|
128754
|
+
return { insertText: insertText, isSnippet: isSnippet, importAdder: importAdder };
|
|
128755
|
+
}
|
|
128756
|
+
function getPresentModifiers(contextToken) {
|
|
128757
|
+
var modifiers = 0 /* None */;
|
|
128758
|
+
var contextMod;
|
|
128759
|
+
/*
|
|
128760
|
+
Cases supported:
|
|
128761
|
+
In
|
|
128762
|
+
`class C {
|
|
128763
|
+
public abstract |
|
|
128764
|
+
}`
|
|
128765
|
+
`contextToken` is ``abstract`` (as an identifier),
|
|
128766
|
+
`contextToken.parent` is property declaration,
|
|
128767
|
+
`location` is class declaration ``class C { ... }``.
|
|
128768
|
+
In
|
|
128769
|
+
`class C {
|
|
128770
|
+
protected override m|
|
|
128771
|
+
}`
|
|
128772
|
+
`contextToken` is ``override`` (as a keyword),
|
|
128773
|
+
`contextToken.parent` is property declaration,
|
|
128774
|
+
`location` is identifier ``m``,
|
|
128775
|
+
`location.parent` is property declaration ``protected override m``,
|
|
128776
|
+
`location.parent.parent` is class declaration ``class C { ... }``.
|
|
128777
|
+
*/
|
|
128778
|
+
if (contextMod = isModifierLike(contextToken)) {
|
|
128779
|
+
modifiers |= ts.modifierToFlag(contextMod);
|
|
128780
|
+
}
|
|
128781
|
+
if (ts.isPropertyDeclaration(contextToken.parent)) {
|
|
128782
|
+
modifiers |= ts.modifiersToFlags(contextToken.parent.modifiers);
|
|
128783
|
+
}
|
|
128784
|
+
return modifiers;
|
|
128785
|
+
}
|
|
128786
|
+
function isModifierLike(node) {
|
|
128787
|
+
if (ts.isModifier(node)) {
|
|
128788
|
+
return node.kind;
|
|
128789
|
+
}
|
|
128790
|
+
if (ts.isIdentifier(node) && node.originalKeywordKind && ts.isModifierKind(node.originalKeywordKind)) {
|
|
128791
|
+
return node.originalKeywordKind;
|
|
128792
|
+
}
|
|
128793
|
+
return undefined;
|
|
128794
|
+
}
|
|
128795
|
+
function createSnippetPrinter(printerOptions) {
|
|
128796
|
+
var printer = ts.createPrinter(printerOptions);
|
|
128797
|
+
var baseWriter = ts.createTextWriter(ts.getNewLineCharacter(printerOptions));
|
|
128798
|
+
var writer = __assign(__assign({}, baseWriter), { write: function (s) { return baseWriter.write(ts.escapeSnippetText(s)); }, nonEscapingWrite: baseWriter.write, writeLiteral: function (s) { return baseWriter.writeLiteral(ts.escapeSnippetText(s)); }, writeStringLiteral: function (s) { return baseWriter.writeStringLiteral(ts.escapeSnippetText(s)); }, writeSymbol: function (s, symbol) { return baseWriter.writeSymbol(ts.escapeSnippetText(s), symbol); }, writeParameter: function (s) { return baseWriter.writeParameter(ts.escapeSnippetText(s)); }, writeComment: function (s) { return baseWriter.writeComment(ts.escapeSnippetText(s)); }, writeProperty: function (s) { return baseWriter.writeProperty(ts.escapeSnippetText(s)); } });
|
|
128799
|
+
return {
|
|
128800
|
+
printSnippetList: printSnippetList,
|
|
128801
|
+
};
|
|
128802
|
+
/* Snippet-escaping version of `printer.printList`. */
|
|
128803
|
+
function printSnippetList(format, list, sourceFile) {
|
|
128804
|
+
writer.clear();
|
|
128805
|
+
printer.writeList(format, list, sourceFile, writer);
|
|
128806
|
+
return writer.getText();
|
|
128807
|
+
}
|
|
128418
128808
|
}
|
|
128419
128809
|
function originToCompletionEntryData(origin) {
|
|
128420
128810
|
var ambientModuleName = origin.fileName ? undefined : ts.stripQuotes(origin.moduleSymbol.name);
|
|
@@ -128482,10 +128872,10 @@ var ts;
|
|
|
128482
128872
|
var importSpecifierTypeOnlyText = isImportSpecifierTypeOnly ? ts.tokenToString(151 /* TypeKeyword */) + " " : "";
|
|
128483
128873
|
var suffix = useSemicolons ? ";" : "";
|
|
128484
128874
|
switch (importKind) {
|
|
128485
|
-
case 3 /* CommonJS */: return { replacementSpan: replacementSpan, insertText: "import" + topLevelTypeOnlyText + escapeSnippetText(name) + tabStop + " = require(" + quotedModuleSpecifier + ")" + suffix };
|
|
128486
|
-
case 1 /* Default */: return { replacementSpan: replacementSpan, insertText: "import" + topLevelTypeOnlyText + escapeSnippetText(name) + tabStop + " from " + quotedModuleSpecifier + suffix };
|
|
128487
|
-
case 2 /* Namespace */: return { replacementSpan: replacementSpan, insertText: "import" + topLevelTypeOnlyText + "* as " + escapeSnippetText(name) + " from " + quotedModuleSpecifier + suffix };
|
|
128488
|
-
case 0 /* Named */: return { replacementSpan: replacementSpan, insertText: "import" + topLevelTypeOnlyText + "{ " + importSpecifierTypeOnlyText + escapeSnippetText(name) + tabStop + " } from " + quotedModuleSpecifier + suffix };
|
|
128875
|
+
case 3 /* CommonJS */: return { replacementSpan: replacementSpan, insertText: "import" + topLevelTypeOnlyText + ts.escapeSnippetText(name) + tabStop + " = require(" + quotedModuleSpecifier + ")" + suffix };
|
|
128876
|
+
case 1 /* Default */: return { replacementSpan: replacementSpan, insertText: "import" + topLevelTypeOnlyText + ts.escapeSnippetText(name) + tabStop + " from " + quotedModuleSpecifier + suffix };
|
|
128877
|
+
case 2 /* Namespace */: return { replacementSpan: replacementSpan, insertText: "import" + topLevelTypeOnlyText + "* as " + ts.escapeSnippetText(name) + " from " + quotedModuleSpecifier + suffix };
|
|
128878
|
+
case 0 /* Named */: return { replacementSpan: replacementSpan, insertText: "import" + topLevelTypeOnlyText + "{ " + importSpecifierTypeOnlyText + ts.escapeSnippetText(name) + tabStop + " } from " + quotedModuleSpecifier + suffix };
|
|
128489
128879
|
}
|
|
128490
128880
|
}
|
|
128491
128881
|
function quotePropertyName(sourceFile, preferences, name) {
|
|
@@ -128509,11 +128899,12 @@ var ts;
|
|
|
128509
128899
|
return CompletionSource.ThisProperty;
|
|
128510
128900
|
}
|
|
128511
128901
|
}
|
|
128512
|
-
function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, sourceFile,
|
|
128902
|
+
function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, sourceFile, host, program, target, log, kind, preferences, compilerOptions, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextIdMap) {
|
|
128513
128903
|
var _a;
|
|
128514
128904
|
var start = ts.timestamp();
|
|
128515
128905
|
var variableDeclaration = getVariableDeclaration(location);
|
|
128516
128906
|
var useSemicolons = ts.probablyUsesSemicolons(sourceFile);
|
|
128907
|
+
var typeChecker = program.getTypeChecker();
|
|
128517
128908
|
// Tracks unique names.
|
|
128518
128909
|
// Value is set to false for global variables or completions from external module exports, because we can have multiple of those;
|
|
128519
128910
|
// true otherwise. Based on the order we add things we will always see locals first, then globals, then module exports.
|
|
@@ -128529,7 +128920,7 @@ var ts;
|
|
|
128529
128920
|
var name = info.name, needsConvertPropertyAccess = info.needsConvertPropertyAccess;
|
|
128530
128921
|
var sortTextId = (_a = symbolToSortTextIdMap === null || symbolToSortTextIdMap === void 0 ? void 0 : symbolToSortTextIdMap[ts.getSymbolId(symbol)]) !== null && _a !== void 0 ? _a : 11 /* LocationPriority */;
|
|
128531
128922
|
var sortText = (isDeprecated(symbol, typeChecker) ? 8 /* DeprecatedOffset */ + sortTextId : sortTextId).toString();
|
|
128532
|
-
var entry = createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile,
|
|
128923
|
+
var entry = createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importCompletionNode, useSemicolons, compilerOptions, preferences, kind);
|
|
128533
128924
|
if (!entry) {
|
|
128534
128925
|
continue;
|
|
128535
128926
|
}
|
|
@@ -128622,11 +129013,13 @@ var ts;
|
|
|
128622
129013
|
if (entryId.data) {
|
|
128623
129014
|
var autoImport = getAutoImportSymbolFromCompletionEntryData(entryId.name, entryId.data, program, host);
|
|
128624
129015
|
if (autoImport) {
|
|
129016
|
+
var _a = getRelevantTokens(position, sourceFile), contextToken_1 = _a.contextToken, previousToken_1 = _a.previousToken;
|
|
128625
129017
|
return {
|
|
128626
129018
|
type: "symbol",
|
|
128627
129019
|
symbol: autoImport.symbol,
|
|
128628
129020
|
location: ts.getTouchingPropertyName(sourceFile, position),
|
|
128629
|
-
previousToken:
|
|
129021
|
+
previousToken: previousToken_1,
|
|
129022
|
+
contextToken: contextToken_1,
|
|
128630
129023
|
isJsxInitializer: false,
|
|
128631
129024
|
isTypeOnlyLocation: false,
|
|
128632
129025
|
origin: autoImport.origin,
|
|
@@ -128641,7 +129034,7 @@ var ts;
|
|
|
128641
129034
|
if (completionData.kind !== 0 /* Data */) {
|
|
128642
129035
|
return { type: "request", request: completionData };
|
|
128643
129036
|
}
|
|
128644
|
-
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;
|
|
129037
|
+
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;
|
|
128645
129038
|
var literal = ts.find(literals, function (l) { return completionNameForLiteral(sourceFile, preferences, l) === entryId.name; });
|
|
128646
129039
|
if (literal !== undefined)
|
|
128647
129040
|
return { type: "literal", literal: literal };
|
|
@@ -128652,15 +129045,15 @@ var ts;
|
|
|
128652
129045
|
return ts.firstDefined(symbols, function (symbol, index) {
|
|
128653
129046
|
var origin = symbolToOriginInfoMap[index];
|
|
128654
129047
|
var info = getCompletionEntryDisplayNameForSymbol(symbol, ts.getEmitScriptTarget(compilerOptions), origin, completionKind, completionData.isJsxIdentifierExpected);
|
|
128655
|
-
return info && info.name === entryId.name && getSourceFromOrigin(origin) === entryId.source
|
|
128656
|
-
? { type: "symbol", symbol: symbol, location: location, origin: origin, previousToken: previousToken, isJsxInitializer: isJsxInitializer, isTypeOnlyLocation: isTypeOnlyLocation }
|
|
129048
|
+
return info && info.name === entryId.name && (entryId.source === CompletionSource.ClassMemberSnippet && symbol.flags & 106500 /* ClassMember */ || getSourceFromOrigin(origin) === entryId.source)
|
|
129049
|
+
? { type: "symbol", symbol: symbol, location: location, origin: origin, contextToken: contextToken, previousToken: previousToken, isJsxInitializer: isJsxInitializer, isTypeOnlyLocation: isTypeOnlyLocation }
|
|
128657
129050
|
: undefined;
|
|
128658
129051
|
}) || { type: "none" };
|
|
128659
129052
|
}
|
|
128660
129053
|
function getCompletionEntryDetails(program, log, sourceFile, position, entryId, host, formatContext, preferences, cancellationToken) {
|
|
128661
129054
|
var typeChecker = program.getTypeChecker();
|
|
128662
129055
|
var compilerOptions = program.getCompilerOptions();
|
|
128663
|
-
var name = entryId.name;
|
|
129056
|
+
var name = entryId.name, source = entryId.source, data = entryId.data;
|
|
128664
129057
|
var contextToken = ts.findPrecedingToken(position, sourceFile);
|
|
128665
129058
|
if (ts.isInString(sourceFile, position, contextToken)) {
|
|
128666
129059
|
return Completions.StringCompletions.getStringLiteralCompletionDetails(name, sourceFile, position, contextToken, typeChecker, compilerOptions, host, cancellationToken, preferences);
|
|
@@ -128684,8 +129077,8 @@ var ts;
|
|
|
128684
129077
|
}
|
|
128685
129078
|
}
|
|
128686
129079
|
case "symbol": {
|
|
128687
|
-
var symbol = symbolCompletion.symbol, location = symbolCompletion.location, origin = symbolCompletion.origin, previousToken = symbolCompletion.previousToken;
|
|
128688
|
-
var _a = getCompletionEntryCodeActionsAndSourceDisplay(origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences,
|
|
129080
|
+
var symbol = symbolCompletion.symbol, location = symbolCompletion.location, contextToken_2 = symbolCompletion.contextToken, origin = symbolCompletion.origin, previousToken = symbolCompletion.previousToken;
|
|
129081
|
+
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;
|
|
128689
129082
|
return createCompletionDetailsForSymbol(symbol, typeChecker, sourceFile, location, cancellationToken, codeActions, sourceDisplay); // TODO: GH#18217
|
|
128690
129083
|
}
|
|
128691
129084
|
case "literal": {
|
|
@@ -128714,14 +129107,27 @@ var ts;
|
|
|
128714
129107
|
return { name: name, kindModifiers: kindModifiers, kind: kind, displayParts: displayParts, documentation: documentation, tags: tags, codeActions: codeActions, source: source, sourceDisplay: source };
|
|
128715
129108
|
}
|
|
128716
129109
|
Completions.createCompletionDetails = createCompletionDetails;
|
|
128717
|
-
function getCompletionEntryCodeActionsAndSourceDisplay(origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data) {
|
|
129110
|
+
function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source) {
|
|
128718
129111
|
if (data === null || data === void 0 ? void 0 : data.moduleSpecifier) {
|
|
128719
|
-
var _a = getRelevantTokens(position, sourceFile),
|
|
128720
|
-
if (
|
|
129112
|
+
var _a = getRelevantTokens(position, sourceFile), contextToken_3 = _a.contextToken, previousToken_2 = _a.previousToken;
|
|
129113
|
+
if (previousToken_2 && getImportStatementCompletionInfo(contextToken_3 || previousToken_2).replacementNode) {
|
|
128721
129114
|
// Import statement completion: 'import c|'
|
|
128722
129115
|
return { codeActions: undefined, sourceDisplay: [ts.textPart(data.moduleSpecifier)] };
|
|
128723
129116
|
}
|
|
128724
129117
|
}
|
|
129118
|
+
if (source === CompletionSource.ClassMemberSnippet) {
|
|
129119
|
+
var importAdder = getEntryForMemberCompletion(host, program, compilerOptions, preferences, name, symbol, location, contextToken).importAdder;
|
|
129120
|
+
if (importAdder) {
|
|
129121
|
+
var changes = ts.textChanges.ChangeTracker.with({ host: host, formatContext: formatContext, preferences: preferences }, importAdder.writeFixes);
|
|
129122
|
+
return {
|
|
129123
|
+
sourceDisplay: undefined,
|
|
129124
|
+
codeActions: [{
|
|
129125
|
+
changes: changes,
|
|
129126
|
+
description: ts.diagnosticToString([ts.Diagnostics.Includes_imports_of_types_referenced_by_0, name]),
|
|
129127
|
+
}],
|
|
129128
|
+
};
|
|
129129
|
+
}
|
|
129130
|
+
}
|
|
128725
129131
|
if (!origin || !(originIsExport(origin) || originIsResolvedExport(origin))) {
|
|
128726
129132
|
return { codeActions: undefined, sourceDisplay: undefined };
|
|
128727
129133
|
}
|
|
@@ -144562,7 +144968,7 @@ var ts;
|
|
|
144562
144968
|
/** Note: output node may be mutated input node. */
|
|
144563
144969
|
function getNonformattedText(node, sourceFile, newLineCharacter) {
|
|
144564
144970
|
var writer = createWriter(newLineCharacter);
|
|
144565
|
-
var newLine = newLineCharacter
|
|
144971
|
+
var newLine = ts.getNewLineKind(newLineCharacter);
|
|
144566
144972
|
ts.createPrinter({
|
|
144567
144973
|
newLine: newLine,
|
|
144568
144974
|
neverAsciiEscape: true,
|
|
@@ -145027,21 +145433,16 @@ var ts;
|
|
|
145027
145433
|
(function (codefix) {
|
|
145028
145434
|
var errorCodeToFixes = ts.createMultiMap();
|
|
145029
145435
|
var fixIdToRegistration = new ts.Map();
|
|
145030
|
-
function diagnosticToString(diag) {
|
|
145031
|
-
return ts.isArray(diag)
|
|
145032
|
-
? ts.formatStringFromArgs(ts.getLocaleSpecificMessage(diag[0]), diag.slice(1))
|
|
145033
|
-
: ts.getLocaleSpecificMessage(diag);
|
|
145034
|
-
}
|
|
145035
145436
|
function createCodeFixActionWithoutFixAll(fixName, changes, description) {
|
|
145036
|
-
return createCodeFixActionWorker(fixName, diagnosticToString(description), changes, /*fixId*/ undefined, /*fixAllDescription*/ undefined);
|
|
145437
|
+
return createCodeFixActionWorker(fixName, ts.diagnosticToString(description), changes, /*fixId*/ undefined, /*fixAllDescription*/ undefined);
|
|
145037
145438
|
}
|
|
145038
145439
|
codefix.createCodeFixActionWithoutFixAll = createCodeFixActionWithoutFixAll;
|
|
145039
145440
|
function createCodeFixAction(fixName, changes, description, fixId, fixAllDescription, command) {
|
|
145040
|
-
return createCodeFixActionWorker(fixName, diagnosticToString(description), changes, fixId, diagnosticToString(fixAllDescription), command);
|
|
145441
|
+
return createCodeFixActionWorker(fixName, ts.diagnosticToString(description), changes, fixId, ts.diagnosticToString(fixAllDescription), command);
|
|
145041
145442
|
}
|
|
145042
145443
|
codefix.createCodeFixAction = createCodeFixAction;
|
|
145043
145444
|
function createCodeFixActionMaybeFixAll(fixName, changes, description, fixId, fixAllDescription, command) {
|
|
145044
|
-
return createCodeFixActionWorker(fixName, diagnosticToString(description), changes, fixId, fixAllDescription && diagnosticToString(fixAllDescription), command);
|
|
145445
|
+
return createCodeFixActionWorker(fixName, ts.diagnosticToString(description), changes, fixId, fixAllDescription && ts.diagnosticToString(fixAllDescription), command);
|
|
145045
145446
|
}
|
|
145046
145447
|
codefix.createCodeFixActionMaybeFixAll = createCodeFixActionMaybeFixAll;
|
|
145047
145448
|
function createCodeFixActionWorker(fixName, description, changes, fixId, fixAllDescription, command) {
|
|
@@ -147802,7 +148203,7 @@ var ts;
|
|
|
147802
148203
|
var addToExisting = new ts.Map();
|
|
147803
148204
|
/** Use `getNewImportEntry` for access */
|
|
147804
148205
|
var newImports = new ts.Map();
|
|
147805
|
-
return { addImportFromDiagnostic: addImportFromDiagnostic, addImportFromExportedSymbol: addImportFromExportedSymbol, writeFixes: writeFixes };
|
|
148206
|
+
return { addImportFromDiagnostic: addImportFromDiagnostic, addImportFromExportedSymbol: addImportFromExportedSymbol, writeFixes: writeFixes, hasFixes: hasFixes };
|
|
147806
148207
|
function addImportFromDiagnostic(diagnostic, context) {
|
|
147807
148208
|
var info = getFixesInfo(context, diagnostic.code, diagnostic.start, useAutoImportProvider);
|
|
147808
148209
|
if (!info || !info.fixes.length)
|
|
@@ -147953,6 +148354,9 @@ var ts;
|
|
|
147953
148354
|
ts.insertImports(changeTracker, sourceFile, newDeclarations, /*blankLineBetween*/ true);
|
|
147954
148355
|
}
|
|
147955
148356
|
}
|
|
148357
|
+
function hasFixes() {
|
|
148358
|
+
return addToNamespace.length > 0 || importType.length > 0 || addToExisting.size > 0 || newImports.size > 0;
|
|
148359
|
+
}
|
|
147956
148360
|
}
|
|
147957
148361
|
// Sorted with the preferred fix coming first.
|
|
147958
148362
|
var ImportFixKind;
|
|
@@ -152163,7 +152567,7 @@ var ts;
|
|
|
152163
152567
|
for (var _i = 0, possiblyMissingSymbols_1 = possiblyMissingSymbols; _i < possiblyMissingSymbols_1.length; _i++) {
|
|
152164
152568
|
var symbol = possiblyMissingSymbols_1[_i];
|
|
152165
152569
|
if (!classMembers.has(symbol.escapedName)) {
|
|
152166
|
-
addNewNodeForMemberSymbol(symbol, classDeclaration, sourceFile, context, preferences, importAdder, addClassElement);
|
|
152570
|
+
addNewNodeForMemberSymbol(symbol, classDeclaration, sourceFile, context, preferences, importAdder, addClassElement, /* body */ undefined);
|
|
152167
152571
|
}
|
|
152168
152572
|
}
|
|
152169
152573
|
}
|
|
@@ -152176,9 +152580,11 @@ var ts;
|
|
|
152176
152580
|
}
|
|
152177
152581
|
codefix.getNoopSymbolTrackerWithResolver = getNoopSymbolTrackerWithResolver;
|
|
152178
152582
|
/**
|
|
152179
|
-
*
|
|
152583
|
+
* `addClassElement` will not be called if we can't figure out a representation for `symbol` in `enclosingDeclaration`.
|
|
152584
|
+
* @param body If defined, this will be the body of the member node passed to `addClassElement`. Otherwise, the body will default to a stub.
|
|
152180
152585
|
*/
|
|
152181
|
-
function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, context, preferences, importAdder, addClassElement) {
|
|
152586
|
+
function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, context, preferences, importAdder, addClassElement, body, isAmbient) {
|
|
152587
|
+
if (isAmbient === void 0) { isAmbient = false; }
|
|
152182
152588
|
var declarations = symbol.getDeclarations();
|
|
152183
152589
|
if (!(declarations && declarations.length)) {
|
|
152184
152590
|
return undefined;
|
|
@@ -152191,7 +152597,7 @@ var ts;
|
|
|
152191
152597
|
var modifiers = visibilityModifier ? ts.factory.createNodeArray([visibilityModifier]) : undefined;
|
|
152192
152598
|
var type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration));
|
|
152193
152599
|
var optional = !!(symbol.flags & 16777216 /* Optional */);
|
|
152194
|
-
var ambient = !!(enclosingDeclaration.flags & 8388608 /* Ambient */);
|
|
152600
|
+
var ambient = !!(enclosingDeclaration.flags & 8388608 /* Ambient */) || isAmbient;
|
|
152195
152601
|
var quotePreference = ts.getQuotePreference(sourceFile, preferences);
|
|
152196
152602
|
switch (declaration.kind) {
|
|
152197
152603
|
case 165 /* PropertySignature */:
|
|
@@ -152227,14 +152633,14 @@ var ts;
|
|
|
152227
152633
|
var accessor = orderedAccessors_1[_i];
|
|
152228
152634
|
if (ts.isGetAccessorDeclaration(accessor)) {
|
|
152229
152635
|
addClassElement(ts.factory.createGetAccessorDeclaration(
|
|
152230
|
-
/*decorators*/ undefined, modifiers, name, ts.emptyArray, typeNode_1, ambient ? undefined : createStubbedMethodBody(quotePreference)));
|
|
152636
|
+
/*decorators*/ undefined, modifiers, name, ts.emptyArray, typeNode_1, ambient ? undefined : body || createStubbedMethodBody(quotePreference)));
|
|
152231
152637
|
}
|
|
152232
152638
|
else {
|
|
152233
152639
|
ts.Debug.assertNode(accessor, ts.isSetAccessorDeclaration, "The counterpart to a getter should be a setter");
|
|
152234
152640
|
var parameter = ts.getSetAccessorValueParameter(accessor);
|
|
152235
152641
|
var parameterName = parameter && ts.isIdentifier(parameter.name) ? ts.idText(parameter.name) : undefined;
|
|
152236
152642
|
addClassElement(ts.factory.createSetAccessorDeclaration(
|
|
152237
|
-
/*decorators*/ undefined, modifiers, name, createDummyParameters(1, [parameterName], [typeNode_1], 1, /*inJs*/ false), ambient ? undefined : createStubbedMethodBody(quotePreference)));
|
|
152643
|
+
/*decorators*/ undefined, modifiers, name, createDummyParameters(1, [parameterName], [typeNode_1], 1, /*inJs*/ false), ambient ? undefined : body || createStubbedMethodBody(quotePreference)));
|
|
152238
152644
|
}
|
|
152239
152645
|
}
|
|
152240
152646
|
break;
|
|
@@ -152255,7 +152661,7 @@ var ts;
|
|
|
152255
152661
|
if (declarations.length === 1) {
|
|
152256
152662
|
ts.Debug.assert(signatures.length === 1, "One declaration implies one signature");
|
|
152257
152663
|
var signature = signatures[0];
|
|
152258
|
-
outputMethod(quotePreference, signature, modifiers, name, ambient ? undefined : createStubbedMethodBody(quotePreference));
|
|
152664
|
+
outputMethod(quotePreference, signature, modifiers, name, ambient ? undefined : body || createStubbedMethodBody(quotePreference));
|
|
152259
152665
|
break;
|
|
152260
152666
|
}
|
|
152261
152667
|
for (var _a = 0, signatures_1 = signatures; _a < signatures_1.length; _a++) {
|
|
@@ -152266,11 +152672,11 @@ var ts;
|
|
|
152266
152672
|
if (!ambient) {
|
|
152267
152673
|
if (declarations.length > signatures.length) {
|
|
152268
152674
|
var signature = checker.getSignatureFromDeclaration(declarations[declarations.length - 1]);
|
|
152269
|
-
outputMethod(quotePreference, signature, modifiers, name, createStubbedMethodBody(quotePreference));
|
|
152675
|
+
outputMethod(quotePreference, signature, modifiers, name, body || createStubbedMethodBody(quotePreference));
|
|
152270
152676
|
}
|
|
152271
152677
|
else {
|
|
152272
152678
|
ts.Debug.assert(declarations.length === signatures.length, "Declarations and signatures should match count");
|
|
152273
|
-
addClassElement(createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, name, optional, modifiers, quotePreference));
|
|
152679
|
+
addClassElement(createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, name, optional, modifiers, quotePreference, body));
|
|
152274
152680
|
}
|
|
152275
152681
|
}
|
|
152276
152682
|
break;
|
|
@@ -152281,6 +152687,7 @@ var ts;
|
|
|
152281
152687
|
addClassElement(method);
|
|
152282
152688
|
}
|
|
152283
152689
|
}
|
|
152690
|
+
codefix.addNewNodeForMemberSymbol = addNewNodeForMemberSymbol;
|
|
152284
152691
|
function createSignatureDeclarationFromSignature(kind, context, quotePreference, signature, body, name, modifiers, optional, enclosingDeclaration, importAdder) {
|
|
152285
152692
|
var program = context.program;
|
|
152286
152693
|
var checker = program.getTypeChecker();
|
|
@@ -152418,7 +152825,7 @@ var ts;
|
|
|
152418
152825
|
}
|
|
152419
152826
|
return parameters;
|
|
152420
152827
|
}
|
|
152421
|
-
function createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, name, optional, modifiers, quotePreference) {
|
|
152828
|
+
function createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, name, optional, modifiers, quotePreference, body) {
|
|
152422
152829
|
/** This is *a* signature with the maximal number of arguments,
|
|
152423
152830
|
* such that if there is a "maximal" signature without rest arguments,
|
|
152424
152831
|
* this is one of them.
|
|
@@ -152449,7 +152856,7 @@ var ts;
|
|
|
152449
152856
|
parameters.push(restParameter);
|
|
152450
152857
|
}
|
|
152451
152858
|
return createStubbedMethod(modifiers, name, optional,
|
|
152452
|
-
/*typeParameters*/ undefined, parameters, getReturnTypeFromSignatures(signatures, checker, context, enclosingDeclaration), quotePreference);
|
|
152859
|
+
/*typeParameters*/ undefined, parameters, getReturnTypeFromSignatures(signatures, checker, context, enclosingDeclaration), quotePreference, body);
|
|
152453
152860
|
}
|
|
152454
152861
|
function getReturnTypeFromSignatures(signatures, checker, context, enclosingDeclaration) {
|
|
152455
152862
|
if (ts.length(signatures)) {
|
|
@@ -152457,10 +152864,10 @@ var ts;
|
|
|
152457
152864
|
return checker.typeToTypeNode(type, enclosingDeclaration, /*flags*/ undefined, getNoopSymbolTrackerWithResolver(context));
|
|
152458
152865
|
}
|
|
152459
152866
|
}
|
|
152460
|
-
function createStubbedMethod(modifiers, name, optional, typeParameters, parameters, returnType, quotePreference) {
|
|
152867
|
+
function createStubbedMethod(modifiers, name, optional, typeParameters, parameters, returnType, quotePreference, body) {
|
|
152461
152868
|
return ts.factory.createMethodDeclaration(
|
|
152462
152869
|
/*decorators*/ undefined, modifiers,
|
|
152463
|
-
/*asteriskToken*/ undefined, name, optional ? ts.factory.createToken(57 /* QuestionToken */) : undefined, typeParameters, parameters, returnType, createStubbedMethodBody(quotePreference));
|
|
152870
|
+
/*asteriskToken*/ undefined, name, optional ? ts.factory.createToken(57 /* QuestionToken */) : undefined, typeParameters, parameters, returnType, body || createStubbedMethodBody(quotePreference));
|
|
152464
152871
|
}
|
|
152465
152872
|
function createStubbedMethodBody(quotePreference) {
|
|
152466
152873
|
return createStubbedBody(ts.Diagnostics.Method_not_implemented.message, quotePreference);
|
|
@@ -164496,6 +164903,10 @@ var ts;
|
|
|
164496
164903
|
this.hasAddedOrRemovedSymlinks = true;
|
|
164497
164904
|
}
|
|
164498
164905
|
};
|
|
164906
|
+
/* @internal */
|
|
164907
|
+
Project.prototype.onDiscoveredSymlink = function () {
|
|
164908
|
+
this.hasAddedOrRemovedSymlinks = true;
|
|
164909
|
+
};
|
|
164499
164910
|
/**
|
|
164500
164911
|
* Updates set of files that contribute to this project
|
|
164501
164912
|
* @returns: true if set of files in the project stays the same and false - otherwise.
|