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.
- package/dev/vs/basic-languages/monaco.contribution.js +18 -18
- package/dev/vs/{cssMode-DYAvCb0Q.js → cssMode-B0VkNrib.js} +1 -1
- package/dev/vs/editor/editor.main.css +34 -20
- package/dev/vs/editor/editor.main.js +1 -1
- package/dev/vs/{editor-V-thM4Kh.js → editor-CR18QzPP.js} +541 -177
- package/dev/vs/editor.js +1 -1
- package/dev/vs/{freemarker2-DNhaeW6n.js → freemarker2-Byr9HmH9.js} +1 -1
- package/dev/vs/{handlebars-B9XLHU9b.js → handlebars-BEVXeROF.js} +1 -1
- package/dev/vs/{html-CSZlVq5J.js → html-CetHjWIf.js} +1 -1
- package/dev/vs/{htmlMode-DkNCbjhM.js → htmlMode-BNKYUVNo.js} +1 -1
- package/dev/vs/{index-CuJyCoc4.js → index-g_7JbDIY.js} +1 -1
- package/dev/vs/index.js +1 -1
- package/dev/vs/{javascript-D1PoJUjx.js → javascript-BEgEU725.js} +1 -1
- package/dev/vs/{jsonMode-C84g5aG1.js → jsonMode-CT2UkfFE.js} +1 -1
- package/dev/vs/language/css/monaco.contribution.js +1 -1
- package/dev/vs/language/html/monaco.contribution.js +1 -1
- package/dev/vs/language/json/monaco.contribution.js +1 -1
- package/dev/vs/language/typescript/monaco.contribution.js +1 -1
- package/dev/vs/{liquid-BR1qAgSc.js → liquid-D-aiCb1P.js} +1 -1
- package/dev/vs/{lspLanguageFeatures-e8bPBYUK.js → lspLanguageFeatures-CE9Occyu.js} +1 -1
- package/dev/vs/{mdx-BLfAN-pP.js → mdx-DchJ8pbq.js} +1 -1
- package/dev/vs/{monaco.contribution-BpJCJ2aN.js → monaco.contribution-CHqb1dWh.js} +2 -2
- package/dev/vs/{monaco.contribution-BoVCpaaV.js → monaco.contribution-CVBrIlxn.js} +2 -2
- package/dev/vs/{monaco.contribution-Ccg01HGd.js → monaco.contribution-CZxuzvA9.js} +2 -2
- package/dev/vs/{monaco.contribution-ehavOHIf.js → monaco.contribution-Cw4OdERZ.js} +2 -2
- package/dev/vs/nls/lang/cs.js +1 -1
- package/dev/vs/nls/lang/de.js +1 -1
- package/dev/vs/nls/lang/es.js +1 -1
- package/dev/vs/nls/lang/fr.js +1 -1
- package/dev/vs/nls/lang/it.js +1 -1
- package/dev/vs/nls/lang/ja.js +1 -1
- package/dev/vs/nls/lang/ko.js +1 -1
- package/dev/vs/nls/lang/pl.js +1 -1
- package/dev/vs/nls/lang/pt-br.js +1 -1
- package/dev/vs/nls/lang/ru.js +1 -1
- package/dev/vs/nls/lang/tr.js +1 -1
- package/dev/vs/nls/lang/zh-cn.js +1 -1
- package/dev/vs/nls/lang/zh-tw.js +1 -1
- package/dev/vs/{python-sycHAgxs.js → python-BCOSaCC8.js} +1 -1
- package/dev/vs/{razor-B62R6Lsx.js → razor-BM2tZCwj.js} +1 -1
- package/dev/vs/{toggleHighContrast-3bUMPAmT.js → toggleHighContrast-CLgtrrIB.js} +141 -310
- package/dev/vs/{tsMode-Co79Xo5K.js → tsMode-jpkv3SbL.js} +1 -1
- package/dev/vs/{typescript-_1BH4dlp.js → typescript-f8pt88eA.js} +1 -1
- package/dev/vs/{workers-BGdHt1rb.js → workers-zrUx_2Gw.js} +1 -1
- package/dev/vs/{xml-Cqh8dVgY.js → xml-CmSjtiR0.js} +1 -1
- package/dev/vs/{yaml-D6-bhWv5.js → yaml-PRriLGdw.js} +1 -1
- package/esm/vs/base/browser/markdownRenderer.js +1 -0
- package/esm/vs/editor/browser/controller/editContext/clipboardUtils.js +81 -35
- package/esm/vs/editor/browser/controller/editContext/editContext.js +11 -0
- package/esm/vs/editor/browser/controller/editContext/native/nativeEditContext.js +39 -32
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContext.js +5 -16
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextInput.js +39 -16
- package/esm/vs/editor/browser/dataTransfer.js +1 -1
- package/esm/vs/editor/browser/view.js +21 -1
- package/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget.js +18 -0
- package/esm/vs/editor/common/model/bracketPairsTextModelPart/colorizedBracketPairsDecorationProvider.js +3 -3
- package/esm/vs/editor/common/model/textModel.js +4 -4
- package/esm/vs/editor/common/model/tokens/tokenizationFontDecorationsProvider.js +20 -16
- package/esm/vs/editor/common/viewModel/viewModelDecorations.js +11 -4
- package/esm/vs/editor/common/viewModel/viewModelImpl.js +25 -14
- package/esm/vs/editor/contrib/clipboard/browser/clipboard.js +3 -3
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js +28 -64
- package/esm/vs/editor/contrib/floatingMenu/browser/floatingMenu.css +27 -20
- package/esm/vs/editor/contrib/floatingMenu/browser/floatingMenu.js +37 -9
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.css +7 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.js +22 -3
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineSuggestionsView.js +1 -0
- package/esm/vs/editor/editor.api.d.ts +5 -1
- package/esm/vs/nls/lang/cs.js +1 -1
- package/esm/vs/nls/lang/de.js +1 -1
- package/esm/vs/nls/lang/es.js +1 -1
- package/esm/vs/nls/lang/fr.js +1 -1
- package/esm/vs/nls/lang/it.js +1 -1
- package/esm/vs/nls/lang/ja.js +1 -1
- package/esm/vs/nls/lang/ko.js +1 -1
- package/esm/vs/nls/lang/pl.js +1 -1
- package/esm/vs/nls/lang/pt-br.js +1 -1
- package/esm/vs/nls/lang/ru.js +1 -1
- package/esm/vs/nls/lang/tr.js +1 -1
- package/esm/vs/nls/lang/zh-cn.js +1 -1
- package/esm/vs/nls/lang/zh-tw.js +1 -1
- package/esm/vs/platform/actionWidget/browser/actionList.js +46 -6
- package/esm/vs/platform/actionWidget/browser/actionWidget.js +9 -2
- package/min/vs/basic-languages/monaco.contribution.js +1 -1
- package/min/vs/{cssMode-C9eBIuJR.js → cssMode-CheCY05R.js} +1 -1
- package/min/vs/editor/editor.main.css +1 -1
- package/min/vs/editor/editor.main.js +1 -1
- package/min/vs/{editor-Ch74nR58.js → editor-DxYWA3-X.js} +112 -110
- package/min/vs/editor.js +1 -1
- package/min/vs/{freemarker2-sjIgVc3I.js → freemarker2-C7J7V1Hp.js} +1 -1
- package/min/vs/{handlebars-IDPYJ5Bq.js → handlebars-DsCar5Ix.js} +1 -1
- package/min/vs/{html-DfUrEqvV.js → html-BGLIaUZV.js} +1 -1
- package/min/vs/{htmlMode-Dg0zLT1w.js → htmlMode-BB6WOoy3.js} +1 -1
- package/min/vs/{index-D6TJnMd3.js → index-BdR0nSqf.js} +1 -1
- package/min/vs/index.js +1 -1
- package/min/vs/{javascript-BpnRo0yM.js → javascript-CXE3i1eX.js} +1 -1
- package/min/vs/{jsonMode-DtUQxAtK.js → jsonMode-rtaE9alu.js} +1 -1
- package/min/vs/language/css/monaco.contribution.js +1 -1
- package/min/vs/language/html/monaco.contribution.js +1 -1
- package/min/vs/language/json/monaco.contribution.js +1 -1
- package/min/vs/language/typescript/monaco.contribution.js +1 -1
- package/min/vs/{liquid-Bpv368IV.js → liquid-CEdn0ovR.js} +1 -1
- package/min/vs/{lspLanguageFeatures-C0Mzq6q_.js → lspLanguageFeatures-CRAjJmzF.js} +1 -1
- package/min/vs/{mdx-CT-XRvYr.js → mdx-DLDMIqnu.js} +1 -1
- package/min/vs/{monaco.contribution-tn0sN6iU.js → monaco.contribution-BrRAk-VA.js} +1 -1
- package/min/vs/{monaco.contribution-B6pVhtM0.js → monaco.contribution-C67XgReK.js} +1 -1
- package/min/vs/{monaco.contribution-ZmSpiAe2.js → monaco.contribution-CYT-Sx3l.js} +1 -1
- package/min/vs/{monaco.contribution-Bp7k_fZE.js → monaco.contribution-DjiQkKLa.js} +1 -1
- package/min/vs/nls/lang/cs.js +1 -1
- package/min/vs/nls/lang/de.js +1 -1
- package/min/vs/nls/lang/es.js +1 -1
- package/min/vs/nls/lang/fr.js +1 -1
- package/min/vs/nls/lang/it.js +1 -1
- package/min/vs/nls/lang/ja.js +1 -1
- package/min/vs/nls/lang/ko.js +1 -1
- package/min/vs/nls/lang/pl.js +1 -1
- package/min/vs/nls/lang/pt-br.js +1 -1
- package/min/vs/nls/lang/ru.js +1 -1
- package/min/vs/nls/lang/tr.js +1 -1
- package/min/vs/nls/lang/zh-cn.js +1 -1
- package/min/vs/nls/lang/zh-tw.js +1 -1
- package/min/vs/{python-CdDzXJRR.js → python-CKbl_I3e.js} +1 -1
- package/min/vs/{razor-oKyioz5n.js → razor--RjiPxbd.js} +1 -1
- package/min/vs/{toggleHighContrast-CKdnSOZR.js → toggleHighContrast-BKDMxisH.js} +30 -32
- package/min/vs/{tsMode-cB-UHsG6.js → tsMode-C48d5M22.js} +1 -1
- package/min/vs/{typescript-B8RK7Scz.js → typescript-e7oUhPyX.js} +1 -1
- package/min/vs/{workers-DYaZhUMn.js → workers-CtpYUoCo.js} +1 -1
- package/min/vs/{xml-DvqAg4in.js → xml-tOyfgws7.js} +1 -1
- package/min/vs/{yaml-KLiQ2nzu.js → yaml-Cmf9NYDf.js} +1 -1
- package/monaco.d.ts +5 -1
- 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
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
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
|
|
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
|
|
669
|
-
|
|
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
|
-
|
|
789
|
+
pushRange(new Range(modelLineNumber, this.model.getLineMinColumn(modelLineNumber), modelLineNumber, this.model.getLineMaxColumn(modelLineNumber)), newLineCharacter);
|
|
779
790
|
}
|
|
780
791
|
}
|
|
781
792
|
else {
|
|
782
|
-
|
|
793
|
+
pushRange(modelRange);
|
|
783
794
|
}
|
|
784
795
|
prevModelLineNumber = modelLineNumber;
|
|
785
796
|
}
|
|
786
|
-
return result.length === 1 ? result[0] : result;
|
|
787
797
|
}
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
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(),
|
|
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.
|
|
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.
|
|
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
|
-
|
|
71
|
-
this._register(
|
|
72
|
-
this._register(
|
|
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
|
-
|
|
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 (!
|
|
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:
|
|
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 =
|
|
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 =
|
|
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,
|
|
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
|
-
|
|
174
|
-
|
|
175
|
-
|
|
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
|
-
|
|
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.
|
|
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.
|
|
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(
|
|
404
|
+
setCopyMetadata(clipboardData, metadata) {
|
|
436
405
|
this._logService.trace('CopyPasteController#setCopyMetadata new id : ', metadata.id);
|
|
437
|
-
|
|
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
|
-
|
|
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:
|
|
8
|
-
color: var(--vscode-
|
|
9
|
-
background-color: var(--vscode-
|
|
10
|
-
border-radius:
|
|
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
|
-
.
|
|
19
|
-
|
|
20
|
-
font-size: 12px;
|
|
21
|
-
border-radius: 2px;
|
|
20
|
+
.actions-container {
|
|
21
|
+
gap: 4px;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
.action-item > .action-label
|
|
25
|
-
|
|
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
|
-
|
|
30
|
-
|
|
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
|
|
34
|
-
|
|
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
|
|
42
|
-
background-color: var(--vscode-button-
|
|
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
|
|
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
|
|
36
|
-
if (
|
|
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 = '
|
|
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 =
|
|
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;
|