monaco-editor 0.56.0-dev-20260119 → 0.56.0-dev-20260121

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.
Files changed (143) hide show
  1. package/dev/vs/basic-languages/monaco.contribution.js +18 -18
  2. package/dev/vs/{cssMode-VP5J4n2d.js → cssMode-B0VkNrib.js} +1 -1
  3. package/dev/vs/editor/editor.main.css +42 -25
  4. package/dev/vs/editor/editor.main.js +1 -1
  5. package/dev/vs/{editor-ML6zs6Go.js → editor-CR18QzPP.js} +633 -162
  6. package/dev/vs/editor.js +1 -1
  7. package/dev/vs/{freemarker2-DOuHb9T9.js → freemarker2-Byr9HmH9.js} +1 -1
  8. package/dev/vs/{handlebars-CEHZxVsE.js → handlebars-BEVXeROF.js} +1 -1
  9. package/dev/vs/{html-CHMe_cBk.js → html-CetHjWIf.js} +1 -1
  10. package/dev/vs/{htmlMode-D7MQf6Yp.js → htmlMode-BNKYUVNo.js} +1 -1
  11. package/dev/vs/{index-KO0Jv4kb.js → index-g_7JbDIY.js} +1 -1
  12. package/dev/vs/index.js +1 -1
  13. package/dev/vs/{javascript-hfXEMgFg.js → javascript-BEgEU725.js} +1 -1
  14. package/dev/vs/{jsonMode-Dp9qexJG.js → jsonMode-CT2UkfFE.js} +1 -1
  15. package/dev/vs/language/css/monaco.contribution.js +1 -1
  16. package/dev/vs/language/html/monaco.contribution.js +1 -1
  17. package/dev/vs/language/json/monaco.contribution.js +1 -1
  18. package/dev/vs/language/typescript/monaco.contribution.js +1 -1
  19. package/dev/vs/{liquid-C5xy2cvN.js → liquid-D-aiCb1P.js} +1 -1
  20. package/dev/vs/{lspLanguageFeatures-D6ykJL1B.js → lspLanguageFeatures-CE9Occyu.js} +1 -1
  21. package/dev/vs/{mdx-DTsW_-Y_.js → mdx-DchJ8pbq.js} +1 -1
  22. package/dev/vs/{monaco.contribution-DuzmV_VZ.js → monaco.contribution-CHqb1dWh.js} +2 -2
  23. package/dev/vs/{monaco.contribution-t7Hz4wVA.js → monaco.contribution-CVBrIlxn.js} +2 -2
  24. package/dev/vs/{monaco.contribution-CcoogmES.js → monaco.contribution-CZxuzvA9.js} +2 -2
  25. package/dev/vs/{monaco.contribution-CQ8dNY-Q.js → monaco.contribution-Cw4OdERZ.js} +2 -2
  26. package/dev/vs/nls/lang/cs.js +1 -1
  27. package/dev/vs/nls/lang/de.js +1 -1
  28. package/dev/vs/nls/lang/es.js +1 -1
  29. package/dev/vs/nls/lang/fr.js +1 -1
  30. package/dev/vs/nls/lang/it.js +1 -1
  31. package/dev/vs/nls/lang/ja.js +1 -1
  32. package/dev/vs/nls/lang/ko.js +1 -1
  33. package/dev/vs/nls/lang/pl.js +1 -1
  34. package/dev/vs/nls/lang/pt-br.js +1 -1
  35. package/dev/vs/nls/lang/ru.js +1 -1
  36. package/dev/vs/nls/lang/tr.js +1 -1
  37. package/dev/vs/nls/lang/zh-cn.js +1 -1
  38. package/dev/vs/nls/lang/zh-tw.js +1 -1
  39. package/dev/vs/{python-1ZtmJ8bh.js → python-BCOSaCC8.js} +1 -1
  40. package/dev/vs/{razor-D7Pdon_S.js → razor-BM2tZCwj.js} +1 -1
  41. package/dev/vs/{toggleHighContrast-Btd2ryZF.js → toggleHighContrast-CLgtrrIB.js} +148 -315
  42. package/dev/vs/{tsMode-Dy3ckMs8.js → tsMode-jpkv3SbL.js} +1 -1
  43. package/dev/vs/{typescript-BBL8N09V.js → typescript-f8pt88eA.js} +1 -1
  44. package/dev/vs/{workers-B9Ao1ciR.js → workers-zrUx_2Gw.js} +1 -1
  45. package/dev/vs/{xml-7BH7GgP4.js → xml-CmSjtiR0.js} +1 -1
  46. package/dev/vs/{yaml-DvwGvgS8.js → yaml-PRriLGdw.js} +1 -1
  47. package/esm/vs/base/browser/markdownRenderer.js +1 -0
  48. package/esm/vs/base/browser/ui/actionbar/actionViewItems.js +4 -1
  49. package/esm/vs/base/browser/ui/actionbar/actionbar.css +8 -5
  50. package/esm/vs/base/browser/ui/contextview/contextview.js +1 -1
  51. package/esm/vs/base/browser/ui/list/list.js +2 -1
  52. package/esm/vs/base/browser/ui/list/listWidget.js +62 -5
  53. package/esm/vs/base/browser/ui/tree/abstractTree.js +4 -1
  54. package/esm/vs/base/browser/ui/tree/asyncDataTree.js +4 -1
  55. package/esm/vs/editor/browser/controller/editContext/clipboardUtils.js +81 -35
  56. package/esm/vs/editor/browser/controller/editContext/editContext.js +11 -0
  57. package/esm/vs/editor/browser/controller/editContext/native/nativeEditContext.js +38 -18
  58. package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContext.js +4 -0
  59. package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextInput.js +39 -16
  60. package/esm/vs/editor/browser/dataTransfer.js +1 -1
  61. package/esm/vs/editor/browser/view.js +21 -1
  62. package/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget.js +18 -0
  63. package/esm/vs/editor/common/model/bracketPairsTextModelPart/colorizedBracketPairsDecorationProvider.js +3 -3
  64. package/esm/vs/editor/common/model/textModel.js +7 -5
  65. package/esm/vs/editor/common/model/tokens/tokenizationFontDecorationsProvider.js +21 -17
  66. package/esm/vs/editor/common/viewModel/viewModelDecorations.js +11 -4
  67. package/esm/vs/editor/common/viewModel/viewModelImpl.js +25 -14
  68. package/esm/vs/editor/contrib/clipboard/browser/clipboard.js +3 -3
  69. package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js +28 -64
  70. package/esm/vs/editor/contrib/floatingMenu/browser/floatingMenu.css +27 -20
  71. package/esm/vs/editor/contrib/floatingMenu/browser/floatingMenu.js +37 -9
  72. package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.js +2 -2
  73. package/esm/vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.css +7 -0
  74. package/esm/vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.js +22 -3
  75. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorView.js +20 -14
  76. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineSuggestionsView.js +1 -0
  77. package/esm/vs/editor/editor.api.d.ts +5 -1
  78. package/esm/vs/nls/lang/cs.js +1 -1
  79. package/esm/vs/nls/lang/de.js +1 -1
  80. package/esm/vs/nls/lang/es.js +1 -1
  81. package/esm/vs/nls/lang/fr.js +1 -1
  82. package/esm/vs/nls/lang/it.js +1 -1
  83. package/esm/vs/nls/lang/ja.js +1 -1
  84. package/esm/vs/nls/lang/ko.js +1 -1
  85. package/esm/vs/nls/lang/pl.js +1 -1
  86. package/esm/vs/nls/lang/pt-br.js +1 -1
  87. package/esm/vs/nls/lang/ru.js +1 -1
  88. package/esm/vs/nls/lang/tr.js +1 -1
  89. package/esm/vs/nls/lang/zh-cn.js +1 -1
  90. package/esm/vs/nls/lang/zh-tw.js +1 -1
  91. package/esm/vs/platform/actionWidget/browser/actionList.js +46 -6
  92. package/esm/vs/platform/actionWidget/browser/actionWidget.js +9 -2
  93. package/esm/vs/platform/actions/common/actions.js +2 -1
  94. package/esm/vs/platform/hover/browser/hoverService.js +1 -0
  95. package/esm/vs/platform/product/common/product.js +16 -1
  96. package/min/vs/basic-languages/monaco.contribution.js +1 -1
  97. package/min/vs/{cssMode-CxJ_Cr_Z.js → cssMode-CheCY05R.js} +1 -1
  98. package/min/vs/editor/editor.main.css +1 -1
  99. package/min/vs/editor/editor.main.js +1 -1
  100. package/min/vs/{editor-CyVlw8K4.js → editor-DxYWA3-X.js} +112 -110
  101. package/min/vs/editor.js +1 -1
  102. package/min/vs/{freemarker2-CJcSu3nc.js → freemarker2-C7J7V1Hp.js} +1 -1
  103. package/min/vs/{handlebars-DPLjS6oj.js → handlebars-DsCar5Ix.js} +1 -1
  104. package/min/vs/{html-DUmbFRY-.js → html-BGLIaUZV.js} +1 -1
  105. package/min/vs/{htmlMode-DfUvYWkE.js → htmlMode-BB6WOoy3.js} +1 -1
  106. package/min/vs/{index-DOycyDud.js → index-BdR0nSqf.js} +1 -1
  107. package/min/vs/index.js +1 -1
  108. package/min/vs/{javascript-CQpB78Gy.js → javascript-CXE3i1eX.js} +1 -1
  109. package/min/vs/{jsonMode-B1E1R3KS.js → jsonMode-rtaE9alu.js} +1 -1
  110. package/min/vs/language/css/monaco.contribution.js +1 -1
  111. package/min/vs/language/html/monaco.contribution.js +1 -1
  112. package/min/vs/language/json/monaco.contribution.js +1 -1
  113. package/min/vs/language/typescript/monaco.contribution.js +1 -1
  114. package/min/vs/{liquid-Bh_nhvai.js → liquid-CEdn0ovR.js} +1 -1
  115. package/min/vs/{lspLanguageFeatures-CAWBopti.js → lspLanguageFeatures-CRAjJmzF.js} +1 -1
  116. package/min/vs/{mdx-CvpAYI3X.js → mdx-DLDMIqnu.js} +1 -1
  117. package/min/vs/{monaco.contribution-QIm8iN-Y.js → monaco.contribution-BrRAk-VA.js} +1 -1
  118. package/min/vs/{monaco.contribution-C3jTRlbI.js → monaco.contribution-C67XgReK.js} +1 -1
  119. package/min/vs/{monaco.contribution-Cmckd8EG.js → monaco.contribution-CYT-Sx3l.js} +1 -1
  120. package/min/vs/{monaco.contribution-6Rc9eWJ0.js → monaco.contribution-DjiQkKLa.js} +1 -1
  121. package/min/vs/nls/lang/cs.js +1 -1
  122. package/min/vs/nls/lang/de.js +1 -1
  123. package/min/vs/nls/lang/es.js +1 -1
  124. package/min/vs/nls/lang/fr.js +1 -1
  125. package/min/vs/nls/lang/it.js +1 -1
  126. package/min/vs/nls/lang/ja.js +1 -1
  127. package/min/vs/nls/lang/ko.js +1 -1
  128. package/min/vs/nls/lang/pl.js +1 -1
  129. package/min/vs/nls/lang/pt-br.js +1 -1
  130. package/min/vs/nls/lang/ru.js +1 -1
  131. package/min/vs/nls/lang/tr.js +1 -1
  132. package/min/vs/nls/lang/zh-cn.js +1 -1
  133. package/min/vs/nls/lang/zh-tw.js +1 -1
  134. package/min/vs/{python-BuY3uazV.js → python-CKbl_I3e.js} +1 -1
  135. package/min/vs/{razor-DQBMGsJX.js → razor--RjiPxbd.js} +1 -1
  136. package/min/vs/{toggleHighContrast-BTse4XBl.js → toggleHighContrast-BKDMxisH.js} +31 -33
  137. package/min/vs/{tsMode-C8sInOMc.js → tsMode-C48d5M22.js} +1 -1
  138. package/min/vs/{typescript-DMigl3F4.js → typescript-e7oUhPyX.js} +1 -1
  139. package/min/vs/{workers-BznOw4bL.js → workers-CtpYUoCo.js} +1 -1
  140. package/min/vs/{xml-C2bHWkWJ.js → xml-tOyfgws7.js} +1 -1
  141. package/min/vs/{yaml-gtjQmyMa.js → yaml-Cmf9NYDf.js} +1 -1
  142. package/monaco.d.ts +5 -1
  143. package/package.json +4 -4
