typescript 5.5.0-dev.20240507 → 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/tsserver.js CHANGED
@@ -85,8 +85,7 @@ function parseLoggingEnvironmentString(logEnvStr) {
85
85
  pathStart += " ";
86
86
  pathStart += args[i];
87
87
  extraPartCounter++;
88
- if (pathStart.charCodeAt(pathStart.length - 1) === typescript_exports.CharacterCodes.doubleQuote)
89
- break;
88
+ if (pathStart.charCodeAt(pathStart.length - 1) === typescript_exports.CharacterCodes.doubleQuote) break;
90
89
  }
91
90
  }
92
91
  return { value: (0, typescript_exports.stripQuotes)(pathStart), extraPartCounter };
@@ -94,8 +93,7 @@ function parseLoggingEnvironmentString(logEnvStr) {
94
93
  }
95
94
  function parseServerMode() {
96
95
  const mode = typescript_exports.server.findArgument("--serverMode");
97
- if (!mode)
98
- return void 0;
96
+ if (!mode) return void 0;
99
97
  switch (mode.toLowerCase()) {
100
98
  case "semantic":
101
99
  return typescript_exports.LanguageServiceMode.Semantic;
@@ -173,8 +171,7 @@ function initializeNodeSystem() {
173
171
  (_c = typescript_exports.perfLogger) == null ? void 0 : _c.logErrEvent(s);
174
172
  break;
175
173
  }
176
- if (!this.canWrite())
177
- return;
174
+ if (!this.canWrite()) return;
178
175
  s = `[${typescript_exports.server.nowString()}] ${s}
179
176
  `;
180
177
  if (!this.inGroup || this.firstInGroup) {
@@ -295,10 +292,8 @@ function initializeNodeSystem() {
295
292
  let serverMode;
296
293
  let unknownServerMode;
297
294
  if (modeOrUnknown !== void 0) {
298
- if (typeof modeOrUnknown === "number")
299
- serverMode = modeOrUnknown;
300
- else
301
- unknownServerMode = modeOrUnknown;
295
+ if (typeof modeOrUnknown === "number") serverMode = modeOrUnknown;
296
+ else unknownServerMode = modeOrUnknown;
302
297
  }
303
298
  return {
304
299
  args: process.argv,
@@ -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;