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/tsserverlibrary.js
CHANGED
|
@@ -294,7 +294,7 @@ var ts;
|
|
|
294
294
|
// The following is baselined as a literal template type without intervention
|
|
295
295
|
/** The version of the TypeScript compiler release */
|
|
296
296
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
297
|
-
ts.version = ts.versionMajorMinor + ".0-dev.
|
|
297
|
+
ts.version = ts.versionMajorMinor + ".0-dev.20211101";
|
|
298
298
|
/* @internal */
|
|
299
299
|
var Comparison;
|
|
300
300
|
(function (Comparison) {
|
|
@@ -2745,6 +2745,10 @@ var ts;
|
|
|
2745
2745
|
return formatEnum(kind, ts.SyntaxKind, /*isFlags*/ false);
|
|
2746
2746
|
}
|
|
2747
2747
|
Debug.formatSyntaxKind = formatSyntaxKind;
|
|
2748
|
+
function formatSnippetKind(kind) {
|
|
2749
|
+
return formatEnum(kind, ts.SnippetKind, /*isFlags*/ false);
|
|
2750
|
+
}
|
|
2751
|
+
Debug.formatSnippetKind = formatSnippetKind;
|
|
2748
2752
|
function formatNodeFlags(flags) {
|
|
2749
2753
|
return formatEnum(flags, ts.NodeFlags, /*isFlags*/ true);
|
|
2750
2754
|
}
|
|
@@ -4661,6 +4665,13 @@ var ts;
|
|
|
4661
4665
|
ExitStatus[ExitStatus["ProjectReferenceCycle_OutputsSkupped"] = 4] = "ProjectReferenceCycle_OutputsSkupped";
|
|
4662
4666
|
})(ExitStatus = ts.ExitStatus || (ts.ExitStatus = {}));
|
|
4663
4667
|
/* @internal */
|
|
4668
|
+
var MemberOverrideStatus;
|
|
4669
|
+
(function (MemberOverrideStatus) {
|
|
4670
|
+
MemberOverrideStatus[MemberOverrideStatus["Ok"] = 0] = "Ok";
|
|
4671
|
+
MemberOverrideStatus[MemberOverrideStatus["NeedsOverride"] = 1] = "NeedsOverride";
|
|
4672
|
+
MemberOverrideStatus[MemberOverrideStatus["HasInvalidOverride"] = 2] = "HasInvalidOverride";
|
|
4673
|
+
})(MemberOverrideStatus = ts.MemberOverrideStatus || (ts.MemberOverrideStatus = {}));
|
|
4674
|
+
/* @internal */
|
|
4664
4675
|
var UnionReduction;
|
|
4665
4676
|
(function (UnionReduction) {
|
|
4666
4677
|
UnionReduction[UnionReduction["None"] = 0] = "None";
|
|
@@ -5309,7 +5320,7 @@ var ts;
|
|
|
5309
5320
|
(function (ModuleResolutionKind) {
|
|
5310
5321
|
ModuleResolutionKind[ModuleResolutionKind["Classic"] = 1] = "Classic";
|
|
5311
5322
|
ModuleResolutionKind[ModuleResolutionKind["NodeJs"] = 2] = "NodeJs";
|
|
5312
|
-
// Starting with node12, node's module resolver has significant departures from
|
|
5323
|
+
// Starting with node12, node's module resolver has significant departures from traditional cjs resolution
|
|
5313
5324
|
// to better support ecmascript modules and their use within node - more features are still being added, so
|
|
5314
5325
|
// we can expect it to change over time, and as such, offer both a `NodeNext` moving resolution target, and a `Node12`
|
|
5315
5326
|
// version-anchored resolution target
|
|
@@ -5642,6 +5653,15 @@ var ts;
|
|
|
5642
5653
|
// Masks
|
|
5643
5654
|
// - Additional bitmasks
|
|
5644
5655
|
})(TransformFlags = ts.TransformFlags || (ts.TransformFlags = {}));
|
|
5656
|
+
// Reference: https://code.visualstudio.com/docs/editor/userdefinedsnippets#_snippet-syntax
|
|
5657
|
+
/* @internal */
|
|
5658
|
+
var SnippetKind;
|
|
5659
|
+
(function (SnippetKind) {
|
|
5660
|
+
SnippetKind[SnippetKind["TabStop"] = 0] = "TabStop";
|
|
5661
|
+
SnippetKind[SnippetKind["Placeholder"] = 1] = "Placeholder";
|
|
5662
|
+
SnippetKind[SnippetKind["Choice"] = 2] = "Choice";
|
|
5663
|
+
SnippetKind[SnippetKind["Variable"] = 3] = "Variable";
|
|
5664
|
+
})(SnippetKind = ts.SnippetKind || (ts.SnippetKind = {}));
|
|
5645
5665
|
var EmitFlags;
|
|
5646
5666
|
(function (EmitFlags) {
|
|
5647
5667
|
EmitFlags[EmitFlags["None"] = 0] = "None";
|
|
@@ -8878,6 +8898,8 @@ var ts;
|
|
|
8878
8898
|
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'."),
|
|
8879
8899
|
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."),
|
|
8880
8900
|
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}'?"),
|
|
8901
|
+
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."),
|
|
8902
|
+
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}'?"),
|
|
8881
8903
|
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}'."),
|
|
8882
8904
|
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}'."),
|
|
8883
8905
|
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}'."),
|
|
@@ -8984,6 +9006,7 @@ var ts;
|
|
|
8984
9006
|
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."),
|
|
8985
9007
|
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}'."),
|
|
8986
9008
|
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}'?"),
|
|
9009
|
+
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'."),
|
|
8987
9010
|
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."),
|
|
8988
9011
|
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."),
|
|
8989
9012
|
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}'."),
|
|
@@ -9641,6 +9664,7 @@ var ts;
|
|
|
9641
9664
|
Remove_unused_destructuring_declaration: diag(90039, ts.DiagnosticCategory.Message, "Remove_unused_destructuring_declaration_90039", "Remove unused destructuring declaration"),
|
|
9642
9665
|
Remove_unused_declarations_for_Colon_0: diag(90041, ts.DiagnosticCategory.Message, "Remove_unused_declarations_for_Colon_0_90041", "Remove unused declarations for: '{0}'"),
|
|
9643
9666
|
Declare_a_private_field_named_0: diag(90053, ts.DiagnosticCategory.Message, "Declare_a_private_field_named_0_90053", "Declare a private field named '{0}'."),
|
|
9667
|
+
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}'"),
|
|
9644
9668
|
Convert_function_to_an_ES2015_class: diag(95001, ts.DiagnosticCategory.Message, "Convert_function_to_an_ES2015_class_95001", "Convert function to an ES2015 class"),
|
|
9645
9669
|
Convert_0_to_1_in_0: diag(95003, ts.DiagnosticCategory.Message, "Convert_0_to_1_in_0_95003", "Convert '{0}' to '{1} in {0}'"),
|
|
9646
9670
|
Extract_to_0_in_1: diag(95004, ts.DiagnosticCategory.Message, "Extract_to_0_in_1_95004", "Extract to {0} in {1}"),
|
|
@@ -20947,6 +20971,10 @@ var ts;
|
|
|
20947
20971
|
return node.kind === 212 /* FunctionExpression */ || node.kind === 213 /* ArrowFunction */;
|
|
20948
20972
|
}
|
|
20949
20973
|
ts.isFunctionExpressionOrArrowFunction = isFunctionExpressionOrArrowFunction;
|
|
20974
|
+
function escapeSnippetText(text) {
|
|
20975
|
+
return text.replace(/\$/gm, "\\$");
|
|
20976
|
+
}
|
|
20977
|
+
ts.escapeSnippetText = escapeSnippetText;
|
|
20950
20978
|
})(ts || (ts = {}));
|
|
20951
20979
|
/* @internal */
|
|
20952
20980
|
var ts;
|
|
@@ -27150,6 +27178,25 @@ var ts;
|
|
|
27150
27178
|
}
|
|
27151
27179
|
}
|
|
27152
27180
|
ts.moveEmitHelpers = moveEmitHelpers;
|
|
27181
|
+
/**
|
|
27182
|
+
* Gets the SnippetElement of a node.
|
|
27183
|
+
*/
|
|
27184
|
+
/* @internal */
|
|
27185
|
+
function getSnippetElement(node) {
|
|
27186
|
+
var _a;
|
|
27187
|
+
return (_a = node.emitNode) === null || _a === void 0 ? void 0 : _a.snippetElement;
|
|
27188
|
+
}
|
|
27189
|
+
ts.getSnippetElement = getSnippetElement;
|
|
27190
|
+
/**
|
|
27191
|
+
* Sets the SnippetElement of a node.
|
|
27192
|
+
*/
|
|
27193
|
+
/* @internal */
|
|
27194
|
+
function setSnippetElement(node, snippet) {
|
|
27195
|
+
var emitNode = getOrCreateEmitNode(node);
|
|
27196
|
+
emitNode.snippetElement = snippet;
|
|
27197
|
+
return node;
|
|
27198
|
+
}
|
|
27199
|
+
ts.setSnippetElement = setSnippetElement;
|
|
27153
27200
|
/* @internal */
|
|
27154
27201
|
function ignoreSourceNewlines(node) {
|
|
27155
27202
|
getOrCreateEmitNode(node).flags |= 134217728 /* IgnoreSourceNewlines */;
|
|
@@ -47275,6 +47322,7 @@ var ts;
|
|
|
47275
47322
|
isDeclarationVisible: isDeclarationVisible,
|
|
47276
47323
|
isPropertyAccessible: isPropertyAccessible,
|
|
47277
47324
|
getTypeOnlyAliasDeclaration: getTypeOnlyAliasDeclaration,
|
|
47325
|
+
getMemberOverrideModifierStatus: getMemberOverrideModifierStatus,
|
|
47278
47326
|
};
|
|
47279
47327
|
function getResolvedSignatureWorker(nodeIn, candidatesOutArray, argumentCount, checkMode) {
|
|
47280
47328
|
var node = ts.getParseTreeNode(nodeIn, ts.isCallLikeExpression);
|
|
@@ -47518,6 +47566,21 @@ var ts;
|
|
|
47518
47566
|
var enumRelation = new ts.Map();
|
|
47519
47567
|
var builtinGlobals = ts.createSymbolTable();
|
|
47520
47568
|
builtinGlobals.set(undefinedSymbol.escapedName, undefinedSymbol);
|
|
47569
|
+
// Extensions suggested for path imports when module resolution is node12 or higher.
|
|
47570
|
+
// The first element of each tuple is the extension a file has.
|
|
47571
|
+
// The second element of each tuple is the extension that should be used in a path import.
|
|
47572
|
+
// e.g. if we want to import file `foo.mts`, we should write `import {} from "./foo.mjs".
|
|
47573
|
+
var suggestedExtensions = [
|
|
47574
|
+
[".mts", ".mjs"],
|
|
47575
|
+
[".ts", ".js"],
|
|
47576
|
+
[".cts", ".cjs"],
|
|
47577
|
+
[".mjs", ".mjs"],
|
|
47578
|
+
[".js", ".js"],
|
|
47579
|
+
[".cjs", ".cjs"],
|
|
47580
|
+
[".tsx", compilerOptions.jsx === 1 /* Preserve */ ? ".jsx" : ".js"],
|
|
47581
|
+
[".jsx", ".jsx"],
|
|
47582
|
+
[".json", ".json"],
|
|
47583
|
+
];
|
|
47521
47584
|
initializeTypeChecker();
|
|
47522
47585
|
return checker;
|
|
47523
47586
|
function getJsxNamespace(location) {
|
|
@@ -49733,7 +49796,7 @@ var ts;
|
|
|
49733
49796
|
: undefined;
|
|
49734
49797
|
}
|
|
49735
49798
|
function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation) {
|
|
49736
|
-
var _a, _b, _c, _d, _e, _f;
|
|
49799
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
49737
49800
|
if (isForAugmentation === void 0) { isForAugmentation = false; }
|
|
49738
49801
|
if (ts.startsWith(moduleReference, "@types/")) {
|
|
49739
49802
|
var diag = ts.Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1;
|
|
@@ -49754,7 +49817,7 @@ var ts;
|
|
|
49754
49817
|
((_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) ||
|
|
49755
49818
|
((_f = (ts.isLiteralImportTypeNode(location) ? location : undefined)) === null || _f === void 0 ? void 0 : _f.argument.literal);
|
|
49756
49819
|
var mode = contextSpecifier && ts.isStringLiteralLike(contextSpecifier) ? ts.getModeForUsageLocation(currentSourceFile, contextSpecifier) : currentSourceFile.impliedNodeFormat;
|
|
49757
|
-
var resolvedModule = ts.getResolvedModule(currentSourceFile, moduleReference, mode);
|
|
49820
|
+
var resolvedModule = ts.getResolvedModule(currentSourceFile, moduleReference, mode);
|
|
49758
49821
|
var resolutionDiagnostic = resolvedModule && ts.getResolutionDiagnostic(compilerOptions, resolvedModule);
|
|
49759
49822
|
var sourceFile = resolvedModule && !resolutionDiagnostic && host.getSourceFile(resolvedModule.resolvedFileName);
|
|
49760
49823
|
if (sourceFile) {
|
|
@@ -49820,6 +49883,10 @@ var ts;
|
|
|
49820
49883
|
}
|
|
49821
49884
|
else {
|
|
49822
49885
|
var tsExtension = ts.tryExtractTSExtension(moduleReference);
|
|
49886
|
+
var isExtensionlessRelativePathImport = ts.pathIsRelative(moduleReference) && !ts.hasExtension(moduleReference);
|
|
49887
|
+
var moduleResolutionKind = ts.getEmitModuleResolutionKind(compilerOptions);
|
|
49888
|
+
var resolutionIsNode12OrNext = moduleResolutionKind === ts.ModuleResolutionKind.Node12 ||
|
|
49889
|
+
moduleResolutionKind === ts.ModuleResolutionKind.NodeNext;
|
|
49823
49890
|
if (tsExtension) {
|
|
49824
49891
|
var diag = ts.Diagnostics.An_import_path_cannot_end_with_a_0_extension_Consider_importing_1_instead;
|
|
49825
49892
|
var importSourceWithoutExtension = ts.removeExtension(moduleReference, tsExtension);
|
|
@@ -49839,6 +49906,19 @@ var ts;
|
|
|
49839
49906
|
ts.hasJsonModuleEmitEnabled(compilerOptions)) {
|
|
49840
49907
|
error(errorNode, ts.Diagnostics.Cannot_find_module_0_Consider_using_resolveJsonModule_to_import_module_with_json_extension, moduleReference);
|
|
49841
49908
|
}
|
|
49909
|
+
else if (mode === ts.ModuleKind.ESNext && resolutionIsNode12OrNext && isExtensionlessRelativePathImport) {
|
|
49910
|
+
var absoluteRef_1 = ts.getNormalizedAbsolutePath(moduleReference, ts.getDirectoryPath(currentSourceFile.path));
|
|
49911
|
+
var suggestedExt = (_g = suggestedExtensions.find(function (_a) {
|
|
49912
|
+
var actualExt = _a[0], _importExt = _a[1];
|
|
49913
|
+
return host.fileExists(absoluteRef_1 + actualExt);
|
|
49914
|
+
})) === null || _g === void 0 ? void 0 : _g[1];
|
|
49915
|
+
if (suggestedExt) {
|
|
49916
|
+
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);
|
|
49917
|
+
}
|
|
49918
|
+
else {
|
|
49919
|
+
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);
|
|
49920
|
+
}
|
|
49921
|
+
}
|
|
49842
49922
|
else {
|
|
49843
49923
|
error(errorNode, moduleNotFoundError, moduleReference);
|
|
49844
49924
|
}
|
|
@@ -61751,7 +61831,8 @@ var ts;
|
|
|
61751
61831
|
if (t.flags & (3 /* AnyOrUnknown */ | 58982400 /* InstantiableNonPrimitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && t !== wildcardType && !isErrorType(t)) {
|
|
61752
61832
|
if (!type.declaration.nameType) {
|
|
61753
61833
|
var constraint = void 0;
|
|
61754
|
-
if (isArrayType(t) ||
|
|
61834
|
+
if (isArrayType(t) || t.flags & 1 /* Any */ && findResolutionCycleStartIndex(typeVariable, 4 /* ImmediateBaseConstraint */) < 0 &&
|
|
61835
|
+
(constraint = getConstraintOfTypeParameter(typeVariable)) && everyType(constraint, ts.or(isArrayType, isTupleType))) {
|
|
61755
61836
|
return instantiateMappedArrayType(t, type, prependTypeMapping(typeVariable, t, mapper));
|
|
61756
61837
|
}
|
|
61757
61838
|
if (isGenericTupleType(t)) {
|
|
@@ -81850,7 +81931,7 @@ var ts;
|
|
|
81850
81931
|
checkKindsOfPropertyMemberOverrides(type, baseType_1);
|
|
81851
81932
|
}
|
|
81852
81933
|
}
|
|
81853
|
-
|
|
81934
|
+
checkMembersForOverrideModifier(node, type, typeWithThis, staticType);
|
|
81854
81935
|
var implementedTypeNodes = ts.getEffectiveImplementsTypeNodes(node);
|
|
81855
81936
|
if (implementedTypeNodes) {
|
|
81856
81937
|
for (var _b = 0, implementedTypeNodes_1 = implementedTypeNodes; _b < implementedTypeNodes_1.length; _b++) {
|
|
@@ -81885,8 +81966,7 @@ var ts;
|
|
|
81885
81966
|
checkPropertyInitialization(node);
|
|
81886
81967
|
}
|
|
81887
81968
|
}
|
|
81888
|
-
function
|
|
81889
|
-
var nodeInAmbientContext = !!(node.flags & 8388608 /* Ambient */);
|
|
81969
|
+
function checkMembersForOverrideModifier(node, type, typeWithThis, staticType) {
|
|
81890
81970
|
var baseTypeNode = ts.getEffectiveBaseTypeNode(node);
|
|
81891
81971
|
var baseTypes = baseTypeNode && getBaseTypes(type);
|
|
81892
81972
|
var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
|
|
@@ -81898,46 +81978,71 @@ var ts;
|
|
|
81898
81978
|
if (ts.isConstructorDeclaration(member)) {
|
|
81899
81979
|
ts.forEach(member.parameters, function (param) {
|
|
81900
81980
|
if (ts.isParameterPropertyDeclaration(param, member)) {
|
|
81901
|
-
|
|
81981
|
+
checkExistingMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, param,
|
|
81982
|
+
/* memberIsParameterProperty */ true);
|
|
81902
81983
|
}
|
|
81903
81984
|
});
|
|
81904
81985
|
}
|
|
81905
|
-
|
|
81986
|
+
checkExistingMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, member,
|
|
81987
|
+
/* memberIsParameterProperty */ false);
|
|
81906
81988
|
};
|
|
81907
81989
|
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
|
|
81908
81990
|
var member = _a[_i];
|
|
81909
81991
|
_loop_29(member);
|
|
81910
81992
|
}
|
|
81911
|
-
|
|
81912
|
-
|
|
81913
|
-
|
|
81914
|
-
|
|
81915
|
-
|
|
81916
|
-
|
|
81917
|
-
|
|
81918
|
-
|
|
81919
|
-
|
|
81920
|
-
|
|
81921
|
-
|
|
81922
|
-
|
|
81923
|
-
|
|
81924
|
-
|
|
81925
|
-
|
|
81926
|
-
|
|
81993
|
+
}
|
|
81994
|
+
/**
|
|
81995
|
+
* @param member Existing member node to be checked.
|
|
81996
|
+
* Note: `member` cannot be a synthetic node.
|
|
81997
|
+
*/
|
|
81998
|
+
function checkExistingMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, member, memberIsParameterProperty, reportErrors) {
|
|
81999
|
+
if (reportErrors === void 0) { reportErrors = true; }
|
|
82000
|
+
var declaredProp = member.name
|
|
82001
|
+
&& getSymbolAtLocation(member.name)
|
|
82002
|
+
|| getSymbolAtLocation(member);
|
|
82003
|
+
if (!declaredProp) {
|
|
82004
|
+
return 0 /* Ok */;
|
|
82005
|
+
}
|
|
82006
|
+
return checkMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, ts.hasOverrideModifier(member), ts.hasAbstractModifier(member), ts.isStatic(member), memberIsParameterProperty, ts.symbolName(declaredProp), reportErrors ? member : undefined);
|
|
82007
|
+
}
|
|
82008
|
+
/**
|
|
82009
|
+
* Checks a class member declaration for either a missing or an invalid `override` modifier.
|
|
82010
|
+
* Note: this function can be used for speculative checking,
|
|
82011
|
+
* i.e. checking a member that does not yet exist in the program.
|
|
82012
|
+
* An example of that would be to call this function in a completions scenario,
|
|
82013
|
+
* when offering a method declaration as completion.
|
|
82014
|
+
* @param errorNode The node where we should report an error, or undefined if we should not report errors.
|
|
82015
|
+
*/
|
|
82016
|
+
function checkMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, memberHasOverrideModifier, memberHasAbstractModifier, memberIsStatic, memberIsParameterProperty, memberName, errorNode) {
|
|
82017
|
+
var isJs = ts.isInJSFile(node);
|
|
82018
|
+
var nodeInAmbientContext = !!(node.flags & 8388608 /* Ambient */);
|
|
82019
|
+
if (baseWithThis && (memberHasOverrideModifier || compilerOptions.noImplicitOverride)) {
|
|
82020
|
+
var memberEscapedName = ts.escapeLeadingUnderscores(memberName);
|
|
82021
|
+
var thisType = memberIsStatic ? staticType : typeWithThis;
|
|
82022
|
+
var baseType = memberIsStatic ? baseStaticType : baseWithThis;
|
|
82023
|
+
var prop = getPropertyOfType(thisType, memberEscapedName);
|
|
82024
|
+
var baseProp = getPropertyOfType(baseType, memberEscapedName);
|
|
82025
|
+
var baseClassName = typeToString(baseWithThis);
|
|
82026
|
+
if (prop && !baseProp && memberHasOverrideModifier) {
|
|
82027
|
+
if (errorNode) {
|
|
82028
|
+
var suggestion = getSuggestedSymbolForNonexistentClassMember(memberName, baseType); // Again, using symbol name: note that's different from `symbol.escapedName`
|
|
81927
82029
|
suggestion ?
|
|
81928
|
-
error(
|
|
82030
|
+
error(errorNode, isJs ?
|
|
81929
82031
|
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 :
|
|
81930
82032
|
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)) :
|
|
81931
|
-
error(
|
|
82033
|
+
error(errorNode, isJs ?
|
|
81932
82034
|
ts.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_it_is_not_declared_in_the_base_class_0 :
|
|
81933
82035
|
ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_it_is_not_declared_in_the_base_class_0, baseClassName);
|
|
81934
82036
|
}
|
|
81935
|
-
|
|
81936
|
-
|
|
81937
|
-
|
|
81938
|
-
|
|
81939
|
-
|
|
81940
|
-
|
|
82037
|
+
return 2 /* HasInvalidOverride */;
|
|
82038
|
+
}
|
|
82039
|
+
else if (prop && (baseProp === null || baseProp === void 0 ? void 0 : baseProp.declarations) && compilerOptions.noImplicitOverride && !nodeInAmbientContext) {
|
|
82040
|
+
var baseHasAbstract = ts.some(baseProp.declarations, ts.hasAbstractModifier);
|
|
82041
|
+
if (memberHasOverrideModifier) {
|
|
82042
|
+
return 0 /* Ok */;
|
|
82043
|
+
}
|
|
82044
|
+
if (!baseHasAbstract) {
|
|
82045
|
+
if (errorNode) {
|
|
81941
82046
|
var diag = memberIsParameterProperty ?
|
|
81942
82047
|
isJs ?
|
|
81943
82048
|
ts.Diagnostics.This_parameter_property_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0 :
|
|
@@ -81945,20 +82050,28 @@ var ts;
|
|
|
81945
82050
|
isJs ?
|
|
81946
82051
|
ts.Diagnostics.This_member_must_have_a_JSDoc_comment_with_an_override_tag_because_it_overrides_a_member_in_the_base_class_0 :
|
|
81947
82052
|
ts.Diagnostics.This_member_must_have_an_override_modifier_because_it_overrides_a_member_in_the_base_class_0;
|
|
81948
|
-
error(
|
|
82053
|
+
error(errorNode, diag, baseClassName);
|
|
81949
82054
|
}
|
|
81950
|
-
|
|
81951
|
-
|
|
82055
|
+
return 1 /* NeedsOverride */;
|
|
82056
|
+
}
|
|
82057
|
+
else if (memberHasAbstractModifier && baseHasAbstract) {
|
|
82058
|
+
if (errorNode) {
|
|
82059
|
+
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);
|
|
81952
82060
|
}
|
|
82061
|
+
return 1 /* NeedsOverride */;
|
|
81953
82062
|
}
|
|
81954
82063
|
}
|
|
81955
|
-
|
|
82064
|
+
}
|
|
82065
|
+
else if (memberHasOverrideModifier) {
|
|
82066
|
+
if (errorNode) {
|
|
81956
82067
|
var className = typeToString(type);
|
|
81957
|
-
error(
|
|
82068
|
+
error(errorNode, isJs ?
|
|
81958
82069
|
ts.Diagnostics.This_member_cannot_have_a_JSDoc_comment_with_an_override_tag_because_its_containing_class_0_does_not_extend_another_class :
|
|
81959
82070
|
ts.Diagnostics.This_member_cannot_have_an_override_modifier_because_its_containing_class_0_does_not_extend_another_class, className);
|
|
81960
82071
|
}
|
|
82072
|
+
return 2 /* HasInvalidOverride */;
|
|
81961
82073
|
}
|
|
82074
|
+
return 0 /* Ok */;
|
|
81962
82075
|
}
|
|
81963
82076
|
function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
|
|
81964
82077
|
// iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible
|
|
@@ -82001,6 +82114,31 @@ var ts;
|
|
|
82001
82114
|
}
|
|
82002
82115
|
}
|
|
82003
82116
|
}
|
|
82117
|
+
/**
|
|
82118
|
+
* Checks a member declaration node to see if has a missing or invalid `override` modifier.
|
|
82119
|
+
* @param node Class-like node where the member is declared.
|
|
82120
|
+
* @param member Member declaration node.
|
|
82121
|
+
* Note: `member` can be a synthetic node without a parent.
|
|
82122
|
+
*/
|
|
82123
|
+
function getMemberOverrideModifierStatus(node, member) {
|
|
82124
|
+
if (!member.name) {
|
|
82125
|
+
return 0 /* Ok */;
|
|
82126
|
+
}
|
|
82127
|
+
var symbol = getSymbolOfNode(node);
|
|
82128
|
+
var type = getDeclaredTypeOfSymbol(symbol);
|
|
82129
|
+
var typeWithThis = getTypeWithThisArgument(type);
|
|
82130
|
+
var staticType = getTypeOfSymbol(symbol);
|
|
82131
|
+
var baseTypeNode = ts.getEffectiveBaseTypeNode(node);
|
|
82132
|
+
var baseTypes = baseTypeNode && getBaseTypes(type);
|
|
82133
|
+
var baseWithThis = (baseTypes === null || baseTypes === void 0 ? void 0 : baseTypes.length) ? getTypeWithThisArgument(ts.first(baseTypes), type.thisType) : undefined;
|
|
82134
|
+
var baseStaticType = getBaseConstructorTypeOfClass(type);
|
|
82135
|
+
var memberHasOverrideModifier = member.parent
|
|
82136
|
+
? ts.hasOverrideModifier(member)
|
|
82137
|
+
: ts.hasSyntacticModifier(member, 16384 /* Override */);
|
|
82138
|
+
var memberName = ts.unescapeLeadingUnderscores(ts.getTextOfPropertyName(member.name));
|
|
82139
|
+
return checkMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, memberHasOverrideModifier, ts.hasAbstractModifier(member), ts.isStatic(member),
|
|
82140
|
+
/* memberIsParameterProperty */ false, memberName);
|
|
82141
|
+
}
|
|
82004
82142
|
function getTargetSymbol(s) {
|
|
82005
82143
|
// if symbol is instantiated its flags are not copied from the 'target'
|
|
82006
82144
|
// so we'll need to get back original 'target' symbol to work with correct set of flags
|
|
@@ -94997,11 +95135,11 @@ var ts;
|
|
|
94997
95135
|
currentFileState.filenameDeclaration = declaration;
|
|
94998
95136
|
return currentFileState.filenameDeclaration.name;
|
|
94999
95137
|
}
|
|
95000
|
-
function getJsxFactoryCalleePrimitive(
|
|
95001
|
-
return compilerOptions.jsx === 5 /* ReactJSXDev */ ? "jsxDEV" :
|
|
95138
|
+
function getJsxFactoryCalleePrimitive(isStaticChildren) {
|
|
95139
|
+
return compilerOptions.jsx === 5 /* ReactJSXDev */ ? "jsxDEV" : isStaticChildren ? "jsxs" : "jsx";
|
|
95002
95140
|
}
|
|
95003
|
-
function getJsxFactoryCallee(
|
|
95004
|
-
var type = getJsxFactoryCalleePrimitive(
|
|
95141
|
+
function getJsxFactoryCallee(isStaticChildren) {
|
|
95142
|
+
var type = getJsxFactoryCalleePrimitive(isStaticChildren);
|
|
95005
95143
|
return getImplicitImportForName(type);
|
|
95006
95144
|
}
|
|
95007
95145
|
function getImplicitJsxFragmentReference() {
|
|
@@ -95153,7 +95291,7 @@ var ts;
|
|
|
95153
95291
|
}
|
|
95154
95292
|
function convertJsxChildrenToChildrenPropAssignment(children) {
|
|
95155
95293
|
var nonWhitespaceChildren = ts.getSemanticJsxChildren(children);
|
|
95156
|
-
if (ts.length(nonWhitespaceChildren) === 1) {
|
|
95294
|
+
if (ts.length(nonWhitespaceChildren) === 1 && !nonWhitespaceChildren[0].dotDotDotToken) {
|
|
95157
95295
|
var result_12 = transformJsxChildToExpression(nonWhitespaceChildren[0]);
|
|
95158
95296
|
return result_12 && factory.createPropertyAssignment("children", result_12);
|
|
95159
95297
|
}
|
|
@@ -95167,15 +95305,18 @@ var ts;
|
|
|
95167
95305
|
var attrs = keyAttr ? ts.filter(node.attributes.properties, function (p) { return p !== keyAttr; }) : node.attributes.properties;
|
|
95168
95306
|
var objectProperties = ts.length(attrs) ? transformJsxAttributesToObjectProps(attrs, childrenProp) :
|
|
95169
95307
|
factory.createObjectLiteralExpression(childrenProp ? [childrenProp] : ts.emptyArray); // When there are no attributes, React wants {}
|
|
95170
|
-
return visitJsxOpeningLikeElementOrFragmentJSX(tagName, objectProperties, keyAttr,
|
|
95308
|
+
return visitJsxOpeningLikeElementOrFragmentJSX(tagName, objectProperties, keyAttr, children || ts.emptyArray, isChild, location);
|
|
95171
95309
|
}
|
|
95172
|
-
function visitJsxOpeningLikeElementOrFragmentJSX(tagName, objectProperties, keyAttr,
|
|
95310
|
+
function visitJsxOpeningLikeElementOrFragmentJSX(tagName, objectProperties, keyAttr, children, isChild, location) {
|
|
95311
|
+
var _a;
|
|
95312
|
+
var nonWhitespaceChildren = ts.getSemanticJsxChildren(children);
|
|
95313
|
+
var isStaticChildren = ts.length(nonWhitespaceChildren) > 1 || !!((_a = nonWhitespaceChildren[0]) === null || _a === void 0 ? void 0 : _a.dotDotDotToken);
|
|
95173
95314
|
var args = [tagName, objectProperties, !keyAttr ? factory.createVoidZero() : transformJsxAttributeInitializer(keyAttr.initializer)];
|
|
95174
95315
|
if (compilerOptions.jsx === 5 /* ReactJSXDev */) {
|
|
95175
95316
|
var originalFile = ts.getOriginalNode(currentSourceFile);
|
|
95176
95317
|
if (originalFile && ts.isSourceFile(originalFile)) {
|
|
95177
95318
|
// isStaticChildren development flag
|
|
95178
|
-
args.push(
|
|
95319
|
+
args.push(isStaticChildren ? factory.createTrue() : factory.createFalse());
|
|
95179
95320
|
// __source development flag
|
|
95180
95321
|
var lineCol = ts.getLineAndCharacterOfPosition(originalFile, location.pos);
|
|
95181
95322
|
args.push(factory.createObjectLiteralExpression([
|
|
@@ -95187,7 +95328,7 @@ var ts;
|
|
|
95187
95328
|
args.push(factory.createThis());
|
|
95188
95329
|
}
|
|
95189
95330
|
}
|
|
95190
|
-
var element = ts.setTextRange(factory.createCallExpression(getJsxFactoryCallee(
|
|
95331
|
+
var element = ts.setTextRange(factory.createCallExpression(getJsxFactoryCallee(isStaticChildren), /*typeArguments*/ undefined, args), location);
|
|
95191
95332
|
if (isChild) {
|
|
95192
95333
|
ts.startOnNewLine(element);
|
|
95193
95334
|
}
|
|
@@ -95217,7 +95358,7 @@ var ts;
|
|
|
95217
95358
|
}
|
|
95218
95359
|
}
|
|
95219
95360
|
return visitJsxOpeningLikeElementOrFragmentJSX(getImplicitJsxFragmentReference(), childrenProps || factory.createObjectLiteralExpression([]),
|
|
95220
|
-
/*keyAttr*/ undefined,
|
|
95361
|
+
/*keyAttr*/ undefined, children, isChild, location);
|
|
95221
95362
|
}
|
|
95222
95363
|
function visitJsxOpeningFragmentCreateElement(node, children, isChild, location) {
|
|
95223
95364
|
var element = ts.createExpressionForJsxFragment(factory, context.getEmitResolver().getJsxFactoryEntity(currentSourceFile), context.getEmitResolver().getJsxFragmentFactoryEntity(currentSourceFile), compilerOptions.reactNamespace, // TODO: GH#18217
|
|
@@ -108305,7 +108446,14 @@ var ts;
|
|
|
108305
108446
|
// clear the parenthesizer rule as we ascend
|
|
108306
108447
|
currentParenthesizerRule = undefined;
|
|
108307
108448
|
}
|
|
108308
|
-
function pipelineEmitWithHintWorker(hint, node) {
|
|
108449
|
+
function pipelineEmitWithHintWorker(hint, node, allowSnippets) {
|
|
108450
|
+
if (allowSnippets === void 0) { allowSnippets = true; }
|
|
108451
|
+
if (allowSnippets) {
|
|
108452
|
+
var snippet = ts.getSnippetElement(node);
|
|
108453
|
+
if (snippet) {
|
|
108454
|
+
return emitSnippetNode(hint, node, snippet);
|
|
108455
|
+
}
|
|
108456
|
+
}
|
|
108309
108457
|
if (hint === 0 /* SourceFile */)
|
|
108310
108458
|
return emitSourceFile(ts.cast(node, ts.isSourceFile));
|
|
108311
108459
|
if (hint === 2 /* IdentifierName */)
|
|
@@ -108914,6 +109062,28 @@ var ts;
|
|
|
108914
109062
|
}
|
|
108915
109063
|
}
|
|
108916
109064
|
//
|
|
109065
|
+
// Snippet Elements
|
|
109066
|
+
//
|
|
109067
|
+
function emitSnippetNode(hint, node, snippet) {
|
|
109068
|
+
switch (snippet.kind) {
|
|
109069
|
+
case 1 /* Placeholder */:
|
|
109070
|
+
emitPlaceholder(hint, node, snippet);
|
|
109071
|
+
break;
|
|
109072
|
+
case 0 /* TabStop */:
|
|
109073
|
+
emitTabStop(snippet);
|
|
109074
|
+
break;
|
|
109075
|
+
}
|
|
109076
|
+
}
|
|
109077
|
+
function emitPlaceholder(hint, node, snippet) {
|
|
109078
|
+
nonEscapingWrite("${" + snippet.order + ":"); // `${2:`
|
|
109079
|
+
pipelineEmitWithHintWorker(hint, node, /*allowSnippets*/ false); // `...`
|
|
109080
|
+
nonEscapingWrite("}"); // `}`
|
|
109081
|
+
// `${2:...}`
|
|
109082
|
+
}
|
|
109083
|
+
function emitTabStop(snippet) {
|
|
109084
|
+
nonEscapingWrite("$" + snippet.order);
|
|
109085
|
+
}
|
|
109086
|
+
//
|
|
108917
109087
|
// Identifiers
|
|
108918
109088
|
//
|
|
108919
109089
|
function emitIdentifier(node) {
|
|
@@ -111152,6 +111322,15 @@ var ts;
|
|
|
111152
111322
|
function writeProperty(s) {
|
|
111153
111323
|
writer.writeProperty(s);
|
|
111154
111324
|
}
|
|
111325
|
+
function nonEscapingWrite(s) {
|
|
111326
|
+
// This should be defined in a snippet-escaping text writer.
|
|
111327
|
+
if (writer.nonEscapingWrite) {
|
|
111328
|
+
writer.nonEscapingWrite(s);
|
|
111329
|
+
}
|
|
111330
|
+
else {
|
|
111331
|
+
writer.write(s);
|
|
111332
|
+
}
|
|
111333
|
+
}
|
|
111155
111334
|
function writeLine(count) {
|
|
111156
111335
|
if (count === void 0) { count = 1; }
|
|
111157
111336
|
for (var i = 0; i < count; i++) {
|
|
@@ -114255,8 +114434,8 @@ var ts;
|
|
|
114255
114434
|
var typesReferenceDirectives = ts.map(newSourceFile.typeReferenceDirectives, function (ref) { return ts.toFileNameLowerCase(ref.fileName); });
|
|
114256
114435
|
var typeReferenceResolutions = resolveTypeReferenceDirectiveNamesWorker(typesReferenceDirectives, newSourceFile);
|
|
114257
114436
|
// ensure that types resolutions are still correct
|
|
114258
|
-
var
|
|
114259
|
-
if (
|
|
114437
|
+
var typeReferenceResolutionsChanged = ts.hasChangesInResolutions(typesReferenceDirectives, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, oldSourceFile, ts.typeDirectiveIsEqualTo);
|
|
114438
|
+
if (typeReferenceResolutionsChanged) {
|
|
114260
114439
|
structureIsReused = 1 /* SafeModules */;
|
|
114261
114440
|
newSourceFile.resolvedTypeReferenceDirectiveNames = ts.zipToModeAwareCache(newSourceFile, typesReferenceDirectives, typeReferenceResolutions);
|
|
114262
114441
|
}
|
|
@@ -115544,6 +115723,21 @@ var ts;
|
|
|
115544
115723
|
return resolvedRef;
|
|
115545
115724
|
}
|
|
115546
115725
|
function verifyCompilerOptions() {
|
|
115726
|
+
var isNightly = ts.stringContains(ts.version, "-dev");
|
|
115727
|
+
if (!isNightly) {
|
|
115728
|
+
if (ts.getEmitModuleKind(options) === ts.ModuleKind.Node12) {
|
|
115729
|
+
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");
|
|
115730
|
+
}
|
|
115731
|
+
else if (ts.getEmitModuleKind(options) === ts.ModuleKind.NodeNext) {
|
|
115732
|
+
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");
|
|
115733
|
+
}
|
|
115734
|
+
else if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.Node12) {
|
|
115735
|
+
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");
|
|
115736
|
+
}
|
|
115737
|
+
else if (ts.getEmitModuleResolutionKind(options) === ts.ModuleResolutionKind.NodeNext) {
|
|
115738
|
+
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");
|
|
115739
|
+
}
|
|
115740
|
+
}
|
|
115547
115741
|
if (options.strictPropertyInitialization && !ts.getStrictOptionValue(options, "strictNullChecks")) {
|
|
115548
115742
|
createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1, "strictPropertyInitialization", "strictNullChecks");
|
|
115549
115743
|
}
|
|
@@ -116022,8 +116216,8 @@ var ts;
|
|
|
116022
116216
|
function createDiagnosticForOptionName(message, option1, option2, option3) {
|
|
116023
116217
|
createDiagnosticForOption(/*onKey*/ true, option1, option2, message, option1, option2, option3);
|
|
116024
116218
|
}
|
|
116025
|
-
function createOptionValueDiagnostic(option1, message, arg0) {
|
|
116026
|
-
createDiagnosticForOption(/*onKey*/ false, option1, /*option2*/ undefined, message, arg0);
|
|
116219
|
+
function createOptionValueDiagnostic(option1, message, arg0, arg1) {
|
|
116220
|
+
createDiagnosticForOption(/*onKey*/ false, option1, /*option2*/ undefined, message, arg0, arg1);
|
|
116027
116221
|
}
|
|
116028
116222
|
function createDiagnosticForReference(sourceFile, index, message, arg0, arg1) {
|
|
116029
116223
|
var referencesSyntax = ts.firstDefined(ts.getTsConfigPropArray(sourceFile || options.configFile, "references"), function (property) { return ts.isArrayLiteralExpression(property.initializer) ? property.initializer : undefined; });
|
|
@@ -118267,6 +118461,9 @@ var ts;
|
|
|
118267
118461
|
else {
|
|
118268
118462
|
resolution = loader(name, containingFile, compilerOptions, ((_c = resolutionHost.getCompilerHost) === null || _c === void 0 ? void 0 : _c.call(resolutionHost)) || resolutionHost, redirectedReference, containingSourceFile);
|
|
118269
118463
|
perDirectoryResolution.set(name, mode, resolution);
|
|
118464
|
+
if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
|
|
118465
|
+
resolutionHost.onDiscoveredSymlink();
|
|
118466
|
+
}
|
|
118270
118467
|
}
|
|
118271
118468
|
resolutionsInFile.set(name, mode, resolution);
|
|
118272
118469
|
watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName);
|
|
@@ -118735,6 +118932,11 @@ var ts;
|
|
|
118735
118932
|
}
|
|
118736
118933
|
}
|
|
118737
118934
|
ts.createResolutionCache = createResolutionCache;
|
|
118935
|
+
function resolutionIsSymlink(resolution) {
|
|
118936
|
+
var _a, _b;
|
|
118937
|
+
return !!(((_a = resolution.resolvedModule) === null || _a === void 0 ? void 0 : _a.originalPath) ||
|
|
118938
|
+
((_b = resolution.resolvedTypeReferenceDirective) === null || _b === void 0 ? void 0 : _b.originalPath));
|
|
118939
|
+
}
|
|
118738
118940
|
})(ts || (ts = {}));
|
|
118739
118941
|
// Used by importFixes, getEditsForFileRename, and declaration emit to synthesize import module specifiers.
|
|
118740
118942
|
/* @internal */
|
|
@@ -126177,6 +126379,16 @@ var ts;
|
|
|
126177
126379
|
return decisionFromFile !== null && decisionFromFile !== void 0 ? decisionFromFile : program.usesUriStyleNodeCoreModules;
|
|
126178
126380
|
}
|
|
126179
126381
|
ts.shouldUseUriStyleNodeCoreModules = shouldUseUriStyleNodeCoreModules;
|
|
126382
|
+
function getNewLineKind(newLineCharacter) {
|
|
126383
|
+
return newLineCharacter === "\n" ? 1 /* LineFeed */ : 0 /* CarriageReturnLineFeed */;
|
|
126384
|
+
}
|
|
126385
|
+
ts.getNewLineKind = getNewLineKind;
|
|
126386
|
+
function diagnosticToString(diag) {
|
|
126387
|
+
return ts.isArray(diag)
|
|
126388
|
+
? ts.formatStringFromArgs(ts.getLocaleSpecificMessage(diag[0]), diag.slice(1))
|
|
126389
|
+
: ts.getLocaleSpecificMessage(diag);
|
|
126390
|
+
}
|
|
126391
|
+
ts.diagnosticToString = diagnosticToString;
|
|
126180
126392
|
// #endregion
|
|
126181
126393
|
})(ts || (ts = {}));
|
|
126182
126394
|
/*@internal*/
|
|
@@ -127774,7 +127986,7 @@ var ts;
|
|
|
127774
127986
|
(function (Completions) {
|
|
127775
127987
|
var StringCompletions;
|
|
127776
127988
|
(function (StringCompletions) {
|
|
127777
|
-
function getStringLiteralCompletions(sourceFile, position, contextToken,
|
|
127989
|
+
function getStringLiteralCompletions(sourceFile, position, contextToken, options, host, program, log, preferences) {
|
|
127778
127990
|
if (ts.isInReferenceComment(sourceFile, position)) {
|
|
127779
127991
|
var entries = getTripleSlashReferenceCompletion(sourceFile, position, options, host);
|
|
127780
127992
|
return entries && convertPathCompletions(entries);
|
|
@@ -127782,12 +127994,12 @@ var ts;
|
|
|
127782
127994
|
if (ts.isInString(sourceFile, position, contextToken)) {
|
|
127783
127995
|
if (!contextToken || !ts.isStringLiteralLike(contextToken))
|
|
127784
127996
|
return undefined;
|
|
127785
|
-
var entries = getStringLiteralCompletionEntries(sourceFile, contextToken, position,
|
|
127786
|
-
return convertStringLiteralCompletions(entries, contextToken, sourceFile,
|
|
127997
|
+
var entries = getStringLiteralCompletionEntries(sourceFile, contextToken, position, program.getTypeChecker(), options, host, preferences);
|
|
127998
|
+
return convertStringLiteralCompletions(entries, contextToken, sourceFile, host, program, log, options, preferences);
|
|
127787
127999
|
}
|
|
127788
128000
|
}
|
|
127789
128001
|
StringCompletions.getStringLiteralCompletions = getStringLiteralCompletions;
|
|
127790
|
-
function convertStringLiteralCompletions(completion, contextToken, sourceFile,
|
|
128002
|
+
function convertStringLiteralCompletions(completion, contextToken, sourceFile, host, program, log, options, preferences) {
|
|
127791
128003
|
if (completion === undefined) {
|
|
127792
128004
|
return undefined;
|
|
127793
128005
|
}
|
|
@@ -127797,7 +128009,7 @@ var ts;
|
|
|
127797
128009
|
return convertPathCompletions(completion.paths);
|
|
127798
128010
|
case 1 /* Properties */: {
|
|
127799
128011
|
var entries = [];
|
|
127800
|
-
Completions.getCompletionEntriesFromSymbols(completion.symbols, entries, contextToken, contextToken, sourceFile, sourceFile,
|
|
128012
|
+
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
|
|
127801
128013
|
return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: completion.hasIndexSignature, optionalReplacementSpan: optionalReplacementSpan, entries: entries };
|
|
127802
128014
|
}
|
|
127803
128015
|
case 2 /* Types */: {
|
|
@@ -128523,6 +128735,8 @@ var ts;
|
|
|
128523
128735
|
(function (CompletionSource) {
|
|
128524
128736
|
/** Completions that require `this.` insertion text */
|
|
128525
128737
|
CompletionSource["ThisProperty"] = "ThisProperty/";
|
|
128738
|
+
/** Auto-import that comes attached to a class member snippet */
|
|
128739
|
+
CompletionSource["ClassMemberSnippet"] = "ClassMemberSnippet/";
|
|
128526
128740
|
})(CompletionSource = Completions.CompletionSource || (Completions.CompletionSource = {}));
|
|
128527
128741
|
var SymbolOriginInfoKind;
|
|
128528
128742
|
(function (SymbolOriginInfoKind) {
|
|
@@ -128631,7 +128845,6 @@ var ts;
|
|
|
128631
128845
|
}
|
|
128632
128846
|
// If the request is a continuation of an earlier `isIncomplete` response,
|
|
128633
128847
|
// we can continue it from the cached previous response.
|
|
128634
|
-
var typeChecker = program.getTypeChecker();
|
|
128635
128848
|
var compilerOptions = program.getCompilerOptions();
|
|
128636
128849
|
var incompleteCompletionsCache = preferences.allowIncompleteCompletions ? (_a = host.getIncompleteCompletionsCache) === null || _a === void 0 ? void 0 : _a.call(host) : undefined;
|
|
128637
128850
|
if (incompleteCompletionsCache && completionKind === 3 /* TriggerForIncompleteCompletions */ && previousToken && ts.isIdentifier(previousToken)) {
|
|
@@ -128643,7 +128856,7 @@ var ts;
|
|
|
128643
128856
|
else {
|
|
128644
128857
|
incompleteCompletionsCache === null || incompleteCompletionsCache === void 0 ? void 0 : incompleteCompletionsCache.clear();
|
|
128645
128858
|
}
|
|
128646
|
-
var stringCompletions = Completions.StringCompletions.getStringLiteralCompletions(sourceFile, position, previousToken,
|
|
128859
|
+
var stringCompletions = Completions.StringCompletions.getStringLiteralCompletions(sourceFile, position, previousToken, compilerOptions, host, program, log, preferences);
|
|
128647
128860
|
if (stringCompletions) {
|
|
128648
128861
|
return stringCompletions;
|
|
128649
128862
|
}
|
|
@@ -128657,7 +128870,7 @@ var ts;
|
|
|
128657
128870
|
}
|
|
128658
128871
|
switch (completionData.kind) {
|
|
128659
128872
|
case 0 /* Data */:
|
|
128660
|
-
var response = completionInfoFromData(sourceFile,
|
|
128873
|
+
var response = completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences);
|
|
128661
128874
|
if (response === null || response === void 0 ? void 0 : response.isIncomplete) {
|
|
128662
128875
|
incompleteCompletionsCache === null || incompleteCompletionsCache === void 0 ? void 0 : incompleteCompletionsCache.set(response);
|
|
128663
128876
|
}
|
|
@@ -128754,7 +128967,7 @@ var ts;
|
|
|
128754
128967
|
// StringLiteralLike locations are handled separately in stringCompletions.ts
|
|
128755
128968
|
return (location === null || location === void 0 ? void 0 : location.kind) === 79 /* Identifier */ ? ts.createTextSpanFromNode(location) : undefined;
|
|
128756
128969
|
}
|
|
128757
|
-
function completionInfoFromData(sourceFile,
|
|
128970
|
+
function completionInfoFromData(sourceFile, host, program, compilerOptions, log, completionData, preferences) {
|
|
128758
128971
|
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;
|
|
128759
128972
|
// Verify if the file is JSX language variant
|
|
128760
128973
|
if (ts.getLanguageVariant(sourceFile.scriptKind) === 1 /* JSX */) {
|
|
@@ -128766,7 +128979,7 @@ var ts;
|
|
|
128766
128979
|
var entries = [];
|
|
128767
128980
|
if (isUncheckedFile(sourceFile, compilerOptions)) {
|
|
128768
128981
|
var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries,
|
|
128769
|
-
/*replacementToken*/ undefined, contextToken, location, sourceFile,
|
|
128982
|
+
/*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextIdMap);
|
|
128770
128983
|
getJSCompletionEntries(sourceFile, location.pos, uniqueNames, ts.getEmitScriptTarget(compilerOptions), entries); // TODO: GH#18217
|
|
128771
128984
|
}
|
|
128772
128985
|
else {
|
|
@@ -128774,7 +128987,7 @@ var ts;
|
|
|
128774
128987
|
return undefined;
|
|
128775
128988
|
}
|
|
128776
128989
|
getCompletionEntriesFromSymbols(symbols, entries,
|
|
128777
|
-
/*replacementToken*/ undefined, contextToken, location, sourceFile,
|
|
128990
|
+
/*replacementToken*/ undefined, contextToken, location, sourceFile, host, program, ts.getEmitScriptTarget(compilerOptions), log, completionKind, preferences, compilerOptions, isTypeOnlyLocation, propertyAccessToConvert, isJsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextIdMap);
|
|
128778
128991
|
}
|
|
128779
128992
|
if (keywordFilters !== 0 /* None */) {
|
|
128780
128993
|
var entryNames = new ts.Set(entries.map(function (e) { return e.name; }));
|
|
@@ -128880,14 +129093,16 @@ var ts;
|
|
|
128880
129093
|
function createCompletionEntryForLiteral(sourceFile, preferences, literal) {
|
|
128881
129094
|
return { name: completionNameForLiteral(sourceFile, preferences, literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: SortText.LocationPriority };
|
|
128882
129095
|
}
|
|
128883
|
-
function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile,
|
|
128884
|
-
var _a;
|
|
129096
|
+
function createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importCompletionNode, useSemicolons, options, preferences, completionKind) {
|
|
129097
|
+
var _a, _b;
|
|
128885
129098
|
var insertText;
|
|
128886
129099
|
var replacementSpan = ts.getReplacementSpanForContextToken(replacementToken);
|
|
128887
129100
|
var data;
|
|
128888
129101
|
var isSnippet;
|
|
129102
|
+
var source = getSourceFromOrigin(origin);
|
|
128889
129103
|
var sourceDisplay;
|
|
128890
129104
|
var hasAction;
|
|
129105
|
+
var typeChecker = program.getTypeChecker();
|
|
128891
129106
|
var insertQuestionDot = origin && originIsNullableMember(origin);
|
|
128892
129107
|
var useBraces = origin && originIsSymbolMember(origin) || needsConvertPropertyAccess;
|
|
128893
129108
|
if (origin && originIsThisType(origin)) {
|
|
@@ -128938,12 +129153,16 @@ var ts;
|
|
|
128938
129153
|
isSnippet = preferences.includeCompletionsWithSnippetText ? true : undefined;
|
|
128939
129154
|
}
|
|
128940
129155
|
}
|
|
128941
|
-
if (
|
|
128942
|
-
|
|
128943
|
-
|
|
128944
|
-
|
|
128945
|
-
|
|
128946
|
-
|
|
129156
|
+
if (preferences.includeCompletionsWithClassMemberSnippets &&
|
|
129157
|
+
preferences.includeCompletionsWithInsertText &&
|
|
129158
|
+
completionKind === 3 /* MemberLike */ &&
|
|
129159
|
+
isClassLikeMemberCompletion(symbol, location)) {
|
|
129160
|
+
var importAdder = void 0;
|
|
129161
|
+
(_b = getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, contextToken), insertText = _b.insertText, isSnippet = _b.isSnippet, importAdder = _b.importAdder);
|
|
129162
|
+
if (importAdder === null || importAdder === void 0 ? void 0 : importAdder.hasFixes()) {
|
|
129163
|
+
hasAction = true;
|
|
129164
|
+
source = CompletionSource.ClassMemberSnippet;
|
|
129165
|
+
}
|
|
128947
129166
|
}
|
|
128948
129167
|
var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, location);
|
|
128949
129168
|
if (kind === "JSX attribute" /* jsxAttribute */ && preferences.includeCompletionsWithSnippetText && preferences.jsxAttributeCompletionStyle && preferences.jsxAttributeCompletionStyle !== "none") {
|
|
@@ -128955,7 +129174,7 @@ var ts;
|
|
|
128955
129174
|
&& !(type.flags & 1048576 /* Union */ && ts.find(type.types, function (type) { return !!(type.flags & 528 /* BooleanLike */); }))) {
|
|
128956
129175
|
if (type.flags & 402653316 /* StringLike */ || (type.flags & 1048576 /* Union */ && ts.every(type.types, function (type) { return !!(type.flags & (402653316 /* StringLike */ | 32768 /* Undefined */)); }))) {
|
|
128957
129176
|
// If is string like or undefined use quotes
|
|
128958
|
-
insertText = escapeSnippetText(name) + "=" + ts.quote(sourceFile, preferences, "$1");
|
|
129177
|
+
insertText = ts.escapeSnippetText(name) + "=" + ts.quote(sourceFile, preferences, "$1");
|
|
128959
129178
|
isSnippet = true;
|
|
128960
129179
|
}
|
|
128961
129180
|
else {
|
|
@@ -128964,13 +129183,20 @@ var ts;
|
|
|
128964
129183
|
}
|
|
128965
129184
|
}
|
|
128966
129185
|
if (useBraces_1) {
|
|
128967
|
-
insertText = escapeSnippetText(name) + "={$1}";
|
|
129186
|
+
insertText = ts.escapeSnippetText(name) + "={$1}";
|
|
128968
129187
|
isSnippet = true;
|
|
128969
129188
|
}
|
|
128970
129189
|
if (isSnippet) {
|
|
128971
129190
|
replacementSpan = ts.createTextSpanFromNode(location, sourceFile);
|
|
128972
129191
|
}
|
|
128973
129192
|
}
|
|
129193
|
+
if (insertText !== undefined && !preferences.includeCompletionsWithInsertText) {
|
|
129194
|
+
return undefined;
|
|
129195
|
+
}
|
|
129196
|
+
if (originIsExport(origin) || originIsResolvedExport(origin)) {
|
|
129197
|
+
data = originToCompletionEntryData(origin);
|
|
129198
|
+
hasAction = !importCompletionNode;
|
|
129199
|
+
}
|
|
128974
129200
|
// TODO(drosen): Right now we just permit *all* semantic meanings when calling
|
|
128975
129201
|
// 'getSymbolKind' which is permissible given that it is backwards compatible; but
|
|
128976
129202
|
// really we should consider passing the meaning for the node so that we don't report
|
|
@@ -128983,7 +129209,7 @@ var ts;
|
|
|
128983
129209
|
kind: kind,
|
|
128984
129210
|
kindModifiers: ts.SymbolDisplay.getSymbolModifiers(typeChecker, symbol),
|
|
128985
129211
|
sortText: sortText,
|
|
128986
|
-
source:
|
|
129212
|
+
source: source,
|
|
128987
129213
|
hasAction: hasAction ? true : undefined,
|
|
128988
129214
|
isRecommended: isRecommendedCompletionMatch(symbol, recommendedCompletion, typeChecker) || undefined,
|
|
128989
129215
|
insertText: insertText,
|
|
@@ -128995,8 +129221,172 @@ var ts;
|
|
|
128995
129221
|
data: data,
|
|
128996
129222
|
};
|
|
128997
129223
|
}
|
|
128998
|
-
function
|
|
128999
|
-
|
|
129224
|
+
function isClassLikeMemberCompletion(symbol, location) {
|
|
129225
|
+
// TODO: support JS files.
|
|
129226
|
+
if (ts.isInJSFile(location)) {
|
|
129227
|
+
return false;
|
|
129228
|
+
}
|
|
129229
|
+
// Completion symbol must be for a class member.
|
|
129230
|
+
var memberFlags = 106500 /* ClassMember */
|
|
129231
|
+
& 900095 /* EnumMemberExcludes */;
|
|
129232
|
+
/* In
|
|
129233
|
+
`class C {
|
|
129234
|
+
|
|
|
129235
|
+
}`
|
|
129236
|
+
`location` is a class-like declaration.
|
|
129237
|
+
In
|
|
129238
|
+
`class C {
|
|
129239
|
+
m|
|
|
129240
|
+
}`
|
|
129241
|
+
`location` is an identifier,
|
|
129242
|
+
`location.parent` is a class element declaration,
|
|
129243
|
+
and `location.parent.parent` is a class-like declaration.
|
|
129244
|
+
In
|
|
129245
|
+
`abstract class C {
|
|
129246
|
+
abstract
|
|
129247
|
+
abstract m|
|
|
129248
|
+
}`
|
|
129249
|
+
`location` is a syntax list (with modifiers as children),
|
|
129250
|
+
and `location.parent` is a class-like declaration.
|
|
129251
|
+
*/
|
|
129252
|
+
return !!(symbol.flags & memberFlags) &&
|
|
129253
|
+
(ts.isClassLike(location) ||
|
|
129254
|
+
(location.parent &&
|
|
129255
|
+
location.parent.parent &&
|
|
129256
|
+
ts.isClassElement(location.parent) &&
|
|
129257
|
+
location === location.parent.name &&
|
|
129258
|
+
ts.isClassLike(location.parent.parent)) ||
|
|
129259
|
+
(location.parent &&
|
|
129260
|
+
ts.isSyntaxList(location) &&
|
|
129261
|
+
ts.isClassLike(location.parent)));
|
|
129262
|
+
}
|
|
129263
|
+
function getEntryForMemberCompletion(host, program, options, preferences, name, symbol, location, contextToken) {
|
|
129264
|
+
var classLikeDeclaration = ts.findAncestor(location, ts.isClassLike);
|
|
129265
|
+
if (!classLikeDeclaration) {
|
|
129266
|
+
return { insertText: name };
|
|
129267
|
+
}
|
|
129268
|
+
var isSnippet;
|
|
129269
|
+
var insertText = name;
|
|
129270
|
+
var checker = program.getTypeChecker();
|
|
129271
|
+
var sourceFile = location.getSourceFile();
|
|
129272
|
+
var printer = createSnippetPrinter({
|
|
129273
|
+
removeComments: true,
|
|
129274
|
+
module: options.module,
|
|
129275
|
+
target: options.target,
|
|
129276
|
+
omitTrailingSemicolon: true,
|
|
129277
|
+
newLine: ts.getNewLineKind(ts.getNewLineCharacter(options, ts.maybeBind(host, host.getNewLine))),
|
|
129278
|
+
});
|
|
129279
|
+
var importAdder = ts.codefix.createImportAdder(sourceFile, program, preferences, host);
|
|
129280
|
+
var body;
|
|
129281
|
+
if (preferences.includeCompletionsWithSnippetText) {
|
|
129282
|
+
isSnippet = true;
|
|
129283
|
+
// We are adding a tabstop (i.e. `$0`) in the body of the suggested member,
|
|
129284
|
+
// if it has one, so that the cursor ends up in the body once the completion is inserted.
|
|
129285
|
+
// Note: this assumes we won't have more than one body in the completion nodes, which should be the case.
|
|
129286
|
+
var emptyStatement = ts.factory.createExpressionStatement(ts.factory.createIdentifier(""));
|
|
129287
|
+
ts.setSnippetElement(emptyStatement, { kind: 0 /* TabStop */, order: 0 });
|
|
129288
|
+
body = ts.factory.createBlock([emptyStatement], /* multiline */ true);
|
|
129289
|
+
}
|
|
129290
|
+
else {
|
|
129291
|
+
body = ts.factory.createBlock([], /* multiline */ true);
|
|
129292
|
+
}
|
|
129293
|
+
var modifiers = 0 /* None */;
|
|
129294
|
+
// Whether the suggested member should be abstract.
|
|
129295
|
+
// e.g. in `abstract class C { abstract | }`, we should offer abstract method signatures at position `|`.
|
|
129296
|
+
// Note: We are relying on checking if the context token is `abstract`,
|
|
129297
|
+
// since other visibility modifiers (e.g. `protected`) should come *before* `abstract`.
|
|
129298
|
+
// However, that is not true for the e.g. `override` modifier, so this check has its limitations.
|
|
129299
|
+
var isAbstract = contextToken && isModifierLike(contextToken) === 126 /* AbstractKeyword */;
|
|
129300
|
+
var completionNodes = [];
|
|
129301
|
+
ts.codefix.addNewNodeForMemberSymbol(symbol, classLikeDeclaration, sourceFile, { program: program, host: host }, preferences, importAdder,
|
|
129302
|
+
// `addNewNodeForMemberSymbol` calls this callback function for each new member node
|
|
129303
|
+
// it adds for the given member symbol.
|
|
129304
|
+
// We store these member nodes in the `completionNodes` array.
|
|
129305
|
+
// Note: there might be:
|
|
129306
|
+
// - No nodes if `addNewNodeForMemberSymbol` cannot figure out a node for the member;
|
|
129307
|
+
// - One node;
|
|
129308
|
+
// - More than one node if the member is overloaded (e.g. a method with overload signatures).
|
|
129309
|
+
function (node) {
|
|
129310
|
+
var requiredModifiers = 0 /* None */;
|
|
129311
|
+
if (isAbstract) {
|
|
129312
|
+
requiredModifiers |= 128 /* Abstract */;
|
|
129313
|
+
}
|
|
129314
|
+
if (ts.isClassElement(node)
|
|
129315
|
+
&& checker.getMemberOverrideModifierStatus(classLikeDeclaration, node) === 1 /* NeedsOverride */) {
|
|
129316
|
+
requiredModifiers |= 16384 /* Override */;
|
|
129317
|
+
}
|
|
129318
|
+
var presentModifiers = 0 /* None */;
|
|
129319
|
+
if (!completionNodes.length) {
|
|
129320
|
+
// Omit already present modifiers from the first completion node/signature.
|
|
129321
|
+
if (contextToken) {
|
|
129322
|
+
presentModifiers = getPresentModifiers(contextToken);
|
|
129323
|
+
}
|
|
129324
|
+
// Keep track of added missing required modifiers and modifiers already present.
|
|
129325
|
+
// This is needed when we have overloaded signatures,
|
|
129326
|
+
// so this callback will be called for multiple nodes/signatures,
|
|
129327
|
+
// and we need to make sure the modifiers are uniform for all nodes/signatures.
|
|
129328
|
+
modifiers = node.modifierFlagsCache | requiredModifiers | presentModifiers;
|
|
129329
|
+
}
|
|
129330
|
+
node = ts.factory.updateModifiers(node, modifiers & (~presentModifiers));
|
|
129331
|
+
completionNodes.push(node);
|
|
129332
|
+
}, body, isAbstract);
|
|
129333
|
+
if (completionNodes.length) {
|
|
129334
|
+
insertText = printer.printSnippetList(1 /* MultiLine */, ts.factory.createNodeArray(completionNodes), sourceFile);
|
|
129335
|
+
}
|
|
129336
|
+
return { insertText: insertText, isSnippet: isSnippet, importAdder: importAdder };
|
|
129337
|
+
}
|
|
129338
|
+
function getPresentModifiers(contextToken) {
|
|
129339
|
+
var modifiers = 0 /* None */;
|
|
129340
|
+
var contextMod;
|
|
129341
|
+
/*
|
|
129342
|
+
Cases supported:
|
|
129343
|
+
In
|
|
129344
|
+
`class C {
|
|
129345
|
+
public abstract |
|
|
129346
|
+
}`
|
|
129347
|
+
`contextToken` is ``abstract`` (as an identifier),
|
|
129348
|
+
`contextToken.parent` is property declaration,
|
|
129349
|
+
`location` is class declaration ``class C { ... }``.
|
|
129350
|
+
In
|
|
129351
|
+
`class C {
|
|
129352
|
+
protected override m|
|
|
129353
|
+
}`
|
|
129354
|
+
`contextToken` is ``override`` (as a keyword),
|
|
129355
|
+
`contextToken.parent` is property declaration,
|
|
129356
|
+
`location` is identifier ``m``,
|
|
129357
|
+
`location.parent` is property declaration ``protected override m``,
|
|
129358
|
+
`location.parent.parent` is class declaration ``class C { ... }``.
|
|
129359
|
+
*/
|
|
129360
|
+
if (contextMod = isModifierLike(contextToken)) {
|
|
129361
|
+
modifiers |= ts.modifierToFlag(contextMod);
|
|
129362
|
+
}
|
|
129363
|
+
if (ts.isPropertyDeclaration(contextToken.parent)) {
|
|
129364
|
+
modifiers |= ts.modifiersToFlags(contextToken.parent.modifiers);
|
|
129365
|
+
}
|
|
129366
|
+
return modifiers;
|
|
129367
|
+
}
|
|
129368
|
+
function isModifierLike(node) {
|
|
129369
|
+
if (ts.isModifier(node)) {
|
|
129370
|
+
return node.kind;
|
|
129371
|
+
}
|
|
129372
|
+
if (ts.isIdentifier(node) && node.originalKeywordKind && ts.isModifierKind(node.originalKeywordKind)) {
|
|
129373
|
+
return node.originalKeywordKind;
|
|
129374
|
+
}
|
|
129375
|
+
return undefined;
|
|
129376
|
+
}
|
|
129377
|
+
function createSnippetPrinter(printerOptions) {
|
|
129378
|
+
var printer = ts.createPrinter(printerOptions);
|
|
129379
|
+
var baseWriter = ts.createTextWriter(ts.getNewLineCharacter(printerOptions));
|
|
129380
|
+
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)); } });
|
|
129381
|
+
return {
|
|
129382
|
+
printSnippetList: printSnippetList,
|
|
129383
|
+
};
|
|
129384
|
+
/* Snippet-escaping version of `printer.printList`. */
|
|
129385
|
+
function printSnippetList(format, list, sourceFile) {
|
|
129386
|
+
writer.clear();
|
|
129387
|
+
printer.writeList(format, list, sourceFile, writer);
|
|
129388
|
+
return writer.getText();
|
|
129389
|
+
}
|
|
129000
129390
|
}
|
|
129001
129391
|
function originToCompletionEntryData(origin) {
|
|
129002
129392
|
var ambientModuleName = origin.fileName ? undefined : ts.stripQuotes(origin.moduleSymbol.name);
|
|
@@ -129064,10 +129454,10 @@ var ts;
|
|
|
129064
129454
|
var importSpecifierTypeOnlyText = isImportSpecifierTypeOnly ? ts.tokenToString(151 /* TypeKeyword */) + " " : "";
|
|
129065
129455
|
var suffix = useSemicolons ? ";" : "";
|
|
129066
129456
|
switch (importKind) {
|
|
129067
|
-
case 3 /* CommonJS */: return { replacementSpan: replacementSpan, insertText: "import" + topLevelTypeOnlyText + escapeSnippetText(name) + tabStop + " = require(" + quotedModuleSpecifier + ")" + suffix };
|
|
129068
|
-
case 1 /* Default */: return { replacementSpan: replacementSpan, insertText: "import" + topLevelTypeOnlyText + escapeSnippetText(name) + tabStop + " from " + quotedModuleSpecifier + suffix };
|
|
129069
|
-
case 2 /* Namespace */: return { replacementSpan: replacementSpan, insertText: "import" + topLevelTypeOnlyText + "* as " + escapeSnippetText(name) + " from " + quotedModuleSpecifier + suffix };
|
|
129070
|
-
case 0 /* Named */: return { replacementSpan: replacementSpan, insertText: "import" + topLevelTypeOnlyText + "{ " + importSpecifierTypeOnlyText + escapeSnippetText(name) + tabStop + " } from " + quotedModuleSpecifier + suffix };
|
|
129457
|
+
case 3 /* CommonJS */: return { replacementSpan: replacementSpan, insertText: "import" + topLevelTypeOnlyText + ts.escapeSnippetText(name) + tabStop + " = require(" + quotedModuleSpecifier + ")" + suffix };
|
|
129458
|
+
case 1 /* Default */: return { replacementSpan: replacementSpan, insertText: "import" + topLevelTypeOnlyText + ts.escapeSnippetText(name) + tabStop + " from " + quotedModuleSpecifier + suffix };
|
|
129459
|
+
case 2 /* Namespace */: return { replacementSpan: replacementSpan, insertText: "import" + topLevelTypeOnlyText + "* as " + ts.escapeSnippetText(name) + " from " + quotedModuleSpecifier + suffix };
|
|
129460
|
+
case 0 /* Named */: return { replacementSpan: replacementSpan, insertText: "import" + topLevelTypeOnlyText + "{ " + importSpecifierTypeOnlyText + ts.escapeSnippetText(name) + tabStop + " } from " + quotedModuleSpecifier + suffix };
|
|
129071
129461
|
}
|
|
129072
129462
|
}
|
|
129073
129463
|
function quotePropertyName(sourceFile, preferences, name) {
|
|
@@ -129091,11 +129481,12 @@ var ts;
|
|
|
129091
129481
|
return CompletionSource.ThisProperty;
|
|
129092
129482
|
}
|
|
129093
129483
|
}
|
|
129094
|
-
function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, sourceFile,
|
|
129484
|
+
function getCompletionEntriesFromSymbols(symbols, entries, replacementToken, contextToken, location, sourceFile, host, program, target, log, kind, preferences, compilerOptions, isTypeOnlyLocation, propertyAccessToConvert, jsxIdentifierExpected, isJsxInitializer, importCompletionNode, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextIdMap) {
|
|
129095
129485
|
var _a;
|
|
129096
129486
|
var start = ts.timestamp();
|
|
129097
129487
|
var variableDeclaration = getVariableDeclaration(location);
|
|
129098
129488
|
var useSemicolons = ts.probablyUsesSemicolons(sourceFile);
|
|
129489
|
+
var typeChecker = program.getTypeChecker();
|
|
129099
129490
|
// Tracks unique names.
|
|
129100
129491
|
// Value is set to false for global variables or completions from external module exports, because we can have multiple of those;
|
|
129101
129492
|
// true otherwise. Based on the order we add things we will always see locals first, then globals, then module exports.
|
|
@@ -129111,7 +129502,7 @@ var ts;
|
|
|
129111
129502
|
var name = info.name, needsConvertPropertyAccess = info.needsConvertPropertyAccess;
|
|
129112
129503
|
var sortTextId = (_a = symbolToSortTextIdMap === null || symbolToSortTextIdMap === void 0 ? void 0 : symbolToSortTextIdMap[ts.getSymbolId(symbol)]) !== null && _a !== void 0 ? _a : 11 /* LocationPriority */;
|
|
129113
129504
|
var sortText = (isDeprecated(symbol, typeChecker) ? 8 /* DeprecatedOffset */ + sortTextId : sortTextId).toString();
|
|
129114
|
-
var entry = createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile,
|
|
129505
|
+
var entry = createCompletionEntry(symbol, sortText, replacementToken, contextToken, location, sourceFile, host, program, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, importCompletionNode, useSemicolons, compilerOptions, preferences, kind);
|
|
129115
129506
|
if (!entry) {
|
|
129116
129507
|
continue;
|
|
129117
129508
|
}
|
|
@@ -129204,11 +129595,13 @@ var ts;
|
|
|
129204
129595
|
if (entryId.data) {
|
|
129205
129596
|
var autoImport = getAutoImportSymbolFromCompletionEntryData(entryId.name, entryId.data, program, host);
|
|
129206
129597
|
if (autoImport) {
|
|
129598
|
+
var _a = getRelevantTokens(position, sourceFile), contextToken_1 = _a.contextToken, previousToken_1 = _a.previousToken;
|
|
129207
129599
|
return {
|
|
129208
129600
|
type: "symbol",
|
|
129209
129601
|
symbol: autoImport.symbol,
|
|
129210
129602
|
location: ts.getTouchingPropertyName(sourceFile, position),
|
|
129211
|
-
previousToken:
|
|
129603
|
+
previousToken: previousToken_1,
|
|
129604
|
+
contextToken: contextToken_1,
|
|
129212
129605
|
isJsxInitializer: false,
|
|
129213
129606
|
isTypeOnlyLocation: false,
|
|
129214
129607
|
origin: autoImport.origin,
|
|
@@ -129223,7 +129616,7 @@ var ts;
|
|
|
129223
129616
|
if (completionData.kind !== 0 /* Data */) {
|
|
129224
129617
|
return { type: "request", request: completionData };
|
|
129225
129618
|
}
|
|
129226
|
-
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;
|
|
129619
|
+
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;
|
|
129227
129620
|
var literal = ts.find(literals, function (l) { return completionNameForLiteral(sourceFile, preferences, l) === entryId.name; });
|
|
129228
129621
|
if (literal !== undefined)
|
|
129229
129622
|
return { type: "literal", literal: literal };
|
|
@@ -129234,15 +129627,15 @@ var ts;
|
|
|
129234
129627
|
return ts.firstDefined(symbols, function (symbol, index) {
|
|
129235
129628
|
var origin = symbolToOriginInfoMap[index];
|
|
129236
129629
|
var info = getCompletionEntryDisplayNameForSymbol(symbol, ts.getEmitScriptTarget(compilerOptions), origin, completionKind, completionData.isJsxIdentifierExpected);
|
|
129237
|
-
return info && info.name === entryId.name && getSourceFromOrigin(origin) === entryId.source
|
|
129238
|
-
? { type: "symbol", symbol: symbol, location: location, origin: origin, previousToken: previousToken, isJsxInitializer: isJsxInitializer, isTypeOnlyLocation: isTypeOnlyLocation }
|
|
129630
|
+
return info && info.name === entryId.name && (entryId.source === CompletionSource.ClassMemberSnippet && symbol.flags & 106500 /* ClassMember */ || getSourceFromOrigin(origin) === entryId.source)
|
|
129631
|
+
? { type: "symbol", symbol: symbol, location: location, origin: origin, contextToken: contextToken, previousToken: previousToken, isJsxInitializer: isJsxInitializer, isTypeOnlyLocation: isTypeOnlyLocation }
|
|
129239
129632
|
: undefined;
|
|
129240
129633
|
}) || { type: "none" };
|
|
129241
129634
|
}
|
|
129242
129635
|
function getCompletionEntryDetails(program, log, sourceFile, position, entryId, host, formatContext, preferences, cancellationToken) {
|
|
129243
129636
|
var typeChecker = program.getTypeChecker();
|
|
129244
129637
|
var compilerOptions = program.getCompilerOptions();
|
|
129245
|
-
var name = entryId.name;
|
|
129638
|
+
var name = entryId.name, source = entryId.source, data = entryId.data;
|
|
129246
129639
|
var contextToken = ts.findPrecedingToken(position, sourceFile);
|
|
129247
129640
|
if (ts.isInString(sourceFile, position, contextToken)) {
|
|
129248
129641
|
return Completions.StringCompletions.getStringLiteralCompletionDetails(name, sourceFile, position, contextToken, typeChecker, compilerOptions, host, cancellationToken, preferences);
|
|
@@ -129266,8 +129659,8 @@ var ts;
|
|
|
129266
129659
|
}
|
|
129267
129660
|
}
|
|
129268
129661
|
case "symbol": {
|
|
129269
|
-
var symbol = symbolCompletion.symbol, location = symbolCompletion.location, origin = symbolCompletion.origin, previousToken = symbolCompletion.previousToken;
|
|
129270
|
-
var _a = getCompletionEntryCodeActionsAndSourceDisplay(origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences,
|
|
129662
|
+
var symbol = symbolCompletion.symbol, location = symbolCompletion.location, contextToken_2 = symbolCompletion.contextToken, origin = symbolCompletion.origin, previousToken = symbolCompletion.previousToken;
|
|
129663
|
+
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;
|
|
129271
129664
|
return createCompletionDetailsForSymbol(symbol, typeChecker, sourceFile, location, cancellationToken, codeActions, sourceDisplay); // TODO: GH#18217
|
|
129272
129665
|
}
|
|
129273
129666
|
case "literal": {
|
|
@@ -129296,14 +129689,27 @@ var ts;
|
|
|
129296
129689
|
return { name: name, kindModifiers: kindModifiers, kind: kind, displayParts: displayParts, documentation: documentation, tags: tags, codeActions: codeActions, source: source, sourceDisplay: source };
|
|
129297
129690
|
}
|
|
129298
129691
|
Completions.createCompletionDetails = createCompletionDetails;
|
|
129299
|
-
function getCompletionEntryCodeActionsAndSourceDisplay(origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data) {
|
|
129692
|
+
function getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source) {
|
|
129300
129693
|
if (data === null || data === void 0 ? void 0 : data.moduleSpecifier) {
|
|
129301
|
-
var _a = getRelevantTokens(position, sourceFile),
|
|
129302
|
-
if (
|
|
129694
|
+
var _a = getRelevantTokens(position, sourceFile), contextToken_3 = _a.contextToken, previousToken_2 = _a.previousToken;
|
|
129695
|
+
if (previousToken_2 && getImportStatementCompletionInfo(contextToken_3 || previousToken_2).replacementNode) {
|
|
129303
129696
|
// Import statement completion: 'import c|'
|
|
129304
129697
|
return { codeActions: undefined, sourceDisplay: [ts.textPart(data.moduleSpecifier)] };
|
|
129305
129698
|
}
|
|
129306
129699
|
}
|
|
129700
|
+
if (source === CompletionSource.ClassMemberSnippet) {
|
|
129701
|
+
var importAdder = getEntryForMemberCompletion(host, program, compilerOptions, preferences, name, symbol, location, contextToken).importAdder;
|
|
129702
|
+
if (importAdder) {
|
|
129703
|
+
var changes = ts.textChanges.ChangeTracker.with({ host: host, formatContext: formatContext, preferences: preferences }, importAdder.writeFixes);
|
|
129704
|
+
return {
|
|
129705
|
+
sourceDisplay: undefined,
|
|
129706
|
+
codeActions: [{
|
|
129707
|
+
changes: changes,
|
|
129708
|
+
description: ts.diagnosticToString([ts.Diagnostics.Includes_imports_of_types_referenced_by_0, name]),
|
|
129709
|
+
}],
|
|
129710
|
+
};
|
|
129711
|
+
}
|
|
129712
|
+
}
|
|
129307
129713
|
if (!origin || !(originIsExport(origin) || originIsResolvedExport(origin))) {
|
|
129308
129714
|
return { codeActions: undefined, sourceDisplay: undefined };
|
|
129309
129715
|
}
|
|
@@ -145144,7 +145550,7 @@ var ts;
|
|
|
145144
145550
|
/** Note: output node may be mutated input node. */
|
|
145145
145551
|
function getNonformattedText(node, sourceFile, newLineCharacter) {
|
|
145146
145552
|
var writer = createWriter(newLineCharacter);
|
|
145147
|
-
var newLine = newLineCharacter
|
|
145553
|
+
var newLine = ts.getNewLineKind(newLineCharacter);
|
|
145148
145554
|
ts.createPrinter({
|
|
145149
145555
|
newLine: newLine,
|
|
145150
145556
|
neverAsciiEscape: true,
|
|
@@ -145609,21 +146015,16 @@ var ts;
|
|
|
145609
146015
|
(function (codefix) {
|
|
145610
146016
|
var errorCodeToFixes = ts.createMultiMap();
|
|
145611
146017
|
var fixIdToRegistration = new ts.Map();
|
|
145612
|
-
function diagnosticToString(diag) {
|
|
145613
|
-
return ts.isArray(diag)
|
|
145614
|
-
? ts.formatStringFromArgs(ts.getLocaleSpecificMessage(diag[0]), diag.slice(1))
|
|
145615
|
-
: ts.getLocaleSpecificMessage(diag);
|
|
145616
|
-
}
|
|
145617
146018
|
function createCodeFixActionWithoutFixAll(fixName, changes, description) {
|
|
145618
|
-
return createCodeFixActionWorker(fixName, diagnosticToString(description), changes, /*fixId*/ undefined, /*fixAllDescription*/ undefined);
|
|
146019
|
+
return createCodeFixActionWorker(fixName, ts.diagnosticToString(description), changes, /*fixId*/ undefined, /*fixAllDescription*/ undefined);
|
|
145619
146020
|
}
|
|
145620
146021
|
codefix.createCodeFixActionWithoutFixAll = createCodeFixActionWithoutFixAll;
|
|
145621
146022
|
function createCodeFixAction(fixName, changes, description, fixId, fixAllDescription, command) {
|
|
145622
|
-
return createCodeFixActionWorker(fixName, diagnosticToString(description), changes, fixId, diagnosticToString(fixAllDescription), command);
|
|
146023
|
+
return createCodeFixActionWorker(fixName, ts.diagnosticToString(description), changes, fixId, ts.diagnosticToString(fixAllDescription), command);
|
|
145623
146024
|
}
|
|
145624
146025
|
codefix.createCodeFixAction = createCodeFixAction;
|
|
145625
146026
|
function createCodeFixActionMaybeFixAll(fixName, changes, description, fixId, fixAllDescription, command) {
|
|
145626
|
-
return createCodeFixActionWorker(fixName, diagnosticToString(description), changes, fixId, fixAllDescription && diagnosticToString(fixAllDescription), command);
|
|
146027
|
+
return createCodeFixActionWorker(fixName, ts.diagnosticToString(description), changes, fixId, fixAllDescription && ts.diagnosticToString(fixAllDescription), command);
|
|
145627
146028
|
}
|
|
145628
146029
|
codefix.createCodeFixActionMaybeFixAll = createCodeFixActionMaybeFixAll;
|
|
145629
146030
|
function createCodeFixActionWorker(fixName, description, changes, fixId, fixAllDescription, command) {
|
|
@@ -148384,7 +148785,7 @@ var ts;
|
|
|
148384
148785
|
var addToExisting = new ts.Map();
|
|
148385
148786
|
/** Use `getNewImportEntry` for access */
|
|
148386
148787
|
var newImports = new ts.Map();
|
|
148387
|
-
return { addImportFromDiagnostic: addImportFromDiagnostic, addImportFromExportedSymbol: addImportFromExportedSymbol, writeFixes: writeFixes };
|
|
148788
|
+
return { addImportFromDiagnostic: addImportFromDiagnostic, addImportFromExportedSymbol: addImportFromExportedSymbol, writeFixes: writeFixes, hasFixes: hasFixes };
|
|
148388
148789
|
function addImportFromDiagnostic(diagnostic, context) {
|
|
148389
148790
|
var info = getFixesInfo(context, diagnostic.code, diagnostic.start, useAutoImportProvider);
|
|
148390
148791
|
if (!info || !info.fixes.length)
|
|
@@ -148535,6 +148936,9 @@ var ts;
|
|
|
148535
148936
|
ts.insertImports(changeTracker, sourceFile, newDeclarations, /*blankLineBetween*/ true);
|
|
148536
148937
|
}
|
|
148537
148938
|
}
|
|
148939
|
+
function hasFixes() {
|
|
148940
|
+
return addToNamespace.length > 0 || importType.length > 0 || addToExisting.size > 0 || newImports.size > 0;
|
|
148941
|
+
}
|
|
148538
148942
|
}
|
|
148539
148943
|
// Sorted with the preferred fix coming first.
|
|
148540
148944
|
var ImportFixKind;
|
|
@@ -152745,7 +153149,7 @@ var ts;
|
|
|
152745
153149
|
for (var _i = 0, possiblyMissingSymbols_1 = possiblyMissingSymbols; _i < possiblyMissingSymbols_1.length; _i++) {
|
|
152746
153150
|
var symbol = possiblyMissingSymbols_1[_i];
|
|
152747
153151
|
if (!classMembers.has(symbol.escapedName)) {
|
|
152748
|
-
addNewNodeForMemberSymbol(symbol, classDeclaration, sourceFile, context, preferences, importAdder, addClassElement);
|
|
153152
|
+
addNewNodeForMemberSymbol(symbol, classDeclaration, sourceFile, context, preferences, importAdder, addClassElement, /* body */ undefined);
|
|
152749
153153
|
}
|
|
152750
153154
|
}
|
|
152751
153155
|
}
|
|
@@ -152758,9 +153162,11 @@ var ts;
|
|
|
152758
153162
|
}
|
|
152759
153163
|
codefix.getNoopSymbolTrackerWithResolver = getNoopSymbolTrackerWithResolver;
|
|
152760
153164
|
/**
|
|
152761
|
-
*
|
|
153165
|
+
* `addClassElement` will not be called if we can't figure out a representation for `symbol` in `enclosingDeclaration`.
|
|
153166
|
+
* @param body If defined, this will be the body of the member node passed to `addClassElement`. Otherwise, the body will default to a stub.
|
|
152762
153167
|
*/
|
|
152763
|
-
function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, context, preferences, importAdder, addClassElement) {
|
|
153168
|
+
function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, context, preferences, importAdder, addClassElement, body, isAmbient) {
|
|
153169
|
+
if (isAmbient === void 0) { isAmbient = false; }
|
|
152764
153170
|
var declarations = symbol.getDeclarations();
|
|
152765
153171
|
if (!(declarations && declarations.length)) {
|
|
152766
153172
|
return undefined;
|
|
@@ -152773,7 +153179,7 @@ var ts;
|
|
|
152773
153179
|
var modifiers = visibilityModifier ? ts.factory.createNodeArray([visibilityModifier]) : undefined;
|
|
152774
153180
|
var type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration));
|
|
152775
153181
|
var optional = !!(symbol.flags & 16777216 /* Optional */);
|
|
152776
|
-
var ambient = !!(enclosingDeclaration.flags & 8388608 /* Ambient */);
|
|
153182
|
+
var ambient = !!(enclosingDeclaration.flags & 8388608 /* Ambient */) || isAmbient;
|
|
152777
153183
|
var quotePreference = ts.getQuotePreference(sourceFile, preferences);
|
|
152778
153184
|
switch (declaration.kind) {
|
|
152779
153185
|
case 165 /* PropertySignature */:
|
|
@@ -152809,14 +153215,14 @@ var ts;
|
|
|
152809
153215
|
var accessor = orderedAccessors_1[_i];
|
|
152810
153216
|
if (ts.isGetAccessorDeclaration(accessor)) {
|
|
152811
153217
|
addClassElement(ts.factory.createGetAccessorDeclaration(
|
|
152812
|
-
/*decorators*/ undefined, modifiers, name, ts.emptyArray, typeNode_1, ambient ? undefined : createStubbedMethodBody(quotePreference)));
|
|
153218
|
+
/*decorators*/ undefined, modifiers, name, ts.emptyArray, typeNode_1, ambient ? undefined : body || createStubbedMethodBody(quotePreference)));
|
|
152813
153219
|
}
|
|
152814
153220
|
else {
|
|
152815
153221
|
ts.Debug.assertNode(accessor, ts.isSetAccessorDeclaration, "The counterpart to a getter should be a setter");
|
|
152816
153222
|
var parameter = ts.getSetAccessorValueParameter(accessor);
|
|
152817
153223
|
var parameterName = parameter && ts.isIdentifier(parameter.name) ? ts.idText(parameter.name) : undefined;
|
|
152818
153224
|
addClassElement(ts.factory.createSetAccessorDeclaration(
|
|
152819
|
-
/*decorators*/ undefined, modifiers, name, createDummyParameters(1, [parameterName], [typeNode_1], 1, /*inJs*/ false), ambient ? undefined : createStubbedMethodBody(quotePreference)));
|
|
153225
|
+
/*decorators*/ undefined, modifiers, name, createDummyParameters(1, [parameterName], [typeNode_1], 1, /*inJs*/ false), ambient ? undefined : body || createStubbedMethodBody(quotePreference)));
|
|
152820
153226
|
}
|
|
152821
153227
|
}
|
|
152822
153228
|
break;
|
|
@@ -152837,7 +153243,7 @@ var ts;
|
|
|
152837
153243
|
if (declarations.length === 1) {
|
|
152838
153244
|
ts.Debug.assert(signatures.length === 1, "One declaration implies one signature");
|
|
152839
153245
|
var signature = signatures[0];
|
|
152840
|
-
outputMethod(quotePreference, signature, modifiers, name, ambient ? undefined : createStubbedMethodBody(quotePreference));
|
|
153246
|
+
outputMethod(quotePreference, signature, modifiers, name, ambient ? undefined : body || createStubbedMethodBody(quotePreference));
|
|
152841
153247
|
break;
|
|
152842
153248
|
}
|
|
152843
153249
|
for (var _a = 0, signatures_1 = signatures; _a < signatures_1.length; _a++) {
|
|
@@ -152848,11 +153254,11 @@ var ts;
|
|
|
152848
153254
|
if (!ambient) {
|
|
152849
153255
|
if (declarations.length > signatures.length) {
|
|
152850
153256
|
var signature = checker.getSignatureFromDeclaration(declarations[declarations.length - 1]);
|
|
152851
|
-
outputMethod(quotePreference, signature, modifiers, name, createStubbedMethodBody(quotePreference));
|
|
153257
|
+
outputMethod(quotePreference, signature, modifiers, name, body || createStubbedMethodBody(quotePreference));
|
|
152852
153258
|
}
|
|
152853
153259
|
else {
|
|
152854
153260
|
ts.Debug.assert(declarations.length === signatures.length, "Declarations and signatures should match count");
|
|
152855
|
-
addClassElement(createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, name, optional, modifiers, quotePreference));
|
|
153261
|
+
addClassElement(createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, name, optional, modifiers, quotePreference, body));
|
|
152856
153262
|
}
|
|
152857
153263
|
}
|
|
152858
153264
|
break;
|
|
@@ -152863,6 +153269,7 @@ var ts;
|
|
|
152863
153269
|
addClassElement(method);
|
|
152864
153270
|
}
|
|
152865
153271
|
}
|
|
153272
|
+
codefix.addNewNodeForMemberSymbol = addNewNodeForMemberSymbol;
|
|
152866
153273
|
function createSignatureDeclarationFromSignature(kind, context, quotePreference, signature, body, name, modifiers, optional, enclosingDeclaration, importAdder) {
|
|
152867
153274
|
var program = context.program;
|
|
152868
153275
|
var checker = program.getTypeChecker();
|
|
@@ -153000,7 +153407,7 @@ var ts;
|
|
|
153000
153407
|
}
|
|
153001
153408
|
return parameters;
|
|
153002
153409
|
}
|
|
153003
|
-
function createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, name, optional, modifiers, quotePreference) {
|
|
153410
|
+
function createMethodImplementingSignatures(checker, context, enclosingDeclaration, signatures, name, optional, modifiers, quotePreference, body) {
|
|
153004
153411
|
/** This is *a* signature with the maximal number of arguments,
|
|
153005
153412
|
* such that if there is a "maximal" signature without rest arguments,
|
|
153006
153413
|
* this is one of them.
|
|
@@ -153031,7 +153438,7 @@ var ts;
|
|
|
153031
153438
|
parameters.push(restParameter);
|
|
153032
153439
|
}
|
|
153033
153440
|
return createStubbedMethod(modifiers, name, optional,
|
|
153034
|
-
/*typeParameters*/ undefined, parameters, getReturnTypeFromSignatures(signatures, checker, context, enclosingDeclaration), quotePreference);
|
|
153441
|
+
/*typeParameters*/ undefined, parameters, getReturnTypeFromSignatures(signatures, checker, context, enclosingDeclaration), quotePreference, body);
|
|
153035
153442
|
}
|
|
153036
153443
|
function getReturnTypeFromSignatures(signatures, checker, context, enclosingDeclaration) {
|
|
153037
153444
|
if (ts.length(signatures)) {
|
|
@@ -153039,10 +153446,10 @@ var ts;
|
|
|
153039
153446
|
return checker.typeToTypeNode(type, enclosingDeclaration, /*flags*/ undefined, getNoopSymbolTrackerWithResolver(context));
|
|
153040
153447
|
}
|
|
153041
153448
|
}
|
|
153042
|
-
function createStubbedMethod(modifiers, name, optional, typeParameters, parameters, returnType, quotePreference) {
|
|
153449
|
+
function createStubbedMethod(modifiers, name, optional, typeParameters, parameters, returnType, quotePreference, body) {
|
|
153043
153450
|
return ts.factory.createMethodDeclaration(
|
|
153044
153451
|
/*decorators*/ undefined, modifiers,
|
|
153045
|
-
/*asteriskToken*/ undefined, name, optional ? ts.factory.createToken(57 /* QuestionToken */) : undefined, typeParameters, parameters, returnType, createStubbedMethodBody(quotePreference));
|
|
153452
|
+
/*asteriskToken*/ undefined, name, optional ? ts.factory.createToken(57 /* QuestionToken */) : undefined, typeParameters, parameters, returnType, body || createStubbedMethodBody(quotePreference));
|
|
153046
153453
|
}
|
|
153047
153454
|
function createStubbedMethodBody(quotePreference) {
|
|
153048
153455
|
return createStubbedBody(ts.Diagnostics.Method_not_implemented.message, quotePreference);
|
|
@@ -164690,6 +165097,10 @@ var ts;
|
|
|
164690
165097
|
this.hasAddedOrRemovedSymlinks = true;
|
|
164691
165098
|
}
|
|
164692
165099
|
};
|
|
165100
|
+
/* @internal */
|
|
165101
|
+
Project.prototype.onDiscoveredSymlink = function () {
|
|
165102
|
+
this.hasAddedOrRemovedSymlinks = true;
|
|
165103
|
+
};
|
|
164693
165104
|
/**
|
|
164694
165105
|
* Updates set of files that contribute to this project
|
|
164695
165106
|
* @returns: true if set of files in the project stays the same and false - otherwise.
|