@@ -1,5 +1,5 @@
1
1
  import { DataTransfers } from '../../base/browser/dnd.js';
2
- import { VSDataTransfer, createStringDataTransferItem, UriList, createFileDataTransferItem } from '../../base/common/dataTransfer.js';
2
+ import { createStringDataTransferItem, UriList, VSDataTransfer, createFileDataTransferItem } from '../../base/common/dataTransfer.js';
3
3
  import { Mimes } from '../../base/common/mime.js';
4
4
  import { URI } from '../../base/common/uri.js';
5
5
  import { getPathForFile, CodeDataTransfers } from '../../platform/dnd/browser/dnd.js';
@@ -2,7 +2,7 @@ import { runAtThisOrScheduleAtNextAnimationFrame, getWindow, trackFocus } from '
2
2
  import { createFastDomNode } from '../../base/browser/fastDomNode.js';
3
3
  import { inputLatency } from '../../base/browser/performance.js';
4
4
  import { BugIndicatingError, onUnexpectedError } from '../../base/common/errors.js';
5
- import { Disposable } from '../../base/common/lifecycle.js';
5
+ import { DisposableStore, Disposable } from '../../base/common/lifecycle.js';
6
6
  import { PointerHandlerLastRenderData } from './controller/mouseTarget.js';
