typescript 5.5.0-dev.20240508 → 5.5.0-dev.20240509

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 CHANGED
@@ -18,7 +18,7 @@ and limitations under the License.
18
18
 
19
19
  // src/compiler/corePublic.ts
20
20
  var versionMajorMinor = "5.5";
21
- var version = `${versionMajorMinor}.0-dev.20240508`;
21
+ var version = `${versionMajorMinor}.0-dev.20240509`;
22
22
 
23
23
  // src/compiler/core.ts
24
24
  var emptyArray = [];
@@ -45467,7 +45467,8 @@ function createTypeChecker(host) {
45467
45467
  getTypeOnlyAliasDeclaration,
45468
45468
  getMemberOverrideModifierStatus,
45469
45469
  isTypeParameterPossiblyReferenced,
45470
- typeHasCallOrConstructSignatures
45470
+ typeHasCallOrConstructSignatures,
45471
+ getSymbolFlags
45471
45472
  };
45472
45473
  function getCandidateSignaturesForStringLiteralCompletions(call, editingArgument) {
45473
45474
  const candidatesSet = /* @__PURE__ */ new Set();
@@ -51119,7 +51120,7 @@ function createTypeChecker(host) {
51119
51120
  var _a;
51120
51121
  const addUndefined = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration);
51121
51122
  const enclosingDeclaration = context.enclosingDeclaration;
51122
- if (!isErrorType(type) && enclosingDeclaration) {
51123
+ if (enclosingDeclaration && (!isErrorType(type) || context.flags & 1 /* AllowUnresolvedNames */)) {
51123
51124
  const declWithExistingAnnotation = declaration && getNonlocalEffectiveTypeAnnotationNode(declaration) ? declaration : getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
51124
51125
  if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
51125
51126
  const existing = getNonlocalEffectiveTypeAnnotationNode(declWithExistingAnnotation);
@@ -51408,7 +51409,7 @@ function createTypeChecker(host) {
51408
51409
  );
51409
51410
  }
51410
51411
  if (isNamedDeclaration(node) && node.name.kind === 167 /* ComputedPropertyName */ && !isLateBindableName(node.name)) {
51411
- if (!(context.flags & 1 /* AllowUnresolvedComputedNames */ && hasDynamicName(node) && isEntityNameExpression(node.name.expression) && checkComputedPropertyName(node.name).flags & 1 /* Any */)) {
51412
+ if (!(context.flags & 1 /* AllowUnresolvedNames */ && hasDynamicName(node) && isEntityNameExpression(node.name.expression) && checkComputedPropertyName(node.name).flags & 1 /* Any */)) {
51412
51413
  return void 0;
51413
51414
  }
51414
51415
  }
@@ -109875,7 +109876,7 @@ function getDeclarationDiagnostics(host, resolver, file) {
109875
109876
  );
109876
109877
  return result.diagnostics;
109877
109878
  }
109878
- var declarationEmitNodeBuilderFlags = 1024 /* MultilineObjectLiterals */ | 2048 /* WriteClassExpressionAsTypeLiteral */ | 4096 /* UseTypeOfFunction */ | 8 /* UseStructuralFallback */ | 524288 /* AllowEmptyTuple */ | 1 /* AllowUnresolvedComputedNames */ | 4 /* GenerateNamesForShadowedTypeParams */ | 1 /* NoTruncation */;
109879
+ var declarationEmitNodeBuilderFlags = 1024 /* MultilineObjectLiterals */ | 2048 /* WriteClassExpressionAsTypeLiteral */ | 4096 /* UseTypeOfFunction */ | 8 /* UseStructuralFallback */ | 524288 /* AllowEmptyTuple */ | 1 /* AllowUnresolvedNames */ | 4 /* GenerateNamesForShadowedTypeParams */ | 1 /* NoTruncation */;
109879
109880
  function transformDeclarations(context) {
109880
109881
  const throwDiagnostic = () => Debug.fail("Diagnostic emitted without context");
109881
109882
  let getSymbolAccessibilityDiagnostic = throwDiagnostic;
@@ -99,6 +99,7 @@ declare namespace ts {
99
99
  GetApplicableRefactors = "getApplicableRefactors",
100
100
  GetEditsForRefactor = "getEditsForRefactor",
101
101
  GetMoveToRefactoringFileSuggestions = "getMoveToRefactoringFileSuggestions",
102
+ GetPasteEdits = "getPasteEdits",
102
103
  OrganizeImports = "organizeImports",
103
104
  GetEditsForFileRename = "getEditsForFileRename",
104
105
  ConfigurePlugin = "configurePlugin",
@@ -469,6 +470,33 @@ declare namespace ts {
469
470
  files: string[];
470
471
  };
471
472
  }
473
+ /**
474
+ * Request refactorings at a given position post pasting text from some other location.
475
+ */
476
+ export interface GetPasteEditsRequest extends Request {
477
+ command: CommandTypes.GetPasteEdits;
478
+ arguments: GetPasteEditsRequestArgs;
479
+ }
480
+ export interface GetPasteEditsRequestArgs extends FileRequestArgs {
481
+ /** The text that gets pasted in a file. */
482
+ pastedText: string[];
483
+ /** Locations of where the `pastedText` gets added in a file. If the length of the `pastedText` and `pastedLocations` are not the same,
484
+ * then the `pastedText` is combined into one and added at all the `pastedLocations`.
485
+ */
486
+ pasteLocations: TextSpan[];
487
+ /** The source location of each `pastedText`. If present, the length of `spans` must be equal to the length of `pastedText`. */
488
+ copiedFrom?: {
489
+ file: string;
490
+ spans: TextSpan[];
491
+ };
492
+ }
493
+ export interface GetPasteEditsResponse extends Response {
494
+ body: PasteEditsAction;
495
+ }
496
+ export interface PasteEditsAction {
497
+ edits: FileCodeEdits[];
498
+ fixId?: {};
499
+ }
472
500
  export interface GetEditsForRefactorRequest extends Request {
473
501
  command: CommandTypes.GetEditsForRefactor;
474
502
  arguments: GetEditsForRefactorRequestArgs;
@@ -3499,6 +3527,7 @@ declare namespace ts {
3499
3527
  private getApplicableRefactors;
3500
3528
  private getEditsForRefactor;
3501
3529
  private getMoveToRefactoringFileSuggestions;
3530
+ private getPasteEdits;
3502
3531
  private organizeImports;
3503
3532
  private getEditsForFileRename;
3504
3533
  private getCodeFixes;
@@ -3507,6 +3536,7 @@ declare namespace ts {
3507
3536
  private getStartAndEndPosition;
3508
3537
  private mapCodeAction;
3509
3538
  private mapCodeFixAction;
3539
+ private mapPasteEditsAction;
3510
3540
  private mapTextChangesToCodeEdits;
3511
3541
  private mapTextChangeToCodeEdit;
3512
3542
  private convertTextChangeToCodeEdit;
@@ -10103,6 +10133,7 @@ declare namespace ts {
10103
10133
  uncommentSelection(fileName: string, textRange: TextRange): TextChange[];
10104
10134
  getSupportedCodeFixes(fileName?: string): readonly string[];
10105
10135
  dispose(): void;
10136
+ getPasteEdits(args: PasteEditsArgs, formatOptions: FormatCodeSettings): PasteEdits;
10106
10137
  }
10107
10138
  interface JsxClosingTagInfo {
10108
10139
  readonly newText: string;
@@ -10120,6 +10151,20 @@ declare namespace ts {
10120
10151
  SortAndCombine = "SortAndCombine",
10121
10152
  RemoveUnused = "RemoveUnused",
10122
10153
  }
10154
+ interface PasteEdits {
10155
+ edits: readonly FileTextChanges[];
10156
+ fixId?: {};
10157
+ }
10158
+ interface PasteEditsArgs {
10159
+ targetFile: string;
10160
+ pastedText: string[];
10161
+ pasteLocations: TextRange[];
10162
+ copiedFrom: {
10163
+ file: string;
10164
+ range: TextRange[];
10165
+ } | undefined;
10166
+ preferences: UserPreferences;
10167
+ }
10123
10168
  interface OrganizeImportsArgs extends CombinedCodeFixScope {
10124
10169
  /** @deprecated Use `mode` instead */
10125
10170
  skipDestructiveCodeActions?: boolean;
package/lib/typescript.js CHANGED
@@ -632,6 +632,7 @@ __export(typescript_exports, {
632
632
  forEachKey: () => forEachKey,
633
633
  forEachLeadingCommentRange: () => forEachLeadingCommentRange,
634
634
  forEachNameInAccessChainWalkingLeft: () => forEachNameInAccessChainWalkingLeft,
635
+ forEachNameOfDefaultExport: () => forEachNameOfDefaultExport,
635
636
  forEachPropertyAssignment: () => forEachPropertyAssignment,
636
637
  forEachResolvedProjectReference: () => forEachResolvedProjectReference,
637
638
  forEachReturnStatement: () => forEachReturnStatement,
@@ -728,11 +729,11 @@ __export(typescript_exports, {
728
729
  getDeclaredExpandoInitializer: () => getDeclaredExpandoInitializer,
729
730
  getDecorators: () => getDecorators,
730
731
  getDefaultCompilerOptions: () => getDefaultCompilerOptions2,
731
- getDefaultExportInfoWorker: () => getDefaultExportInfoWorker,
732
732
  getDefaultFormatCodeSettings: () => getDefaultFormatCodeSettings,
733
733
  getDefaultLibFileName: () => getDefaultLibFileName,
734
734
  getDefaultLibFilePath: () => getDefaultLibFilePath,
735
735
  getDefaultLikeExportInfo: () => getDefaultLikeExportInfo,
736
+ getDefaultLikeExportNameFromDeclaration: () => getDefaultLikeExportNameFromDeclaration,
736
737
  getDefaultResolutionModeForFileWorker: () => getDefaultResolutionModeForFileWorker,
737
738
  getDiagnosticText: () => getDiagnosticText,
738
739
  getDiagnosticsWithinSpan: () => getDiagnosticsWithinSpan,
@@ -1067,6 +1068,7 @@ __export(typescript_exports, {
1067
1068
  getSwitchedType: () => getSwitchedType,
1068
1069
  getSymbolId: () => getSymbolId,
1069
1070
  getSymbolNameForPrivateIdentifier: () => getSymbolNameForPrivateIdentifier,
1071
+ getSymbolParentOrFail: () => getSymbolParentOrFail,
1070
1072
  getSymbolTarget: () => getSymbolTarget,
1071
1073
  getSyntacticClassifications: () => getSyntacticClassifications,
1072
1074
  getSyntacticModifierFlags: () => getSyntacticModifierFlags,
@@ -1931,7 +1933,9 @@ __export(typescript_exports, {
1931
1933
  moduleResolutionOptionDeclarations: () => moduleResolutionOptionDeclarations,
1932
1934
  moduleResolutionSupportsPackageJsonExportsAndImports: () => moduleResolutionSupportsPackageJsonExportsAndImports,
1933
1935
  moduleResolutionUsesNodeModules: () => moduleResolutionUsesNodeModules,
1936
+ moduleSpecifierToValidIdentifier: () => moduleSpecifierToValidIdentifier,
1934
1937
  moduleSpecifiers: () => ts_moduleSpecifiers_exports,
1938
+ moduleSymbolToValidIdentifier: () => moduleSymbolToValidIdentifier,
1935
1939
  moveEmitHelpers: () => moveEmitHelpers,
1936
1940
  moveRangeEnd: () => moveRangeEnd,
1937
1941
  moveRangePastDecorators: () => moveRangePastDecorators,
@@ -2011,6 +2015,7 @@ __export(typescript_exports, {
2011
2015
  parsePackageName: () => parsePackageName,
2012
2016
  parsePseudoBigInt: () => parsePseudoBigInt,
2013
2017
  parseValidBigInt: () => parseValidBigInt,
2018
+ pasteEdits: () => ts_PasteEdits_exports,
2014
2019
  patchWriteFileEnsuringDirectory: () => patchWriteFileEnsuringDirectory,
2015
2020
  pathContainsNodeModules: () => pathContainsNodeModules,
2016
2021
  pathIsAbsolute: () => pathIsAbsolute,
@@ -2364,7 +2369,7 @@ module.exports = __toCommonJS(typescript_exports);
2364
2369
 
2365
2370
  // src/compiler/corePublic.ts
2366
2371
  var versionMajorMinor = "5.5";
2367
- var version = `${versionMajorMinor}.0-dev.20240508`;
2372
+ var version = `${versionMajorMinor}.0-dev.20240509`;
2368
2373
  var Comparison = /* @__PURE__ */ ((Comparison3) => {
2369
2374
  Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
2370
2375
  Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
@@ -6342,7 +6347,7 @@ var NodeBuilderFlags = /* @__PURE__ */ ((NodeBuilderFlags2) => {
6342
6347
  NodeBuilderFlags2[NodeBuilderFlags2["NoSyntacticPrinter"] = -2147483648] = "NoSyntacticPrinter";
6343
6348
  NodeBuilderFlags2[NodeBuilderFlags2["AllowNodeModulesRelativePaths"] = 67108864] = "AllowNodeModulesRelativePaths";
6344
6349
  NodeBuilderFlags2[NodeBuilderFlags2["DoNotIncludeSymbolChain"] = 134217728] = "DoNotIncludeSymbolChain";
6345
- NodeBuilderFlags2[NodeBuilderFlags2["AllowUnresolvedComputedNames"] = 1] = "AllowUnresolvedComputedNames";
6350
+ NodeBuilderFlags2[NodeBuilderFlags2["AllowUnresolvedNames"] = 1] = "AllowUnresolvedNames";
6346
6351
  NodeBuilderFlags2[NodeBuilderFlags2["IgnoreErrors"] = 70221824] = "IgnoreErrors";
6347
6352
  NodeBuilderFlags2[NodeBuilderFlags2["InObjectTypeLiteral"] = 4194304] = "InObjectTypeLiteral";
6348
6353
  NodeBuilderFlags2[NodeBuilderFlags2["InTypeAlias"] = 8388608] = "InTypeAlias";
@@ -6911,22 +6916,22 @@ var ScriptKind = /* @__PURE__ */ ((ScriptKind7) => {
6911
6916
  ScriptKind7[ScriptKind7["Deferred"] = 7] = "Deferred";
6912
6917
  return ScriptKind7;
6913
6918
  })(ScriptKind || {});
6914
- var ScriptTarget = /* @__PURE__ */ ((ScriptTarget12) => {
6915
- ScriptTarget12[ScriptTarget12["ES3"] = 0] = "ES3";
6916
- ScriptTarget12[ScriptTarget12["ES5"] = 1] = "ES5";
6917
- ScriptTarget12[ScriptTarget12["ES2015"] = 2] = "ES2015";
6918
- ScriptTarget12[ScriptTarget12["ES2016"] = 3] = "ES2016";
6919
- ScriptTarget12[ScriptTarget12["ES2017"] = 4] = "ES2017";
6920
- ScriptTarget12[ScriptTarget12["ES2018"] = 5] = "ES2018";
6921
- ScriptTarget12[ScriptTarget12["ES2019"] = 6] = "ES2019";
6922
- ScriptTarget12[ScriptTarget12["ES2020"] = 7] = "ES2020";
6923
- ScriptTarget12[ScriptTarget12["ES2021"] = 8] = "ES2021";
6924
- ScriptTarget12[ScriptTarget12["ES2022"] = 9] = "ES2022";
6925
- ScriptTarget12[ScriptTarget12["ES2023"] = 10] = "ES2023";
6926
- ScriptTarget12[ScriptTarget12["ESNext"] = 99] = "ESNext";
6927
- ScriptTarget12[ScriptTarget12["JSON"] = 100] = "JSON";
6928
- ScriptTarget12[ScriptTarget12["Latest"] = 99 /* ESNext */] = "Latest";
6929
- return ScriptTarget12;
6919
+ var ScriptTarget = /* @__PURE__ */ ((ScriptTarget11) => {
6920
+ ScriptTarget11[ScriptTarget11["ES3"] = 0] = "ES3";
6921
+ ScriptTarget11[ScriptTarget11["ES5"] = 1] = "ES5";
6922
+ ScriptTarget11[ScriptTarget11["ES2015"] = 2] = "ES2015";
6923
+ ScriptTarget11[ScriptTarget11["ES2016"] = 3] = "ES2016";
6924
+ ScriptTarget11[ScriptTarget11["ES2017"] = 4] = "ES2017";
6925
+ ScriptTarget11[ScriptTarget11["ES2018"] = 5] = "ES2018";
6926
+ ScriptTarget11[ScriptTarget11["ES2019"] = 6] = "ES2019";
6927
+ ScriptTarget11[ScriptTarget11["ES2020"] = 7] = "ES2020";
6928
+ ScriptTarget11[ScriptTarget11["ES2021"] = 8] = "ES2021";
6929
+ ScriptTarget11[ScriptTarget11["ES2022"] = 9] = "ES2022";
6930
+ ScriptTarget11[ScriptTarget11["ES2023"] = 10] = "ES2023";
6931
+ ScriptTarget11[ScriptTarget11["ESNext"] = 99] = "ESNext";
6932
+ ScriptTarget11[ScriptTarget11["JSON"] = 100] = "JSON";
6933
+ ScriptTarget11[ScriptTarget11["Latest"] = 99 /* ESNext */] = "Latest";
6934
+ return ScriptTarget11;
6930
6935
  })(ScriptTarget || {});
6931
6936
  var LanguageVariant = /* @__PURE__ */ ((LanguageVariant4) => {
6932
6937
  LanguageVariant4[LanguageVariant4["Standard"] = 0] = "Standard";
@@ -50266,7 +50271,8 @@ function createTypeChecker(host) {
50266
50271
  getTypeOnlyAliasDeclaration,
50267
50272
  getMemberOverrideModifierStatus,
50268
50273
  isTypeParameterPossiblyReferenced,
50269
- typeHasCallOrConstructSignatures
50274
+ typeHasCallOrConstructSignatures,
50275
+ getSymbolFlags
50270
50276
  };
50271
50277
  function getCandidateSignaturesForStringLiteralCompletions(call, editingArgument) {
50272
50278
  const candidatesSet = /* @__PURE__ */ new Set();
@@ -55918,7 +55924,7 @@ function createTypeChecker(host) {
55918
55924
  var _a;
55919
55925
  const addUndefined = declaration && (isParameter(declaration) || isJSDocParameterTag(declaration)) && requiresAddingImplicitUndefined(declaration);
55920
55926
  const enclosingDeclaration = context.enclosingDeclaration;
55921
- if (!isErrorType(type) && enclosingDeclaration) {
55927
+ if (enclosingDeclaration && (!isErrorType(type) || context.flags & 1 /* AllowUnresolvedNames */)) {
55922
55928
  const declWithExistingAnnotation = declaration && getNonlocalEffectiveTypeAnnotationNode(declaration) ? declaration : getDeclarationWithTypeAnnotation(symbol, getEnclosingDeclarationIgnoringFakeScope(enclosingDeclaration));
55923
55929
  if (declWithExistingAnnotation && !isFunctionLikeDeclaration(declWithExistingAnnotation) && !isGetAccessorDeclaration(declWithExistingAnnotation)) {
55924
55930
  const existing = getNonlocalEffectiveTypeAnnotationNode(declWithExistingAnnotation);
@@ -56207,7 +56213,7 @@ function createTypeChecker(host) {
56207
56213
  );
56208
56214
  }
56209
56215
  if (isNamedDeclaration(node) && node.name.kind === 167 /* ComputedPropertyName */ && !isLateBindableName(node.name)) {
56210
- if (!(context.flags & 1 /* AllowUnresolvedComputedNames */ && hasDynamicName(node) && isEntityNameExpression(node.name.expression) && checkComputedPropertyName(node.name).flags & 1 /* Any */)) {
56216
+ if (!(context.flags & 1 /* AllowUnresolvedNames */ && hasDynamicName(node) && isEntityNameExpression(node.name.expression) && checkComputedPropertyName(node.name).flags & 1 /* Any */)) {
56211
56217
  return void 0;
56212
56218
  }
56213
56219
  }
@@ -114856,7 +114862,7 @@ function getDeclarationDiagnostics(host, resolver, file) {
114856
114862
  );
114857
114863
  return result.diagnostics;
114858
114864
  }
114859
- var declarationEmitNodeBuilderFlags = 1024 /* MultilineObjectLiterals */ | 2048 /* WriteClassExpressionAsTypeLiteral */ | 4096 /* UseTypeOfFunction */ | 8 /* UseStructuralFallback */ | 524288 /* AllowEmptyTuple */ | 1 /* AllowUnresolvedComputedNames */ | 4 /* GenerateNamesForShadowedTypeParams */ | 1 /* NoTruncation */;
114865
+ var declarationEmitNodeBuilderFlags = 1024 /* MultilineObjectLiterals */ | 2048 /* WriteClassExpressionAsTypeLiteral */ | 4096 /* UseTypeOfFunction */ | 8 /* UseStructuralFallback */ | 524288 /* AllowEmptyTuple */ | 1 /* AllowUnresolvedNames */ | 4 /* GenerateNamesForShadowedTypeParams */ | 1 /* NoTruncation */;
114860
114866
  function transformDeclarations(context) {
114861
114867
  const throwDiagnostic = () => Debug.fail("Diagnostic emitted without context");
114862
114868
  let getSymbolAccessibilityDiagnostic = throwDiagnostic;
@@ -134676,13 +134682,13 @@ var scanner = createScanner(
134676
134682
  /*skipTrivia*/
134677
134683
  true
134678
134684
  );
134679
- var SemanticMeaning = /* @__PURE__ */ ((SemanticMeaning3) => {
134680
- SemanticMeaning3[SemanticMeaning3["None"] = 0] = "None";
134681
- SemanticMeaning3[SemanticMeaning3["Value"] = 1] = "Value";
134682
- SemanticMeaning3[SemanticMeaning3["Type"] = 2] = "Type";
134683
- SemanticMeaning3[SemanticMeaning3["Namespace"] = 4] = "Namespace";
134684
- SemanticMeaning3[SemanticMeaning3["All"] = 7] = "All";
134685
- return SemanticMeaning3;
134685
+ var SemanticMeaning = /* @__PURE__ */ ((SemanticMeaning2) => {
134686
+ SemanticMeaning2[SemanticMeaning2["None"] = 0] = "None";
134687
+ SemanticMeaning2[SemanticMeaning2["Value"] = 1] = "Value";
134688
+ SemanticMeaning2[SemanticMeaning2["Type"] = 2] = "Type";
134689
+ SemanticMeaning2[SemanticMeaning2["Namespace"] = 4] = "Namespace";
134690
+ SemanticMeaning2[SemanticMeaning2["All"] = 7] = "All";
134691
+ return SemanticMeaning2;
134686
134692
  })(SemanticMeaning || {});
134687
134693
  function getMeaningFromDeclaration(node) {
134688
134694
  switch (node.kind) {
@@ -136631,7 +136637,11 @@ function getPrecedingNonSpaceCharacterPosition(text, position) {
136631
136637
  function getSynthesizedDeepClone(node, includeTrivia = true) {
136632
136638
  const clone2 = node && getSynthesizedDeepCloneWorker(node);
136633
136639
  if (clone2 && !includeTrivia) suppressLeadingAndTrailingTrivia(clone2);
136634
- return clone2;
136640
+ return setParentRecursive(
136641
+ clone2,
136642
+ /*incremental*/
136643
+ false
136644
+ );
136635
136645
  }
136636
136646
  function getSynthesizedDeepCloneWithReplacements(node, includeTrivia, replaceNode) {
136637
136647
  let clone2 = replaceNode(node);
@@ -137228,13 +137238,13 @@ function getNamesForExportedSymbol(symbol, scriptTarget) {
137228
137238
  if (needsNameFromDeclaration(symbol)) {
137229
137239
  const fromDeclaration = getDefaultLikeExportNameFromDeclaration(symbol);
137230
137240
  if (fromDeclaration) return fromDeclaration;
137231
- const fileNameCase = ts_codefix_exports.moduleSymbolToValidIdentifier(
137241
+ const fileNameCase = moduleSymbolToValidIdentifier(
137232
137242
  getSymbolParentOrFail(symbol),
137233
137243
  scriptTarget,
137234
137244
  /*forceCapitalize*/
137235
137245
  false
137236
137246
  );
137237
- const capitalized = ts_codefix_exports.moduleSymbolToValidIdentifier(
137247
+ const capitalized = moduleSymbolToValidIdentifier(
137238
137248
  getSymbolParentOrFail(symbol),
137239
137249
  scriptTarget,
137240
137250
  /*forceCapitalize*/
@@ -137247,7 +137257,7 @@ function getNamesForExportedSymbol(symbol, scriptTarget) {
137247
137257
  }
137248
137258
  function getNameForExportedSymbol(symbol, scriptTarget, preferCapitalized) {
137249
137259
  if (needsNameFromDeclaration(symbol)) {
137250
- return getDefaultLikeExportNameFromDeclaration(symbol) || ts_codefix_exports.moduleSymbolToValidIdentifier(getSymbolParentOrFail(symbol), scriptTarget, !!preferCapitalized);
137260
+ return getDefaultLikeExportNameFromDeclaration(symbol) || moduleSymbolToValidIdentifier(getSymbolParentOrFail(symbol), scriptTarget, !!preferCapitalized);
137251
137261
  }
137252
137262
  return symbol.name;
137253
137263
  }
@@ -137278,6 +137288,36 @@ function getSymbolParentOrFail(symbol) {
137278
137288
  }).join(", ")}.`
137279
137289
  );
137280
137290
  }
137291
+ function moduleSymbolToValidIdentifier(moduleSymbol, target, forceCapitalize) {
137292
+ return moduleSpecifierToValidIdentifier(removeFileExtension(stripQuotes(moduleSymbol.name)), target, forceCapitalize);
137293
+ }
137294
+ function moduleSpecifierToValidIdentifier(moduleSpecifier, target, forceCapitalize) {
137295
+ const baseName = getBaseFileName(removeSuffix(moduleSpecifier, "/index"));
137296
+ let res = "";
137297
+ let lastCharWasValid = true;
137298
+ const firstCharCode = baseName.charCodeAt(0);
137299
+ if (isIdentifierStart(firstCharCode, target)) {
137300
+ res += String.fromCharCode(firstCharCode);
137301
+ if (forceCapitalize) {
137302
+ res = res.toUpperCase();
137303
+ }
137304
+ } else {
137305
+ lastCharWasValid = false;
137306
+ }
137307
+ for (let i = 1; i < baseName.length; i++) {
137308
+ const ch = baseName.charCodeAt(i);
137309
+ const isValid = isIdentifierPart(ch, target);
137310
+ if (isValid) {
137311
+ let char = String.fromCharCode(ch);
137312
+ if (!lastCharWasValid) {
137313
+ char = char.toUpperCase();
137314
+ }
137315
+ res += char;
137316
+ }
137317
+ lastCharWasValid = isValid;
137318
+ }
137319
+ return !isStringANonContextualKeyword(res) ? res || "_" : `_${res}`;
137320
+ }
137281
137321
  function stringContainsAt(haystack, needle, startIndex) {
137282
137322
  const needleLength = needle.length;
137283
137323
  if (needleLength + startIndex > haystack.length) {
@@ -137781,7 +137821,6 @@ function getExportInfoMap(importingFile, host, program, preferences, cancellatio
137781
137821
  return cache;
137782
137822
  }
137783
137823
  (_d = host.log) == null ? void 0 : _d.call(host, "getExportInfoMap: cache miss or empty; calculating new results");
137784
- const compilerOptions = program.getCompilerOptions();
137785
137824
  let moduleCount = 0;
137786
137825
  try {
137787
137826
  forEachExternalModuleToImportFrom(
@@ -137794,7 +137833,7 @@ function getExportInfoMap(importingFile, host, program, preferences, cancellatio
137794
137833
  if (++moduleCount % 100 === 0) cancellationToken == null ? void 0 : cancellationToken.throwIfCancellationRequested();
137795
137834
  const seenExports = /* @__PURE__ */ new Map();
137796
137835
  const checker = program2.getTypeChecker();
137797
- const defaultInfo = getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions);
137836
+ const defaultInfo = getDefaultLikeExportInfo(moduleSymbol, checker);
137798
137837
  if (defaultInfo && isImportableSymbol(defaultInfo.symbol, checker)) {
137799
137838
  cache.add(
137800
137839
  importingFile.path,
@@ -137830,48 +137869,37 @@ function getExportInfoMap(importingFile, host, program, preferences, cancellatio
137830
137869
  (_e = host.log) == null ? void 0 : _e.call(host, `getExportInfoMap: done in ${timestamp() - start} ms`);
137831
137870
  return cache;
137832
137871
  }
137833
- function getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions) {
137834
- const exported = getDefaultLikeExportWorker(moduleSymbol, checker);
137835
- if (!exported) return void 0;
137836
- const { symbol, exportKind } = exported;
137837
- const info = getDefaultExportInfoWorker(symbol, checker, compilerOptions);
137838
- return info && { symbol, exportKind, ...info };
137839
- }
137840
- function isImportableSymbol(symbol, checker) {
137841
- return !checker.isUndefinedSymbol(symbol) && !checker.isUnknownSymbol(symbol) && !isKnownSymbol(symbol) && !isPrivateIdentifierSymbol(symbol);
137842
- }
137843
- function getDefaultLikeExportWorker(moduleSymbol, checker) {
137872
+ function getDefaultLikeExportInfo(moduleSymbol, checker) {
137844
137873
  const exportEquals = checker.resolveExternalModuleSymbol(moduleSymbol);
137845
137874
  if (exportEquals !== moduleSymbol) return { symbol: exportEquals, exportKind: 2 /* ExportEquals */ };
137846
137875
  const defaultExport = checker.tryGetMemberInModuleExports("default" /* Default */, moduleSymbol);
137847
137876
  if (defaultExport) return { symbol: defaultExport, exportKind: 1 /* Default */ };
137848
137877
  }
137849
- function getDefaultExportInfoWorker(defaultExport, checker, compilerOptions) {
137850
- const localSymbol = getLocalSymbolForExportDefault(defaultExport);
137851
- if (localSymbol) return { resolvedSymbol: localSymbol, name: localSymbol.name };
137852
- const name = getNameForExportDefault(defaultExport);
137853
- if (name !== void 0) return { resolvedSymbol: defaultExport, name };
137854
- if (defaultExport.flags & 2097152 /* Alias */) {
137855
- const aliased = checker.getImmediateAliasedSymbol(defaultExport);
137856
- if (aliased && aliased.parent) {
137857
- return getDefaultExportInfoWorker(aliased, checker, compilerOptions);
137878
+ function isImportableSymbol(symbol, checker) {
137879
+ return !checker.isUndefinedSymbol(symbol) && !checker.isUnknownSymbol(symbol) && !isKnownSymbol(symbol) && !isPrivateIdentifierSymbol(symbol);
137880
+ }
137881
+ function forEachNameOfDefaultExport(defaultExport, checker, compilerOptions, preferCapitalizedNames, cb) {
137882
+ let chain;
137883
+ let current = defaultExport;
137884
+ while (current) {
137885
+ const fromDeclaration = getDefaultLikeExportNameFromDeclaration(current);
137886
+ if (fromDeclaration) {
137887
+ const final = cb(fromDeclaration);
137888
+ if (final) return final;
137858
137889
  }
137890
+ if (current.escapedName !== "default" /* Default */ && current.escapedName !== "export=" /* ExportEquals */) {
137891
+ const final = cb(current.name);
137892
+ if (final) return final;
137893
+ }
137894
+ chain = append(chain, current);
137895
+ current = current.flags & 2097152 /* Alias */ ? checker.getImmediateAliasedSymbol(current) : void 0;
137859
137896
  }
137860
- if (defaultExport.escapedName !== "default" /* Default */ && defaultExport.escapedName !== "export=" /* ExportEquals */) {
137861
- return { resolvedSymbol: defaultExport, name: defaultExport.getName() };
137862
- }
137863
- return { resolvedSymbol: defaultExport, name: getNameForExportedSymbol(defaultExport, compilerOptions.target) };
137864
- }
137865
- function getNameForExportDefault(symbol) {
137866
- return symbol.declarations && firstDefined(symbol.declarations, (declaration) => {
137867
- var _a;
137868
- if (isExportAssignment(declaration)) {
137869
- return (_a = tryCast(skipOuterExpressions(declaration.expression), isIdentifier)) == null ? void 0 : _a.text;
137870
- } else if (isExportSpecifier(declaration)) {
137871
- Debug.assert(declaration.name.text === "default" /* Default */, "Expected the specifier to be a default export");
137872
- return declaration.propertyName && declaration.propertyName.text;
137897
+ for (const symbol of chain ?? emptyArray) {
137898
+ if (symbol.parent && isExternalModuleSymbol(symbol.parent)) {
137899
+ const final = cb(moduleSymbolToValidIdentifier(symbol.parent, getEmitScriptTarget(compilerOptions), preferCapitalizedNames));
137900
+ if (final) return final;
137873
137901
  }
137874
- });
137902
+ }
137875
137903
  }
137876
137904
 
137877
137905
  // src/services/classifier.ts
@@ -141643,6 +141671,7 @@ function cleanText(text) {
141643
141671
  var ts_refactor_exports = {};
141644
141672
  __export(ts_refactor_exports, {
141645
141673
  addExportToChanges: () => addExportToChanges,
141674
+ addExportsInOldFile: () => addExportsInOldFile,
141646
141675
  addImportsForMovedSymbols: () => addImportsForMovedSymbols,
141647
141676
  addNewFileToTsconfig: () => addNewFileToTsconfig,
141648
141677
  addOrRemoveBracesToArrowFunction: () => ts_refactor_addOrRemoveBracesToArrowFunction_exports,
@@ -141663,6 +141692,7 @@ __export(ts_refactor_exports, {
141663
141692
  generateGetAccessorAndSetAccessor: () => ts_refactor_generateGetAccessorAndSetAccessor_exports,
141664
141693
  getApplicableRefactors: () => getApplicableRefactors,
141665
141694
  getEditsForRefactor: () => getEditsForRefactor,
141695
+ getExistingLocals: () => getExistingLocals,
141666
141696
  getIdentifierForNode: () => getIdentifierForNode,
141667
141697
  getNewStatementsAndRemoveFromOldFile: () => getNewStatementsAndRemoveFromOldFile,
141668
141698
  getStatementsToMove: () => getStatementsToMove,
@@ -142086,7 +142116,7 @@ function doChangeNamedToNamespaceOrDefault(sourceFile, program, changes, toConve
142086
142116
  toConvertSymbols.add(symbol);
142087
142117
  }
142088
142118
  });
142089
- const preferredName = moduleSpecifier && isStringLiteral(moduleSpecifier) ? ts_codefix_exports.moduleSpecifierToValidIdentifier(moduleSpecifier.text, 99 /* ESNext */) : "module";
142119
+ const preferredName = moduleSpecifier && isStringLiteral(moduleSpecifier) ? moduleSpecifierToValidIdentifier(moduleSpecifier.text, 99 /* ESNext */) : "module";
142090
142120
  function hasNamespaceNameConflict(namedImport) {
142091
142121
  return !!ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(namedImport.name, checker, sourceFile, (id) => {
142092
142122
  const symbol = checker.resolveName(
@@ -142700,7 +142730,7 @@ function getNamespaceLikeImport(node) {
142700
142730
  }
142701
142731
  }
142702
142732
  function updateNamespaceLikeImport(changes, sourceFile, checker, movedSymbols, newModuleSpecifier, oldImportId, oldImportNode, quotePreference) {
142703
- const preferredNewNamespaceName = ts_codefix_exports.moduleSpecifierToValidIdentifier(newModuleSpecifier, 99 /* ESNext */);
142733
+ const preferredNewNamespaceName = moduleSpecifierToValidIdentifier(newModuleSpecifier, 99 /* ESNext */);
142704
142734
  let needUniqueName = false;
142705
142735
  const toChange = [];
142706
142736
  ts_FindAllReferences_exports.Core.eachSymbolReferenceInFile(oldImportId, checker, sourceFile, (ref) => {
@@ -147915,7 +147945,8 @@ var invalidOperationsInPartialSemanticMode = [
147915
147945
  "provideCallHierarchyIncomingCalls",
147916
147946
  "provideCallHierarchyOutgoingCalls",
147917
147947
  "provideInlayHints",
147918
- "getSupportedCodeFixes"
147948
+ "getSupportedCodeFixes",
147949
+ "getPasteEdits"
147919
147950
  ];
147920
147951
  var invalidOperationsInSyntacticMode = [
147921
147952
  ...invalidOperationsInPartialSemanticMode,
@@ -148319,6 +148350,19 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
148319
148350
  tags
148320
148351
  };
148321
148352
  }
148353
+ function getPasteEdits(args, formatOptions) {
148354
+ synchronizeHostData();
148355
+ return ts_PasteEdits_exports.pasteEditsProvider(
148356
+ getValidSourceFile(args.targetFile),
148357
+ args.pastedText,
148358
+ args.pasteLocations,
148359
+ args.copiedFrom ? { file: getValidSourceFile(args.copiedFrom.file), range: args.copiedFrom.range } : void 0,
148360
+ host,
148361
+ args.preferences,
148362
+ ts_formatting_exports.getFormatContext(formatOptions, host),
148363
+ cancellationToken
148364
+ );
148365
+ }
148322
148366
  function getNodeForQuickInfo(node) {
148323
148367
  if (isNewExpression(node.parent) && node.pos === node.parent.pos) {
148324
148368
  return node.parent.expression;
@@ -148569,12 +148613,12 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
148569
148613
  return ts_codefix_exports.getFixes({ errorCode, sourceFile, span, program, host, cancellationToken, formatContext, preferences });
148570
148614
  });
148571
148615
  }
148572
- function getCombinedCodeFix(scope, fixId54, formatOptions, preferences = emptyOptions) {
148616
+ function getCombinedCodeFix(scope, fixId55, formatOptions, preferences = emptyOptions) {
148573
148617
  synchronizeHostData();
148574
148618
  Debug.assert(scope.type === "file");
148575
148619
  const sourceFile = getValidSourceFile(scope.fileName);
148576
148620
  const formatContext = ts_formatting_exports.getFormatContext(formatOptions, host);
148577
- return ts_codefix_exports.getAllFixes({ fixId: fixId54, sourceFile, program, host, cancellationToken, formatContext, preferences });
148621
+ return ts_codefix_exports.getAllFixes({ fixId: fixId55, sourceFile, program, host, cancellationToken, formatContext, preferences });
148578
148622
  }
148579
148623
  function organizeImports2(args, formatOptions, preferences = emptyOptions) {
148580
148624
  synchronizeHostData();
@@ -149094,7 +149138,8 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
149094
149138
  commentSelection,
149095
149139
  uncommentSelection,
149096
149140
  provideInlayHints: provideInlayHints2,
149097
- getSupportedCodeFixes
149141
+ getSupportedCodeFixes,
149142
+ getPasteEdits
149098
149143
  };
149099
149144
  switch (languageServiceMode) {
149100
149145
  case 0 /* Semantic */:
@@ -150212,8 +150257,6 @@ __export(ts_codefix_exports, {
150212
150257
  getSupportedErrorCodes: () => getSupportedErrorCodes,
150213
150258
  importFixName: () => importFixName,
150214
150259
  importSymbols: () => importSymbols,
150215
- moduleSpecifierToValidIdentifier: () => moduleSpecifierToValidIdentifier,
150216
- moduleSymbolToValidIdentifier: () => moduleSymbolToValidIdentifier,
150217
150260
  parameterShouldGetTypeFromJSDoc: () => parameterShouldGetTypeFromJSDoc,
150218
150261
  registerCodeFix: () => registerCodeFix,
150219
150262
  setJsonCompilerOptionValue: () => setJsonCompilerOptionValue,
@@ -150236,14 +150279,14 @@ function createCodeFixActionWithoutFixAll(fixName8, changes, description3) {
150236
150279
  void 0
150237
150280
  );
150238
150281
  }
150239
- function createCodeFixAction(fixName8, changes, description3, fixId54, fixAllDescription, command) {
150240
- return createCodeFixActionWorker(fixName8, diagnosticToString(description3), changes, fixId54, diagnosticToString(fixAllDescription), command);
150282
+ function createCodeFixAction(fixName8, changes, description3, fixId55, fixAllDescription, command) {
150283
+ return createCodeFixActionWorker(fixName8, diagnosticToString(description3), changes, fixId55, diagnosticToString(fixAllDescription), command);
150241
150284
  }
150242
- function createCodeFixActionMaybeFixAll(fixName8, changes, description3, fixId54, fixAllDescription, command) {
150243
- return createCodeFixActionWorker(fixName8, diagnosticToString(description3), changes, fixId54, fixAllDescription && diagnosticToString(fixAllDescription), command);
150285
+ function createCodeFixActionMaybeFixAll(fixName8, changes, description3, fixId55, fixAllDescription, command) {
150286
+ return createCodeFixActionWorker(fixName8, diagnosticToString(description3), changes, fixId55, fixAllDescription && diagnosticToString(fixAllDescription), command);
150244
150287
  }
150245
- function createCodeFixActionWorker(fixName8, description3, changes, fixId54, fixAllDescription, command) {
150246
- return { fixName: fixName8, description: description3, changes, fixId: fixId54, fixAllDescription, commands: command ? [command] : void 0 };
150288
+ function createCodeFixActionWorker(fixName8, description3, changes, fixId55, fixAllDescription, command) {
150289
+ return { fixName: fixName8, description: description3, changes, fixId: fixId55, fixAllDescription, commands: command ? [command] : void 0 };
150247
150290
  }
150248
150291
  function registerCodeFix(reg) {
150249
150292
  for (const error2 of reg.errorCodes) {
@@ -150251,9 +150294,9 @@ function registerCodeFix(reg) {
150251
150294
  errorCodeToFixes.add(String(error2), reg);
150252
150295
  }
150253
150296
  if (reg.fixIds) {
150254
- for (const fixId54 of reg.fixIds) {
150255
- Debug.assert(!fixIdToRegistration.has(fixId54));
150256
- fixIdToRegistration.set(fixId54, reg);
150297
+ for (const fixId55 of reg.fixIds) {
150298
+ Debug.assert(!fixIdToRegistration.has(fixId55));
150299
+ fixIdToRegistration.set(fixId55, reg);
150257
150300
  }
150258
150301
  }
150259
150302
  }
@@ -150269,8 +150312,8 @@ function removeFixIdIfFixAllUnavailable(registration, diagnostics) {
150269
150312
  if (maybeFixableDiagnostics > 1) break;
150270
150313
  }
150271
150314
  const fixAllUnavailable = maybeFixableDiagnostics < 2;
150272
- return ({ fixId: fixId54, fixAllDescription, ...action }) => {
150273
- return fixAllUnavailable ? action : { ...action, fixId: fixId54, fixAllDescription };
150315
+ return ({ fixId: fixId55, fixAllDescription, ...action }) => {
150316
+ return fixAllUnavailable ? action : { ...action, fixId: fixId55, fixAllDescription };
150274
150317
  };
150275
150318
  }
150276
150319
  function getFixes(context) {
@@ -153774,7 +153817,6 @@ function getAllExportInfoForSymbol(importingFile, symbol, symbolName2, moduleSym
153774
153817
  }
153775
153818
  function getSingleExportInfoForSymbol(symbol, symbolName2, moduleSymbol, program, host) {
153776
153819
  var _a, _b;
153777
- const compilerOptions = program.getCompilerOptions();
153778
153820
  const mainProgramInfo = getInfoWithChecker(
153779
153821
  program.getTypeChecker(),
153780
153822
  /*isFromPackageJson*/
@@ -153790,7 +153832,7 @@ function getSingleExportInfoForSymbol(symbol, symbolName2, moduleSymbol, program
153790
153832
  true
153791
153833
  ), `Could not find symbol in specified module for code actions`);
153792
153834
  function getInfoWithChecker(checker, isFromPackageJson) {
153793
- const defaultInfo = getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions);
153835
+ const defaultInfo = getDefaultLikeExportInfo(moduleSymbol, checker);
153794
153836
  if (defaultInfo && skipAlias(defaultInfo.symbol, checker) === symbol) {
153795
153837
  return { symbol: defaultInfo.symbol, moduleSymbol, moduleFileName: void 0, exportKind: defaultInfo.exportKind, targetFlags: skipAlias(symbol, checker).flags, isFromPackageJson };
153796
153838
  }
@@ -153800,12 +153842,9 @@ function getSingleExportInfoForSymbol(symbol, symbolName2, moduleSymbol, program
153800
153842
  }
153801
153843
  }
153802
153844
  }
153803
- function isFutureSymbolExportInfoArray(info) {
153804
- return info[0].symbol === void 0;
153805
- }
153806
153845
  function getImportFixes(exportInfos, usagePosition, isValidTypeOnlyUseSite, useRequire, program, sourceFile, host, preferences, importMap = isFullSourceFile(sourceFile) ? createExistingImportMap(sourceFile, program) : void 0, fromCacheOnly) {
153807
153846
  const checker = program.getTypeChecker();
153808
- const existingImports = importMap && !isFutureSymbolExportInfoArray(exportInfos) ? flatMap(exportInfos, importMap.getImportsForExportInfo) : emptyArray;
153847
+ const existingImports = importMap ? flatMap(exportInfos, importMap.getImportsForExportInfo) : emptyArray;
153809
153848
  const useNamespace = usagePosition !== void 0 && tryUseExistingNamespaceImport(existingImports, usagePosition);
153810
153849
  const addToExisting = tryAddToExistingImport(existingImports, isValidTypeOnlyUseSite, checker, program.getCompilerOptions());
153811
153850
  if (addToExisting) {
@@ -154001,7 +154040,6 @@ function getNewImportFixes(program, sourceFile, usagePosition, isValidTypeOnlyUs
154001
154040
  );
154002
154041
  computedWithoutCacheCount += computedWithoutCache ? 1 : 0;
154003
154042
  return mapDefined(moduleSpecifiers, (moduleSpecifier) => {
154004
- var _a;
154005
154043
  if (rejectNodeModulesRelativePaths && pathContainsNodeModules(moduleSpecifier)) {
154006
154044
  return void 0;
154007
154045
  }
@@ -154014,7 +154052,14 @@ function getNewImportFixes(program, sourceFile, usagePosition, isValidTypeOnlyUs
154014
154052
  const exportEquals = checker.resolveExternalModuleSymbol(exportInfo2.moduleSymbol);
154015
154053
  let namespacePrefix;
154016
154054
  if (exportEquals !== exportInfo2.moduleSymbol) {
154017
- namespacePrefix = (_a = getDefaultExportInfoWorker(exportEquals, checker, compilerOptions)) == null ? void 0 : _a.name;
154055
+ namespacePrefix = forEachNameOfDefaultExport(
154056
+ exportEquals,
154057
+ checker,
154058
+ compilerOptions,
154059
+ /*preferCapitalizedNames*/
154060
+ false,
154061
+ identity
154062
+ );
154018
154063
  }
154019
154064
  namespacePrefix || (namespacePrefix = moduleSymbolToValidIdentifier(
154020
154065
  exportInfo2.moduleSymbol,
@@ -154298,12 +154343,12 @@ function getExportInfos(symbolName2, isJsxTagName, currentTokenMeaning, cancella
154298
154343
  const checker = program2.getTypeChecker();
154299
154344
  cancellationToken.throwIfCancellationRequested();
154300
154345
  const compilerOptions = program2.getCompilerOptions();
154301
- const defaultInfo = getDefaultLikeExportInfo(moduleSymbol, checker, compilerOptions);
154302
- if (defaultInfo && (defaultInfo.name === symbolName2 || moduleSymbolToValidIdentifier(moduleSymbol, getEmitScriptTarget(compilerOptions), isJsxTagName) === symbolName2) && symbolHasMeaning(defaultInfo.resolvedSymbol, currentTokenMeaning)) {
154346
+ const defaultInfo = getDefaultLikeExportInfo(moduleSymbol, checker);
154347
+ if (defaultInfo && symbolFlagsHaveMeaning(checker.getSymbolFlags(defaultInfo.symbol), currentTokenMeaning) && forEachNameOfDefaultExport(defaultInfo.symbol, checker, compilerOptions, isJsxTagName, (name) => name === symbolName2)) {
154303
154348
  addSymbol(moduleSymbol, sourceFile, defaultInfo.symbol, defaultInfo.exportKind, program2, isFromPackageJson);
154304
154349
  }
154305
154350
  const exportSymbolWithIdenticalName = checker.tryGetMemberInModuleExportsAndProperties(symbolName2, moduleSymbol);
154306
- if (exportSymbolWithIdenticalName && symbolHasMeaning(exportSymbolWithIdenticalName, currentTokenMeaning)) {
154351
+ if (exportSymbolWithIdenticalName && symbolFlagsHaveMeaning(checker.getSymbolFlags(exportSymbolWithIdenticalName), currentTokenMeaning)) {
154307
154352
  addSymbol(moduleSymbol, sourceFile, exportSymbolWithIdenticalName, 0 /* Named */, program2, isFromPackageJson);
154308
154353
  }
154309
154354
  });
@@ -154697,38 +154742,8 @@ function createConstEqualsRequireDeclaration(name, quotedModuleSpecifier) {
154697
154742
  ], 2 /* Const */)
154698
154743
  );
154699
154744
  }
154700
- function symbolHasMeaning({ declarations }, meaning) {
154701
- return some(declarations, (decl) => !!(getMeaningFromDeclaration(decl) & meaning));
154702
- }
154703
- function moduleSymbolToValidIdentifier(moduleSymbol, target, forceCapitalize) {
154704
- return moduleSpecifierToValidIdentifier(removeFileExtension(stripQuotes(moduleSymbol.name)), target, forceCapitalize);
154705
- }
154706
- function moduleSpecifierToValidIdentifier(moduleSpecifier, target, forceCapitalize) {
154707
- const baseName = getBaseFileName(removeSuffix(moduleSpecifier, "/index"));
154708
- let res = "";
154709
- let lastCharWasValid = true;
154710
- const firstCharCode = baseName.charCodeAt(0);
154711
- if (isIdentifierStart(firstCharCode, target)) {
154712
- res += String.fromCharCode(firstCharCode);
154713
- if (forceCapitalize) {
154714
- res = res.toUpperCase();
154715
- }
154716
- } else {
154717
- lastCharWasValid = false;
154718
- }
154719
- for (let i = 1; i < baseName.length; i++) {
154720
- const ch = baseName.charCodeAt(i);
154721
- const isValid = isIdentifierPart(ch, target);
154722
- if (isValid) {
154723
- let char = String.fromCharCode(ch);
154724
- if (!lastCharWasValid) {
154725
- char = char.toUpperCase();
154726
- }
154727
- res += char;
154728
- }
154729
- lastCharWasValid = isValid;
154730
- }
154731
- return !isStringANonContextualKeyword(res) ? res || "_" : `_${res}`;
154745
+ function symbolFlagsHaveMeaning(flags, meaning) {
154746
+ return meaning === 7 /* All */ ? true : meaning & 1 /* Value */ ? !!(flags & 111551 /* Value */) : meaning & 2 /* Type */ ? !!(flags & 788968 /* Type */) : meaning & 4 /* Namespace */ ? !!(flags & 1920 /* Namespace */) : false;
154732
154747
  }
154733
154748
  function getImpliedNodeFormatForEmit(file, program) {
154734
154749
  return isFullSourceFile(file) ? program.getImpliedNodeFormatForEmit(file) : getImpliedNodeFormatForEmitWorker(file, program.getCompilerOptions());
@@ -154914,10 +154929,10 @@ registerCodeFix({
154914
154929
  const { errorCode, span } = context;
154915
154930
  const info = errorCodeFixIdMap[errorCode];
154916
154931
  if (!info) return emptyArray;
154917
- const { descriptions, fixId: fixId54, fixAllDescriptions } = info;
154932
+ const { descriptions, fixId: fixId55, fixAllDescriptions } = info;
154918
154933
  const changes = ts_textChanges_exports.ChangeTracker.with(context, (changes2) => dispatchChanges(changes2, context, errorCode, span.start));
154919
154934
  return [
154920
- createCodeFixActionMaybeFixAll(fixName, changes, descriptions, fixId54, fixAllDescriptions)
154935
+ createCodeFixActionMaybeFixAll(fixName, changes, descriptions, fixId55, fixAllDescriptions)
154921
154936
  ];
154922
154937
  },
154923
154938
  fixIds: [fixName, fixAddOverrideId, fixRemoveOverrideId],
@@ -155693,7 +155708,7 @@ registerCodeFix({
155693
155708
  },
155694
155709
  fixIds: [fixMissingMember, fixMissingFunctionDeclaration, fixMissingProperties, fixMissingAttributes],
155695
155710
  getAllCodeActions: (context) => {
155696
- const { program, fixId: fixId54 } = context;
155711
+ const { program, fixId: fixId55 } = context;
155697
155712
  const checker = program.getTypeChecker();
155698
155713
  const seen = /* @__PURE__ */ new Map();
155699
155714
  const typeDeclToMembers = /* @__PURE__ */ new Map();
@@ -155703,11 +155718,11 @@ registerCodeFix({
155703
155718
  if (!info || !addToSeen(seen, getNodeId(info.parentDeclaration) + "#" + (info.kind === 3 /* ObjectLiteral */ ? info.identifier : info.token.text))) {
155704
155719
  return;
155705
155720
  }
155706
- if (fixId54 === fixMissingFunctionDeclaration && (info.kind === 2 /* Function */ || info.kind === 5 /* Signature */)) {
155721
+ if (fixId55 === fixMissingFunctionDeclaration && (info.kind === 2 /* Function */ || info.kind === 5 /* Signature */)) {
155707
155722
  addFunctionDeclaration(changes, context, info);
155708
- } else if (fixId54 === fixMissingProperties && info.kind === 3 /* ObjectLiteral */) {
155723
+ } else if (fixId55 === fixMissingProperties && info.kind === 3 /* ObjectLiteral */) {
155709
155724
  addObjectLiteralProperties(changes, context, info);
155710
- } else if (fixId54 === fixMissingAttributes && info.kind === 4 /* JsxAttributes */) {
155725
+ } else if (fixId55 === fixMissingAttributes && info.kind === 4 /* JsxAttributes */) {
155711
155726
  addJsxAttributes(changes, context, info);
155712
155727
  } else {
155713
155728
  if (info.kind === 1 /* Enum */) {
@@ -157578,20 +157593,20 @@ registerCodeFix({
157578
157593
  actions2.push(fix(type, fixIdNullable, Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types));
157579
157594
  }
157580
157595
  return actions2;
157581
- function fix(type2, fixId54, fixAllDescription) {
157596
+ function fix(type2, fixId55, fixAllDescription) {
157582
157597
  const changes = ts_textChanges_exports.ChangeTracker.with(context, (t) => doChange29(t, sourceFile, typeNode, type2, checker));
157583
- return createCodeFixAction("jdocTypes", changes, [Diagnostics.Change_0_to_1, original, checker.typeToString(type2)], fixId54, fixAllDescription);
157598
+ return createCodeFixAction("jdocTypes", changes, [Diagnostics.Change_0_to_1, original, checker.typeToString(type2)], fixId55, fixAllDescription);
157584
157599
  }
157585
157600
  },
157586
157601
  fixIds: [fixIdPlain, fixIdNullable],
157587
157602
  getAllCodeActions(context) {
157588
- const { fixId: fixId54, program, sourceFile } = context;
157603
+ const { fixId: fixId55, program, sourceFile } = context;
157589
157604
  const checker = program.getTypeChecker();
157590
157605
  return codeFixAll(context, errorCodes45, (changes, err) => {
157591
157606
  const info = getInfo15(err.file, err.start, checker);
157592
157607
  if (!info) return;
157593
157608
  const { typeNode, type } = info;
157594
- const fixedType = typeNode.kind === 314 /* JSDocNullableType */ && fixId54 === fixIdNullable ? checker.getNullableType(type, 32768 /* Undefined */) : type;
157609
+ const fixedType = typeNode.kind === 314 /* JSDocNullableType */ && fixId55 === fixIdNullable ? checker.getNullableType(type, 32768 /* Undefined */) : type;
157595
157610
  doChange29(changes, sourceFile, typeNode, fixedType, checker);
157596
157611
  });
157597
157612
  }
@@ -177031,6 +177046,79 @@ var SmartIndenter;
177031
177046
  }
177032
177047
  })(SmartIndenter || (SmartIndenter = {}));
177033
177048
 
177049
+ // src/services/_namespaces/ts.PasteEdits.ts
177050
+ var ts_PasteEdits_exports = {};
177051
+ __export(ts_PasteEdits_exports, {
177052
+ pasteEditsProvider: () => pasteEditsProvider
177053
+ });
177054
+
177055
+ // src/services/pasteEdits.ts
177056
+ var fixId54 = "providePostPasteEdits";
177057
+ function pasteEditsProvider(targetFile, pastedText, pasteLocations, copiedFrom, host, preferences, formatContext, cancellationToken) {
177058
+ const changes = ts_textChanges_exports.ChangeTracker.with({ host, formatContext, preferences }, (changeTracker) => pasteEdits(targetFile, pastedText, pasteLocations, copiedFrom, host, preferences, formatContext, cancellationToken, changeTracker));
177059
+ return { edits: changes, fixId: fixId54 };
177060
+ }
177061
+ function pasteEdits(targetFile, pastedText, pasteLocations, copiedFrom, host, preferences, formatContext, cancellationToken, changes) {
177062
+ let actualPastedText;
177063
+ if (pastedText.length !== pasteLocations.length) {
177064
+ actualPastedText = pastedText.length === 1 ? pastedText : [pastedText.join("\n")];
177065
+ }
177066
+ pasteLocations.forEach((paste, i) => {
177067
+ changes.replaceRangeWithText(
177068
+ targetFile,
177069
+ { pos: paste.pos, end: paste.end },
177070
+ actualPastedText ? actualPastedText[0] : pastedText[i]
177071
+ );
177072
+ });
177073
+ const statements = [];
177074
+ let newText = targetFile.text;
177075
+ for (let i = pasteLocations.length - 1; i >= 0; i--) {
177076
+ const { pos, end } = pasteLocations[i];
177077
+ newText = actualPastedText ? newText.slice(0, pos) + actualPastedText[0] + newText.slice(end) : newText.slice(0, pos) + pastedText[i] + newText.slice(end);
177078
+ }
177079
+ Debug.checkDefined(host.runWithTemporaryFileUpdate).call(host, targetFile.fileName, newText, (updatedProgram, originalProgram, updatedFile) => {
177080
+ const importAdder = ts_codefix_exports.createImportAdder(updatedFile, updatedProgram, preferences, host);
177081
+ if (copiedFrom == null ? void 0 : copiedFrom.range) {
177082
+ Debug.assert(copiedFrom.range.length === pastedText.length);
177083
+ copiedFrom.range.forEach((copy) => {
177084
+ addRange(statements, copiedFrom.file.statements, getLineOfLocalPosition(copiedFrom.file, copy.pos), getLineOfLocalPosition(copiedFrom.file, copy.end) + 1);
177085
+ });
177086
+ const usage = getUsageInfo(copiedFrom.file, statements, originalProgram.getTypeChecker(), getExistingLocals(updatedFile, statements, originalProgram.getTypeChecker()));
177087
+ Debug.assertIsDefined(originalProgram);
177088
+ const useEsModuleSyntax = !fileShouldUseJavaScriptRequire(targetFile.fileName, originalProgram, host, !!copiedFrom.file.commonJsModuleIndicator);
177089
+ addExportsInOldFile(copiedFrom.file, usage.targetFileImportsFromOldFile, changes, useEsModuleSyntax);
177090
+ addTargetFileImports(copiedFrom.file, usage.oldImportsNeededByTargetFile, usage.targetFileImportsFromOldFile, originalProgram.getTypeChecker(), updatedProgram, importAdder);
177091
+ } else {
177092
+ const context = {
177093
+ sourceFile: updatedFile,
177094
+ program: originalProgram,
177095
+ cancellationToken,
177096
+ host,
177097
+ preferences,
177098
+ formatContext
177099
+ };
177100
+ forEachChild(updatedFile, function cb(node) {
177101
+ if (isIdentifier(node) && !(originalProgram == null ? void 0 : originalProgram.getTypeChecker().resolveName(
177102
+ node.text,
177103
+ node,
177104
+ -1 /* All */,
177105
+ /*excludeGlobals*/
177106
+ false
177107
+ ))) {
177108
+ importAdder.addImportForUnresolvedIdentifier(
177109
+ context,
177110
+ node,
177111
+ /*useAutoImportProvider*/
177112
+ true
177113
+ );
177114
+ }
177115
+ node.forEachChild(cb);
177116
+ });
177117
+ }
177118
+ importAdder.writeFixes(changes, getQuotePreference(copiedFrom ? copiedFrom.file : targetFile, preferences));
177119
+ });
177120
+ }
177121
+
177034
177122
  // src/server/_namespaces/ts.ts
177035
177123
  var ts_exports2 = {};
177036
177124
  __export(ts_exports2, {
@@ -177630,6 +177718,7 @@ __export(ts_exports2, {
177630
177718
  forEachKey: () => forEachKey,
177631
177719
  forEachLeadingCommentRange: () => forEachLeadingCommentRange,
177632
177720
  forEachNameInAccessChainWalkingLeft: () => forEachNameInAccessChainWalkingLeft,
177721
+ forEachNameOfDefaultExport: () => forEachNameOfDefaultExport,
177633
177722
  forEachPropertyAssignment: () => forEachPropertyAssignment,
177634
177723
  forEachResolvedProjectReference: () => forEachResolvedProjectReference,
177635
177724
  forEachReturnStatement: () => forEachReturnStatement,
@@ -177726,11 +177815,11 @@ __export(ts_exports2, {
177726
177815
  getDeclaredExpandoInitializer: () => getDeclaredExpandoInitializer,
177727
177816
  getDecorators: () => getDecorators,
177728
177817
  getDefaultCompilerOptions: () => getDefaultCompilerOptions2,
177729
- getDefaultExportInfoWorker: () => getDefaultExportInfoWorker,
177730
177818
  getDefaultFormatCodeSettings: () => getDefaultFormatCodeSettings,
177731
177819
  getDefaultLibFileName: () => getDefaultLibFileName,
177732
177820
  getDefaultLibFilePath: () => getDefaultLibFilePath,
177733
177821
  getDefaultLikeExportInfo: () => getDefaultLikeExportInfo,
177822
+ getDefaultLikeExportNameFromDeclaration: () => getDefaultLikeExportNameFromDeclaration,
177734
177823
  getDefaultResolutionModeForFileWorker: () => getDefaultResolutionModeForFileWorker,
177735
177824
  getDiagnosticText: () => getDiagnosticText,
177736
177825
  getDiagnosticsWithinSpan: () => getDiagnosticsWithinSpan,
@@ -178065,6 +178154,7 @@ __export(ts_exports2, {
178065
178154
  getSwitchedType: () => getSwitchedType,
178066
178155
  getSymbolId: () => getSymbolId,
178067
178156
  getSymbolNameForPrivateIdentifier: () => getSymbolNameForPrivateIdentifier,
178157
+ getSymbolParentOrFail: () => getSymbolParentOrFail,
178068
178158
  getSymbolTarget: () => getSymbolTarget,
178069
178159
  getSyntacticClassifications: () => getSyntacticClassifications,
178070
178160
  getSyntacticModifierFlags: () => getSyntacticModifierFlags,
@@ -178929,7 +179019,9 @@ __export(ts_exports2, {
178929
179019
  moduleResolutionOptionDeclarations: () => moduleResolutionOptionDeclarations,
178930
179020
  moduleResolutionSupportsPackageJsonExportsAndImports: () => moduleResolutionSupportsPackageJsonExportsAndImports,
178931
179021
  moduleResolutionUsesNodeModules: () => moduleResolutionUsesNodeModules,
179022
+ moduleSpecifierToValidIdentifier: () => moduleSpecifierToValidIdentifier,
178932
179023
  moduleSpecifiers: () => ts_moduleSpecifiers_exports,
179024
+ moduleSymbolToValidIdentifier: () => moduleSymbolToValidIdentifier,
178933
179025
  moveEmitHelpers: () => moveEmitHelpers,
178934
179026
  moveRangeEnd: () => moveRangeEnd,
178935
179027
  moveRangePastDecorators: () => moveRangePastDecorators,
@@ -179009,6 +179101,7 @@ __export(ts_exports2, {
179009
179101
  parsePackageName: () => parsePackageName,
179010
179102
  parsePseudoBigInt: () => parsePseudoBigInt,
179011
179103
  parseValidBigInt: () => parseValidBigInt,
179104
+ pasteEdits: () => ts_PasteEdits_exports,
179012
179105
  patchWriteFileEnsuringDirectory: () => patchWriteFileEnsuringDirectory,
179013
179106
  pathContainsNodeModules: () => pathContainsNodeModules,
179014
179107
  pathIsAbsolute: () => pathIsAbsolute,
@@ -180168,7 +180261,7 @@ __export(ts_server_protocol_exports, {
180168
180261
  NewLineKind: () => NewLineKind2,
180169
180262
  OrganizeImportsMode: () => OrganizeImportsMode,
180170
180263
  PollingWatchKind: () => PollingWatchKind2,
180171
- ScriptTarget: () => ScriptTarget11,
180264
+ ScriptTarget: () => ScriptTarget10,
180172
180265
  SemicolonPreference: () => SemicolonPreference,
180173
180266
  WatchDirectoryKind: () => WatchDirectoryKind2,
180174
180267
  WatchFileKind: () => WatchFileKind2
@@ -180265,6 +180358,7 @@ var CommandTypes = /* @__PURE__ */ ((CommandTypes2) => {
180265
180358
  CommandTypes2["GetApplicableRefactors"] = "getApplicableRefactors";
180266
180359
  CommandTypes2["GetEditsForRefactor"] = "getEditsForRefactor";
180267
180360
  CommandTypes2["GetMoveToRefactoringFileSuggestions"] = "getMoveToRefactoringFileSuggestions";
180361
+ CommandTypes2["GetPasteEdits"] = "getPasteEdits";
180268
180362
  CommandTypes2["GetEditsForRefactorFull"] = "getEditsForRefactor-full";
180269
180363
  CommandTypes2["OrganizeImports"] = "organizeImports";
180270
180364
  CommandTypes2["OrganizeImportsFull"] = "organizeImports-full";
@@ -180357,24 +180451,24 @@ var NewLineKind2 = /* @__PURE__ */ ((NewLineKind3) => {
180357
180451
  NewLineKind3["Lf"] = "Lf";
180358
180452
  return NewLineKind3;
180359
180453
  })(NewLineKind2 || {});
180360
- var ScriptTarget11 = /* @__PURE__ */ ((ScriptTarget12) => {
180361
- ScriptTarget12["ES3"] = "es3";
180362
- ScriptTarget12["ES5"] = "es5";
180363
- ScriptTarget12["ES6"] = "es6";
180364
- ScriptTarget12["ES2015"] = "es2015";
180365
- ScriptTarget12["ES2016"] = "es2016";
180366
- ScriptTarget12["ES2017"] = "es2017";
180367
- ScriptTarget12["ES2018"] = "es2018";
180368
- ScriptTarget12["ES2019"] = "es2019";
180369
- ScriptTarget12["ES2020"] = "es2020";
180370
- ScriptTarget12["ES2021"] = "es2021";
180371
- ScriptTarget12["ES2022"] = "es2022";
180372
- ScriptTarget12["ES2023"] = "es2023";
180373
- ScriptTarget12["ESNext"] = "esnext";
180374
- ScriptTarget12["JSON"] = "json";
180375
- ScriptTarget12["Latest"] = "esnext" /* ESNext */;
180376
- return ScriptTarget12;
180377
- })(ScriptTarget11 || {});
180454
+ var ScriptTarget10 = /* @__PURE__ */ ((ScriptTarget11) => {
180455
+ ScriptTarget11["ES3"] = "es3";
180456
+ ScriptTarget11["ES5"] = "es5";
180457
+ ScriptTarget11["ES6"] = "es6";
180458
+ ScriptTarget11["ES2015"] = "es2015";
180459
+ ScriptTarget11["ES2016"] = "es2016";
180460
+ ScriptTarget11["ES2017"] = "es2017";
180461
+ ScriptTarget11["ES2018"] = "es2018";
180462
+ ScriptTarget11["ES2019"] = "es2019";
180463
+ ScriptTarget11["ES2020"] = "es2020";
180464
+ ScriptTarget11["ES2021"] = "es2021";
180465
+ ScriptTarget11["ES2022"] = "es2022";
180466
+ ScriptTarget11["ES2023"] = "es2023";
180467
+ ScriptTarget11["ESNext"] = "esnext";
180468
+ ScriptTarget11["JSON"] = "json";
180469
+ ScriptTarget11["Latest"] = "esnext" /* ESNext */;
180470
+ return ScriptTarget11;
180471
+ })(ScriptTarget10 || {});
180378
180472
  {
180379
180473
  }
180380
180474
 
@@ -182633,6 +182727,17 @@ var Project3 = class _Project {
182633
182727
  return this.noDtsResolutionProject;
182634
182728
  }
182635
182729
  /** @internal */
182730
+ runWithTemporaryFileUpdate(rootFile, updatedText, cb) {
182731
+ var _a, _b, _c, _d, _e;
182732
+ const originalProgram = this.program;
182733
+ const originalText = (_b = (_a = this.program) == null ? void 0 : _a.getSourceFile(rootFile)) == null ? void 0 : _b.getText();
182734
+ Debug.assert(this.program && this.program.getSourceFile(rootFile) && originalText);
182735
+ (_c = this.getScriptInfo(rootFile)) == null ? void 0 : _c.editContent(0, this.program.getSourceFile(rootFile).getText().length, updatedText);
182736
+ this.updateGraph();
182737
+ cb(this.program, originalProgram, (_d = this.program) == null ? void 0 : _d.getSourceFile(rootFile));
182738
+ (_e = this.getScriptInfo(rootFile)) == null ? void 0 : _e.editContent(0, this.program.getSourceFile(rootFile).getText().length, originalText);
182739
+ }
182740
+ /** @internal */
182636
182741
  getCompilerOptionsForNoDtsResolutionProject() {
182637
182742
  return {
182638
182743
  ...this.getCompilerOptions(),
@@ -187468,7 +187573,8 @@ var invalidPartialSemanticModeCommands = [
187468
187573
  "getEditsForFileRename-full" /* GetEditsForFileRenameFull */,
187469
187574
  "prepareCallHierarchy" /* PrepareCallHierarchy */,
187470
187575
  "provideCallHierarchyIncomingCalls" /* ProvideCallHierarchyIncomingCalls */,
187471
- "provideCallHierarchyOutgoingCalls" /* ProvideCallHierarchyOutgoingCalls */
187576
+ "provideCallHierarchyOutgoingCalls" /* ProvideCallHierarchyOutgoingCalls */,
187577
+ "getPasteEdits" /* GetPasteEdits */
187472
187578
  ];
187473
187579
  var invalidSyntacticModeCommands = [
187474
187580
  ...invalidPartialSemanticModeCommands,
@@ -188016,6 +188122,9 @@ var Session3 = class _Session {
188016
188122
  ["getMoveToRefactoringFileSuggestions" /* GetMoveToRefactoringFileSuggestions */]: (request) => {
188017
188123
  return this.requiredResponse(this.getMoveToRefactoringFileSuggestions(request.arguments));
188018
188124
  },
188125
+ ["getPasteEdits" /* GetPasteEdits */]: (request) => {
188126
+ return this.requiredResponse(this.getPasteEdits(request.arguments));
188127
+ },
188019
188128
  ["getEditsForRefactor-full" /* GetEditsForRefactorFull */]: (request) => {
188020
188129
  return this.requiredResponse(this.getEditsForRefactor(
188021
188130
  request.arguments,
@@ -189799,6 +189908,21 @@ Project '${project.projectName}' (${ProjectKind[project.projectKind]}) ${counter
189799
189908
  const scriptInfo = project.getScriptInfoForNormalizedPath(file);
189800
189909
  return project.getLanguageService().getMoveToRefactoringFileSuggestions(file, this.extractPositionOrRange(args, scriptInfo), this.getPreferences(file));
189801
189910
  }
189911
+ getPasteEdits(args) {
189912
+ const { file, project } = this.getFileAndProject(args);
189913
+ const copiedFrom = args.copiedFrom ? { file: args.copiedFrom.file, range: args.copiedFrom.spans.map((copies) => this.getRange({ file: args.copiedFrom.file, startLine: copies.start.line, startOffset: copies.start.offset, endLine: copies.end.line, endOffset: copies.end.offset }, project.getScriptInfoForNormalizedPath(toNormalizedPath(args.copiedFrom.file)))) } : void 0;
189914
+ const result = project.getLanguageService().getPasteEdits(
189915
+ {
189916
+ targetFile: file,
189917
+ pastedText: args.pastedText,
189918
+ pasteLocations: args.pasteLocations.map((paste) => this.getRange({ file, startLine: paste.start.line, startOffset: paste.start.offset, endLine: paste.end.line, endOffset: paste.end.offset }, project.getScriptInfoForNormalizedPath(file))),
189919
+ copiedFrom,
189920
+ preferences: this.getPreferences(file)
189921
+ },
189922
+ this.getFormatOptions(file)
189923
+ );
189924
+ return result && this.mapPasteEditsAction(result);
189925
+ }
189802
189926
  organizeImports(args, simplifiedResult) {
189803
189927
  Debug.assert(args.scope.type === "file");
189804
189928
  const { file, project } = this.getFileAndProject(args.scope.args);
@@ -189865,10 +189989,10 @@ ${e.message}`;
189865
189989
  }
189866
189990
  return simplifiedResult ? codeActions.map((codeAction) => this.mapCodeFixAction(codeAction)) : codeActions;
189867
189991
  }
189868
- getCombinedCodeFix({ scope, fixId: fixId54 }, simplifiedResult) {
189992
+ getCombinedCodeFix({ scope, fixId: fixId55 }, simplifiedResult) {
189869
189993
  Debug.assert(scope.type === "file");
189870
189994
  const { file, project } = this.getFileAndProject(scope.args);
189871
- const res = project.getLanguageService().getCombinedCodeFix({ type: "file", fileName: file }, fixId54, this.getFormatOptions(file), this.getPreferences(file));
189995
+ const res = project.getLanguageService().getCombinedCodeFix({ type: "file", fileName: file }, fixId55, this.getFormatOptions(file), this.getPreferences(file));
189872
189996
  if (simplifiedResult) {
189873
189997
  return { changes: this.mapTextChangesToCodeEdits(res.changes), commands: res.commands };
189874
189998
  } else {
@@ -189907,8 +190031,11 @@ ${e.message}`;
189907
190031
  mapCodeAction({ description: description3, changes, commands }) {
189908
190032
  return { description: description3, changes: this.mapTextChangesToCodeEdits(changes), commands };
189909
190033
  }
189910
- mapCodeFixAction({ fixName: fixName8, description: description3, changes, commands, fixId: fixId54, fixAllDescription }) {
189911
- return { fixName: fixName8, description: description3, changes: this.mapTextChangesToCodeEdits(changes), commands, fixId: fixId54, fixAllDescription };
190034
+ mapCodeFixAction({ fixName: fixName8, description: description3, changes, commands, fixId: fixId55, fixAllDescription }) {
190035
+ return { fixName: fixName8, description: description3, changes: this.mapTextChangesToCodeEdits(changes), commands, fixId: fixId55, fixAllDescription };
190036
+ }
190037
+ mapPasteEditsAction({ edits, fixId: fixId55 }) {
190038
+ return { edits: this.mapTextChangesToCodeEdits(edits), fixId: fixId55 };
189912
190039
  }
189913
190040
  mapTextChangesToCodeEdits(textChanges2) {
189914
190041
  return textChanges2.map((change) => this.mapTextChangeToCodeEdit(change));
@@ -191933,6 +192060,7 @@ if (typeof console !== "undefined") {
191933
192060
  forEachKey,
191934
192061
  forEachLeadingCommentRange,
191935
192062
  forEachNameInAccessChainWalkingLeft,
192063
+ forEachNameOfDefaultExport,
191936
192064
  forEachPropertyAssignment,
191937
192065
  forEachResolvedProjectReference,
191938
192066
  forEachReturnStatement,
@@ -192029,11 +192157,11 @@ if (typeof console !== "undefined") {
192029
192157
  getDeclaredExpandoInitializer,
192030
192158
  getDecorators,
192031
192159
  getDefaultCompilerOptions,
192032
- getDefaultExportInfoWorker,
192033
192160
  getDefaultFormatCodeSettings,
192034
192161
  getDefaultLibFileName,
192035
192162
  getDefaultLibFilePath,
192036
192163
  getDefaultLikeExportInfo,
192164
+ getDefaultLikeExportNameFromDeclaration,
192037
192165
  getDefaultResolutionModeForFileWorker,
192038
192166
  getDiagnosticText,
192039
192167
  getDiagnosticsWithinSpan,
@@ -192368,6 +192496,7 @@ if (typeof console !== "undefined") {
192368
192496
  getSwitchedType,
192369
192497
  getSymbolId,
192370
192498
  getSymbolNameForPrivateIdentifier,
192499
+ getSymbolParentOrFail,
192371
192500
  getSymbolTarget,
192372
192501
  getSyntacticClassifications,
192373
192502
  getSyntacticModifierFlags,
@@ -193232,7 +193361,9 @@ if (typeof console !== "undefined") {
193232
193361
  moduleResolutionOptionDeclarations,
193233
193362
  moduleResolutionSupportsPackageJsonExportsAndImports,
193234
193363
  moduleResolutionUsesNodeModules,
193364
+ moduleSpecifierToValidIdentifier,
193235
193365
  moduleSpecifiers,
193366
+ moduleSymbolToValidIdentifier,
193236
193367
  moveEmitHelpers,
193237
193368
  moveRangeEnd,
193238
193369
  moveRangePastDecorators,
@@ -193312,6 +193443,7 @@ if (typeof console !== "undefined") {
193312
193443
  parsePackageName,
193313
193444
  parsePseudoBigInt,
193314
193445
  parseValidBigInt,
193446
+ pasteEdits,
193315
193447
  patchWriteFileEnsuringDirectory,
193316
193448
  pathContainsNodeModules,
193317
193449
  pathIsAbsolute,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "typescript",
3
3
  "author": "Microsoft Corp.",
4
4
  "homepage": "https://www.typescriptlang.org/",
5
- "version": "5.5.0-dev.20240508",
5
+ "version": "5.5.0-dev.20240509",
6
6
  "license": "Apache-2.0",
7
7
  "description": "TypeScript is a language for application scale JavaScript development",
8
8
  "keywords": [
@@ -110,5 +110,5 @@
110
110
  "node": "20.1.0",
111
111
  "npm": "8.19.4"
112
112
  },
113
- "gitHead": "b9c71c3fc39f7cbafa82f8aa6f1d3b8a86e27ede"
113
+ "gitHead": "be8fb98cf106d2f9421038dbfc9de9352f3ba4b1"
114
114
  }