@typescript-deploys/pr-build 5.0.0-pr-50996-2 → 5.0.0-pr-51492-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +47 -55
- package/lib/tsserver.js +64 -311
- package/lib/tsserverlibrary.d.ts +25 -24
- package/lib/tsserverlibrary.js +65 -312
- package/lib/typescript.d.ts +23 -22
- package/lib/typescript.js +52 -295
- package/package.json +1 -1
package/lib/tsserverlibrary.js
CHANGED
|
@@ -4719,19 +4719,19 @@ ${lanes.join("\n")}
|
|
|
4719
4719
|
PollingWatchKind3[PollingWatchKind3["FixedChunkSize"] = 3] = "FixedChunkSize";
|
|
4720
4720
|
return PollingWatchKind3;
|
|
4721
4721
|
})(PollingWatchKind || {});
|
|
4722
|
-
ModuleKind = /* @__PURE__ */ ((
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
return
|
|
4722
|
+
ModuleKind = /* @__PURE__ */ ((ModuleKind3) => {
|
|
4723
|
+
ModuleKind3[ModuleKind3["None"] = 0] = "None";
|
|
4724
|
+
ModuleKind3[ModuleKind3["CommonJS"] = 1] = "CommonJS";
|
|
4725
|
+
ModuleKind3[ModuleKind3["AMD"] = 2] = "AMD";
|
|
4726
|
+
ModuleKind3[ModuleKind3["UMD"] = 3] = "UMD";
|
|
4727
|
+
ModuleKind3[ModuleKind3["System"] = 4] = "System";
|
|
4728
|
+
ModuleKind3[ModuleKind3["ES2015"] = 5] = "ES2015";
|
|
4729
|
+
ModuleKind3[ModuleKind3["ES2020"] = 6] = "ES2020";
|
|
4730
|
+
ModuleKind3[ModuleKind3["ES2022"] = 7] = "ES2022";
|
|
4731
|
+
ModuleKind3[ModuleKind3["ESNext"] = 99] = "ESNext";
|
|
4732
|
+
ModuleKind3[ModuleKind3["Node16"] = 100] = "Node16";
|
|
4733
|
+
ModuleKind3[ModuleKind3["NodeNext"] = 199] = "NodeNext";
|
|
4734
|
+
return ModuleKind3;
|
|
4735
4735
|
})(ModuleKind || {});
|
|
4736
4736
|
JsxEmit = /* @__PURE__ */ ((JsxEmit3) => {
|
|
4737
4737
|
JsxEmit3[JsxEmit3["None"] = 0] = "None";
|
|
@@ -17142,32 +17142,6 @@ ${lanes.join("\n")}
|
|
|
17142
17142
|
function pseudoBigIntToString({ negative, base10Value }) {
|
|
17143
17143
|
return (negative && base10Value !== "0" ? "-" : "") + base10Value;
|
|
17144
17144
|
}
|
|
17145
|
-
function parseBigInt(text) {
|
|
17146
|
-
if (!isValidBigIntString(text, false)) {
|
|
17147
|
-
return void 0;
|
|
17148
|
-
}
|
|
17149
|
-
return parseValidBigInt(text);
|
|
17150
|
-
}
|
|
17151
|
-
function parseValidBigInt(text) {
|
|
17152
|
-
const negative = text.startsWith("-");
|
|
17153
|
-
const base10Value = parsePseudoBigInt(`${negative ? text.slice(1) : text}n`);
|
|
17154
|
-
return { negative, base10Value };
|
|
17155
|
-
}
|
|
17156
|
-
function isValidBigIntString(s, roundTripOnly) {
|
|
17157
|
-
if (s === "")
|
|
17158
|
-
return false;
|
|
17159
|
-
const scanner2 = createScanner(99 /* ESNext */, false);
|
|
17160
|
-
let success = true;
|
|
17161
|
-
scanner2.setOnError(() => success = false);
|
|
17162
|
-
scanner2.setText(s + "n");
|
|
17163
|
-
let result = scanner2.scan();
|
|
17164
|
-
const negative = result === 40 /* MinusToken */;
|
|
17165
|
-
if (negative) {
|
|
17166
|
-
result = scanner2.scan();
|
|
17167
|
-
}
|
|
17168
|
-
const flags = scanner2.getTokenFlags();
|
|
17169
|
-
return success && result === 9 /* BigIntLiteral */ && scanner2.getTextPos() === s.length + 1 && !(flags & 512 /* ContainsSeparator */) && (!roundTripOnly || s === pseudoBigIntToString({ negative, base10Value: parsePseudoBigInt(scanner2.getTokenValue()) }));
|
|
17170
|
-
}
|
|
17171
17145
|
function isValidTypeOnlyAliasUseSite(useSite) {
|
|
17172
17146
|
return !!(useSite.flags & 16777216 /* Ambient */) || isPartOfTypeQuery(useSite) || isIdentifierInNonEmittingHeritageClause(useSite) || isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(useSite) || !(isExpressionNode(useSite) || isShorthandPropertyNameUseSite(useSite));
|
|
17173
17147
|
}
|
|
@@ -17494,10 +17468,6 @@ ${lanes.join("\n")}
|
|
|
17494
17468
|
const { isBracketed, typeExpression } = node;
|
|
17495
17469
|
return isBracketed || !!typeExpression && typeExpression.type.kind === 319 /* JSDocOptionalType */;
|
|
17496
17470
|
}
|
|
17497
|
-
function canUsePropertyAccess(name, languageVersion) {
|
|
17498
|
-
const firstChar = name.charCodeAt(0);
|
|
17499
|
-
return firstChar === 35 /* hash */ ? name.length > 1 && isIdentifierStart(name.charCodeAt(1), languageVersion) : isIdentifierStart(firstChar, languageVersion);
|
|
17500
|
-
}
|
|
17501
17471
|
var resolvingEmptyArray, externalHelpersModuleNameText, defaultMaximumTruncationLength, noTruncationMaximumTruncationLength, stringWriter, GetLiteralTextFlags, fullTripleSlashReferencePathRegEx, fullTripleSlashReferenceTypeReferenceDirectiveRegEx, fullTripleSlashAMDReferencePathRegEx, defaultLibReferenceRegEx, AssignmentKind, FunctionFlags, Associativity, OperatorPrecedence, templateSubstitutionRegExp, doubleQuoteEscapedCharsRegExp, singleQuoteEscapedCharsRegExp, backtickQuoteEscapedCharsRegExp, escapedCharsMap, nonAsciiCharacters, jsxDoubleQuoteEscapedCharsRegExp, jsxSingleQuoteEscapedCharsRegExp, jsxEscapedCharsMap, indentStrings, base64Digits, carriageReturnLineFeed, lineFeed, AccessKind, objectAllocator, localizedDiagnosticMessages, reservedCharacterPattern, wildcardCharCodes, commonPackageFolders, implicitExcludePathRegexPattern, filesMatcher, directoriesMatcher, excludeMatcher, wildcardMatchers, supportedTSExtensions, supportedTSExtensionsFlat, supportedTSExtensionsWithJson, supportedTSExtensionsForExtractExtension, supportedJSExtensions, supportedJSExtensionsFlat, allSupportedExtensions, allSupportedExtensionsWithJson, supportedDeclarationExtensions, extensionsToRemove, emptyFileSystemEntries;
|
|
17502
17472
|
var init_utilities = __esm({
|
|
17503
17473
|
"src/compiler/utilities.ts"() {
|
|
@@ -39925,11 +39895,11 @@ ${lanes.join("\n")}
|
|
|
39925
39895
|
if (specifier && modulePath.isRedirect) {
|
|
39926
39896
|
return nodeModulesSpecifiers;
|
|
39927
39897
|
}
|
|
39928
|
-
if (!specifier
|
|
39898
|
+
if (!specifier) {
|
|
39929
39899
|
const local = getLocalModuleSpecifier(modulePath.path, info, compilerOptions, host, options.overrideImportMode || importingSourceFile.impliedNodeFormat, preferences);
|
|
39930
39900
|
if (pathIsBareSpecifier(local)) {
|
|
39931
39901
|
pathsSpecifiers = append(pathsSpecifiers, local);
|
|
39932
|
-
} else if (!importedFileIsInNodeModules || modulePath.isInNodeModules) {
|
|
39902
|
+
} else if (!modulePath.isRedirect && (!importedFileIsInNodeModules || modulePath.isInNodeModules)) {
|
|
39933
39903
|
relativeSpecifiers = append(relativeSpecifiers, local);
|
|
39934
39904
|
}
|
|
39935
39905
|
}
|
|
@@ -39954,31 +39924,29 @@ ${lanes.join("\n")}
|
|
|
39954
39924
|
return relativePath;
|
|
39955
39925
|
}
|
|
39956
39926
|
const fromPaths = paths && tryGetModuleNameFromPaths(relativeToBaseUrl, paths, getAllowedEndings(ending, compilerOptions, importMode), host, compilerOptions);
|
|
39957
|
-
const
|
|
39958
|
-
if (!
|
|
39927
|
+
const maybeNonRelative = fromPaths === void 0 && baseUrl !== void 0 ? removeExtensionAndIndexPostFix(relativeToBaseUrl, ending, compilerOptions) : fromPaths;
|
|
39928
|
+
if (!maybeNonRelative) {
|
|
39959
39929
|
return relativePath;
|
|
39960
39930
|
}
|
|
39961
|
-
if (relativePreference === 1 /* NonRelative */) {
|
|
39962
|
-
return
|
|
39931
|
+
if (relativePreference === 1 /* NonRelative */ && !pathIsRelative(maybeNonRelative)) {
|
|
39932
|
+
return maybeNonRelative;
|
|
39963
39933
|
}
|
|
39964
|
-
if (relativePreference === 3 /* ExternalNonRelative */) {
|
|
39934
|
+
if (relativePreference === 3 /* ExternalNonRelative */ && !pathIsRelative(maybeNonRelative)) {
|
|
39965
39935
|
const projectDirectory = compilerOptions.configFilePath ? toPath(getDirectoryPath(compilerOptions.configFilePath), host.getCurrentDirectory(), info.getCanonicalFileName) : info.getCanonicalFileName(host.getCurrentDirectory());
|
|
39966
39936
|
const modulePath = toPath(moduleFileName, projectDirectory, getCanonicalFileName);
|
|
39967
39937
|
const sourceIsInternal = startsWith(sourceDirectory, projectDirectory);
|
|
39968
39938
|
const targetIsInternal = startsWith(modulePath, projectDirectory);
|
|
39969
39939
|
if (sourceIsInternal && !targetIsInternal || !sourceIsInternal && targetIsInternal) {
|
|
39970
|
-
return
|
|
39940
|
+
return maybeNonRelative;
|
|
39971
39941
|
}
|
|
39972
39942
|
const nearestTargetPackageJson = getNearestAncestorDirectoryWithPackageJson(host, getDirectoryPath(modulePath));
|
|
39973
39943
|
const nearestSourcePackageJson = getNearestAncestorDirectoryWithPackageJson(host, sourceDirectory);
|
|
39974
39944
|
if (nearestSourcePackageJson !== nearestTargetPackageJson) {
|
|
39975
|
-
return
|
|
39945
|
+
return maybeNonRelative;
|
|
39976
39946
|
}
|
|
39977
39947
|
return relativePath;
|
|
39978
39948
|
}
|
|
39979
|
-
|
|
39980
|
-
Debug.assertNever(relativePreference);
|
|
39981
|
-
return isPathRelativeToParent(nonRelative) || countPathComponents(relativePath) < countPathComponents(nonRelative) ? relativePath : nonRelative;
|
|
39949
|
+
return isPathRelativeToParent(maybeNonRelative) || countPathComponents(relativePath) < countPathComponents(maybeNonRelative) ? relativePath : maybeNonRelative;
|
|
39982
39950
|
}
|
|
39983
39951
|
function countPathComponents(path) {
|
|
39984
39952
|
let count = 0;
|
|
@@ -45487,7 +45455,8 @@ ${lanes.join("\n")}
|
|
|
45487
45455
|
if (isSingleOrDoubleQuote(firstChar) && some(symbol2.declarations, hasNonGlobalAugmentationExternalModuleSymbol)) {
|
|
45488
45456
|
return factory.createStringLiteral(getSpecifierForModuleSymbol(symbol2, context));
|
|
45489
45457
|
}
|
|
45490
|
-
|
|
45458
|
+
const canUsePropertyAccess = firstChar === 35 /* hash */ ? symbolName2.length > 1 && isIdentifierStart(symbolName2.charCodeAt(1), languageVersion) : isIdentifierStart(firstChar, languageVersion);
|
|
45459
|
+
if (index === 0 || canUsePropertyAccess) {
|
|
45491
45460
|
const identifier = setEmitFlags(factory.createIdentifier(symbolName2, typeParameterNodes), 16777216 /* NoAsciiEscaping */);
|
|
45492
45461
|
identifier.symbol = symbol2;
|
|
45493
45462
|
return index > 0 ? factory.createPropertyAccessExpression(createExpressionFromSymbolChain(chain2, index - 1), identifier) : identifier;
|
|
@@ -57543,7 +57512,24 @@ ${lanes.join("\n")}
|
|
|
57543
57512
|
return isFinite(n) && (!roundTripOnly || "" + n === s);
|
|
57544
57513
|
}
|
|
57545
57514
|
function parseBigIntLiteralType(text) {
|
|
57546
|
-
|
|
57515
|
+
const negative = text.startsWith("-");
|
|
57516
|
+
const base10Value = parsePseudoBigInt(`${negative ? text.slice(1) : text}n`);
|
|
57517
|
+
return getBigIntLiteralType({ negative, base10Value });
|
|
57518
|
+
}
|
|
57519
|
+
function isValidBigIntString(s, roundTripOnly) {
|
|
57520
|
+
if (s === "")
|
|
57521
|
+
return false;
|
|
57522
|
+
const scanner2 = createScanner(99 /* ESNext */, false);
|
|
57523
|
+
let success = true;
|
|
57524
|
+
scanner2.setOnError(() => success = false);
|
|
57525
|
+
scanner2.setText(s + "n");
|
|
57526
|
+
let result = scanner2.scan();
|
|
57527
|
+
const negative = result === 40 /* MinusToken */;
|
|
57528
|
+
if (negative) {
|
|
57529
|
+
result = scanner2.scan();
|
|
57530
|
+
}
|
|
57531
|
+
const flags = scanner2.getTokenFlags();
|
|
57532
|
+
return success && result === 9 /* BigIntLiteral */ && scanner2.getTextPos() === s.length + 1 && !(flags & 512 /* ContainsSeparator */) && (!roundTripOnly || s === pseudoBigIntToString({ negative, base10Value: parsePseudoBigInt(scanner2.getTokenValue()) }));
|
|
57547
57533
|
}
|
|
57548
57534
|
function isMemberOfStringMapping(source, target) {
|
|
57549
57535
|
if (target.flags & (4 /* String */ | 1 /* Any */)) {
|
|
@@ -105080,12 +105066,12 @@ ${lanes.join("\n")}
|
|
|
105080
105066
|
const resolved = getResolutionWithResolvedFileName(resolution);
|
|
105081
105067
|
trace(
|
|
105082
105068
|
host,
|
|
105083
|
-
loader === resolveModuleName2 ? (resolved == null ? void 0 : resolved.resolvedFileName) ? resolved.
|
|
105069
|
+
loader === resolveModuleName2 ? (resolved == null ? void 0 : resolved.resolvedFileName) ? resolved.packageId ? Diagnostics.Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3_with_Package_ID_4 : Diagnostics.Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3 : Diagnostics.Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_not_resolved : (resolved == null ? void 0 : resolved.resolvedFileName) ? resolved.packageId ? Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3_with_Package_ID_4 : Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3 : Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_resolved,
|
|
105084
105070
|
name,
|
|
105085
105071
|
containingFile,
|
|
105086
105072
|
getDirectoryPath(containingFile),
|
|
105087
105073
|
resolved == null ? void 0 : resolved.resolvedFileName,
|
|
105088
|
-
(resolved == null ? void 0 : resolved.
|
|
105074
|
+
(resolved == null ? void 0 : resolved.packageId) && packageIdToString(resolved.packageId)
|
|
105089
105075
|
);
|
|
105090
105076
|
}
|
|
105091
105077
|
} else {
|
|
@@ -105110,11 +105096,11 @@ ${lanes.join("\n")}
|
|
|
105110
105096
|
const resolved = getResolutionWithResolvedFileName(resolution);
|
|
105111
105097
|
trace(
|
|
105112
105098
|
host,
|
|
105113
|
-
loader === resolveModuleName2 ? (resolved == null ? void 0 : resolved.resolvedFileName) ? resolved.
|
|
105099
|
+
loader === resolveModuleName2 ? (resolved == null ? void 0 : resolved.resolvedFileName) ? resolved.packageId ? Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 : Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2 : Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_not_resolved : (resolved == null ? void 0 : resolved.resolvedFileName) ? resolved.packageId ? Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 : Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2 : Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_not_resolved,
|
|
105114
105100
|
name,
|
|
105115
105101
|
containingFile,
|
|
105116
105102
|
resolved == null ? void 0 : resolved.resolvedFileName,
|
|
105117
|
-
(resolved == null ? void 0 : resolved.
|
|
105103
|
+
(resolved == null ? void 0 : resolved.packageId) && packageIdToString(resolved.packageId)
|
|
105118
105104
|
);
|
|
105119
105105
|
}
|
|
105120
105106
|
}
|
|
@@ -129579,13 +129565,6 @@ ${lanes.join("\n")}
|
|
|
129579
129565
|
if (!isChecked) {
|
|
129580
129566
|
getJSCompletionEntries(sourceFile, location.pos, uniqueNames, getEmitScriptTarget(compilerOptions), entries);
|
|
129581
129567
|
}
|
|
129582
|
-
let caseBlock;
|
|
129583
|
-
if (preferences.includeCompletionsWithInsertText && contextToken && (caseBlock = findAncestor(contextToken, isCaseBlock))) {
|
|
129584
|
-
const cases = getExhaustiveCaseSnippets(caseBlock, sourceFile, preferences, compilerOptions, host, program, formatContext);
|
|
129585
|
-
if (cases) {
|
|
129586
|
-
entries.push(cases.entry);
|
|
129587
|
-
}
|
|
129588
|
-
}
|
|
129589
129568
|
return {
|
|
129590
129569
|
flags: completionData.flags,
|
|
129591
129570
|
isGlobalCompletion: isInSnippetScope,
|
|
@@ -129599,194 +129578,6 @@ ${lanes.join("\n")}
|
|
|
129599
129578
|
function isCheckedFile(sourceFile, compilerOptions) {
|
|
129600
129579
|
return !isSourceFileJS(sourceFile) || !!isCheckJsEnabledForFile(sourceFile, compilerOptions);
|
|
129601
129580
|
}
|
|
129602
|
-
function getExhaustiveCaseSnippets(caseBlock, sourceFile, preferences, options, host, program, formatContext) {
|
|
129603
|
-
const clauses = caseBlock.clauses;
|
|
129604
|
-
const checker = program.getTypeChecker();
|
|
129605
|
-
const switchType = checker.getTypeAtLocation(caseBlock.parent.expression);
|
|
129606
|
-
if (switchType && switchType.isUnion() && every(switchType.types, (type) => type.isLiteral())) {
|
|
129607
|
-
const tracker = newCaseClauseTracker(checker);
|
|
129608
|
-
for (const clause of clauses) {
|
|
129609
|
-
if (!isDefaultClause(clause)) {
|
|
129610
|
-
tracker.addClause(clause);
|
|
129611
|
-
}
|
|
129612
|
-
}
|
|
129613
|
-
const target = getEmitScriptTarget(options);
|
|
129614
|
-
const quotePreference = getQuotePreference(sourceFile, preferences);
|
|
129615
|
-
const importAdder = ts_codefix_exports.createImportAdder(sourceFile, program, preferences, host);
|
|
129616
|
-
const elements = [];
|
|
129617
|
-
for (const type of switchType.types) {
|
|
129618
|
-
if (type.flags & 1024 /* EnumLiteral */) {
|
|
129619
|
-
Debug.assert(type.symbol, "An enum member type should have a symbol");
|
|
129620
|
-
Debug.assert(type.symbol.parent, "An enum member type should have a parent symbol (the enum symbol)");
|
|
129621
|
-
const enumValue = type.symbol.valueDeclaration && checker.getConstantValue(type.symbol.valueDeclaration);
|
|
129622
|
-
if (enumValue !== void 0) {
|
|
129623
|
-
if (tracker.hasValue(enumValue)) {
|
|
129624
|
-
continue;
|
|
129625
|
-
}
|
|
129626
|
-
tracker.addValue(enumValue);
|
|
129627
|
-
}
|
|
129628
|
-
const typeNode = ts_codefix_exports.typeToAutoImportableTypeNode(checker, importAdder, type, caseBlock, target);
|
|
129629
|
-
if (!typeNode) {
|
|
129630
|
-
return void 0;
|
|
129631
|
-
}
|
|
129632
|
-
const expr = typeNodeToExpression(typeNode, target, quotePreference);
|
|
129633
|
-
if (!expr) {
|
|
129634
|
-
return void 0;
|
|
129635
|
-
}
|
|
129636
|
-
elements.push(expr);
|
|
129637
|
-
} else if (!tracker.hasValue(type.value)) {
|
|
129638
|
-
switch (typeof type.value) {
|
|
129639
|
-
case "object":
|
|
129640
|
-
elements.push(factory.createBigIntLiteral(type.value));
|
|
129641
|
-
break;
|
|
129642
|
-
case "number":
|
|
129643
|
-
elements.push(factory.createNumericLiteral(type.value));
|
|
129644
|
-
break;
|
|
129645
|
-
case "string":
|
|
129646
|
-
elements.push(factory.createStringLiteral(type.value));
|
|
129647
|
-
break;
|
|
129648
|
-
}
|
|
129649
|
-
}
|
|
129650
|
-
}
|
|
129651
|
-
if (elements.length === 0) {
|
|
129652
|
-
return void 0;
|
|
129653
|
-
}
|
|
129654
|
-
const newClauses = map(elements, (element) => {
|
|
129655
|
-
return factory.createCaseClause(element, []);
|
|
129656
|
-
});
|
|
129657
|
-
const printer = createSnippetPrinter({
|
|
129658
|
-
removeComments: true,
|
|
129659
|
-
module: options.module,
|
|
129660
|
-
target: options.target,
|
|
129661
|
-
newLine: getNewLineKind(getNewLineCharacter(options, maybeBind(host, host.getNewLine)))
|
|
129662
|
-
});
|
|
129663
|
-
const insertText = formatContext ? printer.printAndFormatSnippetList(
|
|
129664
|
-
1 /* MultiLine */ | 131072 /* NoTrailingNewLine */,
|
|
129665
|
-
factory.createNodeArray(newClauses),
|
|
129666
|
-
sourceFile,
|
|
129667
|
-
formatContext
|
|
129668
|
-
) : printer.printSnippetList(
|
|
129669
|
-
1 /* MultiLine */ | 131072 /* NoTrailingNewLine */,
|
|
129670
|
-
factory.createNodeArray(newClauses),
|
|
129671
|
-
sourceFile
|
|
129672
|
-
);
|
|
129673
|
-
const firstClause = printer.printSnippetList(0 /* SingleLine */, factory.createNodeArray([first(newClauses)]), sourceFile);
|
|
129674
|
-
return {
|
|
129675
|
-
entry: {
|
|
129676
|
-
name: `${firstClause} ...`,
|
|
129677
|
-
kind: "" /* unknown */,
|
|
129678
|
-
sortText: SortText.GlobalsOrKeywords,
|
|
129679
|
-
insertText,
|
|
129680
|
-
hasAction: importAdder.hasFixes() || void 0,
|
|
129681
|
-
source: "SwitchCases/" /* SwitchCases */
|
|
129682
|
-
},
|
|
129683
|
-
importAdder
|
|
129684
|
-
};
|
|
129685
|
-
}
|
|
129686
|
-
return void 0;
|
|
129687
|
-
}
|
|
129688
|
-
function newCaseClauseTracker(checker) {
|
|
129689
|
-
const existingStrings = /* @__PURE__ */ new Set();
|
|
129690
|
-
const existingNumbers = /* @__PURE__ */ new Set();
|
|
129691
|
-
const existingBigInts = /* @__PURE__ */ new Set();
|
|
129692
|
-
return {
|
|
129693
|
-
addValue,
|
|
129694
|
-
addClause,
|
|
129695
|
-
hasValue
|
|
129696
|
-
};
|
|
129697
|
-
function addClause(clause) {
|
|
129698
|
-
if (isLiteralExpression(clause.expression)) {
|
|
129699
|
-
const expression = clause.expression;
|
|
129700
|
-
switch (expression.kind) {
|
|
129701
|
-
case 14 /* NoSubstitutionTemplateLiteral */:
|
|
129702
|
-
case 10 /* StringLiteral */:
|
|
129703
|
-
existingStrings.add(expression.text);
|
|
129704
|
-
break;
|
|
129705
|
-
case 8 /* NumericLiteral */:
|
|
129706
|
-
existingNumbers.add(parseInt(expression.text));
|
|
129707
|
-
break;
|
|
129708
|
-
case 9 /* BigIntLiteral */:
|
|
129709
|
-
const parsedBigInt = parseBigInt(endsWith(expression.text, "n") ? expression.text.slice(0, -1) : expression.text);
|
|
129710
|
-
if (parsedBigInt) {
|
|
129711
|
-
existingBigInts.add(pseudoBigIntToString(parsedBigInt));
|
|
129712
|
-
}
|
|
129713
|
-
break;
|
|
129714
|
-
}
|
|
129715
|
-
} else {
|
|
129716
|
-
const symbol = checker.getSymbolAtLocation(clause.expression);
|
|
129717
|
-
if (symbol && symbol.valueDeclaration && isEnumMember(symbol.valueDeclaration)) {
|
|
129718
|
-
const enumValue = checker.getConstantValue(symbol.valueDeclaration);
|
|
129719
|
-
if (enumValue !== void 0) {
|
|
129720
|
-
addValue(enumValue);
|
|
129721
|
-
}
|
|
129722
|
-
}
|
|
129723
|
-
}
|
|
129724
|
-
}
|
|
129725
|
-
function addValue(value) {
|
|
129726
|
-
switch (typeof value) {
|
|
129727
|
-
case "string":
|
|
129728
|
-
existingStrings.add(value);
|
|
129729
|
-
break;
|
|
129730
|
-
case "number":
|
|
129731
|
-
existingNumbers.add(value);
|
|
129732
|
-
}
|
|
129733
|
-
}
|
|
129734
|
-
function hasValue(value) {
|
|
129735
|
-
switch (typeof value) {
|
|
129736
|
-
case "string":
|
|
129737
|
-
return existingStrings.has(value);
|
|
129738
|
-
case "number":
|
|
129739
|
-
return existingNumbers.has(value);
|
|
129740
|
-
case "object":
|
|
129741
|
-
return existingBigInts.has(pseudoBigIntToString(value));
|
|
129742
|
-
}
|
|
129743
|
-
}
|
|
129744
|
-
}
|
|
129745
|
-
function typeNodeToExpression(typeNode, languageVersion, quotePreference) {
|
|
129746
|
-
switch (typeNode.kind) {
|
|
129747
|
-
case 180 /* TypeReference */:
|
|
129748
|
-
const typeName = typeNode.typeName;
|
|
129749
|
-
return entityNameToExpression(typeName, languageVersion, quotePreference);
|
|
129750
|
-
case 196 /* IndexedAccessType */:
|
|
129751
|
-
const objectExpression = typeNodeToExpression(typeNode.objectType, languageVersion, quotePreference);
|
|
129752
|
-
const indexExpression = typeNodeToExpression(typeNode.indexType, languageVersion, quotePreference);
|
|
129753
|
-
return objectExpression && indexExpression && factory.createElementAccessExpression(objectExpression, indexExpression);
|
|
129754
|
-
case 198 /* LiteralType */:
|
|
129755
|
-
const literal = typeNode.literal;
|
|
129756
|
-
switch (literal.kind) {
|
|
129757
|
-
case 10 /* StringLiteral */:
|
|
129758
|
-
return factory.createStringLiteral(literal.text, quotePreference === 0 /* Single */);
|
|
129759
|
-
case 8 /* NumericLiteral */:
|
|
129760
|
-
return factory.createNumericLiteral(literal.text, literal.numericLiteralFlags);
|
|
129761
|
-
}
|
|
129762
|
-
return void 0;
|
|
129763
|
-
case 193 /* ParenthesizedType */:
|
|
129764
|
-
const exp = typeNodeToExpression(typeNode.type, languageVersion, quotePreference);
|
|
129765
|
-
return exp && (isIdentifier(exp) ? exp : factory.createParenthesizedExpression(exp));
|
|
129766
|
-
case 183 /* TypeQuery */:
|
|
129767
|
-
return entityNameToExpression(typeNode.exprName, languageVersion, quotePreference);
|
|
129768
|
-
case 202 /* ImportType */:
|
|
129769
|
-
Debug.fail(`We should not get an import type after calling 'codefix.typeToAutoImportableTypeNode'.`);
|
|
129770
|
-
}
|
|
129771
|
-
return void 0;
|
|
129772
|
-
}
|
|
129773
|
-
function entityNameToExpression(entityName, languageVersion, quotePreference) {
|
|
129774
|
-
if (isIdentifier(entityName)) {
|
|
129775
|
-
return entityName;
|
|
129776
|
-
}
|
|
129777
|
-
const realName = unescapeLeadingUnderscores(entityName.right.escapedText);
|
|
129778
|
-
if (canUsePropertyAccess(realName, languageVersion)) {
|
|
129779
|
-
return factory.createPropertyAccessExpression(
|
|
129780
|
-
entityNameToExpression(entityName.left, languageVersion, quotePreference),
|
|
129781
|
-
realName
|
|
129782
|
-
);
|
|
129783
|
-
} else {
|
|
129784
|
-
return factory.createElementAccessExpression(
|
|
129785
|
-
entityNameToExpression(entityName.left, languageVersion, quotePreference),
|
|
129786
|
-
factory.createStringLiteral(realName, quotePreference === 0 /* Single */)
|
|
129787
|
-
);
|
|
129788
|
-
}
|
|
129789
|
-
}
|
|
129790
129581
|
function isMemberCompletionKind(kind) {
|
|
129791
129582
|
switch (kind) {
|
|
129792
129583
|
case CompletionKind.ObjectPropertyDeclaration:
|
|
@@ -130445,9 +130236,6 @@ ${lanes.join("\n")}
|
|
|
130445
130236
|
return entries;
|
|
130446
130237
|
}
|
|
130447
130238
|
function getSymbolCompletionFromEntryId(program, log, sourceFile, position, entryId, host, preferences) {
|
|
130448
|
-
if (entryId.source === "SwitchCases/" /* SwitchCases */) {
|
|
130449
|
-
return { type: "cases" };
|
|
130450
|
-
}
|
|
130451
130239
|
if (entryId.data) {
|
|
130452
130240
|
const autoImport = getAutoImportSymbolFromCompletionEntryData(entryId.name, entryId.data, program, host);
|
|
130453
130241
|
if (autoImport) {
|
|
@@ -130486,9 +130274,9 @@ ${lanes.join("\n")}
|
|
|
130486
130274
|
const typeChecker = program.getTypeChecker();
|
|
130487
130275
|
const compilerOptions = program.getCompilerOptions();
|
|
130488
130276
|
const { name, source, data } = entryId;
|
|
130489
|
-
const
|
|
130490
|
-
if (isInString(sourceFile, position,
|
|
130491
|
-
return ts_Completions_StringCompletions_exports.getStringLiteralCompletionDetails(name, sourceFile, position,
|
|
130277
|
+
const contextToken = findPrecedingToken(position, sourceFile);
|
|
130278
|
+
if (isInString(sourceFile, position, contextToken)) {
|
|
130279
|
+
return ts_Completions_StringCompletions_exports.getStringLiteralCompletionDetails(name, sourceFile, position, contextToken, typeChecker, compilerOptions, host, cancellationToken, preferences);
|
|
130492
130280
|
}
|
|
130493
130281
|
const symbolCompletion = getSymbolCompletionFromEntryId(program, log, sourceFile, position, entryId, host, preferences);
|
|
130494
130282
|
switch (symbolCompletion.type) {
|
|
@@ -130508,40 +130296,14 @@ ${lanes.join("\n")}
|
|
|
130508
130296
|
}
|
|
130509
130297
|
}
|
|
130510
130298
|
case "symbol": {
|
|
130511
|
-
const { symbol, location, contextToken: contextToken2, origin, previousToken
|
|
130512
|
-
const { codeActions, sourceDisplay } = getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken2, origin, symbol, program, host, compilerOptions, sourceFile, position,
|
|
130299
|
+
const { symbol, location, contextToken: contextToken2, origin, previousToken } = symbolCompletion;
|
|
130300
|
+
const { codeActions, sourceDisplay } = getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken2, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source, cancellationToken);
|
|
130513
130301
|
return createCompletionDetailsForSymbol(symbol, typeChecker, sourceFile, location, cancellationToken, codeActions, sourceDisplay);
|
|
130514
130302
|
}
|
|
130515
130303
|
case "literal": {
|
|
130516
130304
|
const { literal } = symbolCompletion;
|
|
130517
130305
|
return createSimpleDetails(completionNameForLiteral(sourceFile, preferences, literal), "string" /* string */, typeof literal === "string" ? 8 /* stringLiteral */ : 7 /* numericLiteral */);
|
|
130518
130306
|
}
|
|
130519
|
-
case "cases": {
|
|
130520
|
-
const { entry, importAdder } = getExhaustiveCaseSnippets(
|
|
130521
|
-
contextToken.parent,
|
|
130522
|
-
sourceFile,
|
|
130523
|
-
preferences,
|
|
130524
|
-
program.getCompilerOptions(),
|
|
130525
|
-
host,
|
|
130526
|
-
program,
|
|
130527
|
-
void 0
|
|
130528
|
-
);
|
|
130529
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(
|
|
130530
|
-
{ host, formatContext, preferences },
|
|
130531
|
-
importAdder.writeFixes
|
|
130532
|
-
);
|
|
130533
|
-
return {
|
|
130534
|
-
name: entry.name,
|
|
130535
|
-
kind: "" /* unknown */,
|
|
130536
|
-
kindModifiers: "",
|
|
130537
|
-
displayParts: [],
|
|
130538
|
-
sourceDisplay: void 0,
|
|
130539
|
-
codeActions: [{
|
|
130540
|
-
changes,
|
|
130541
|
-
description: diagnosticToString([Diagnostics.Includes_imports_of_types_referenced_by_0, name])
|
|
130542
|
-
}]
|
|
130543
|
-
};
|
|
130544
|
-
}
|
|
130545
130307
|
case "none":
|
|
130546
130308
|
return allKeywordsCompletions().some((c) => c.name === name) ? createSimpleDetails(name, "keyword" /* keyword */, 5 /* keyword */) : void 0;
|
|
130547
130309
|
default:
|
|
@@ -132428,7 +132190,6 @@ ${lanes.join("\n")}
|
|
|
132428
132190
|
CompletionSource2["ClassMemberSnippet"] = "ClassMemberSnippet/";
|
|
132429
132191
|
CompletionSource2["TypeOnlyAlias"] = "TypeOnlyAlias/";
|
|
132430
132192
|
CompletionSource2["ObjectLiteralMethodSnippet"] = "ObjectLiteralMethodSnippet/";
|
|
132431
|
-
CompletionSource2["SwitchCases"] = "SwitchCases/";
|
|
132432
132193
|
return CompletionSource2;
|
|
132433
132194
|
})(CompletionSource || {});
|
|
132434
132195
|
SymbolOriginInfoKind = /* @__PURE__ */ ((SymbolOriginInfoKind2) => {
|
|
@@ -148614,7 +148375,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
148614
148375
|
});
|
|
148615
148376
|
|
|
148616
148377
|
// src/server/protocol.ts
|
|
148617
|
-
var CommandTypes, OrganizeImportsMode2, WatchFileKind2, WatchDirectoryKind2, PollingWatchKind2, CompletionTriggerKind2, IndentStyle2, SemicolonPreference2, JsxEmit2,
|
|
148378
|
+
var CommandTypes, OrganizeImportsMode2, WatchFileKind2, WatchDirectoryKind2, PollingWatchKind2, CompletionTriggerKind2, IndentStyle2, SemicolonPreference2, JsxEmit2, ModuleKind2, ModuleResolutionKind2, NewLineKind2, ScriptTarget10, ClassificationType2;
|
|
148618
148379
|
var init_protocol = __esm({
|
|
148619
148380
|
"src/server/protocol.ts"() {
|
|
148620
148381
|
"use strict";
|
|
@@ -148783,17 +148544,17 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
148783
148544
|
JsxEmit3["React"] = "React";
|
|
148784
148545
|
return JsxEmit3;
|
|
148785
148546
|
})(JsxEmit2 || {});
|
|
148786
|
-
|
|
148787
|
-
|
|
148788
|
-
|
|
148789
|
-
|
|
148790
|
-
|
|
148791
|
-
|
|
148792
|
-
|
|
148793
|
-
|
|
148794
|
-
|
|
148795
|
-
return
|
|
148796
|
-
})(
|
|
148547
|
+
ModuleKind2 = /* @__PURE__ */ ((ModuleKind3) => {
|
|
148548
|
+
ModuleKind3["None"] = "None";
|
|
148549
|
+
ModuleKind3["CommonJS"] = "CommonJS";
|
|
148550
|
+
ModuleKind3["AMD"] = "AMD";
|
|
148551
|
+
ModuleKind3["UMD"] = "UMD";
|
|
148552
|
+
ModuleKind3["System"] = "System";
|
|
148553
|
+
ModuleKind3["ES6"] = "ES6";
|
|
148554
|
+
ModuleKind3["ES2015"] = "ES2015";
|
|
148555
|
+
ModuleKind3["ESNext"] = "ESNext";
|
|
148556
|
+
return ModuleKind3;
|
|
148557
|
+
})(ModuleKind2 || {});
|
|
148797
148558
|
ModuleResolutionKind2 = /* @__PURE__ */ ((ModuleResolutionKind3) => {
|
|
148798
148559
|
ModuleResolutionKind3["Classic"] = "Classic";
|
|
148799
148560
|
ModuleResolutionKind3["Node"] = "Node";
|
|
@@ -148858,7 +148619,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
148858
148619
|
CompletionTriggerKind: () => CompletionTriggerKind2,
|
|
148859
148620
|
IndentStyle: () => IndentStyle2,
|
|
148860
148621
|
JsxEmit: () => JsxEmit2,
|
|
148861
|
-
ModuleKind: () =>
|
|
148622
|
+
ModuleKind: () => ModuleKind2,
|
|
148862
148623
|
ModuleResolutionKind: () => ModuleResolutionKind2,
|
|
148863
148624
|
NewLineKind: () => NewLineKind2,
|
|
148864
148625
|
OrganizeImportsMode: () => OrganizeImportsMode2,
|
|
@@ -158261,7 +158022,6 @@ ${e.message}`;
|
|
|
158261
158022
|
canHaveModifiers: () => canHaveModifiers,
|
|
158262
158023
|
canJsonReportNoInputFiles: () => canJsonReportNoInputFiles,
|
|
158263
158024
|
canProduceDiagnostics: () => canProduceDiagnostics,
|
|
158264
|
-
canUsePropertyAccess: () => canUsePropertyAccess,
|
|
158265
158025
|
canWatchDirectoryOrFile: () => canWatchDirectoryOrFile,
|
|
158266
158026
|
cartesianProduct: () => cartesianProduct,
|
|
158267
158027
|
cast: () => cast,
|
|
@@ -159937,7 +159697,6 @@ ${e.message}`;
|
|
|
159937
159697
|
isUnparsedSource: () => isUnparsedSource,
|
|
159938
159698
|
isUnparsedTextLike: () => isUnparsedTextLike,
|
|
159939
159699
|
isUrl: () => isUrl,
|
|
159940
|
-
isValidBigIntString: () => isValidBigIntString,
|
|
159941
159700
|
isValidESSymbolDeclaration: () => isValidESSymbolDeclaration,
|
|
159942
159701
|
isValidTypeOnlyAliasUseSite: () => isValidTypeOnlyAliasUseSite,
|
|
159943
159702
|
isValueSignatureDeclaration: () => isValueSignatureDeclaration,
|
|
@@ -160069,7 +159828,6 @@ ${e.message}`;
|
|
|
160069
159828
|
parameterIsThisKeyword: () => parameterIsThisKeyword,
|
|
160070
159829
|
parameterNamePart: () => parameterNamePart,
|
|
160071
159830
|
parseBaseNodeFactory: () => parseBaseNodeFactory,
|
|
160072
|
-
parseBigInt: () => parseBigInt,
|
|
160073
159831
|
parseBuildCommand: () => parseBuildCommand,
|
|
160074
159832
|
parseCommandLine: () => parseCommandLine,
|
|
160075
159833
|
parseCommandLineWorker: () => parseCommandLineWorker,
|
|
@@ -160088,7 +159846,6 @@ ${e.message}`;
|
|
|
160088
159846
|
parseNodeModuleFromPath: () => parseNodeModuleFromPath,
|
|
160089
159847
|
parsePackageName: () => parsePackageName,
|
|
160090
159848
|
parsePseudoBigInt: () => parsePseudoBigInt,
|
|
160091
|
-
parseValidBigInt: () => parseValidBigInt,
|
|
160092
159849
|
patchWriteFileEnsuringDirectory: () => patchWriteFileEnsuringDirectory,
|
|
160093
159850
|
pathContainsNodeModules: () => pathContainsNodeModules,
|
|
160094
159851
|
pathIsAbsolute: () => pathIsAbsolute,
|
|
@@ -160879,7 +160636,6 @@ ${e.message}`;
|
|
|
160879
160636
|
canHaveModifiers: () => canHaveModifiers,
|
|
160880
160637
|
canJsonReportNoInputFiles: () => canJsonReportNoInputFiles,
|
|
160881
160638
|
canProduceDiagnostics: () => canProduceDiagnostics,
|
|
160882
|
-
canUsePropertyAccess: () => canUsePropertyAccess,
|
|
160883
160639
|
canWatchDirectoryOrFile: () => canWatchDirectoryOrFile,
|
|
160884
160640
|
cartesianProduct: () => cartesianProduct,
|
|
160885
160641
|
cast: () => cast,
|
|
@@ -162555,7 +162311,6 @@ ${e.message}`;
|
|
|
162555
162311
|
isUnparsedSource: () => isUnparsedSource,
|
|
162556
162312
|
isUnparsedTextLike: () => isUnparsedTextLike,
|
|
162557
162313
|
isUrl: () => isUrl,
|
|
162558
|
-
isValidBigIntString: () => isValidBigIntString,
|
|
162559
162314
|
isValidESSymbolDeclaration: () => isValidESSymbolDeclaration,
|
|
162560
162315
|
isValidTypeOnlyAliasUseSite: () => isValidTypeOnlyAliasUseSite,
|
|
162561
162316
|
isValueSignatureDeclaration: () => isValueSignatureDeclaration,
|
|
@@ -162687,7 +162442,6 @@ ${e.message}`;
|
|
|
162687
162442
|
parameterIsThisKeyword: () => parameterIsThisKeyword,
|
|
162688
162443
|
parameterNamePart: () => parameterNamePart,
|
|
162689
162444
|
parseBaseNodeFactory: () => parseBaseNodeFactory,
|
|
162690
|
-
parseBigInt: () => parseBigInt,
|
|
162691
162445
|
parseBuildCommand: () => parseBuildCommand,
|
|
162692
162446
|
parseCommandLine: () => parseCommandLine,
|
|
162693
162447
|
parseCommandLineWorker: () => parseCommandLineWorker,
|
|
@@ -162706,7 +162460,6 @@ ${e.message}`;
|
|
|
162706
162460
|
parseNodeModuleFromPath: () => parseNodeModuleFromPath,
|
|
162707
162461
|
parsePackageName: () => parsePackageName,
|
|
162708
162462
|
parsePseudoBigInt: () => parsePseudoBigInt,
|
|
162709
|
-
parseValidBigInt: () => parseValidBigInt,
|
|
162710
162463
|
patchWriteFileEnsuringDirectory: () => patchWriteFileEnsuringDirectory,
|
|
162711
162464
|
pathContainsNodeModules: () => pathContainsNodeModules,
|
|
162712
162465
|
pathIsAbsolute: () => pathIsAbsolute,
|