monaco-editor 0.56.0-dev-20260120 → 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 (131) hide show
  1. package/dev/vs/basic-languages/monaco.contribution.js +18 -18
  2. package/dev/vs/{cssMode-DYAvCb0Q.js → cssMode-B0VkNrib.js} +1 -1
  3. package/dev/vs/editor/editor.main.css +34 -20
  4. package/dev/vs/editor/editor.main.js +1 -1
  5. package/dev/vs/{editor-V-thM4Kh.js → editor-CR18QzPP.js} +541 -177
  6. package/dev/vs/editor.js +1 -1
  7. package/dev/vs/{freemarker2-DNhaeW6n.js → freemarker2-Byr9HmH9.js} +1 -1
  8. package/dev/vs/{handlebars-B9XLHU9b.js → handlebars-BEVXeROF.js} +1 -1
  9. package/dev/vs/{html-CSZlVq5J.js → html-CetHjWIf.js} +1 -1
  10. package/dev/vs/{htmlMode-DkNCbjhM.js → htmlMode-BNKYUVNo.js} +1 -1
  11. package/dev/vs/{index-CuJyCoc4.js → index-g_7JbDIY.js} +1 -1
  12. package/dev/vs/index.js +1 -1
  13. package/dev/vs/{javascript-D1PoJUjx.js → javascript-BEgEU725.js} +1 -1
  14. package/dev/vs/{jsonMode-C84g5aG1.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-BR1qAgSc.js → liquid-D-aiCb1P.js} +1 -1
  20. package/dev/vs/{lspLanguageFeatures-e8bPBYUK.js → lspLanguageFeatures-CE9Occyu.js} +1 -1
  21. package/dev/vs/{mdx-BLfAN-pP.js → mdx-DchJ8pbq.js} +1 -1
  22. package/dev/vs/{monaco.contribution-BpJCJ2aN.js → monaco.contribution-CHqb1dWh.js} +2 -2
  23. package/dev/vs/{monaco.contribution-BoVCpaaV.js → monaco.contribution-CVBrIlxn.js} +2 -2
  24. package/dev/vs/{monaco.contribution-Ccg01HGd.js → monaco.contribution-CZxuzvA9.js} +2 -2
  25. package/dev/vs/{monaco.contribution-ehavOHIf.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-sycHAgxs.js → python-BCOSaCC8.js} +1 -1
  40. package/dev/vs/{razor-B62R6Lsx.js → razor-BM2tZCwj.js} +1 -1
  41. package/dev/vs/{toggleHighContrast-3bUMPAmT.js → toggleHighContrast-CLgtrrIB.js} +141 -310
  42. package/dev/vs/{tsMode-Co79Xo5K.js → tsMode-jpkv3SbL.js} +1 -1
  43. package/dev/vs/{typescript-_1BH4dlp.js → typescript-f8pt88eA.js} +1 -1
  44. package/dev/vs/{workers-BGdHt1rb.js → workers-zrUx_2Gw.js} +1 -1
  45. package/dev/vs/{xml-Cqh8dVgY.js → xml-CmSjtiR0.js} +1 -1
  46. package/dev/vs/{yaml-D6-bhWv5.js → yaml-PRriLGdw.js} +1 -1
  47. package/esm/vs/base/browser/markdownRenderer.js +1 -0
  48. package/esm/vs/editor/browser/controller/editContext/clipboardUtils.js +81 -35
  49. package/esm/vs/editor/browser/controller/editContext/editContext.js +11 -0
  50. package/esm/vs/editor/browser/controller/editContext/native/nativeEditContext.js +39 -32
  51. package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContext.js +5 -16
  52. package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextInput.js +39 -16
  53. package/esm/vs/editor/browser/dataTransfer.js +1 -1
  54. package/esm/vs/editor/browser/view.js +21 -1
  55. package/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget.js +18 -0
  56. package/esm/vs/editor/common/model/bracketPairsTextModelPart/colorizedBracketPairsDecorationProvider.js +3 -3
  57. package/esm/vs/editor/common/model/textModel.js +4 -4
  58. package/esm/vs/editor/common/model/tokens/tokenizationFontDecorationsProvider.js +20 -16
  59. package/esm/vs/editor/common/viewModel/viewModelDecorations.js +11 -4
  60. package/esm/vs/editor/common/viewModel/viewModelImpl.js +25 -14
  61. package/esm/vs/editor/contrib/clipboard/browser/clipboard.js +3 -3
  62. package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js +28 -64
  63. package/esm/vs/editor/contrib/floatingMenu/browser/floatingMenu.css +27 -20
  64. package/esm/vs/editor/contrib/floatingMenu/browser/floatingMenu.js +37 -9
  65. package/esm/vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.css +7 -0
  66. package/esm/vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.js +22 -3
  67. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineSuggestionsView.js +1 -0
  68. package/esm/vs/editor/editor.api.d.ts +5 -1
  69. package/esm/vs/nls/lang/cs.js +1 -1
  70. package/esm/vs/nls/lang/de.js +1 -1
  71. package/esm/vs/nls/lang/es.js +1 -1
  72. package/esm/vs/nls/lang/fr.js +1 -1
  73. package/esm/vs/nls/lang/it.js +1 -1
  74. package/esm/vs/nls/lang/ja.js +1 -1
  75. package/esm/vs/nls/lang/ko.js +1 -1
  76. package/esm/vs/nls/lang/pl.js +1 -1
  77. package/esm/vs/nls/lang/pt-br.js +1 -1
  78. package/esm/vs/nls/lang/ru.js +1 -1
  79. package/esm/vs/nls/lang/tr.js +1 -1
  80. package/esm/vs/nls/lang/zh-cn.js +1 -1
  81. package/esm/vs/nls/lang/zh-tw.js +1 -1
  82. package/esm/vs/platform/actionWidget/browser/actionList.js +46 -6
  83. package/esm/vs/platform/actionWidget/browser/actionWidget.js +9 -2
  84. package/min/vs/basic-languages/monaco.contribution.js +1 -1
  85. package/min/vs/{cssMode-C9eBIuJR.js → cssMode-CheCY05R.js} +1 -1
  86. package/min/vs/editor/editor.main.css +1 -1
  87. package/min/vs/editor/editor.main.js +1 -1
  88. package/min/vs/{editor-Ch74nR58.js → editor-DxYWA3-X.js} +112 -110
  89. package/min/vs/editor.js +1 -1
  90. package/min/vs/{freemarker2-sjIgVc3I.js → freemarker2-C7J7V1Hp.js} +1 -1
  91. package/min/vs/{handlebars-IDPYJ5Bq.js → handlebars-DsCar5Ix.js} +1 -1
  92. package/min/vs/{html-DfUrEqvV.js → html-BGLIaUZV.js} +1 -1
  93. package/min/vs/{htmlMode-Dg0zLT1w.js → htmlMode-BB6WOoy3.js} +1 -1
  94. package/min/vs/{index-D6TJnMd3.js → index-BdR0nSqf.js} +1 -1
  95. package/min/vs/index.js +1 -1
  96. package/min/vs/{javascript-BpnRo0yM.js → javascript-CXE3i1eX.js} +1 -1
  97. package/min/vs/{jsonMode-DtUQxAtK.js → jsonMode-rtaE9alu.js} +1 -1
  98. package/min/vs/language/css/monaco.contribution.js +1 -1
  99. package/min/vs/language/html/monaco.contribution.js +1 -1
  100. package/min/vs/language/json/monaco.contribution.js +1 -1
  101. package/min/vs/language/typescript/monaco.contribution.js +1 -1
  102. package/min/vs/{liquid-Bpv368IV.js → liquid-CEdn0ovR.js} +1 -1
  103. package/min/vs/{lspLanguageFeatures-C0Mzq6q_.js → lspLanguageFeatures-CRAjJmzF.js} +1 -1
  104. package/min/vs/{mdx-CT-XRvYr.js → mdx-DLDMIqnu.js} +1 -1
  105. package/min/vs/{monaco.contribution-tn0sN6iU.js → monaco.contribution-BrRAk-VA.js} +1 -1
  106. package/min/vs/{monaco.contribution-B6pVhtM0.js → monaco.contribution-C67XgReK.js} +1 -1
  107. package/min/vs/{monaco.contribution-ZmSpiAe2.js → monaco.contribution-CYT-Sx3l.js} +1 -1
  108. package/min/vs/{monaco.contribution-Bp7k_fZE.js → monaco.contribution-DjiQkKLa.js} +1 -1
  109. package/min/vs/nls/lang/cs.js +1 -1
  110. package/min/vs/nls/lang/de.js +1 -1
  111. package/min/vs/nls/lang/es.js +1 -1
  112. package/min/vs/nls/lang/fr.js +1 -1
  113. package/min/vs/nls/lang/it.js +1 -1
  114. package/min/vs/nls/lang/ja.js +1 -1
  115. package/min/vs/nls/lang/ko.js +1 -1
  116. package/min/vs/nls/lang/pl.js +1 -1
  117. package/min/vs/nls/lang/pt-br.js +1 -1
  118. package/min/vs/nls/lang/ru.js +1 -1
  119. package/min/vs/nls/lang/tr.js +1 -1
  120. package/min/vs/nls/lang/zh-cn.js +1 -1
  121. package/min/vs/nls/lang/zh-tw.js +1 -1
  122. package/min/vs/{python-CdDzXJRR.js → python-CKbl_I3e.js} +1 -1
  123. package/min/vs/{razor-oKyioz5n.js → razor--RjiPxbd.js} +1 -1
  124. package/min/vs/{toggleHighContrast-CKdnSOZR.js → toggleHighContrast-BKDMxisH.js} +30 -32
  125. package/min/vs/{tsMode-cB-UHsG6.js → tsMode-C48d5M22.js} +1 -1
  126. package/min/vs/{typescript-B8RK7Scz.js → typescript-e7oUhPyX.js} +1 -1
  127. package/min/vs/{workers-DYaZhUMn.js → workers-CtpYUoCo.js} +1 -1
  128. package/min/vs/{xml-DvqAg4in.js → xml-tOyfgws7.js} +1 -1
  129. package/min/vs/{yaml-KLiQ2nzu.js → yaml-Cmf9NYDf.js} +1 -1
  130. package/monaco.d.ts +5 -1
  131. package/package.json +4 -4