7
7
  import { PointerHandler } from './controller/pointerHandler.js';
8
8
  import { RenderingContext } from './view/renderingContext.js';
@@ -66,6 +66,14 @@ let View = class View extends ViewEventHandler {
66
66
  constructor(editorContainer, ownerID, commandDelegate, configuration, colorTheme, model, userInputEvents, overflowWidgetsDomNode, _instantiationService) {
67
67
  super();
68
68
  this._instantiationService = _instantiationService;
69
+ this._editContextClipboardListeners = new DisposableStore();
70
+ // Clipboard events relayed from editContext
71
+ this._onWillCopy = this._register(new Emitter());
72
+ this.onWillCopy = this._onWillCopy.event;
73
+ this._onWillCut = this._register(new Emitter());
74
+ this.onWillCut = this._onWillCut.event;
75
+ this._onWillPaste = this._register(new Emitter());
76
+ this.onWillPaste = this._onWillPaste.event;
69
77
  // Actual mutable state
70
78
  this._shouldRecomputeGlyphMarginLanes = false;
71
79
  this._ownerID = ownerID;
@@ -88,6 +96,7 @@ let View = class View extends ViewEventHandler {
88
96
  this._editContextEnabled = this._context.configuration.options.get(170 /* EditorOption.effectiveEditContext */);
89
97
  this._accessibilitySupport = this._context.configuration.options.get(2 /* EditorOption.accessibilitySupport */);
90
98
  this._editContext = this._instantiateEditContext();
99
+ this._connectEditContextClipboardEvents();
91
100
  this._viewParts.push(this._editContext);
92
101
  // These two dom nodes must be constructed up front, since references are needed in the layout provider (scrolling & co.)
93
102
  this._linesContent = createFastDomNode(document.createElement('div'));
@@ -211,6 +220,7 @@ let View = class View extends ViewEventHandler {
211
220
  const indexOfEditContext = this._viewParts.indexOf(this._editContext);
212
221
  this._editContext.dispose();
213
222
  this._editContext = this._instantiateEditContext();
223
+ this._connectEditContextClipboardEvents();
214
224
  if (isEditContextFocused) {
215
225
  this._editContext.focus();
216
226
  }
@@ -218,6 +228,14 @@ let View = class View extends ViewEventHandler {
218
228
  this._viewParts.splice(indexOfEditContext, 1, this._editContext);
219
229
  }
220
230
  }
231
+ _connectEditContextClipboardEvents() {
232
+ // Dispose old listeners
233
+ this._editContextClipboardListeners.clear();
234
+ // Connect to current edit context's clipboard events
235
+ this._editContextClipboardListeners.add(this._editContext.onWillCopy(e => this._onWillCopy.fire(e)));
236
+ this._editContextClipboardListeners.add(this._editContext.onWillCut(e => this._onWillCut.fire(e)));
237
+ this._editContextClipboardListeners.add(this._editContext.onWillPaste(e => this._onWillPaste.fire(e)));
238
+ }
221
239
  _computeGlyphMarginLanes() {
222
240
  const model = this._context.viewModel.model;
223
241
  const laneModel = this._context.viewModel.glyphLanes;
@@ -353,6 +371,8 @@ let View = class View extends ViewEventHandler {
353
371
  this._renderAnimationFrame.dispose();
354
372
  this._renderAnimationFrame = null;
355
373
  }
374
+ // Dispose clipboard event listeners
375
+ this._editContextClipboardListeners.dispose();
356
376
  this._contentWidgets.overflowingContentWidgetsDomNode.domNode.remove();
357
377
  this._overlayWidgets.overflowingOverlayWidgetsDomNode.domNode.remove();
358
378
  this._context.removeEventHandler(this);
@@ -134,6 +134,12 @@ let CodeEditorWidget = class CodeEditorWidget extends Disposable {
134
134
  this.onDidCompositionEnd = this._onDidCompositionEnd.event;
135
135
  this._onDidPaste = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));
136
136
  this.onDidPaste = this._onDidPaste.event;
137
+ this._onWillCopy = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));
138
+ this.onWillCopy = this._onWillCopy.event;
139
+ this._onWillCut = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));
140
+ this.onWillCut = this._onWillCut.event;
141
+ this._onWillPaste = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));
142
+ this.onWillPaste = this._onWillPaste.event;
137
143
  this._onMouseUp = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));
138
144
  this.onMouseUp = this._onMouseUp.event;
139
145
  this._onMouseDown = this._register(new InteractionEmitter(this._contributions, this._deliveryQueue));
@@ -1240,6 +1246,14 @@ let CodeEditorWidget = class CodeEditorWidget extends Disposable {
1240
1246
  this._modelData.view.render(true, forceRedraw);
1241
1247
  });
1242
1248
  }