@@ -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) {
@@ -94,29 +94,33 @@ 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
  }
@@ -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
  }
@@ -4,41 +4,48 @@
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
 
6
6
  .floating-menu-overlay-widget {
7
- padding: 0px;
8
- color: var(--vscode-button-foreground);
9
- background-color: var(--vscode-button-background);
10
- border-radius: 2px;
7
+ padding: 2px 4px;
8
+ color: var(--vscode-foreground);
9
+ background-color: var(--vscode-editorWidget-background);
10
+ border-radius: 6px;
11
11
  border: 1px solid var(--vscode-contrastBorder);
12
12
  display: flex;
13
13
  align-items: center;
14
+ justify-content: center;
15
+ gap: 4px;
14
16
  z-index: 10;
15
17
  box-shadow: 0 2px 8px var(--vscode-widget-shadow);
16
18
  overflow: hidden;
17
19
 
18
- .action-item > .action-label {
19
- padding: 5px;
20
- font-size: 12px;
21
- border-radius: 2px;
20
+ .actions-container {
21
+ gap: 4px;
22
22
  }
23
23
 
24
- .action-item > .action-label.codicon, .action-item .codicon {
25
- color: var(--vscode-button-foreground);
24
+ .action-item > .action-label {
25
+ padding: 4px 6px;
26
+ font-size: 11px;
27
+ line-height: 14px;
28
+ border-radius: 4px;
26
29
  }
27
30
 
28
31
  .action-item > .action-label.codicon:not(.separator) {
29
- padding-top: 6px;
30
- padding-bottom: 6px;
32
+ color: var(--vscode-foreground);
33
+ width: 22px;
34
+ height: 22px;
35
+ padding: 0;
36
+ font-size: 16px;
37
+ line-height: 22px;
38
+ display: flex;
39
+ align-items: center;
40
+ justify-content: center;
31
41
  }
32
42
 
33
- .action-item:first-child > .action-label {
34
- padding-left: 7px;
35
- }
36
-
37
- .action-item:last-child > .action-label {
38
- padding-right: 7px;
43
+ .action-item.primary > .action-label {
44
+ background-color: var(--vscode-button-background);
45
+ color: var(--vscode-button-foreground);
39
46
  }
40
47
 
41
- .action-item .action-label.separator {
42
- background-color: var(--vscode-button-separator);
48
+ .action-item.primary > .action-label:hover {
49
+ background-color: var(--vscode-button-hoverBackground) !important;
43
50
  }
44
51
  }
@@ -8,6 +8,7 @@ import { IInstantiationService } from '../../../../platform/instantiation/common
8
8
  import { IKeybindingService } from '../../../../platform/keybinding/common/keybinding.js';
9
9
  import { observableCodeEditor } from '../../../browser/observableCodeEditor.js';
10
10
  import { observableFromEvent } from '../../../../base/common/observableInternal/observables/observableFromEvent.js';
11
+ import { derived } from '../../../../base/common/observableInternal/observables/derived.js';
11
12
  import { autorun } from '../../../../base/common/observableInternal/reactions/autorun.js';
12
13
  import { constObservable } from '../../../../base/common/observableInternal/observables/constObservable.js';
13
14
 
@@ -30,30 +31,57 @@ let FloatingEditorToolbar = class FloatingEditorToolbar extends Disposable {
30
31
  super();
31
32
  const editorObs = this._register(observableCodeEditor(editor));
32
33
  const menu = this._register(menuService.createMenu(MenuId.EditorContent, editor.contextKeyService));
33
- const menuIsEmptyObs = observableFromEvent(this, menu.onDidChange, () => menu.getActions().length === 0);
34
+ const menuActionsObs = observableFromEvent(this, menu.onDidChange, () => menu.getActions());
35
+ const menuPrimaryActionIdObs = derived(reader => {
36
+ const menuActions = menuActionsObs.read(reader);
37
+ if (menuActions.length === 0) {
38
+ return undefined;
39
+ }
40
+ // Navigation group
41
+ const navigationGroup = menuActions
42
+ .find((group) => group[0] === 'navigation');
43
+ // First action in navigation group
44
+ if (navigationGroup && navigationGroup[1].length > 0) {
45
+ return navigationGroup[1][0].id;
46
+ }
47
+ // Fallback to first group/action
48
+ for (const [, actions] of menuActions) {
49
+ if (actions.length > 0) {
50
+ return actions[0].id;
51
+ }
52
+ }
53
+ return undefined;
54
+ });
34
55
  this._register(autorun(reader => {
35
- const menuIsEmpty = menuIsEmptyObs.read(reader);
36
- if (menuIsEmpty) {
56
+ const menuPrimaryActionId = menuPrimaryActionIdObs.read(reader);
57
+ if (!menuPrimaryActionId) {
37
58
  return;
38
59
  }
39
60
  const container = h('div.floating-menu-overlay-widget');
40
61
  // Set height explicitly to ensure that the floating menu element
41
62
  // is rendered in the lower right corner at the correct position.
42
- container.root.style.height = '28px';
63
+ container.root.style.height = '26px';
43
64
  // Toolbar
44
65
  const toolbar = instantiationService.createInstance(MenuWorkbenchToolBar, container.root, MenuId.EditorContent, {
45
66
  actionViewItemProvider: (action, options) => {
46
67
  if (!(action instanceof MenuItemAction)) {
47
68
  return undefined;
48
69
  }
49
- const keybinding = keybindingService.lookupKeybinding(action.id);
50
- if (!keybinding) {
51
- return undefined;
52
- }
53
70
  return instantiationService.createInstance(class extends MenuEntryActionViewItem {
71
+ render(container) {
72
+ super.render(container);
73
+ // Highlight primary action
74
+ if (action.id === menuPrimaryActionId) {
75
+ this.element?.classList.add('primary');
76
+ }
77
+ }
54
78
  updateLabel() {
79
+ const keybinding = keybindingService.lookupKeybinding(action.id);
80
+ const keybindingLabel = keybinding ? keybinding.getLabel() : undefined;
55
81
  if (this.options.label && this.label) {
56
- this.label.textContent = `${this._commandAction.label} (${keybinding.getLabel()})`;
82
+ this.label.textContent = keybindingLabel
83
+ ? `${this._commandAction.label} (${keybindingLabel})`
84
+ : this._commandAction.label;
57
85
  }
58
86
  }
59
87
  }, action, { ...options, keybindingNotRenderedWithLabel: true });
@@ -64,6 +64,13 @@
64
64
  border-bottom: 4px double var(--vscode-editorWarning-border);
65
65
  }
66
66
 
67
+ .monaco-editor .ghost-text-decoration.short-text,
68
+ .monaco-editor .ghost-text-decoration-preview.short-text,
69
+ .monaco-editor .suggest-preview-text .ghost-text.short-text {
70
+ text-decoration: underline dotted var(--vscode-editorGhostText-foreground);
71
+ text-underline-position: under;
72
+ }
73
+
67
74
  .ghost-text-view-warning-widget-icon {
68
75
  .codicon {
69
76
  color: var(--vscode-editorWarning-foreground) !important;