1249
+ renderAsync(forceRedraw = false) {
1250
+ if (!this._modelData || !this._modelData.hasRealView) {
1251
+ return;
1252
+ }
1253
+ this._modelData.viewModel.batchEvents(() => {
1254
+ this._modelData.view.render(false, forceRedraw);
1255
+ });
1256
+ }
1243
1257
  setAriaOptions(options) {
1244
1258
  if (!this._modelData || !this._modelData.hasRealView) {
1245
1259
  return;
@@ -1396,6 +1410,10 @@ let CodeEditorWidget = class CodeEditorWidget extends Disposable {
1396
1410
  }
1397
1411
  view.render(false, true);
1398
1412
  view.domNode.domNode.setAttribute('data-uri', model.uri.toString());
1413
+ // Connect clipboard events from View
1414
+ listenersToRemove.push(view.onWillCopy(e => this._onWillCopy.fire(e)));
1415
+ listenersToRemove.push(view.onWillCut(e => this._onWillCut.fire(e)));
1416
+ listenersToRemove.push(view.onWillPaste(e => this._onWillPaste.fire(e)));
1399
1417
  }
1400
1418
  this._modelData = new ModelData(model, viewModel, view, hasRealView, listenersToRemove, attachedView);
1401
1419
  }
@@ -25,7 +25,7 @@ class ColorizedBracketPairsDecorationProvider extends Disposable {
25
25
  this.colorizationOptions = this.textModel.getOptions().bracketPairColorizationOptions;
26
26
  }
27
27
  //#endregion
28
- getDecorationsInRange(range, ownerId, filterOutValidation, onlyMinimapDecorations) {
28
+ getDecorationsInRange(range, ownerId, filterOutValidation, filterFontDecorations, onlyMinimapDecorations) {
29
29
  if (onlyMinimapDecorations) {
30
30
  // Bracket pair colorization decorations are not rendered in the minimap
31
31
  return [];
@@ -47,14 +47,14 @@ class ColorizedBracketPairsDecorationProvider extends Disposable {
47
47
  })).toArray();
48
48
  return result;
49
49
  }
50
- getAllDecorations(ownerId, filterOutValidation) {
50
+ getAllDecorations(ownerId, filterOutValidation, filterFontDecorations) {
51
51
  if (ownerId === undefined) {
52
52
  return [];
53
53
  }
54
54
  if (!this.colorizationOptions.enabled) {
55
55
  return [];
56
56
  }
57
- return this.getDecorationsInRange(new Range(1, 1, this.textModel.getLineCount(), 1), ownerId, filterOutValidation);
57
+ return this.getDecorationsInRange(new Range(1, 1, this.textModel.getLineCount(), 1), ownerId, filterOutValidation, filterFontDecorations);
58
58
  }
59
59
  }
60
60
  class ColorProvider {
@@ -1351,15 +1351,15 @@ let TextModel = class TextModel extends Disposable {
1351
1351
  const endColumn = this.getLineMaxColumn(endLineNumber);
1352
1352
  const range = new Range(startLineNumber, 1, endLineNumber, endColumn);
1353
1353
  const decorations = this._getDecorationsInRange(range, ownerId, filterOutValidation, filterFontDecorations, onlyMarginDecorations);
1354
- pushMany(decorations, this._decorationProvider.getDecorationsInRange(range, ownerId, filterOutValidation));
1355
- pushMany(decorations, this._fontTokenDecorationsProvider.getDecorationsInRange(range, ownerId, filterOutValidation));
1354
+ pushMany(decorations, this._decorationProvider.getDecorationsInRange(range, ownerId, filterOutValidation, filterFontDecorations));
1355
+ pushMany(decorations, this._fontTokenDecorationsProvider.getDecorationsInRange(range, ownerId, filterOutValidation, filterFontDecorations));
1356
1356
  return decorations;
1357
1357
  }
1358
1358
  getDecorationsInRange(range, ownerId = 0, filterOutValidation = false, filterFontDecorations = false, onlyMinimapDecorations = false, onlyMarginDecorations = false) {
1359
1359
  const validatedRange = this.validateRange(range);
1360
1360
  const decorations = this._getDecorationsInRange(validatedRange, ownerId, filterOutValidation, filterFontDecorations, onlyMarginDecorations);
1361
- pushMany(decorations, this._decorationProvider.getDecorationsInRange(validatedRange, ownerId, filterOutValidation, onlyMinimapDecorations));
1362
- pushMany(decorations, this._fontTokenDecorationsProvider.getDecorationsInRange(validatedRange, ownerId, filterOutValidation, onlyMinimapDecorations));
1361
+ pushMany(decorations, this._decorationProvider.getDecorationsInRange(validatedRange, ownerId, filterOutValidation, filterFontDecorations, onlyMinimapDecorations));
1362
+ pushMany(decorations, this._fontTokenDecorationsProvider.getDecorationsInRange(validatedRange, ownerId, filterOutValidation, filterFontDecorations, onlyMinimapDecorations));
1363
1363
  return decorations;
1364
1364
  }
1365
1365
  getOverviewRulerDecorations(ownerId = 0, filterOutValidation = false, filterFontDecorations = false) {
@@ -1369,7 +1369,9 @@ let TextModel = class TextModel extends Disposable {
1369
1369
  return this._decorationsTree.getAllInjectedText(this, ownerId);
1370
1370
  }
1371
1371
  getCustomLineHeightsDecorations(ownerId = 0) {
1372
- return this._decorationsTree.getAllCustomLineHeights(this, ownerId);
1372
+ const decs = this._decorationsTree.getAllCustomLineHeights(this, ownerId);
1373
+ pushMany(decs, this._fontTokenDecorationsProvider.getAllDecorations(ownerId));
1374
+ return decs;
1373
1375
  }
1374
1376
  _getInjectedTextInLine(lineNumber) {
1375
1377
  const startOffset = this._buffer.getOffsetAt(lineNumber, 1);
@@ -94,34 +94,38 @@ class TokenizationFontDecorationProvider extends Disposable {
94
94
  this._onDidChangeLineHeight.fire(affectedLineHeights);
95
95
  this._onDidChangeFont.fire(affectedLineFonts);
96
96
  }
97
- getDecorationsInRange(range, ownerId, filterOutValidation, onlyMinimapDecorations) {
97
+ getDecorationsInRange(range, ownerId, filterOutValidation, filterFontDecorations, onlyMinimapDecorations) {
98
98
  const startOffsetOfRange = this.textModel.getOffsetAt(range.getStartPosition());
99
99
  const endOffsetOfRange = this.textModel.getOffsetAt(range.getEndPosition());
100
100
  const annotations = this._fontAnnotatedString.getAnnotationsIntersecting(new OffsetRange(startOffsetOfRange, endOffsetOfRange));
101
101
  const decorations = [];
102
102
  for (const annotation of annotations) {
103
- const annotationStartPosition = this.textModel.getPositionAt(annotation.range.start);
104
- const annotationEndPosition = this.textModel.getPositionAt(annotation.range.endExclusive);
105
- const range = Range.fromPositions(annotationStartPosition, annotationEndPosition);
106
103
  const anno = annotation.annotation;
107
- const className = classNameForFontTokenDecorations(anno.fontToken.fontFamily ?? '', anno.fontToken.fontSizeMultiplier ?? 0);
108
104
  const affectsFont = !!(anno.fontToken.fontFamily || anno.fontToken.fontSizeMultiplier);
109
- const id = anno.decorationId;
110
- decorations.push({
111
- id: id,
112
- options: {
113
- description: 'FontOptionDecoration',
114
- inlineClassName: className,
115
- affectsFont
116
- },
117
- ownerId: 0,
118
- range
119
- });
105
+ if (!(affectsFont && filterFontDecorations)) {
106
+ const annotationStartPosition = this.textModel.getPositionAt(annotation.range.start);
107
+ const annotationEndPosition = this.textModel.getPositionAt(annotation.range.endExclusive);
108
+ const range = Range.fromPositions(annotationStartPosition, annotationEndPosition);
109
+ const anno = annotation.annotation;
110
+ const className = classNameForFontTokenDecorations(anno.fontToken.fontFamily ?? '', anno.fontToken.fontSizeMultiplier ?? 0);
111
+ const id = anno.decorationId;
112
+ decorations.push({
113
+ id: id,
114
+ options: {
115
+ description: 'FontOptionDecoration',
116
+ inlineClassName: className,
117
+ lineHeight: anno.fontToken.lineHeightMultiplier,
118
+ affectsFont
119
+ },
120
+ ownerId: 0,
121
+ range
122
+ });
123
+ }
120
124
  }
121
125
  return decorations;
122
126
  }
123
127
  getAllDecorations(ownerId, filterOutValidation) {
124
- return this.getDecorationsInRange(new Range(1, 1, this.textModel.getLineCount(), 1), ownerId, filterOutValidation);
128
+ return this.getDecorationsInRange(new Range(1, 1, this.textModel.getLineCount(), this.textModel.getLineMaxColumn(this.textModel.getLineCount())), ownerId, filterOutValidation);
125
129
  }
126
130
  }
127
131
 
@@ -84,10 +84,11 @@ class ViewModelDecorations {
84
84
  const decorationsInViewport = [];
85
85
  let decorationsInViewportLen = 0;
86
86
  const inlineDecorations = [];
87
+ const hasVariableFonts = [];
87
88
  for (let j = startLineNumber; j <= endLineNumber; j++) {
88
89
  inlineDecorations[j - startLineNumber] = [];
90
+ hasVariableFonts[j - startLineNumber] = false;
89
91
  }
90
- let hasVariableFonts = false;
91
92
  for (let i = 0, len = modelDecorations.length; i < len; i++) {
92
93
  const modelDecoration = modelDecorations[i];
93
94
  const decorationOptions = modelDecoration.options;
@@ -103,23 +104,29 @@ class ViewModelDecorations {
103
104
  const intersectedEndLineNumber = Math.min(endLineNumber, viewRange.endLineNumber);
104
105
  for (let j = intersectedStartLineNumber; j <= intersectedEndLineNumber; j++) {
105
106
  inlineDecorations[j - startLineNumber].push(inlineDecoration);
107
+ if (decorationOptions.affectsFont) {
108
+ hasVariableFonts[j - startLineNumber] = true;
109
+ }
106
110
  }
107
111
  }
108
112
  if (decorationOptions.beforeContentClassName) {
109
113
  if (startLineNumber <= viewRange.startLineNumber && viewRange.startLineNumber <= endLineNumber) {
110
114
  const inlineDecoration = new InlineDecoration(new Range(viewRange.startLineNumber, viewRange.startColumn, viewRange.startLineNumber, viewRange.startColumn), decorationOptions.beforeContentClassName, 1 /* InlineDecorationType.Before */);
111
115
  inlineDecorations[viewRange.startLineNumber - startLineNumber].push(inlineDecoration);
116
+ if (decorationOptions.affectsFont) {
117
+ hasVariableFonts[viewRange.startLineNumber - startLineNumber] = true;
118
+ }
112
119
  }
113
120
  }
114
121
  if (decorationOptions.afterContentClassName) {
115
122
  if (startLineNumber <= viewRange.endLineNumber && viewRange.endLineNumber <= endLineNumber) {
116
123
  const inlineDecoration = new InlineDecoration(new Range(viewRange.endLineNumber, viewRange.endColumn, viewRange.endLineNumber, viewRange.endColumn), decorationOptions.afterContentClassName, 2 /* InlineDecorationType.After */);
117
124
  inlineDecorations[viewRange.endLineNumber - startLineNumber].push(inlineDecoration);
125
+ if (decorationOptions.affectsFont) {
126
+ hasVariableFonts[viewRange.endLineNumber - startLineNumber] = true;
127
+ }
118
128
  }
119
129
  }
120
- if (decorationOptions.affectsFont) {
121
- hasVariableFonts = true;
122
- }
123
130
  }
124
131
  return {
125
132
  decorations: decorationsInViewport,
@@ -105,6 +105,9 @@ class ViewModel extends Disposable {
105
105
  this._viewportStart.dispose();
106
106
  this._eventDispatcher.dispose();
107
107
  }
108
+ getEditorOption(id) {
109
+ return this._configuration.options.get(id);
110
+ }
108
111
  createLineBreaksComputer() {
109
112
  return this._lines.createLineBreaksComputer();
110
113
  }
@@ -119,6 +122,7 @@ class ViewModel extends Disposable {
119
122
  if (!allowVariableLineHeights) {
120
123
  return [];
121
124
  }
125
+ const defaultLineHeight = this._configuration.options.get(75 /* EditorOption.lineHeight */);
122
126
  const decorations = this.model.getCustomLineHeightsDecorations(this._editorId);
123
127
  return decorations.map((d) => {
124
128
  const lineNumber = d.range.startLineNumber;
@@ -127,7 +131,7 @@ class ViewModel extends Disposable {
127
131
  decorationId: d.id,
128
132
  startLineNumber: viewRange.startLineNumber,
129
133
  endLineNumber: viewRange.endLineNumber,
130
- lineHeight: d.options.lineHeight || 0
134
+ lineHeight: d.options.lineHeight ? d.options.lineHeight * defaultLineHeight : 0
131
135
  };
132
136
  });
133
137
  }
@@ -665,12 +669,14 @@ class ViewModel extends Disposable {
665
669
  }
666
670
  getViewportViewLineRenderingData(visibleRange, lineNumber) {
667
671
  const viewportDecorationsCollection = this._decorations.getDecorationsViewportData(visibleRange);
668
- const inlineDecorations = viewportDecorationsCollection.inlineDecorations[lineNumber - visibleRange.startLineNumber];
669
- return this._getViewLineRenderingData(lineNumber, inlineDecorations, viewportDecorationsCollection.hasVariableFonts, viewportDecorationsCollection.decorations);
672
+ const relativeLineNumber = lineNumber - visibleRange.startLineNumber;
673
+ const inlineDecorations = viewportDecorationsCollection.inlineDecorations[relativeLineNumber];
674
+ const hasVariableFonts = viewportDecorationsCollection.hasVariableFonts[relativeLineNumber];
675
+ return this._getViewLineRenderingData(lineNumber, inlineDecorations, hasVariableFonts, viewportDecorationsCollection.decorations);
670
676
  }
671
677
  getViewLineRenderingData(lineNumber) {
672
678
  const decorationsCollection = this._decorations.getDecorationsOnLine(lineNumber);
673
- return this._getViewLineRenderingData(lineNumber, decorationsCollection.inlineDecorations[0], decorationsCollection.hasVariableFonts, decorationsCollection.decorations);
679
+ return this._getViewLineRenderingData(lineNumber, decorationsCollection.inlineDecorations[0], decorationsCollection.hasVariableFonts[0], decorationsCollection.decorations);
674
680
  }
675
681
  _getViewLineRenderingData(lineNumber, inlineDecorations, hasVariableFonts, decorations) {
676
682
  const mightContainRTL = this.model.mightContainRTL();
@@ -765,33 +771,38 @@ class ViewModel extends Disposable {
765
771
  }
766
772
  if (!hasNonEmptyRange && !emptySelectionClipboard) {
767
773
  // all ranges are empty
768
- return '';
774
+ return { sourceRanges: [], sourceText: '' };
769
775
  }
776
+ const ranges = [];
777
+ const result = [];
778
+ const pushRange = (modelRange, append = '') => {
779
+ ranges.push(modelRange);
780
+ result.push(this.model.getValueInRange(modelRange, forceCRLF ? 2 /* EndOfLinePreference.CRLF */ : 0 /* EndOfLinePreference.TextDefined */) + append);
781
+ };
770
782
  if (hasEmptyRange && emptySelectionClipboard) {
771
783
  // some (maybe all) empty selections
772
- const result = [];
773
784
  let prevModelLineNumber = 0;
774
785
  for (const modelRange of modelRanges) {
775
786
  const modelLineNumber = modelRange.startLineNumber;
776
787
  if (modelRange.isEmpty()) {
777
788
  if (modelLineNumber !== prevModelLineNumber) {
778
- result.push(this.model.getLineContent(modelLineNumber) + newLineCharacter);
789
+ pushRange(new Range(modelLineNumber, this.model.getLineMinColumn(modelLineNumber), modelLineNumber, this.model.getLineMaxColumn(modelLineNumber)), newLineCharacter);
779
790
  }
780
791
  }
781
792
  else {
782
- result.push(this.model.getValueInRange(modelRange, forceCRLF ? 2 /* EndOfLinePreference.CRLF */ : 0 /* EndOfLinePreference.TextDefined */));
793
+ pushRange(modelRange);
783
794
  }
784
795
  prevModelLineNumber = modelLineNumber;
785
796
  }
786
- return result.length === 1 ? result[0] : result;
787
797
  }
788
- const result = [];
789
- for (const modelRange of modelRanges) {
790
- if (!modelRange.isEmpty()) {
791
- result.push(this.model.getValueInRange(modelRange, forceCRLF ? 2 /* EndOfLinePreference.CRLF */ : 0 /* EndOfLinePreference.TextDefined */));
798
+ else {
799
+ for (const modelRange of modelRanges) {
800
+ if (!modelRange.isEmpty()) {
801
+ pushRange(modelRange);
802
+ }
792
803
  }
793
804
  }
794
- return result.length === 1 ? result[0] : result;
805
+ return { sourceRanges: ranges, sourceText: result.length === 1 ? result[0] : result };
795
806
  }
796
807
  getRichTextToCopy(modelRanges, emptySelectionClipboard) {
797
808
  const languageId = this.model.getLanguageId();
@@ -180,7 +180,7 @@ function executeClipboardCopyWithWorkaround(editor, clipboardService) {
180
180
  // We have encountered the Electron bug!
181
181
  // As a workaround, we will write (only the plaintext data) to the clipboard in a different way
182
182
  // We will use the clipboard service (which in the native case will go to electron's clipboard API)
183
- const { dataToCopy } = generateDataToCopyAndStoreInMemory(editor._getViewModel(), editor.getOptions(), undefined, isFirefox);
183
+ const { dataToCopy } = generateDataToCopyAndStoreInMemory(editor._getViewModel(), undefined, isFirefox);
184
184
  clipboardService.writeText(dataToCopy.text);
185
185
  }
186
186
  }
@@ -241,7 +241,7 @@ function logCopyCommand(editor) {
241
241
  if (editContextEnabled) {
242
242
  const nativeEditContext = NativeEditContextRegistry.get(editor.getId());
243
243
  if (nativeEditContext) {
244
- nativeEditContext.onWillCopy();
244
+ nativeEditContext.handleWillCopy();
245
245
  }
246
246
  }
247
247
  }
@@ -262,7 +262,7 @@ if (PasteAction) {
262
262
  if (editContextEnabled) {
263
263
  const nativeEditContext = NativeEditContextRegistry.get(focusedEditor.getId());
264
264
  if (nativeEditContext) {
265
- nativeEditContext.onWillPaste();
265
+ nativeEditContext.handleWillPaste();
266
266
  }
267
267
  }
268
268
  logService.trace('registerExecCommandImpl (before triggerPaste)');
@@ -1,13 +1,11 @@
1
- import { addDisposableListener } from '../../../../base/browser/dom.js';
2
1
  import { coalesce } from '../../../../base/common/arrays.js';
3
2
  import { createCancelablePromise, DeferredPromise, raceCancellation } from '../../../../base/common/async.js';
4
3
  import { CancellationTokenSource } from '../../../../base/common/cancellation.js';
5
- import { matchesMimeType, createStringDataTransferItem, UriList } from '../../../../base/common/dataTransfer.js';
4
+ import { VSDataTransfer, matchesMimeType, createStringDataTransferItem, UriList } from '../../../../base/common/dataTransfer.js';
6
5
  import { isCancellationError } from '../../../../base/common/errors.js';
7
6
  import { HierarchicalKind } from '../../../../base/common/hierarchicalKind.js';
8
7
  import { Disposable, DisposableStore } from '../../../../base/common/lifecycle.js';
9
8
  import { Mimes } from '../../../../base/common/mime.js';
10
- import { isWindows } from '../../../../base/common/platform.js';
11
9
  import { upcast } from '../../../../base/common/types.js';
12
10
  import { generateUuid } from '../../../../base/common/uuid.js';
13
11
  import { localize } from '../../../../nls.js';
@@ -19,10 +17,7 @@ import { IInstantiationService } from '../../../../platform/instantiation/common
19
17
  import { ILogService } from '../../../../platform/log/common/log.js';
20
18
  import { IProgressService } from '../../../../platform/progress/common/progress.js';
21
19
  import { IQuickInputService } from '../../../../platform/quickinput/common/quickInput.js';
22
- import { ClipboardEventUtils, InMemoryClipboardMetadataManager } from '../../../browser/controller/editContext/clipboardUtils.js';
23
- import { toVSDataTransfer, toExternalVSDataTransfer } from '../../../browser/dataTransfer.js';
24
20
  import { IBulkEditService } from '../../../browser/services/bulkEditService.js';
25
- import { Range } from '../../../common/core/range.js';
26
21
  import { DocumentPasteTriggerKind } from '../../../common/languages.js';
27
22
  import { ILanguageFeaturesService } from '../../../common/services/languageFeatures.js';
28
23
  import { EditorStateCancellationTokenSource } from '../../editorState/browser/editorState.js';
@@ -67,10 +62,9 @@ let CopyPasteController = class CopyPasteController extends Disposable {
67
62
  this._quickInputService = _quickInputService;
68
63
  this._progressService = _progressService;
69
64
  this._editor = editor;
70
- const container = editor.getContainerDomNode();
71
- this._register(addDisposableListener(container, 'copy', e => this.handleCopy(e)));
72
- this._register(addDisposableListener(container, 'cut', e => this.handleCopy(e)));
73
- this._register(addDisposableListener(container, 'paste', e => this.handlePaste(e), true));
65
+ this._register(editor.onWillCopy(e => this.handleCopy(e)));
66
+ this._register(editor.onWillCut(e => this.handleCopy(e)));
67
+ this._register(editor.onWillPaste(e => this.handlePaste(e)));
74
68
  this._pasteProgressManager = this._register(new InlineProgressManager('pasteIntoEditor', editor, instantiationService));
75
69
  this._postPasteWidgetManager = this._register(instantiationService.createInstance(PostEditWidgetManager, 'pasteIntoEditor', editor, pasteWidgetVisibleCtx, { id: changePasteTypeCommandId, label: localize(927, "Show paste options...") }, () => CopyPasteController_1._configureDefaultAction ? [CopyPasteController_1._configureDefaultAction] : []));
76
70
  }
@@ -99,16 +93,7 @@ let CopyPasteController = class CopyPasteController extends Disposable {
99
93
  await this._currentPasteOperation;
100
94
  }
101
95
  handleCopy(e) {
102
- let id = null;
103
- if (e.clipboardData) {
104
- const [text, metadata] = ClipboardEventUtils.getTextData(e.clipboardData);
105
- const storedMetadata = metadata || InMemoryClipboardMetadataManager.INSTANCE.get(text);
106
- id = storedMetadata?.id || null;
107
- this._logService.trace('CopyPasteController#handleCopy for id : ', id, ' with text.length : ', text.length);
108
- }
109
- else {
110
- this._logService.trace('CopyPasteController#handleCopy');
111
- }
96
+ this._logService.trace('CopyPasteController#handleCopy');
112
97
  if (!this._editor.hasTextFocus()) {
113
98
  return;
114
99
  }
@@ -116,28 +101,18 @@ let CopyPasteController = class CopyPasteController extends Disposable {
116
101
  // This is needed because on web, the browser clipboard is faked out using an in-memory store.
117
102
  // This means the resources clipboard is not properly updated when copying from the editor.
118
103
  this._clipboardService.clearInternalState?.();
119
- if (!e.clipboardData || !this.isPasteAsEnabled()) {
104
+ if (!this.isPasteAsEnabled()) {
120
105
  return;
121
106
  }
122
107
  const model = this._editor.getModel();
108
+ const viewModel = this._editor._getViewModel();
123
109
  const selections = this._editor.getSelections();
124
- if (!model || !selections?.length) {
110
+ if (!model || !viewModel || !selections?.length) {
125
111
  return;
126
112
  }
127
- const enableEmptySelectionClipboard = this._editor.getOption(45 /* EditorOption.emptySelectionClipboard */);
128
- let ranges = selections;
129
- const wasFromEmptySelection = selections.length === 1 && selections[0].isEmpty();
130
- if (wasFromEmptySelection) {
131
- if (!enableEmptySelectionClipboard) {
132
- return;
133
- }
134
- ranges = [new Range(ranges[0].startLineNumber, 1, ranges[0].startLineNumber, 1 + model.getLineLength(ranges[0].startLineNumber))];
135
- }
136
- const toCopy = this._editor._getViewModel()?.getPlainTextToCopy(selections, enableEmptySelectionClipboard, isWindows);
137
- const multicursorText = Array.isArray(toCopy) ? toCopy : null;
138
113
  const defaultPastePayload = {
139
- multicursorText,
140
- pasteOnNewLine: wasFromEmptySelection,
114
+ multicursorText: e.dataToCopy.multicursorText ?? null,
115
+ pasteOnNewLine: e.dataToCopy.isFromEmptySelection,
141
116
  mode: null
142
117
  };
143
118
  const providers = this._languageFeaturesService.documentPasteEditProvider
@@ -147,10 +122,10 @@ let CopyPasteController = class CopyPasteController extends Disposable {
147
122
  this.setCopyMetadata(e.clipboardData, { defaultPastePayload });
148
123
  return;
149
124
  }
150
- const dataTransfer = toVSDataTransfer(e.clipboardData);
125
+ const dataTransfer = new VSDataTransfer();
151
126
  const providerCopyMimeTypes = providers.flatMap(x => x.copyMimeTypes ?? []);
152
127
  // Save off a handle pointing to data that VS Code maintains.
153
- const handle = id ?? generateUuid();
128
+ const handle = generateUuid();
154
129
  this.setCopyMetadata(e.clipboardData, {
155
130
  id: handle,
156
131
  providerCopyMimeTypes,
@@ -159,7 +134,7 @@ let CopyPasteController = class CopyPasteController extends Disposable {
159
134
  const operations = providers.map((provider) => {
160
135
  return {
161
136
  providerMimeTypes: provider.copyMimeTypes,
162
- operation: createCancelablePromise(token => provider.prepareDocumentPaste(model, ranges, dataTransfer, token)
137
+ operation: createCancelablePromise(token => provider.prepareDocumentPaste(model, e.dataToCopy.sourceRanges, dataTransfer, token)
163
138
  .catch(err => {
164
139
  console.error(err);
165
140
  return undefined;
@@ -170,17 +145,15 @@ let CopyPasteController = class CopyPasteController extends Disposable {
170
145
  CopyPasteController_1._currentCopyOperation = { handle, operations };
171
146
  }
172
147
  async handlePaste(e) {
173
- if (e.clipboardData) {
174
- const [text, metadata] = ClipboardEventUtils.getTextData(e.clipboardData);
175
- const metadataComputed = metadata || InMemoryClipboardMetadataManager.INSTANCE.get(text);
176
- this._logService.trace('CopyPasteController#handlePaste for id : ', metadataComputed?.id);
177
- }
178
- else {
179
- this._logService.trace('CopyPasteController#handlePaste');
148
+ this._logService.trace('CopyPasteController#handlePaste for id : ', e.metadata?.id);
149
+ if (!this._editor.hasTextFocus()) {
150
+ return;
180
151
  }
181
- if (!e.clipboardData || !this._editor.hasTextFocus()) {
152
+ const dataTransfer = e.toExternalVSDataTransfer();
153
+ if (!dataTransfer) {
182
154
  return;
183
155
  }
156
+ dataTransfer.delete(vscodeClipboardMime);
184
157
  MessageController.get(this._editor)?.closeMessage();
185
158
  this._currentPasteOperation?.cancel();
186
159
  this._currentPasteOperation = undefined;
@@ -196,8 +169,6 @@ let CopyPasteController = class CopyPasteController extends Disposable {
196
169
  }
197
170
  const metadata = this.fetchCopyMetadata(e);
198
171
  this._logService.trace('CopyPasteController#handlePaste with metadata : ', metadata?.id, ' and text.length : ', e.clipboardData.getData('text/plain').length);
199
- const dataTransfer = toExternalVSDataTransfer(e.clipboardData);
200
- dataTransfer.delete(vscodeClipboardMime);
201
172
  const fileTypes = Array.from(e.clipboardData.files).map(file => file.type);
202
173
  const allPotentialMimeTypes = [
203
174
  ...e.clipboardData.types,
@@ -225,21 +196,19 @@ let CopyPasteController = class CopyPasteController extends Disposable {
225
196
  if (this._pasteAsActionContext?.preferred) {
226
197
  this.showPasteAsNoEditMessage(selections, this._pasteAsActionContext.preferred);
227
198
  // Also prevent default paste from applying
228
- e.preventDefault();
229
- e.stopImmediatePropagation();
199
+ e.setHandled();
230
200
  }
231
201
  return;
232
202
  }
233
203
  // Prevent the editor's default paste handler from running.
234
204
  // Note that after this point, we are fully responsible for handling paste.
235
205
  // If we can't provider a paste for any reason, we need to explicitly delegate pasting back to the editor.
236
- e.preventDefault();
237
- e.stopImmediatePropagation();
206
+ e.setHandled();
238
207
  if (this._pasteAsActionContext) {
239
208
  this.showPasteAsPick(this._pasteAsActionContext.preferred, allProviders, selections, dataTransfer, metadata);
240
209
  }
241
210
  else {
242
- this.doPasteInline(allProviders, selections, dataTransfer, metadata, e);
211
+ this.doPasteInline(allProviders, selections, dataTransfer, metadata, e.browserEvent);
243
212
  }
244
213
  }
245
214
  showPasteAsNoEditMessage(selections, preference) {
@@ -432,15 +401,12 @@ let CopyPasteController = class CopyPasteController extends Disposable {
432
401
  title: localize(934, "Running paste handlers"),
433
402
  }, () => p);
434
403
  }
435
- setCopyMetadata(dataTransfer, metadata) {
404
+ setCopyMetadata(clipboardData, metadata) {
436
405
  this._logService.trace('CopyPasteController#setCopyMetadata new id : ', metadata.id);
437
- dataTransfer.setData(vscodeClipboardMime, JSON.stringify(metadata));
406
+ clipboardData.setData(vscodeClipboardMime, JSON.stringify(metadata));
438
407
  }
439
408
  fetchCopyMetadata(e) {
440
409
  this._logService.trace('CopyPasteController#fetchCopyMetadata');
441
- if (!e.clipboardData) {
442
- return;
443
- }
444
410
  // Prefer using the clipboard data we saved off
445
411
  const rawMetadata = e.clipboardData.getData(vscodeClipboardMime);
446
412
  if (rawMetadata) {
@@ -451,14 +417,12 @@ let CopyPasteController = class CopyPasteController extends Disposable {
451
417
  return undefined;
452
418
  }
453
419
  }
454
- // Otherwise try to extract the generic text editor metadata
455
- const [_, metadata] = ClipboardEventUtils.getTextData(e.clipboardData);
456
- if (metadata) {
420
+ if (e.metadata) {
457
421
  return {
458
422
  defaultPastePayload: {
459
- mode: metadata.mode,
460
- multicursorText: metadata.multicursorText ?? null,
461
- pasteOnNewLine: !!metadata.isFromEmptySelection,
423
+ mode: e.metadata.mode,
424
+ multicursorText: e.metadata.multicursorText ?? null,
425
+ pasteOnNewLine: !!e.metadata.isFromEmptySelection,
462
426
  },
463
427
  };
464
428
  }