monaco-editor-core 0.55.0-dev-20251106 → 0.55.0-rc
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/esm/nls.keys.json +1 -1
- package/esm/nls.messages.cs.js +2 -2
- package/esm/nls.messages.de.js +2 -2
- package/esm/nls.messages.es.js +2 -2
- package/esm/nls.messages.fr.js +2 -2
- package/esm/nls.messages.it.js +2 -2
- package/esm/nls.messages.ja.js +2 -2
- package/esm/nls.messages.js +1 -1
- package/esm/nls.messages.json +1 -1
- package/esm/nls.messages.ko.js +2 -2
- package/esm/nls.messages.pl.js +2 -2
- package/esm/nls.messages.pt-br.js +2 -2
- package/esm/nls.messages.ru.js +2 -2
- package/esm/nls.messages.tr.js +2 -2
- package/esm/nls.messages.zh-cn.js +2 -2
- package/esm/nls.messages.zh-tw.js +2 -2
- package/esm/nls.metadata.json +0 -6
- package/esm/vs/base/browser/ui/codicons/codicon/codicon.ttf +0 -0
- package/esm/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/copySelection.js +24 -83
- package/esm/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/copySelection.js.map +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/diffEditorViewZones.js +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/diffEditorViewZones.js.map +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/inlineDiffDeletedCodeMargin.js +13 -17
- package/esm/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/inlineDiffDeletedCodeMargin.js.map +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/renderLines.js +81 -9
- package/esm/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/renderLines.js.map +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/diffEditor.contribution.js +5 -5
- package/esm/vs/editor/browser/widget/diffEditor/features/hideUnchangedRegionsFeature.js +7 -7
- package/esm/vs/editor/browser/widget/diffEditor/features/movedBlocksLinesFeature.js +2 -2
- package/esm/vs/editor/browser/widget/diffEditor/features/revertButtonsFeature.js +2 -2
- package/esm/vs/editor/browser/widget/diffEditor/registrations.contribution.js +5 -5
- package/esm/vs/editor/browser/widget/multiDiffEditor/colors.js +3 -3
- package/esm/vs/editor/browser/widget/multiDiffEditor/diffEditorItemTemplate.js +1 -1
- package/esm/vs/editor/browser/widget/multiDiffEditor/diffEditorItemTemplate.js.map +1 -1
- package/esm/vs/editor/browser/widget/multiDiffEditor/multiDiffEditorWidgetImpl.js +2 -2
- package/esm/vs/editor/common/config/editorConfigurationSchema.js +54 -54
- package/esm/vs/editor/common/config/editorOptions.js +407 -407
- package/esm/vs/editor/common/config/editorOptions.js.map +1 -1
- package/esm/vs/editor/common/core/editorColorRegistry.js +68 -68
- package/esm/vs/editor/common/editorContextKeys.js +47 -47
- package/esm/vs/editor/common/languages/modesRegistry.js +1 -1
- package/esm/vs/editor/common/languages.js +56 -56
- package/esm/vs/editor/common/model/editStack.js +1 -1
- package/esm/vs/editor/common/standaloneStrings.js +10 -10
- package/esm/vs/editor/common/textModelEditSource.js +2 -2
- package/esm/vs/editor/common/textModelEditSource.js.map +1 -1
- package/esm/vs/editor/common/viewLayout/viewLineRenderer.js +2 -2
- package/esm/vs/editor/contrib/anchorSelect/browser/anchorSelect.js +6 -6
- package/esm/vs/editor/contrib/bracketMatching/browser/bracketMatching.js +6 -6
- package/esm/vs/editor/contrib/caretOperations/browser/caretOperations.js +2 -2
- package/esm/vs/editor/contrib/caretOperations/browser/transpose.js +1 -1
- package/esm/vs/editor/contrib/clipboard/browser/clipboard.js +17 -17
- package/esm/vs/editor/contrib/codeAction/browser/codeAction.js +1 -1
- package/esm/vs/editor/contrib/codeAction/browser/codeActionCommands.js +29 -29
- package/esm/vs/editor/contrib/codeAction/browser/codeActionContributions.js +3 -3
- package/esm/vs/editor/contrib/codeAction/browser/codeActionController.js +3 -3
- package/esm/vs/editor/contrib/codeAction/browser/codeActionMenu.js +8 -8
- package/esm/vs/editor/contrib/codeAction/browser/lightBulbWidget.js +9 -9
- package/esm/vs/editor/contrib/codelens/browser/codelensController.js +2 -2
- package/esm/vs/editor/contrib/colorPicker/browser/colorPickerParts/colorPickerCloseButton.js +1 -1
- package/esm/vs/editor/contrib/colorPicker/browser/colorPickerParts/colorPickerHeader.js +1 -1
- package/esm/vs/editor/contrib/colorPicker/browser/hoverColorPicker/hoverColorPickerParticipant.js +1 -1
- package/esm/vs/editor/contrib/colorPicker/browser/standaloneColorPicker/standaloneColorPickerActions.js +7 -7
- package/esm/vs/editor/contrib/comment/browser/comment.js +6 -6
- package/esm/vs/editor/contrib/contextmenu/browser/contextmenu.js +10 -10
- package/esm/vs/editor/contrib/cursorUndo/browser/cursorUndo.js +2 -2
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteContribution.js +4 -4
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js +9 -9
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/defaultProviders.js +8 -8
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/dropIntoEditorController.js +3 -3
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/postEditWidget.js +2 -2
- package/esm/vs/editor/contrib/editorState/browser/keybindingCancellation.js +1 -1
- package/esm/vs/editor/contrib/find/browser/findController.js +16 -16
- package/esm/vs/editor/contrib/find/browser/findWidget.js +26 -26
- package/esm/vs/editor/contrib/folding/browser/folding.js +20 -20
- package/esm/vs/editor/contrib/folding/browser/folding.js.map +1 -1
- package/esm/vs/editor/contrib/folding/browser/foldingDecorations.js +9 -9
- package/esm/vs/editor/contrib/fontZoom/browser/fontZoom.js +3 -3
- package/esm/vs/editor/contrib/format/browser/format.js +3 -7
- package/esm/vs/editor/contrib/format/browser/format.js.map +1 -1
- package/esm/vs/editor/contrib/format/browser/formatActions.js +2 -2
- package/esm/vs/editor/contrib/gotoError/browser/gotoError.js +8 -8
- package/esm/vs/editor/contrib/gotoError/browser/gotoErrorWidget.js +14 -14
- package/esm/vs/editor/contrib/gotoSymbol/browser/goToCommands.js +39 -39
- package/esm/vs/editor/contrib/gotoSymbol/browser/link/goToDefinitionAtPosition.js +1 -1
- package/esm/vs/editor/contrib/gotoSymbol/browser/peek/referencesController.js +3 -3
- package/esm/vs/editor/contrib/gotoSymbol/browser/peek/referencesTree.js +3 -3
- package/esm/vs/editor/contrib/gotoSymbol/browser/peek/referencesWidget.js +3 -3
- package/esm/vs/editor/contrib/gotoSymbol/browser/referencesModel.js +8 -8
- package/esm/vs/editor/contrib/gotoSymbol/browser/symbolNavigation.js +3 -3
- package/esm/vs/editor/contrib/gpu/browser/gpuActions.js +4 -4
- package/esm/vs/editor/contrib/hover/browser/hoverActionIds.js +2 -2
- package/esm/vs/editor/contrib/hover/browser/hoverActions.js +24 -24
- package/esm/vs/editor/contrib/hover/browser/hoverCopyButton.js +2 -2
- package/esm/vs/editor/contrib/hover/browser/markdownHoverParticipant.js +9 -9
- package/esm/vs/editor/contrib/hover/browser/markerHoverParticipant.js +5 -5
- package/esm/vs/editor/contrib/inPlaceReplace/browser/inPlaceReplace.js +2 -2
- package/esm/vs/editor/contrib/indentation/browser/indentation.js +20 -20
- package/esm/vs/editor/contrib/inlayHints/browser/inlayHintsHover.js +8 -8
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commands.js +20 -20
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionContextKeys.js +12 -12
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionsController.js +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/hintsWidget/hoverParticipant.js +2 -2
- package/esm/vs/editor/contrib/inlineCompletions/browser/hintsWidget/inlineCompletionsHintsWidget.js +5 -5
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorMenu.js +6 -6
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsModel.js +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/theme.js +20 -20
- package/esm/vs/editor/contrib/insertFinalNewLine/browser/insertFinalNewLine.js +1 -1
- package/esm/vs/editor/contrib/lineSelection/browser/lineSelection.js +1 -1
- package/esm/vs/editor/contrib/linesOperations/browser/linesOperations.js +31 -31
- package/esm/vs/editor/contrib/linkedEditing/browser/linkedEditing.js +2 -2
- package/esm/vs/editor/contrib/links/browser/links.js +10 -10
- package/esm/vs/editor/contrib/message/browser/messageController.js +1 -1
- package/esm/vs/editor/contrib/multicursor/browser/multicursor.js +22 -22
- package/esm/vs/editor/contrib/parameterHints/browser/parameterHints.js +1 -1
- package/esm/vs/editor/contrib/parameterHints/browser/parameterHintsWidget.js +4 -4
- package/esm/vs/editor/contrib/peekView/browser/peekView.js +18 -18
- package/esm/vs/editor/contrib/placeholderText/browser/placeholderText.contribution.js +1 -1
- package/esm/vs/editor/contrib/quickAccess/browser/gotoLineQuickAccess.js +10 -10
- package/esm/vs/editor/contrib/quickAccess/browser/gotoSymbolQuickAccess.js +32 -32
- package/esm/vs/editor/contrib/readOnlyMessage/browser/contribution.js +2 -2
- package/esm/vs/editor/contrib/rename/browser/rename.js +11 -11
- package/esm/vs/editor/contrib/rename/browser/renameWidget.js +7 -7
- package/esm/vs/editor/contrib/smartSelect/browser/smartSelect.js +4 -4
- package/esm/vs/editor/contrib/snippet/browser/snippetController2.js +4 -4
- package/esm/vs/editor/contrib/snippet/browser/snippetVariables.js +4 -4
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollActions.js +11 -11
- package/esm/vs/editor/contrib/suggest/browser/suggest.js +8 -8
- package/esm/vs/editor/contrib/suggest/browser/suggestController.js +10 -10
- package/esm/vs/editor/contrib/suggest/browser/suggestWidget.js +17 -17
- package/esm/vs/editor/contrib/suggest/browser/suggestWidgetDetails.js +2 -2
- package/esm/vs/editor/contrib/suggest/browser/suggestWidgetRenderer.js +2 -2
- package/esm/vs/editor/contrib/suggest/browser/wordContextKey.js +1 -1
- package/esm/vs/editor/contrib/symbolIcons/browser/symbolIcons.js +33 -33
- package/esm/vs/editor/contrib/toggleTabFocusMode/browser/toggleTabFocusMode.js +4 -4
- package/esm/vs/editor/contrib/tokenization/browser/tokenization.js +1 -1
- package/esm/vs/editor/contrib/unicodeHighlighter/browser/bannerController.js +1 -1
- package/esm/vs/editor/contrib/unicodeHighlighter/browser/unicodeHighlighter.js +24 -24
- package/esm/vs/editor/contrib/unusualLineTerminators/browser/unusualLineTerminators.js +5 -5
- package/esm/vs/editor/contrib/wordHighlighter/browser/highlightDecorations.js +9 -9
- package/esm/vs/editor/contrib/wordHighlighter/browser/wordHighlighter.js +3 -3
- package/esm/vs/editor/contrib/wordOperations/browser/wordOperations.js +1 -1
- package/esm/vs/platform/accessibilitySignal/browser/accessibilitySignalService.js +62 -62
- package/esm/vs/platform/action/common/actionCommonCategories.js +6 -6
- package/esm/vs/platform/actionWidget/browser/actionList.js +4 -4
- package/esm/vs/platform/actionWidget/browser/actionWidget.js +7 -7
- package/esm/vs/platform/actions/browser/menuEntryActionViewItem.js +5 -5
- package/esm/vs/platform/actions/browser/toolbar.js +2 -2
- package/esm/vs/platform/actions/common/menuService.js +2 -2
- package/esm/vs/platform/configuration/common/configurationRegistry.js +10 -10
- package/esm/vs/platform/contextkey/browser/contextKeyService.js +1 -1
- package/esm/vs/platform/contextkey/common/contextkey.js +9 -9
- package/esm/vs/platform/contextkey/common/contextkeys.js +9 -9
- package/esm/vs/platform/contextkey/common/scanner.js +5 -5
- package/esm/vs/platform/history/browser/contextScopedHistoryWidget.js +1 -1
- package/esm/vs/platform/hover/browser/hoverWidget.js +1 -1
- package/esm/vs/platform/hover/browser/updatableHoverWidget.js +1 -1
- package/esm/vs/platform/keybinding/common/abstractKeybindingService.js +4 -4
- package/esm/vs/platform/list/browser/listService.js +29 -29
- package/esm/vs/platform/list/browser/listService.js.map +1 -1
- package/esm/vs/platform/markers/common/markerService.js +2 -2
- package/esm/vs/platform/markers/common/markers.js +6 -6
- package/esm/vs/platform/quickinput/browser/commandsQuickAccess.js +7 -7
- package/esm/vs/platform/quickinput/browser/helpQuickAccess.js +1 -1
- package/esm/vs/platform/quickinput/browser/quickInput.js +10 -10
- package/esm/vs/platform/quickinput/browser/quickInputActions.js +5 -5
- package/esm/vs/platform/quickinput/browser/quickInputController.js +6 -6
- package/esm/vs/platform/quickinput/browser/quickInputList.js +1 -1
- package/esm/vs/platform/quickinput/browser/quickInputUtils.js +1 -1
- package/esm/vs/platform/quickinput/browser/tree/quickInputTreeAccessibilityProvider.js +1 -1
- package/esm/vs/platform/theme/common/colorUtils.js +2 -2
- package/esm/vs/platform/theme/common/colors/baseColors.js +17 -17
- package/esm/vs/platform/theme/common/colors/chartsColors.js +8 -8
- package/esm/vs/platform/theme/common/colors/editorColors.js +95 -95
- package/esm/vs/platform/theme/common/colors/inputColors.js +47 -47
- package/esm/vs/platform/theme/common/colors/listColors.js +36 -36
- package/esm/vs/platform/theme/common/colors/menuColors.js +7 -7
- package/esm/vs/platform/theme/common/colors/minimapColors.js +11 -11
- package/esm/vs/platform/theme/common/colors/miscColors.js +16 -16
- package/esm/vs/platform/theme/common/colors/quickpickColors.js +9 -9
- package/esm/vs/platform/theme/common/colors/searchColors.js +3 -3
- package/esm/vs/platform/theme/common/iconRegistry.js +6 -6
- package/esm/vs/platform/undoRedo/common/undoRedoService.js +20 -20
- package/esm/vs/platform/workspace/common/workspace.js +1 -1
- package/package.json +2 -2
- package/version.txt +1 -1
|
@@ -20,7 +20,7 @@ export class InlineDiffDeletedCodeMargin extends Disposable {
|
|
|
20
20
|
this._diffActions.style.visibility = _visibility ? 'visible' : 'hidden';
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
constructor(_getViewZoneId, _marginDomNode, _deletedCodeDomNode, _modifiedEditor, _diff, _editor,
|
|
23
|
+
constructor(_getViewZoneId, _marginDomNode, _deletedCodeDomNode, _modifiedEditor, _diff, _editor, _renderLinesResult, _originalTextModel, _contextMenuService, _clipboardService) {
|
|
24
24
|
super();
|
|
25
25
|
this._getViewZoneId = _getViewZoneId;
|
|
26
26
|
this._marginDomNode = _marginDomNode;
|
|
@@ -28,7 +28,7 @@ export class InlineDiffDeletedCodeMargin extends Disposable {
|
|
|
28
28
|
this._modifiedEditor = _modifiedEditor;
|
|
29
29
|
this._diff = _diff;
|
|
30
30
|
this._editor = _editor;
|
|
31
|
-
this.
|
|
31
|
+
this._renderLinesResult = _renderLinesResult;
|
|
32
32
|
this._originalTextModel = _originalTextModel;
|
|
33
33
|
this._contextMenuService = _contextMenuService;
|
|
34
34
|
this._clipboardService = _clipboardService;
|
|
@@ -57,18 +57,18 @@ export class InlineDiffDeletedCodeMargin extends Disposable {
|
|
|
57
57
|
// default action
|
|
58
58
|
actions.push(new Action('diff.clipboard.copyDeletedContent', isDeletion
|
|
59
59
|
? (_diff.original.length > 1
|
|
60
|
-
? localize(
|
|
61
|
-
: localize(
|
|
60
|
+
? localize(112, "Copy deleted lines")
|
|
61
|
+
: localize(113, "Copy deleted line"))
|
|
62
62
|
: (_diff.original.length > 1
|
|
63
|
-
? localize(
|
|
64
|
-
: localize(
|
|
63
|
+
? localize(114, "Copy changed lines")
|
|
64
|
+
: localize(115, "Copy changed line")), undefined, true, async () => {
|
|
65
65
|
const originalText = this._originalTextModel.getValueInRange(_diff.original.toExclusiveRange());
|
|
66
66
|
await this._clipboardService.writeText(originalText);
|
|
67
67
|
}));
|
|
68
68
|
if (_diff.original.length > 1) {
|
|
69
69
|
actions.push(new Action('diff.clipboard.copyDeletedLineContent', isDeletion
|
|
70
|
-
? localize(
|
|
71
|
-
: localize(
|
|
70
|
+
? localize(116, "Copy deleted line ({0})", _diff.original.startLineNumber + currentLineNumberOffset)
|
|
71
|
+
: localize(117, "Copy changed line ({0})", _diff.original.startLineNumber + currentLineNumberOffset), undefined, true, async () => {
|
|
72
72
|
let lineContent = this._originalTextModel.getLineContent(_diff.original.startLineNumber + currentLineNumberOffset);
|
|
73
73
|
if (lineContent === '') {
|
|
74
74
|
// empty line -> new line
|
|
@@ -80,7 +80,7 @@ export class InlineDiffDeletedCodeMargin extends Disposable {
|
|
|
80
80
|
}
|
|
81
81
|
const readOnly = _modifiedEditor.getOption(104 /* EditorOption.readOnly */);
|
|
82
82
|
if (!readOnly) {
|
|
83
|
-
actions.push(new Action('diff.inline.revertChange', localize(
|
|
83
|
+
actions.push(new Action('diff.inline.revertChange', localize(118, "Revert this change"), undefined, true, async () => {
|
|
84
84
|
this._editor.revert(this._diff);
|
|
85
85
|
}));
|
|
86
86
|
}
|
|
@@ -109,13 +109,9 @@ export class InlineDiffDeletedCodeMargin extends Disposable {
|
|
|
109
109
|
}));
|
|
110
110
|
this._register(enableCopySelection({
|
|
111
111
|
domNode: this._deletedCodeDomNode,
|
|
112
|
-
getViewZoneId: () => this._getViewZoneId(),
|
|
113
112
|
diffEntry: _diff,
|
|
114
113
|
originalModel: this._originalTextModel,
|
|
115
|
-
|
|
116
|
-
viewLineCounts: this._viewLineCounts,
|
|
117
|
-
editor: _modifiedEditor,
|
|
118
|
-
showContextMenu,
|
|
114
|
+
renderLinesResult: this._renderLinesResult,
|
|
119
115
|
clipboardService: _clipboardService,
|
|
120
116
|
}));
|
|
121
117
|
}
|
|
@@ -125,10 +121,10 @@ export class InlineDiffDeletedCodeMargin extends Disposable {
|
|
|
125
121
|
const lineNumberOffset = Math.floor(offset / lineHeight);
|
|
126
122
|
const newTop = lineNumberOffset * lineHeight;
|
|
127
123
|
this._diffActions.style.top = `${newTop}px`;
|
|
128
|
-
if (this.
|
|
124
|
+
if (this._renderLinesResult.viewLineCounts) {
|
|
129
125
|
let acc = 0;
|
|
130
|
-
for (let i = 0; i < this.
|
|
131
|
-
acc += this.
|
|
126
|
+
for (let i = 0; i < this._renderLinesResult.viewLineCounts.length; i++) {
|
|
127
|
+
acc += this._renderLinesResult.viewLineCounts[i];
|
|
132
128
|
if (lineNumberOffset < acc) {
|
|
133
129
|
return i;
|
|
134
130
|
}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;YAChB,aAAa,EAAE,IAAI,CAAC,kBAAkB;YACtC,gBAAgB,EAAE,UAAU;YAC5B,cAAc,EAAE,IAAI,CAAC,eAAe;YACpC,MAAM,EAAE,eAAe;YACvB,eAAe;YACf,gBAAgB,EAAE,iBAAiB;SACnC,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,wBAAwB,CAAC,aAA0B,EAAE,CAAS,EAAE,UAAkB;QACzF,MAAM,EAAE,GAAG,EAAE,GAAG,sBAAsB,CAAC,aAAa,CAAC,CAAC;QACtD,MAAM,MAAM,GAAG,CAAC,GAAG,GAAG,CAAC;QACvB,MAAM,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,UAAU,CAAC,CAAC;QACzD,MAAM,MAAM,GAAG,gBAAgB,GAAG,UAAU,CAAC;QAC7C,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,MAAM,IAAI,CAAC;QAC5C,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YAC1B,IAAI,GAAG,GAAG,CAAC,CAAC;YACZ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBACtD,GAAG,IAAI,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;gBAC/B,IAAI,gBAAgB,GAAG,GAAG,EAAE,CAAC;oBAC5B,OAAO,CAAC,CAAC;gBACV,CAAC;YACF,CAAC;QACF,CAAC;QACD,OAAO,gBAAgB,CAAC;IACzB,CAAC;CACD","file":"inlineDiffDeletedCodeMargin.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { addStandardDisposableListener, getDomNodePagePosition } from '../../../../../../base/browser/dom.js';\nimport { Action } from '../../../../../../base/common/actions.js';\nimport { Codicon } from '../../../../../../base/common/codicons.js';\nimport { Disposable } from '../../../../../../base/common/lifecycle.js';\nimport { isIOS } from '../../../../../../base/common/platform.js';\nimport { ThemeIcon } from '../../../../../../base/common/themables.js';\nimport { IEditorMouseEvent, MouseTargetType } from '../../../../editorBrowser.js';\nimport { CodeEditorWidget } from '../../../codeEditor/codeEditorWidget.js';\nimport { DiffEditorWidget } from '../../diffEditorWidget.js';\nimport { EditorOption } from '../../../../../common/config/editorOptions.js';\nimport { DetailedLineRangeMapping } from '../../../../../common/diff/rangeMapping.js';\nimport { EndOfLineSequence, ITextModel } from '../../../../../common/model.js';\nimport { localize } from '../../../../../../nls.js';\nimport { IClipboardService } from '../../../../../../platform/clipboard/common/clipboardService.js';\nimport { IContextMenuService } from '../../../../../../platform/contextview/browser/contextView.js';\nimport { enableCopySelection } from './copySelection.js';\n\nexport class InlineDiffDeletedCodeMargin extends Disposable {\n\tprivate readonly _diffActions: HTMLElement;\n\n\tprivate _visibility: boolean = false;\n\n\tget visibility(): boolean {\n\t\treturn this._visibility;\n\t}\n\n\tset visibility(_visibility: boolean) {\n\t\tif (this._visibility !== _visibility) {\n\t\t\tthis._visibility = _visibility;\n\t\t\tthis._diffActions.style.visibility = _visibility ? 'visible' : 'hidden';\n\t\t}\n\t}\n\n\tconstructor(\n\t\tprivate readonly _getViewZoneId: () => string,\n\t\tprivate readonly _marginDomNode: HTMLElement,\n\t\tprivate readonly _deletedCodeDomNode: HTMLElement,\n\t\tprivate readonly _modifiedEditor: CodeEditorWidget,\n\t\tprivate readonly _diff: DetailedLineRangeMapping,\n\t\tprivate readonly _editor: DiffEditorWidget,\n\t\tprivate readonly _viewLineCounts: number[],\n\t\tprivate readonly _originalTextModel: ITextModel,\n\t\tprivate readonly _contextMenuService: IContextMenuService,\n\t\tprivate readonly _clipboardService: IClipboardService,\n\t) {\n\t\tsuper();\n\n\t\t// make sure the diff margin shows above overlay.\n\t\tthis._marginDomNode.style.zIndex = '10';\n\n\t\tthis._diffActions = document.createElement('div');\n\t\tthis._diffActions.className = ThemeIcon.asClassName(Codicon.lightBulb) + ' lightbulb-glyph';\n\t\tthis._diffActions.style.position = 'absolute';\n\t\tconst lineHeight = this._modifiedEditor.getOption(EditorOption.lineHeight);\n\t\tthis._diffActions.style.right = '0px';\n\t\tthis._diffActions.style.visibility = 'hidden';\n\t\tthis._diffActions.style.height = `${lineHeight}px`;\n\t\tthis._diffActions.style.lineHeight = `${lineHeight}px`;\n\t\tthis._marginDomNode.appendChild(this._diffActions);\n\n\t\tlet currentLineNumberOffset = 0;\n\n\t\tconst useShadowDOM = _modifiedEditor.getOption(EditorOption.useShadowDOM) && !isIOS; // Do not use shadow dom on IOS #122035\n\t\tconst showContextMenu = (anchor: { x: number; y: number }, baseActions?: Action[], onHide?: () => void) => {\n\t\t\tthis._contextMenuService.showContextMenu({\n\t\t\t\tdomForShadowRoot: useShadowDOM ? _modifiedEditor.getDomNode() ?? undefined : undefined,\n\t\t\t\tgetAnchor: () => anchor,\n\t\t\t\tonHide,\n\t\t\t\tgetActions: () => {\n\t\t\t\t\tconst actions: Action[] = baseActions ?? [];\n\t\t\t\t\tconst isDeletion = _diff.modified.isEmpty;\n\n\t\t\t\t\t// default action\n\t\t\t\t\tactions.push(new Action(\n\t\t\t\t\t\t'diff.clipboard.copyDeletedContent',\n\t\t\t\t\t\tisDeletion\n\t\t\t\t\t\t\t? (_diff.original.length > 1\n\t\t\t\t\t\t\t\t? localize('diff.clipboard.copyDeletedLinesContent.label', \"Copy deleted lines\")\n\t\t\t\t\t\t\t\t: localize('diff.clipboard.copyDeletedLinesContent.single.label', \"Copy deleted line\"))\n\t\t\t\t\t\t\t: (_diff.original.length > 1\n\t\t\t\t\t\t\t\t? localize('diff.clipboard.copyChangedLinesContent.label', \"Copy changed lines\")\n\t\t\t\t\t\t\t\t: localize('diff.clipboard.copyChangedLinesContent.single.label', \"Copy changed line\")),\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\tasync () => {\n\t\t\t\t\t\t\tconst originalText = this._originalTextModel.getValueInRange(_diff.original.toExclusiveRange());\n\t\t\t\t\t\t\tawait this._clipboardService.writeText(originalText);\n\t\t\t\t\t\t}\n\t\t\t\t\t));\n\n\t\t\t\t\tif (_diff.original.length > 1) {\n\t\t\t\t\t\tactions.push(new Action(\n\t\t\t\t\t\t\t'diff.clipboard.copyDeletedLineContent',\n\t\t\t\t\t\t\tisDeletion\n\t\t\t\t\t\t\t\t? localize('diff.clipboard.copyDeletedLineContent.label', \"Copy deleted line ({0})\",\n\t\t\t\t\t\t\t\t\t_diff.original.startLineNumber + currentLineNumberOffset)\n\t\t\t\t\t\t\t\t: localize('diff.clipboard.copyChangedLineContent.label', \"Copy changed line ({0})\",\n\t\t\t\t\t\t\t\t\t_diff.original.startLineNumber + currentLineNumberOffset),\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\tasync () => {\n\t\t\t\t\t\t\t\tlet lineContent = this._originalTextModel.getLineContent(_diff.original.startLineNumber + currentLineNumberOffset);\n\t\t\t\t\t\t\t\tif (lineContent === '') {\n\t\t\t\t\t\t\t\t\t// empty line -> new line\n\t\t\t\t\t\t\t\t\tconst eof = this._originalTextModel.getEndOfLineSequence();\n\t\t\t\t\t\t\t\t\tlineContent = eof === EndOfLineSequence.LF ? '\\n' : '\\r\\n';\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tawait this._clipboardService.writeText(lineContent);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t));\n\t\t\t\t\t}\n\t\t\t\t\tconst readOnly = _modifiedEditor.getOption(EditorOption.readOnly);\n\t\t\t\t\tif (!readOnly) {\n\t\t\t\t\t\tactions.push(new Action(\n\t\t\t\t\t\t\t'diff.inline.revertChange',\n\t\t\t\t\t\t\tlocalize('diff.inline.revertChange.label', \"Revert this change\"),\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\tasync () => {\n\t\t\t\t\t\t\t\tthis._editor.revert(this._diff);\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\treturn actions;\n\t\t\t\t},\n\t\t\t\tautoSelectFirstItem: true\n\t\t\t});\n\t\t};\n\n\t\tthis._register(addStandardDisposableListener(this._diffActions, 'mousedown', e => {\n\t\t\tif (!e.leftButton) { return; }\n\n\t\t\tconst { top, height } = getDomNodePagePosition(this._diffActions);\n\t\t\tconst pad = Math.floor(lineHeight / 3);\n\t\t\te.preventDefault();\n\t\t\tshowContextMenu({ x: e.posx, y: top + height + pad });\n\t\t}));\n\n\t\tthis._register(_modifiedEditor.onMouseMove((e: IEditorMouseEvent) => {\n\t\t\tif ((e.target.type === MouseTargetType.CONTENT_VIEW_ZONE || e.target.type === MouseTargetType.GUTTER_VIEW_ZONE) && e.target.detail.viewZoneId === this._getViewZoneId()) {\n\t\t\t\tcurrentLineNumberOffset = this._updateLightBulbPosition(this._marginDomNode, e.event.browserEvent.y, lineHeight);\n\t\t\t\tthis.visibility = true;\n\t\t\t} else {\n\t\t\t\tthis.visibility = false;\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(enableCopySelection({\n\t\t\tdomNode: this._deletedCodeDomNode,\n\t\t\tgetViewZoneId: () => this._getViewZoneId(),\n\t\t\tdiffEntry: _diff,\n\t\t\toriginalModel: this._originalTextModel,\n\t\t\teditorLineHeight: lineHeight,\n\t\t\tviewLineCounts: this._viewLineCounts,\n\t\t\teditor: _modifiedEditor,\n\t\t\tshowContextMenu,\n\t\t\tclipboardService: _clipboardService,\n\t\t}));\n\t}\n\n\tprivate _updateLightBulbPosition(marginDomNode: HTMLElement, y: number, lineHeight: number): number {\n\t\tconst { top } = getDomNodePagePosition(marginDomNode);\n\t\tconst offset = y - top;\n\t\tconst lineNumberOffset = Math.floor(offset / lineHeight);\n\t\tconst newTop = lineNumberOffset * lineHeight;\n\t\tthis._diffActions.style.top = `${newTop}px`;\n\t\tif (this._viewLineCounts) {\n\t\t\tlet acc = 0;\n\t\t\tfor (let i = 0; i < this._viewLineCounts.length; i++) {\n\t\t\t\tacc += this._viewLineCounts[i];\n\t\t\t\tif (lineNumberOffset < acc) {\n\t\t\t\t\treturn i;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn lineNumberOffset;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/inlineDiffDeletedCodeMargin.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,6BAA6B,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC9G,OAAO,EAAE,MAAM,EAAE,MAAM,0CAA0C,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,MAAM,2CAA2C,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AACxE,OAAO,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,4CAA4C,CAAC;AAOvE,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAGzD,MAAM,OAAO,2BAA4B,SAAQ,UAAU;IAK1D,IAAI,UAAU;QACb,OAAO,IAAI,CAAC,WAAW,CAAC;IACzB,CAAC;IAED,IAAI,UAAU,CAAC,WAAoB;QAClC,IAAI,IAAI,CAAC,WAAW,KAAK,WAAW,EAAE,CAAC;YACtC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;YAC/B,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,UAAU,GAAG,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC;QACzE,CAAC;IACF,CAAC;IAED,YACkB,cAA4B,EAC5B,cAA2B,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/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { addStandardDisposableListener, getDomNodePagePosition } from '../../../../../../base/browser/dom.js';\nimport { Action } from '../../../../../../base/common/actions.js';\nimport { Codicon } from '../../../../../../base/common/codicons.js';\nimport { Disposable } from '../../../../../../base/common/lifecycle.js';\nimport { isIOS } from '../../../../../../base/common/platform.js';\nimport { ThemeIcon } from '../../../../../../base/common/themables.js';\nimport { IEditorMouseEvent, MouseTargetType } from '../../../../editorBrowser.js';\nimport { CodeEditorWidget } from '../../../codeEditor/codeEditorWidget.js';\nimport { DiffEditorWidget } from '../../diffEditorWidget.js';\nimport { EditorOption } from '../../../../../common/config/editorOptions.js';\nimport { DetailedLineRangeMapping } from '../../../../../common/diff/rangeMapping.js';\nimport { EndOfLineSequence, ITextModel } from '../../../../../common/model.js';\nimport { localize } from '../../../../../../nls.js';\nimport { IClipboardService } from '../../../../../../platform/clipboard/common/clipboardService.js';\nimport { IContextMenuService } from '../../../../../../platform/contextview/browser/contextView.js';\nimport { enableCopySelection } from './copySelection.js';\nimport { RenderLinesResult } from './renderLines.js';\n\nexport class InlineDiffDeletedCodeMargin extends Disposable {\n\tprivate readonly _diffActions: HTMLElement;\n\n\tprivate _visibility: boolean = false;\n\n\tget visibility(): boolean {\n\t\treturn this._visibility;\n\t}\n\n\tset visibility(_visibility: boolean) {\n\t\tif (this._visibility !== _visibility) {\n\t\t\tthis._visibility = _visibility;\n\t\t\tthis._diffActions.style.visibility = _visibility ? 'visible' : 'hidden';\n\t\t}\n\t}\n\n\tconstructor(\n\t\tprivate readonly _getViewZoneId: () => string,\n\t\tprivate readonly _marginDomNode: HTMLElement,\n\t\tprivate readonly _deletedCodeDomNode: HTMLElement,\n\t\tprivate readonly _modifiedEditor: CodeEditorWidget,\n\t\tprivate readonly _diff: DetailedLineRangeMapping,\n\t\tprivate readonly _editor: DiffEditorWidget,\n\t\tprivate readonly _renderLinesResult: RenderLinesResult,\n\t\tprivate readonly _originalTextModel: ITextModel,\n\t\tprivate readonly _contextMenuService: IContextMenuService,\n\t\tprivate readonly _clipboardService: IClipboardService,\n\t) {\n\t\tsuper();\n\n\t\t// make sure the diff margin shows above overlay.\n\t\tthis._marginDomNode.style.zIndex = '10';\n\n\t\tthis._diffActions = document.createElement('div');\n\t\tthis._diffActions.className = ThemeIcon.asClassName(Codicon.lightBulb) + ' lightbulb-glyph';\n\t\tthis._diffActions.style.position = 'absolute';\n\t\tconst lineHeight = this._modifiedEditor.getOption(EditorOption.lineHeight);\n\t\tthis._diffActions.style.right = '0px';\n\t\tthis._diffActions.style.visibility = 'hidden';\n\t\tthis._diffActions.style.height = `${lineHeight}px`;\n\t\tthis._diffActions.style.lineHeight = `${lineHeight}px`;\n\t\tthis._marginDomNode.appendChild(this._diffActions);\n\n\t\tlet currentLineNumberOffset = 0;\n\n\t\tconst useShadowDOM = _modifiedEditor.getOption(EditorOption.useShadowDOM) && !isIOS; // Do not use shadow dom on IOS #122035\n\t\tconst showContextMenu = (anchor: { x: number; y: number }, baseActions?: Action[], onHide?: () => void) => {\n\t\t\tthis._contextMenuService.showContextMenu({\n\t\t\t\tdomForShadowRoot: useShadowDOM ? _modifiedEditor.getDomNode() ?? undefined : undefined,\n\t\t\t\tgetAnchor: () => anchor,\n\t\t\t\tonHide,\n\t\t\t\tgetActions: () => {\n\t\t\t\t\tconst actions: Action[] = baseActions ?? [];\n\t\t\t\t\tconst isDeletion = _diff.modified.isEmpty;\n\n\t\t\t\t\t// default action\n\t\t\t\t\tactions.push(new Action(\n\t\t\t\t\t\t'diff.clipboard.copyDeletedContent',\n\t\t\t\t\t\tisDeletion\n\t\t\t\t\t\t\t? (_diff.original.length > 1\n\t\t\t\t\t\t\t\t? localize('diff.clipboard.copyDeletedLinesContent.label', \"Copy deleted lines\")\n\t\t\t\t\t\t\t\t: localize('diff.clipboard.copyDeletedLinesContent.single.label', \"Copy deleted line\"))\n\t\t\t\t\t\t\t: (_diff.original.length > 1\n\t\t\t\t\t\t\t\t? localize('diff.clipboard.copyChangedLinesContent.label', \"Copy changed lines\")\n\t\t\t\t\t\t\t\t: localize('diff.clipboard.copyChangedLinesContent.single.label', \"Copy changed line\")),\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\tasync () => {\n\t\t\t\t\t\t\tconst originalText = this._originalTextModel.getValueInRange(_diff.original.toExclusiveRange());\n\t\t\t\t\t\t\tawait this._clipboardService.writeText(originalText);\n\t\t\t\t\t\t}\n\t\t\t\t\t));\n\n\t\t\t\t\tif (_diff.original.length > 1) {\n\t\t\t\t\t\tactions.push(new Action(\n\t\t\t\t\t\t\t'diff.clipboard.copyDeletedLineContent',\n\t\t\t\t\t\t\tisDeletion\n\t\t\t\t\t\t\t\t? localize('diff.clipboard.copyDeletedLineContent.label', \"Copy deleted line ({0})\",\n\t\t\t\t\t\t\t\t\t_diff.original.startLineNumber + currentLineNumberOffset)\n\t\t\t\t\t\t\t\t: localize('diff.clipboard.copyChangedLineContent.label', \"Copy changed line ({0})\",\n\t\t\t\t\t\t\t\t\t_diff.original.startLineNumber + currentLineNumberOffset),\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\tasync () => {\n\t\t\t\t\t\t\t\tlet lineContent = this._originalTextModel.getLineContent(_diff.original.startLineNumber + currentLineNumberOffset);\n\t\t\t\t\t\t\t\tif (lineContent === '') {\n\t\t\t\t\t\t\t\t\t// empty line -> new line\n\t\t\t\t\t\t\t\t\tconst eof = this._originalTextModel.getEndOfLineSequence();\n\t\t\t\t\t\t\t\t\tlineContent = eof === EndOfLineSequence.LF ? '\\n' : '\\r\\n';\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tawait this._clipboardService.writeText(lineContent);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t));\n\t\t\t\t\t}\n\t\t\t\t\tconst readOnly = _modifiedEditor.getOption(EditorOption.readOnly);\n\t\t\t\t\tif (!readOnly) {\n\t\t\t\t\t\tactions.push(new Action(\n\t\t\t\t\t\t\t'diff.inline.revertChange',\n\t\t\t\t\t\t\tlocalize('diff.inline.revertChange.label', \"Revert this change\"),\n\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\tasync () => {\n\t\t\t\t\t\t\t\tthis._editor.revert(this._diff);\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\treturn actions;\n\t\t\t\t},\n\t\t\t\tautoSelectFirstItem: true\n\t\t\t});\n\t\t};\n\n\t\tthis._register(addStandardDisposableListener(this._diffActions, 'mousedown', e => {\n\t\t\tif (!e.leftButton) { return; }\n\n\t\t\tconst { top, height } = getDomNodePagePosition(this._diffActions);\n\t\t\tconst pad = Math.floor(lineHeight / 3);\n\t\t\te.preventDefault();\n\t\t\tshowContextMenu({ x: e.posx, y: top + height + pad });\n\t\t}));\n\n\t\tthis._register(_modifiedEditor.onMouseMove((e: IEditorMouseEvent) => {\n\t\t\tif ((e.target.type === MouseTargetType.CONTENT_VIEW_ZONE || e.target.type === MouseTargetType.GUTTER_VIEW_ZONE) && e.target.detail.viewZoneId === this._getViewZoneId()) {\n\t\t\t\tcurrentLineNumberOffset = this._updateLightBulbPosition(this._marginDomNode, e.event.browserEvent.y, lineHeight);\n\t\t\t\tthis.visibility = true;\n\t\t\t} else {\n\t\t\t\tthis.visibility = false;\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(enableCopySelection({\n\t\t\tdomNode: this._deletedCodeDomNode,\n\t\t\tdiffEntry: _diff,\n\t\t\toriginalModel: this._originalTextModel,\n\t\t\trenderLinesResult: this._renderLinesResult,\n\t\t\tclipboardService: _clipboardService,\n\t\t}));\n\t}\n\n\tprivate _updateLightBulbPosition(marginDomNode: HTMLElement, y: number, lineHeight: number): number {\n\t\tconst { top } = getDomNodePagePosition(marginDomNode);\n\t\tconst offset = y - top;\n\t\tconst lineNumberOffset = Math.floor(offset / lineHeight);\n\t\tconst newTop = lineNumberOffset * lineHeight;\n\t\tthis._diffActions.style.top = `${newTop}px`;\n\t\tif (this._renderLinesResult.viewLineCounts) {\n\t\t\tlet acc = 0;\n\t\t\tfor (let i = 0; i < this._renderLinesResult.viewLineCounts.length; i++) {\n\t\t\t\tacc += this._renderLinesResult.viewLineCounts[i];\n\t\t\t\tif (lineNumberOffset < acc) {\n\t\t\t\t\treturn i;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn lineNumberOffset;\n\t}\n}\n"]}
|
package/esm/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/renderLines.js
CHANGED
|
@@ -5,10 +5,12 @@
|
|
|
5
5
|
import { createTrustedTypesPolicy } from '../../../../../../base/browser/trustedTypes.js';
|
|
6
6
|
import { applyFontInfo } from '../../../../config/domFontInfo.js';
|
|
7
7
|
import { EditorFontLigatures } from '../../../../../common/config/editorOptions.js';
|
|
8
|
+
import { Position } from '../../../../../common/core/position.js';
|
|
8
9
|
import { StringBuilder } from '../../../../../common/core/stringBuilder.js';
|
|
9
10
|
import { LineDecoration } from '../../../../../common/viewLayout/lineDecorations.js';
|
|
10
|
-
import { RenderLineInput, renderViewLine } from '../../../../../common/viewLayout/viewLineRenderer.js';
|
|
11
|
+
import { RenderLineInput, RenderLineOutput, renderViewLine } from '../../../../../common/viewLayout/viewLineRenderer.js';
|
|
11
12
|
import { ViewLineRenderingData } from '../../../../../common/viewModel.js';
|
|
13
|
+
import { getColumnOfNodeOffset } from '../../../../viewParts/viewLines/viewLine.js';
|
|
12
14
|
const ttPolicy = createTrustedTypesPolicy('diffEditorWidget', { createHTML: value => value });
|
|
13
15
|
export function renderLines(source, options, decorations, domNode, noExtra = false) {
|
|
14
16
|
applyFontInfo(domNode, options.fontInfo);
|
|
@@ -17,6 +19,7 @@ export function renderLines(source, options, decorations, domNode, noExtra = fal
|
|
|
17
19
|
let maxCharsPerLine = 0;
|
|
18
20
|
let renderedLineCount = 0;
|
|
19
21
|
const viewLineCounts = [];
|
|
22
|
+
const renderOutputs = [];
|
|
20
23
|
for (let lineIndex = 0; lineIndex < source.lineTokens.length; lineIndex++) {
|
|
21
24
|
const lineNumber = lineIndex + 1;
|
|
22
25
|
const lineTokens = source.lineTokens[lineIndex];
|
|
@@ -26,7 +29,9 @@ export function renderLines(source, options, decorations, domNode, noExtra = fal
|
|
|
26
29
|
let lastBreakOffset = 0;
|
|
27
30
|
for (const breakOffset of lineBreakData.breakOffsets) {
|
|
28
31
|
const viewLineTokens = lineTokens.sliceAndInflate(lastBreakOffset, breakOffset, 0);
|
|
29
|
-
|
|
32
|
+
const result = renderOriginalLine(renderedLineCount, viewLineTokens, LineDecoration.extractWrapped(actualDecorations, lastBreakOffset, breakOffset), hasCharChanges, source.mightContainNonBasicASCII, source.mightContainRTL, options, sb, noExtra);
|
|
33
|
+
maxCharsPerLine = Math.max(maxCharsPerLine, result.maxCharWidth);
|
|
34
|
+
renderOutputs.push(new RenderLineOutputWithOffset(result.output.characterMapping, result.output.containsForeignElements, lastBreakOffset));
|
|
30
35
|
renderedLineCount++;
|
|
31
36
|
lastBreakOffset = breakOffset;
|
|
32
37
|
}
|
|
@@ -34,7 +39,9 @@ export function renderLines(source, options, decorations, domNode, noExtra = fal
|
|
|
34
39
|
}
|
|
35
40
|
else {
|
|
36
41
|
viewLineCounts.push(1);
|
|
37
|
-
|
|
42
|
+
const result = renderOriginalLine(renderedLineCount, lineTokens, actualDecorations, hasCharChanges, source.mightContainNonBasicASCII, source.mightContainRTL, options, sb, noExtra);
|
|
43
|
+
maxCharsPerLine = Math.max(maxCharsPerLine, result.maxCharWidth);
|
|
44
|
+
renderOutputs.push(new RenderLineOutputWithOffset(result.output.characterMapping, result.output.containsForeignElements, 0));
|
|
38
45
|
renderedLineCount++;
|
|
39
46
|
}
|
|
40
47
|
}
|
|
@@ -43,11 +50,7 @@ export function renderLines(source, options, decorations, domNode, noExtra = fal
|
|
|
43
50
|
const trustedhtml = ttPolicy ? ttPolicy.createHTML(html) : html;
|
|
44
51
|
domNode.innerHTML = trustedhtml;
|
|
45
52
|
const minWidthInPx = (maxCharsPerLine * options.typicalHalfwidthCharacterWidth);
|
|
46
|
-
return
|
|
47
|
-
heightInLines: renderedLineCount,
|
|
48
|
-
minWidthInPx,
|
|
49
|
-
viewLineCounts,
|
|
50
|
-
};
|
|
53
|
+
return new RenderLinesResult(renderedLineCount, minWidthInPx, viewLineCounts, renderOutputs, source);
|
|
51
54
|
}
|
|
52
55
|
export class LineSource {
|
|
53
56
|
constructor(lineTokens, lineBreakData = lineTokens.map(t => null), mightContainNonBasicASCII = true, mightContainRTL = true) {
|
|
@@ -86,6 +89,74 @@ export class RenderOptions {
|
|
|
86
89
|
return new RenderOptions(this.tabSize, this.fontInfo, this.disableMonospaceOptimizations, this.typicalHalfwidthCharacterWidth, scrollBeyondLastColumn, this.lineHeight, this.lineDecorationsWidth, this.stopRenderingLineAfter, this.renderWhitespace, this.renderControlCharacters, this.fontLigatures, this.verticalScrollbarSize, this.setWidth);
|
|
87
90
|
}
|
|
88
91
|
}
|
|
92
|
+
export class RenderLinesResult {
|
|
93
|
+
constructor(heightInLines, minWidthInPx, viewLineCounts, _renderOutputs, _source) {
|
|
94
|
+
this.heightInLines = heightInLines;
|
|
95
|
+
this.minWidthInPx = minWidthInPx;
|
|
96
|
+
this.viewLineCounts = viewLineCounts;
|
|
97
|
+
this._renderOutputs = _renderOutputs;
|
|
98
|
+
this._source = _source;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Returns the model position for a given DOM node and offset within that node.
|
|
102
|
+
* @param domNode The span node within a view-line where the offset is located
|
|
103
|
+
* @param offset The offset within the span node
|
|
104
|
+
* @returns The Position in the model, or undefined if the position cannot be determined
|
|
105
|
+
*/
|
|
106
|
+
getModelPositionAt(domNode, offset) {
|
|
107
|
+
// Find the view-line element that contains this span
|
|
108
|
+
let viewLineElement = domNode;
|
|
109
|
+
while (viewLineElement && !viewLineElement.classList.contains('view-line')) {
|
|
110
|
+
viewLineElement = viewLineElement.parentElement;
|
|
111
|
+
}
|
|
112
|
+
if (!viewLineElement) {
|
|
113
|
+
return undefined;
|
|
114
|
+
}
|
|
115
|
+
// Find the container that has all view lines
|
|
116
|
+
const container = viewLineElement.parentElement;
|
|
117
|
+
if (!container) {
|
|
118
|
+
return undefined;
|
|
119
|
+
}
|
|
120
|
+
// Find the view line index based on the element
|
|
121
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
122
|
+
const viewLines = container.querySelectorAll('.view-line');
|
|
123
|
+
let viewLineIndex = -1;
|
|
124
|
+
for (let i = 0; i < viewLines.length; i++) {
|
|
125
|
+
if (viewLines[i] === viewLineElement) {
|
|
126
|
+
viewLineIndex = i;
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
if (viewLineIndex === -1 || viewLineIndex >= this._renderOutputs.length) {
|
|
131
|
+
return undefined;
|
|
132
|
+
}
|
|
133
|
+
// Map view line index back to model line
|
|
134
|
+
let modelLineNumber = 1;
|
|
135
|
+
let remainingViewLines = viewLineIndex;
|
|
136
|
+
for (let i = 0; i < this.viewLineCounts.length; i++) {
|
|
137
|
+
if (remainingViewLines < this.viewLineCounts[i]) {
|
|
138
|
+
modelLineNumber = i + 1;
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
remainingViewLines -= this.viewLineCounts[i];
|
|
142
|
+
}
|
|
143
|
+
if (modelLineNumber > this._source.lineTokens.length) {
|
|
144
|
+
return undefined;
|
|
145
|
+
}
|
|
146
|
+
const renderOutput = this._renderOutputs[viewLineIndex];
|
|
147
|
+
if (!renderOutput) {
|
|
148
|
+
return undefined;
|
|
149
|
+
}
|
|
150
|
+
const column = getColumnOfNodeOffset(renderOutput.characterMapping, domNode, offset) + renderOutput.offset;
|
|
151
|
+
return new Position(modelLineNumber, column);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
class RenderLineOutputWithOffset extends RenderLineOutput {
|
|
155
|
+
constructor(characterMapping, containsForeignElements, offset) {
|
|
156
|
+
super(characterMapping, containsForeignElements);
|
|
157
|
+
this.offset = offset;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
89
160
|
function renderOriginalLine(viewLineIdx, lineTokens, decorations, hasCharChanges, mightContainNonBasicASCII, mightContainRTL, options, sb, noExtra) {
|
|
90
161
|
sb.appendString('<div class="view-line');
|
|
91
162
|
if (!noExtra && !hasCharChanges) {
|
|
@@ -106,6 +177,7 @@ function renderOriginalLine(viewLineIdx, lineTokens, decorations, hasCharChanges
|
|
|
106
177
|
const output = renderViewLine(new RenderLineInput((options.fontInfo.isMonospace && !options.disableMonospaceOptimizations), options.fontInfo.canUseHalfwidthRightwardsArrow, lineContent, false, isBasicASCII, containsRTL, 0, lineTokens, decorations, options.tabSize, 0, options.fontInfo.spaceWidth, options.fontInfo.middotWidth, options.fontInfo.wsmiddotWidth, options.stopRenderingLineAfter, options.renderWhitespace, options.renderControlCharacters, options.fontLigatures !== EditorFontLigatures.OFF, null, // Send no selections, original line cannot be selected
|
|
107
178
|
null, options.verticalScrollbarSize), sb);
|
|
108
179
|
sb.appendString('</div>');
|
|
109
|
-
|
|
180
|
+
const maxCharWidth = output.characterMapping.getHorizontalOffset(output.characterMapping.length);
|
|
181
|
+
return { output, maxCharWidth };
|
|
110
182
|
}
|
|
111
183
|
//# sourceMappingURL=renderLines.js.map
|
package/esm/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/renderLines.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/renderLines.ts","vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/renderLines.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAA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AAI,CAAC,OAAO,CAAC,6BAA6B,CAAC,EACxE,OAAO,CAAC,QAAQ,CAAC,8BAA8B,EAC/C,WAAW,EACX,KAAK,EACL,YAAY,EACZ,WAAW,EACX,CAAC,EACD,UAAU,EACV,WAAW,EACX,OAAO,CAAC,OAAO,EACf,CAAC,EACD,OAAO,CAAC,QAAQ,CAAC,UAAU,EAC3B,OAAO,CAAC,QAAQ,CAAC,WAAW,EAC5B,OAAO,CAAC,QAAQ,CAAC,aAAa,EAC9B,OAAO,CAAC,sBAAsB,EAC9B,OAAO,CAAC,gBAAgB,EACxB,OAAO,CAAC,uBAAuB,EAC/B,OAAO,CAAC,aAAa,KAAK,mBAAmB,CAAC,GAAG,EACjD,IAAI,EAAE,uDAAuD;IAC7D,IAAI,EACJ,OAAO,CAAC,qBAAqB,CAC7B,EAAE,EAAE,CAAC,CAAC;IAEP,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IAE1B,OAAO,MAAM,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;AACpF,CAAC","file":"renderLines.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { createTrustedTypesPolicy } from '../../../../../../base/browser/trustedTypes.js';\nimport { applyFontInfo } from '../../../../config/domFontInfo.js';\nimport { ICodeEditor } from '../../../../editorBrowser.js';\nimport { EditorFontLigatures, EditorOption, FindComputedEditorOptionValueById } from '../../../../../common/config/editorOptions.js';\nimport { FontInfo } from '../../../../../common/config/fontInfo.js';\nimport { StringBuilder } from '../../../../../common/core/stringBuilder.js';\nimport { ModelLineProjectionData } from '../../../../../common/modelLineProjectionData.js';\nimport { IViewLineTokens, LineTokens } from '../../../../../common/tokens/lineTokens.js';\nimport { LineDecoration } from '../../../../../common/viewLayout/lineDecorations.js';\nimport { RenderLineInput, renderViewLine } from '../../../../../common/viewLayout/viewLineRenderer.js';\nimport { ViewLineRenderingData } from '../../../../../common/viewModel.js';\nimport { InlineDecoration } from '../../../../../common/viewModel/inlineDecorations.js';\n\nconst ttPolicy = createTrustedTypesPolicy('diffEditorWidget', { createHTML: value => value });\n\nexport function renderLines(source: LineSource, options: RenderOptions, decorations: InlineDecoration[], domNode: HTMLElement, noExtra = false): RenderLinesResult {\n\tapplyFontInfo(domNode, options.fontInfo);\n\n\tconst hasCharChanges = (decorations.length > 0);\n\n\tconst sb = new StringBuilder(10000);\n\tlet maxCharsPerLine = 0;\n\tlet renderedLineCount = 0;\n\tconst viewLineCounts: number[] = [];\n\tfor (let lineIndex = 0; lineIndex < source.lineTokens.length; lineIndex++) {\n\t\tconst lineNumber = lineIndex + 1;\n\t\tconst lineTokens = source.lineTokens[lineIndex];\n\t\tconst lineBreakData = source.lineBreakData[lineIndex];\n\t\tconst actualDecorations = LineDecoration.filter(decorations, lineNumber, 1, Number.MAX_SAFE_INTEGER);\n\n\t\tif (lineBreakData) {\n\t\t\tlet lastBreakOffset = 0;\n\t\t\tfor (const breakOffset of lineBreakData.breakOffsets) {\n\t\t\t\tconst viewLineTokens = lineTokens.sliceAndInflate(lastBreakOffset, breakOffset, 0);\n\t\t\t\tmaxCharsPerLine = Math.max(maxCharsPerLine, renderOriginalLine(\n\t\t\t\t\trenderedLineCount,\n\t\t\t\t\tviewLineTokens,\n\t\t\t\t\tLineDecoration.extractWrapped(actualDecorations, lastBreakOffset, breakOffset),\n\t\t\t\t\thasCharChanges,\n\t\t\t\t\tsource.mightContainNonBasicASCII,\n\t\t\t\t\tsource.mightContainRTL,\n\t\t\t\t\toptions,\n\t\t\t\t\tsb,\n\t\t\t\t\tnoExtra,\n\t\t\t\t));\n\t\t\t\trenderedLineCount++;\n\t\t\t\tlastBreakOffset = breakOffset;\n\t\t\t}\n\t\t\tviewLineCounts.push(lineBreakData.breakOffsets.length);\n\t\t} else {\n\t\t\tviewLineCounts.push(1);\n\t\t\tmaxCharsPerLine = Math.max(maxCharsPerLine, renderOriginalLine(\n\t\t\t\trenderedLineCount,\n\t\t\t\tlineTokens,\n\t\t\t\tactualDecorations,\n\t\t\t\thasCharChanges,\n\t\t\t\tsource.mightContainNonBasicASCII,\n\t\t\t\tsource.mightContainRTL,\n\t\t\t\toptions,\n\t\t\t\tsb,\n\t\t\t\tnoExtra,\n\t\t\t));\n\t\t\trenderedLineCount++;\n\t\t}\n\t}\n\tmaxCharsPerLine += options.scrollBeyondLastColumn;\n\n\tconst html = sb.build();\n\tconst trustedhtml = ttPolicy ? ttPolicy.createHTML(html) : html;\n\tdomNode.innerHTML = trustedhtml as string;\n\tconst minWidthInPx = (maxCharsPerLine * options.typicalHalfwidthCharacterWidth);\n\n\treturn {\n\t\theightInLines: renderedLineCount,\n\t\tminWidthInPx,\n\t\tviewLineCounts,\n\t};\n}\n\n\nexport class LineSource {\n\tconstructor(\n\t\tpublic readonly lineTokens: LineTokens[],\n\t\tpublic readonly lineBreakData: (ModelLineProjectionData | null)[] = lineTokens.map(t => null),\n\t\tpublic readonly mightContainNonBasicASCII: boolean = true,\n\t\tpublic readonly mightContainRTL: boolean = true,\n\t) { }\n}\n\nexport class RenderOptions {\n\tpublic static fromEditor(editor: ICodeEditor): RenderOptions {\n\n\t\tconst modifiedEditorOptions = editor.getOptions();\n\t\tconst fontInfo = modifiedEditorOptions.get(EditorOption.fontInfo);\n\t\tconst layoutInfo = modifiedEditorOptions.get(EditorOption.layoutInfo);\n\n\t\treturn new RenderOptions(\n\t\t\teditor.getModel()?.getOptions().tabSize || 0,\n\t\t\tfontInfo,\n\t\t\tmodifiedEditorOptions.get(EditorOption.disableMonospaceOptimizations),\n\t\t\tfontInfo.typicalHalfwidthCharacterWidth,\n\t\t\tmodifiedEditorOptions.get(EditorOption.scrollBeyondLastColumn),\n\n\t\t\tmodifiedEditorOptions.get(EditorOption.lineHeight),\n\n\t\t\tlayoutInfo.decorationsWidth,\n\t\t\tmodifiedEditorOptions.get(EditorOption.stopRenderingLineAfter),\n\t\t\tmodifiedEditorOptions.get(EditorOption.renderWhitespace),\n\t\t\tmodifiedEditorOptions.get(EditorOption.renderControlCharacters),\n\t\t\tmodifiedEditorOptions.get(EditorOption.fontLigatures),\n\t\t\tmodifiedEditorOptions.get(EditorOption.scrollbar).verticalScrollbarSize,\n\t\t);\n\t}\n\n\tconstructor(\n\t\tpublic readonly tabSize: number,\n\t\tpublic readonly fontInfo: FontInfo,\n\t\tpublic readonly disableMonospaceOptimizations: boolean,\n\t\tpublic readonly typicalHalfwidthCharacterWidth: number,\n\t\tpublic readonly scrollBeyondLastColumn: number,\n\t\tpublic readonly lineHeight: number,\n\t\tpublic readonly lineDecorationsWidth: number,\n\t\tpublic readonly stopRenderingLineAfter: number,\n\t\tpublic readonly renderWhitespace: FindComputedEditorOptionValueById<EditorOption.renderWhitespace>,\n\t\tpublic readonly renderControlCharacters: boolean,\n\t\tpublic readonly fontLigatures: FindComputedEditorOptionValueById<EditorOption.fontLigatures>,\n\t\tpublic readonly verticalScrollbarSize: number,\n\t\tpublic readonly setWidth = true,\n\t) { }\n\n\tpublic withSetWidth(setWidth: boolean): RenderOptions {\n\t\treturn new RenderOptions(\n\t\t\tthis.tabSize,\n\t\t\tthis.fontInfo,\n\t\t\tthis.disableMonospaceOptimizations,\n\t\t\tthis.typicalHalfwidthCharacterWidth,\n\t\t\tthis.scrollBeyondLastColumn,\n\t\t\tthis.lineHeight,\n\t\t\tthis.lineDecorationsWidth,\n\t\t\tthis.stopRenderingLineAfter,\n\t\t\tthis.renderWhitespace,\n\t\t\tthis.renderControlCharacters,\n\t\t\tthis.fontLigatures,\n\t\t\tthis.verticalScrollbarSize,\n\t\t\tsetWidth,\n\t\t);\n\t}\n\n\tpublic withScrollBeyondLastColumn(scrollBeyondLastColumn: number): RenderOptions {\n\t\treturn new RenderOptions(\n\t\t\tthis.tabSize,\n\t\t\tthis.fontInfo,\n\t\t\tthis.disableMonospaceOptimizations,\n\t\t\tthis.typicalHalfwidthCharacterWidth,\n\t\t\tscrollBeyondLastColumn,\n\t\t\tthis.lineHeight,\n\t\t\tthis.lineDecorationsWidth,\n\t\t\tthis.stopRenderingLineAfter,\n\t\t\tthis.renderWhitespace,\n\t\t\tthis.renderControlCharacters,\n\t\t\tthis.fontLigatures,\n\t\t\tthis.verticalScrollbarSize,\n\t\t\tthis.setWidth,\n\t\t);\n\t}\n}\n\nexport interface RenderLinesResult {\n\tminWidthInPx: number;\n\theightInLines: number;\n\tviewLineCounts: number[];\n}\n\nfunction renderOriginalLine(\n\tviewLineIdx: number,\n\tlineTokens: IViewLineTokens,\n\tdecorations: LineDecoration[],\n\thasCharChanges: boolean,\n\tmightContainNonBasicASCII: boolean,\n\tmightContainRTL: boolean,\n\toptions: RenderOptions,\n\tsb: StringBuilder,\n\tnoExtra: boolean,\n): number {\n\n\tsb.appendString('<div class=\"view-line');\n\tif (!noExtra && !hasCharChanges) {\n\t\t// No char changes\n\t\tsb.appendString(' char-delete');\n\t}\n\tsb.appendString('\" style=\"top:');\n\tsb.appendString(String(viewLineIdx * options.lineHeight));\n\tif (options.setWidth) {\n\t\tsb.appendString('px;width:1000000px;\">');\n\t} else {\n\t\tsb.appendString('px;\">');\n\t}\n\n\tconst lineContent = lineTokens.getLineContent();\n\tconst isBasicASCII = ViewLineRenderingData.isBasicASCII(lineContent, mightContainNonBasicASCII);\n\tconst containsRTL = ViewLineRenderingData.containsRTL(lineContent, isBasicASCII, mightContainRTL);\n\tconst output = renderViewLine(new RenderLineInput(\n\t\t(options.fontInfo.isMonospace && !options.disableMonospaceOptimizations),\n\t\toptions.fontInfo.canUseHalfwidthRightwardsArrow,\n\t\tlineContent,\n\t\tfalse,\n\t\tisBasicASCII,\n\t\tcontainsRTL,\n\t\t0,\n\t\tlineTokens,\n\t\tdecorations,\n\t\toptions.tabSize,\n\t\t0,\n\t\toptions.fontInfo.spaceWidth,\n\t\toptions.fontInfo.middotWidth,\n\t\toptions.fontInfo.wsmiddotWidth,\n\t\toptions.stopRenderingLineAfter,\n\t\toptions.renderWhitespace,\n\t\toptions.renderControlCharacters,\n\t\toptions.fontLigatures !== EditorFontLigatures.OFF,\n\t\tnull, // Send no selections, original line cannot be selected\n\t\tnull,\n\t\toptions.verticalScrollbarSize\n\t), sb);\n\n\tsb.appendString('</div>');\n\n\treturn output.characterMapping.getHorizontalOffset(output.characterMapping.length);\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { createTrustedTypesPolicy } from '../../../../../../base/browser/trustedTypes.js';\nimport { applyFontInfo } from '../../../../config/domFontInfo.js';\nimport { ICodeEditor } from '../../../../editorBrowser.js';\nimport { EditorFontLigatures, EditorOption, FindComputedEditorOptionValueById } from '../../../../../common/config/editorOptions.js';\nimport { FontInfo } from '../../../../../common/config/fontInfo.js';\nimport { StringBuilder } from '../../../../../common/core/stringBuilder.js';\nimport { ModelLineProjectionData } from '../../../../../common/modelLineProjectionData.js';\nimport { IViewLineTokens, LineTokens } from '../../../../../common/tokens/lineTokens.js';\nimport { LineDecoration } from '../../../../../common/viewLayout/lineDecorations.js';\nimport { RenderLineInput, renderViewLine } from '../../../../../common/viewLayout/viewLineRenderer.js';\nimport { ViewLineRenderingData } from '../../../../../common/viewModel.js';\nimport { InlineDecoration } from '../../../../../common/viewModel/inlineDecorations.js';\n\nconst ttPolicy = createTrustedTypesPolicy('diffEditorWidget', { createHTML: value => value });\n\nexport function renderLines(source: LineSource, options: RenderOptions, decorations: InlineDecoration[], domNode: HTMLElement, noExtra = false): RenderLinesResult {\n\tapplyFontInfo(domNode, options.fontInfo);\n\n\tconst hasCharChanges = (decorations.length > 0);\n\n\tconst sb = new StringBuilder(10000);\n\tlet maxCharsPerLine = 0;\n\tlet renderedLineCount = 0;\n\tconst viewLineCounts: number[] = [];\n\tfor (let lineIndex = 0; lineIndex < source.lineTokens.length; lineIndex++) {\n\t\tconst lineNumber = lineIndex + 1;\n\t\tconst lineTokens = source.lineTokens[lineIndex];\n\t\tconst lineBreakData = source.lineBreakData[lineIndex];\n\t\tconst actualDecorations = LineDecoration.filter(decorations, lineNumber, 1, Number.MAX_SAFE_INTEGER);\n\n\t\tif (lineBreakData) {\n\t\t\tlet lastBreakOffset = 0;\n\t\t\tfor (const breakOffset of lineBreakData.breakOffsets) {\n\t\t\t\tconst viewLineTokens = lineTokens.sliceAndInflate(lastBreakOffset, breakOffset, 0);\n\t\t\t\tmaxCharsPerLine = Math.max(maxCharsPerLine, renderOriginalLine(\n\t\t\t\t\trenderedLineCount,\n\t\t\t\t\tviewLineTokens,\n\t\t\t\t\tLineDecoration.extractWrapped(actualDecorations, lastBreakOffset, breakOffset),\n\t\t\t\t\thasCharChanges,\n\t\t\t\t\tsource.mightContainNonBasicASCII,\n\t\t\t\t\tsource.mightContainRTL,\n\t\t\t\t\toptions,\n\t\t\t\t\tsb,\n\t\t\t\t\tnoExtra,\n\t\t\t\t));\n\t\t\t\trenderedLineCount++;\n\t\t\t\tlastBreakOffset = breakOffset;\n\t\t\t}\n\t\t\tviewLineCounts.push(lineBreakData.breakOffsets.length);\n\t\t} else {\n\t\t\tviewLineCounts.push(1);\n\t\t\tmaxCharsPerLine = Math.max(maxCharsPerLine, renderOriginalLine(\n\t\t\t\trenderedLineCount,\n\t\t\t\tlineTokens,\n\t\t\t\tactualDecorations,\n\t\t\t\thasCharChanges,\n\t\t\t\tsource.mightContainNonBasicASCII,\n\t\t\t\tsource.mightContainRTL,\n\t\t\t\toptions,\n\t\t\t\tsb,\n\t\t\t\tnoExtra,\n\t\t\t));\n\t\t\trenderedLineCount++;\n\t\t}\n\t}\n\tmaxCharsPerLine += options.scrollBeyondLastColumn;\n\n\tconst html = sb.build();\n\tconst trustedhtml = ttPolicy ? ttPolicy.createHTML(html) : html;\n\tdomNode.innerHTML = trustedhtml as string;\n\tconst minWidthInPx = (maxCharsPerLine * options.typicalHalfwidthCharacterWidth);\n\n\treturn {\n\t\theightInLines: renderedLineCount,\n\t\tminWidthInPx,\n\t\tviewLineCounts,\n\t};\n}\n\n\nexport class LineSource {\n\tconstructor(\n\t\tpublic readonly lineTokens: LineTokens[],\n\t\tpublic readonly lineBreakData: (ModelLineProjectionData | null)[] = lineTokens.map(t => null),\n\t\tpublic readonly mightContainNonBasicASCII: boolean = true,\n\t\tpublic readonly mightContainRTL: boolean = true,\n\t) { }\n}\n\nexport class RenderOptions {\n\tpublic static fromEditor(editor: ICodeEditor): RenderOptions {\n\n\t\tconst modifiedEditorOptions = editor.getOptions();\n\t\tconst fontInfo = modifiedEditorOptions.get(EditorOption.fontInfo);\n\t\tconst layoutInfo = modifiedEditorOptions.get(EditorOption.layoutInfo);\n\n\t\treturn new RenderOptions(\n\t\t\teditor.getModel()?.getOptions().tabSize || 0,\n\t\t\tfontInfo,\n\t\t\tmodifiedEditorOptions.get(EditorOption.disableMonospaceOptimizations),\n\t\t\tfontInfo.typicalHalfwidthCharacterWidth,\n\t\t\tmodifiedEditorOptions.get(EditorOption.scrollBeyondLastColumn),\n\n\t\t\tmodifiedEditorOptions.get(EditorOption.lineHeight),\n\n\t\t\tlayoutInfo.decorationsWidth,\n\t\t\tmodifiedEditorOptions.get(EditorOption.stopRenderingLineAfter),\n\t\t\tmodifiedEditorOptions.get(EditorOption.renderWhitespace),\n\t\t\tmodifiedEditorOptions.get(EditorOption.renderControlCharacters),\n\t\t\tmodifiedEditorOptions.get(EditorOption.fontLigatures),\n\t\t\tmodifiedEditorOptions.get(EditorOption.scrollbar).verticalScrollbarSize,\n\t\t);\n\t}\n\n\tconstructor(\n\t\tpublic readonly tabSize: number,\n\t\tpublic readonly fontInfo: FontInfo,\n\t\tpublic readonly disableMonospaceOptimizations: boolean,\n\t\tpublic readonly typicalHalfwidthCharacterWidth: number,\n\t\tpublic readonly scrollBeyondLastColumn: number,\n\t\tpublic readonly lineHeight: number,\n\t\tpublic readonly lineDecorationsWidth: number,\n\t\tpublic readonly stopRenderingLineAfter: number,\n\t\tpublic readonly renderWhitespace: FindComputedEditorOptionValueById<EditorOption.renderWhitespace>,\n\t\tpublic readonly renderControlCharacters: boolean,\n\t\tpublic readonly fontLigatures: FindComputedEditorOptionValueById<EditorOption.fontLigatures>,\n\t\tpublic readonly verticalScrollbarSize: number,\n\t\tpublic readonly setWidth = true,\n\t) { }\n\n\tpublic withSetWidth(setWidth: boolean): RenderOptions {\n\t\treturn new RenderOptions(\n\t\t\tthis.tabSize,\n\t\t\tthis.fontInfo,\n\t\t\tthis.disableMonospaceOptimizations,\n\t\t\tthis.typicalHalfwidthCharacterWidth,\n\t\t\tthis.scrollBeyondLastColumn,\n\t\t\tthis.lineHeight,\n\t\t\tthis.lineDecorationsWidth,\n\t\t\tthis.stopRenderingLineAfter,\n\t\t\tthis.renderWhitespace,\n\t\t\tthis.renderControlCharacters,\n\t\t\tthis.fontLigatures,\n\t\t\tthis.verticalScrollbarSize,\n\t\t\tsetWidth,\n\t\t);\n\t}\n\n\tpublic withScrollBeyondLastColumn(scrollBeyondLastColumn: number): RenderOptions {\n\t\treturn new RenderOptions(\n\t\t\tthis.tabSize,\n\t\t\tthis.fontInfo,\n\t\t\tthis.disableMonospaceOptimizations,\n\t\t\tthis.typicalHalfwidthCharacterWidth,\n\t\t\tscrollBeyondLastColumn,\n\t\t\tthis.lineHeight,\n\t\t\tthis.lineDecorationsWidth,\n\t\t\tthis.stopRenderingLineAfter,\n\t\t\tthis.renderWhitespace,\n\t\t\tthis.renderControlCharacters,\n\t\t\tthis.fontLigatures,\n\t\t\tthis.verticalScrollbarSize,\n\t\t\tthis.setWidth,\n\t\t);\n\t}\n}\n\nexport interface RenderLinesResult {\n\tminWidthInPx: number;\n\theightInLines: number;\n\tviewLineCounts: number[];\n}\n\nfunction renderOriginalLine(\n\tviewLineIdx: number,\n\tlineTokens: IViewLineTokens,\n\tdecorations: LineDecoration[],\n\thasCharChanges: boolean,\n\tmightContainNonBasicASCII: boolean,\n\tmightContainRTL: boolean,\n\toptions: RenderOptions,\n\tsb: StringBuilder,\n\tnoExtra: boolean,\n): number {\n\n\tsb.appendString('<div class=\"view-line');\n\tif (!noExtra && !hasCharChanges) {\n\t\t// No char changes\n\t\tsb.appendString(' char-delete');\n\t}\n\tsb.appendString('\" style=\"top:');\n\tsb.appendString(String(viewLineIdx * options.lineHeight));\n\tif (options.setWidth) {\n\t\tsb.appendString('px;width:1000000px;\">');\n\t} else {\n\t\tsb.appendString('px;\">');\n\t}\n\n\tconst lineContent = lineTokens.getLineContent();\n\tconst isBasicASCII = ViewLineRenderingData.isBasicASCII(lineContent, mightContainNonBasicASCII);\n\tconst containsRTL = ViewLineRenderingData.containsRTL(lineContent, isBasicASCII, mightContainRTL);\n\tconst output = renderViewLine(new RenderLineInput(\n\t\t(options.fontInfo.isMonospace && !options.disableMonospaceOptimizations),\n\t\toptions.fontInfo.canUseHalfwidthRightwardsArrow,\n\t\tlineContent,\n\t\tfalse,\n\t\tisBasicASCII,\n\t\tcontainsRTL,\n\t\t0,\n\t\tlineTokens,\n\t\tdecorations,\n\t\toptions.tabSize,\n\t\t0,\n\t\toptions.fontInfo.spaceWidth,\n\t\toptions.fontInfo.middotWidth,\n\t\toptions.fontInfo.wsmiddotWidth,\n\t\toptions.stopRenderingLineAfter,\n\t\toptions.renderWhitespace,\n\t\toptions.renderControlCharacters,\n\t\toptions.fontLigatures !== EditorFontLigatures.OFF,\n\t\tnull, // Send no selections, original line cannot be selected\n\t\tnull,\n\t\toptions.verticalScrollbarSize\n\t), sb);\n\n\tsb.appendString('</div>');\n\n\treturn output.characterMapping.getHorizontalOffset(output.characterMapping.length);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/renderLines.ts","vs/editor/browser/widget/diffEditor/components/di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AC","file":"renderLines.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { createTrustedTypesPolicy } from '../../../../../../base/browser/trustedTypes.js';\nimport { applyFontInfo } from '../../../../config/domFontInfo.js';\nimport { ICodeEditor } from '../../../../editorBrowser.js';\nimport { EditorFontLigatures, EditorOption, FindComputedEditorOptionValueById } from '../../../../../common/config/editorOptions.js';\nimport { FontInfo } from '../../../../../common/config/fontInfo.js';\nimport { Position } from '../../../../../common/core/position.js';\nimport { StringBuilder } from '../../../../../common/core/stringBuilder.js';\nimport { ModelLineProjectionData } from '../../../../../common/modelLineProjectionData.js';\nimport { IViewLineTokens, LineTokens } from '../../../../../common/tokens/lineTokens.js';\nimport { LineDecoration } from '../../../../../common/viewLayout/lineDecorations.js';\nimport { CharacterMapping, ForeignElementType, RenderLineInput, RenderLineOutput, renderViewLine } from '../../../../../common/viewLayout/viewLineRenderer.js';\nimport { ViewLineRenderingData } from '../../../../../common/viewModel.js';\nimport { InlineDecoration } from '../../../../../common/viewModel/inlineDecorations.js';\nimport { getColumnOfNodeOffset } from '../../../../viewParts/viewLines/viewLine.js';\n\nconst ttPolicy = createTrustedTypesPolicy('diffEditorWidget', { createHTML: value => value });\n\nexport function renderLines(source: LineSource, options: RenderOptions, decorations: InlineDecoration[], domNode: HTMLElement, noExtra = false): RenderLinesResult {\n\tapplyFontInfo(domNode, options.fontInfo);\n\n\tconst hasCharChanges = (decorations.length > 0);\n\n\tconst sb = new StringBuilder(10000);\n\tlet maxCharsPerLine = 0;\n\tlet renderedLineCount = 0;\n\tconst viewLineCounts: number[] = [];\n\tconst renderOutputs: RenderLineOutputWithOffset[] = [];\n\tfor (let lineIndex = 0; lineIndex < source.lineTokens.length; lineIndex++) {\n\t\tconst lineNumber = lineIndex + 1;\n\t\tconst lineTokens = source.lineTokens[lineIndex];\n\t\tconst lineBreakData = source.lineBreakData[lineIndex];\n\t\tconst actualDecorations = LineDecoration.filter(decorations, lineNumber, 1, Number.MAX_SAFE_INTEGER);\n\n\t\tif (lineBreakData) {\n\t\t\tlet lastBreakOffset = 0;\n\t\t\tfor (const breakOffset of lineBreakData.breakOffsets) {\n\t\t\t\tconst viewLineTokens = lineTokens.sliceAndInflate(lastBreakOffset, breakOffset, 0);\n\t\t\t\tconst result = renderOriginalLine(\n\t\t\t\t\trenderedLineCount,\n\t\t\t\t\tviewLineTokens,\n\t\t\t\t\tLineDecoration.extractWrapped(actualDecorations, lastBreakOffset, breakOffset),\n\t\t\t\t\thasCharChanges,\n\t\t\t\t\tsource.mightContainNonBasicASCII,\n\t\t\t\t\tsource.mightContainRTL,\n\t\t\t\t\toptions,\n\t\t\t\t\tsb,\n\t\t\t\t\tnoExtra,\n\t\t\t\t);\n\t\t\t\tmaxCharsPerLine = Math.max(maxCharsPerLine, result.maxCharWidth);\n\t\t\t\trenderOutputs.push(new RenderLineOutputWithOffset(result.output.characterMapping, result.output.containsForeignElements, lastBreakOffset));\n\t\t\t\trenderedLineCount++;\n\t\t\t\tlastBreakOffset = breakOffset;\n\t\t\t}\n\t\t\tviewLineCounts.push(lineBreakData.breakOffsets.length);\n\t\t} else {\n\t\t\tviewLineCounts.push(1);\n\t\t\tconst result = renderOriginalLine(\n\t\t\t\trenderedLineCount,\n\t\t\t\tlineTokens,\n\t\t\t\tactualDecorations,\n\t\t\t\thasCharChanges,\n\t\t\t\tsource.mightContainNonBasicASCII,\n\t\t\t\tsource.mightContainRTL,\n\t\t\t\toptions,\n\t\t\t\tsb,\n\t\t\t\tnoExtra,\n\t\t\t);\n\t\t\tmaxCharsPerLine = Math.max(maxCharsPerLine, result.maxCharWidth);\n\t\t\trenderOutputs.push(new RenderLineOutputWithOffset(result.output.characterMapping, result.output.containsForeignElements, 0));\n\t\t\trenderedLineCount++;\n\t\t}\n\t}\n\tmaxCharsPerLine += options.scrollBeyondLastColumn;\n\n\tconst html = sb.build();\n\tconst trustedhtml = ttPolicy ? ttPolicy.createHTML(html) : html;\n\tdomNode.innerHTML = trustedhtml as string;\n\tconst minWidthInPx = (maxCharsPerLine * options.typicalHalfwidthCharacterWidth);\n\n\treturn new RenderLinesResult(\n\t\trenderedLineCount,\n\t\tminWidthInPx,\n\t\tviewLineCounts,\n\t\trenderOutputs,\n\t\tsource,\n\t);\n}\n\nexport class LineSource {\n\tconstructor(\n\t\tpublic readonly lineTokens: LineTokens[],\n\t\tpublic readonly lineBreakData: (ModelLineProjectionData | null)[] = lineTokens.map(t => null),\n\t\tpublic readonly mightContainNonBasicASCII: boolean = true,\n\t\tpublic readonly mightContainRTL: boolean = true,\n\t) { }\n}\n\nexport class RenderOptions {\n\tpublic static fromEditor(editor: ICodeEditor): RenderOptions {\n\n\t\tconst modifiedEditorOptions = editor.getOptions();\n\t\tconst fontInfo = modifiedEditorOptions.get(EditorOption.fontInfo);\n\t\tconst layoutInfo = modifiedEditorOptions.get(EditorOption.layoutInfo);\n\n\t\treturn new RenderOptions(\n\t\t\teditor.getModel()?.getOptions().tabSize || 0,\n\t\t\tfontInfo,\n\t\t\tmodifiedEditorOptions.get(EditorOption.disableMonospaceOptimizations),\n\t\t\tfontInfo.typicalHalfwidthCharacterWidth,\n\t\t\tmodifiedEditorOptions.get(EditorOption.scrollBeyondLastColumn),\n\n\t\t\tmodifiedEditorOptions.get(EditorOption.lineHeight),\n\n\t\t\tlayoutInfo.decorationsWidth,\n\t\t\tmodifiedEditorOptions.get(EditorOption.stopRenderingLineAfter),\n\t\t\tmodifiedEditorOptions.get(EditorOption.renderWhitespace),\n\t\t\tmodifiedEditorOptions.get(EditorOption.renderControlCharacters),\n\t\t\tmodifiedEditorOptions.get(EditorOption.fontLigatures),\n\t\t\tmodifiedEditorOptions.get(EditorOption.scrollbar).verticalScrollbarSize,\n\t\t);\n\t}\n\n\tconstructor(\n\t\tpublic readonly tabSize: number,\n\t\tpublic readonly fontInfo: FontInfo,\n\t\tpublic readonly disableMonospaceOptimizations: boolean,\n\t\tpublic readonly typicalHalfwidthCharacterWidth: number,\n\t\tpublic readonly scrollBeyondLastColumn: number,\n\t\tpublic readonly lineHeight: number,\n\t\tpublic readonly lineDecorationsWidth: number,\n\t\tpublic readonly stopRenderingLineAfter: number,\n\t\tpublic readonly renderWhitespace: FindComputedEditorOptionValueById<EditorOption.renderWhitespace>,\n\t\tpublic readonly renderControlCharacters: boolean,\n\t\tpublic readonly fontLigatures: FindComputedEditorOptionValueById<EditorOption.fontLigatures>,\n\t\tpublic readonly verticalScrollbarSize: number,\n\t\tpublic readonly setWidth = true,\n\t) { }\n\n\tpublic withSetWidth(setWidth: boolean): RenderOptions {\n\t\treturn new RenderOptions(\n\t\t\tthis.tabSize,\n\t\t\tthis.fontInfo,\n\t\t\tthis.disableMonospaceOptimizations,\n\t\t\tthis.typicalHalfwidthCharacterWidth,\n\t\t\tthis.scrollBeyondLastColumn,\n\t\t\tthis.lineHeight,\n\t\t\tthis.lineDecorationsWidth,\n\t\t\tthis.stopRenderingLineAfter,\n\t\t\tthis.renderWhitespace,\n\t\t\tthis.renderControlCharacters,\n\t\t\tthis.fontLigatures,\n\t\t\tthis.verticalScrollbarSize,\n\t\t\tsetWidth,\n\t\t);\n\t}\n\n\tpublic withScrollBeyondLastColumn(scrollBeyondLastColumn: number): RenderOptions {\n\t\treturn new RenderOptions(\n\t\t\tthis.tabSize,\n\t\t\tthis.fontInfo,\n\t\t\tthis.disableMonospaceOptimizations,\n\t\t\tthis.typicalHalfwidthCharacterWidth,\n\t\t\tscrollBeyondLastColumn,\n\t\t\tthis.lineHeight,\n\t\t\tthis.lineDecorationsWidth,\n\t\t\tthis.stopRenderingLineAfter,\n\t\t\tthis.renderWhitespace,\n\t\t\tthis.renderControlCharacters,\n\t\t\tthis.fontLigatures,\n\t\t\tthis.verticalScrollbarSize,\n\t\t\tthis.setWidth,\n\t\t);\n\t}\n}\n\nexport class RenderLinesResult {\n\tconstructor(\n\t\tpublic readonly heightInLines: number,\n\t\tpublic readonly minWidthInPx: number,\n\t\tpublic readonly viewLineCounts: number[],\n\t\tprivate readonly _renderOutputs: RenderLineOutputWithOffset[],\n\t\tprivate readonly _source: LineSource,\n\t) { }\n\n\t/**\n\t * Returns the model position for a given DOM node and offset within that node.\n\t * @param domNode The span node within a view-line where the offset is located\n\t * @param offset The offset within the span node\n\t * @returns The Position in the model, or undefined if the position cannot be determined\n\t */\n\tpublic getModelPositionAt(domNode: HTMLElement, offset: number): Position | undefined {\n\t\t// Find the view-line element that contains this span\n\t\tlet viewLineElement: HTMLElement | null = domNode;\n\t\twhile (viewLineElement && !viewLineElement.classList.contains('view-line')) {\n\t\t\tviewLineElement = viewLineElement.parentElement;\n\t\t}\n\n\t\tif (!viewLineElement) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Find the container that has all view lines\n\t\tconst container = viewLineElement.parentElement;\n\t\tif (!container) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Find the view line index based on the element\n\t\t// eslint-disable-next-line no-restricted-syntax\n\t\tconst viewLines = container.querySelectorAll('.view-line');\n\t\tlet viewLineIndex = -1;\n\t\tfor (let i = 0; i < viewLines.length; i++) {\n\t\t\tif (viewLines[i] === viewLineElement) {\n\t\t\t\tviewLineIndex = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (viewLineIndex === -1 || viewLineIndex >= this._renderOutputs.length) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Map view line index back to model line\n\t\tlet modelLineNumber = 1;\n\t\tlet remainingViewLines = viewLineIndex;\n\t\tfor (let i = 0; i < this.viewLineCounts.length; i++) {\n\t\t\tif (remainingViewLines < this.viewLineCounts[i]) {\n\t\t\t\tmodelLineNumber = i + 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tremainingViewLines -= this.viewLineCounts[i];\n\t\t}\n\n\t\tif (modelLineNumber > this._source.lineTokens.length) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst renderOutput = this._renderOutputs[viewLineIndex];\n\t\tif (!renderOutput) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst column = getColumnOfNodeOffset(renderOutput.characterMapping, domNode, offset) + renderOutput.offset;\n\n\t\treturn new Position(modelLineNumber, column);\n\t}\n}\n\nclass RenderLineOutputWithOffset extends RenderLineOutput {\n\tconstructor(characterMapping: CharacterMapping, containsForeignElements: ForeignElementType, public readonly offset: number) {\n\t\tsuper(characterMapping, containsForeignElements);\n\t}\n}\n\nfunction renderOriginalLine(\n\tviewLineIdx: number,\n\tlineTokens: IViewLineTokens,\n\tdecorations: LineDecoration[],\n\thasCharChanges: boolean,\n\tmightContainNonBasicASCII: boolean,\n\tmightContainRTL: boolean,\n\toptions: RenderOptions,\n\tsb: StringBuilder,\n\tnoExtra: boolean,\n): { output: RenderLineOutput; maxCharWidth: number } {\n\n\tsb.appendString('<div class=\"view-line');\n\tif (!noExtra && !hasCharChanges) {\n\t\t// No char changes\n\t\tsb.appendString(' char-delete');\n\t}\n\tsb.appendString('\" style=\"top:');\n\tsb.appendString(String(viewLineIdx * options.lineHeight));\n\tif (options.setWidth) {\n\t\tsb.appendString('px;width:1000000px;\">');\n\t} else {\n\t\tsb.appendString('px;\">');\n\t}\n\n\tconst lineContent = lineTokens.getLineContent();\n\tconst isBasicASCII = ViewLineRenderingData.isBasicASCII(lineContent, mightContainNonBasicASCII);\n\tconst containsRTL = ViewLineRenderingData.containsRTL(lineContent, isBasicASCII, mightContainRTL);\n\tconst output = renderViewLine(new RenderLineInput(\n\t\t(options.fontInfo.isMonospace && !options.disableMonospaceOptimizations),\n\t\toptions.fontInfo.canUseHalfwidthRightwardsArrow,\n\t\tlineContent,\n\t\tfalse,\n\t\tisBasicASCII,\n\t\tcontainsRTL,\n\t\t0,\n\t\tlineTokens,\n\t\tdecorations,\n\t\toptions.tabSize,\n\t\t0,\n\t\toptions.fontInfo.spaceWidth,\n\t\toptions.fontInfo.middotWidth,\n\t\toptions.fontInfo.wsmiddotWidth,\n\t\toptions.stopRenderingLineAfter,\n\t\toptions.renderWhitespace,\n\t\toptions.renderControlCharacters,\n\t\toptions.fontLigatures !== EditorFontLigatures.OFF,\n\t\tnull, // Send no selections, original line cannot be selected\n\t\tnull,\n\t\toptions.verticalScrollbarSize\n\t), sb);\n\n\tsb.appendString('</div>');\n\n\tconst maxCharWidth = output.characterMapping.getHorizontalOffset(output.characterMapping.length);\n\treturn { output, maxCharWidth };\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { createTrustedTypesPolicy } from '../../../../../../base/browser/trustedTypes.js';\nimport { applyFontInfo } from '../../../../config/domFontInfo.js';\nimport { ICodeEditor } from '../../../../editorBrowser.js';\nimport { EditorFontLigatures, EditorOption, FindComputedEditorOptionValueById } from '../../../../../common/config/editorOptions.js';\nimport { FontInfo } from '../../../../../common/config/fontInfo.js';\nimport { Position } from '../../../../../common/core/position.js';\nimport { StringBuilder } from '../../../../../common/core/stringBuilder.js';\nimport { ModelLineProjectionData } from '../../../../../common/modelLineProjectionData.js';\nimport { IViewLineTokens, LineTokens } from '../../../../../common/tokens/lineTokens.js';\nimport { LineDecoration } from '../../../../../common/viewLayout/lineDecorations.js';\nimport { CharacterMapping, ForeignElementType, RenderLineInput, RenderLineOutput, renderViewLine } from '../../../../../common/viewLayout/viewLineRenderer.js';\nimport { ViewLineRenderingData } from '../../../../../common/viewModel.js';\nimport { InlineDecoration } from '../../../../../common/viewModel/inlineDecorations.js';\nimport { getColumnOfNodeOffset } from '../../../../viewParts/viewLines/viewLine.js';\n\nconst ttPolicy = createTrustedTypesPolicy('diffEditorWidget', { createHTML: value => value });\n\nexport function renderLines(source: LineSource, options: RenderOptions, decorations: InlineDecoration[], domNode: HTMLElement, noExtra = false): RenderLinesResult {\n\tapplyFontInfo(domNode, options.fontInfo);\n\n\tconst hasCharChanges = (decorations.length > 0);\n\n\tconst sb = new StringBuilder(10000);\n\tlet maxCharsPerLine = 0;\n\tlet renderedLineCount = 0;\n\tconst viewLineCounts: number[] = [];\n\tconst renderOutputs: RenderLineOutputWithOffset[] = [];\n\tfor (let lineIndex = 0; lineIndex < source.lineTokens.length; lineIndex++) {\n\t\tconst lineNumber = lineIndex + 1;\n\t\tconst lineTokens = source.lineTokens[lineIndex];\n\t\tconst lineBreakData = source.lineBreakData[lineIndex];\n\t\tconst actualDecorations = LineDecoration.filter(decorations, lineNumber, 1, Number.MAX_SAFE_INTEGER);\n\n\t\tif (lineBreakData) {\n\t\t\tlet lastBreakOffset = 0;\n\t\t\tfor (const breakOffset of lineBreakData.breakOffsets) {\n\t\t\t\tconst viewLineTokens = lineTokens.sliceAndInflate(lastBreakOffset, breakOffset, 0);\n\t\t\t\tconst result = renderOriginalLine(\n\t\t\t\t\trenderedLineCount,\n\t\t\t\t\tviewLineTokens,\n\t\t\t\t\tLineDecoration.extractWrapped(actualDecorations, lastBreakOffset, breakOffset),\n\t\t\t\t\thasCharChanges,\n\t\t\t\t\tsource.mightContainNonBasicASCII,\n\t\t\t\t\tsource.mightContainRTL,\n\t\t\t\t\toptions,\n\t\t\t\t\tsb,\n\t\t\t\t\tnoExtra,\n\t\t\t\t);\n\t\t\t\tmaxCharsPerLine = Math.max(maxCharsPerLine, result.maxCharWidth);\n\t\t\t\trenderOutputs.push(new RenderLineOutputWithOffset(result.output.characterMapping, result.output.containsForeignElements, lastBreakOffset));\n\t\t\t\trenderedLineCount++;\n\t\t\t\tlastBreakOffset = breakOffset;\n\t\t\t}\n\t\t\tviewLineCounts.push(lineBreakData.breakOffsets.length);\n\t\t} else {\n\t\t\tviewLineCounts.push(1);\n\t\t\tconst result = renderOriginalLine(\n\t\t\t\trenderedLineCount,\n\t\t\t\tlineTokens,\n\t\t\t\tactualDecorations,\n\t\t\t\thasCharChanges,\n\t\t\t\tsource.mightContainNonBasicASCII,\n\t\t\t\tsource.mightContainRTL,\n\t\t\t\toptions,\n\t\t\t\tsb,\n\t\t\t\tnoExtra,\n\t\t\t);\n\t\t\tmaxCharsPerLine = Math.max(maxCharsPerLine, result.maxCharWidth);\n\t\t\trenderOutputs.push(new RenderLineOutputWithOffset(result.output.characterMapping, result.output.containsForeignElements, 0));\n\t\t\trenderedLineCount++;\n\t\t}\n\t}\n\tmaxCharsPerLine += options.scrollBeyondLastColumn;\n\n\tconst html = sb.build();\n\tconst trustedhtml = ttPolicy ? ttPolicy.createHTML(html) : html;\n\tdomNode.innerHTML = trustedhtml as string;\n\tconst minWidthInPx = (maxCharsPerLine * options.typicalHalfwidthCharacterWidth);\n\n\treturn new RenderLinesResult(\n\t\trenderedLineCount,\n\t\tminWidthInPx,\n\t\tviewLineCounts,\n\t\trenderOutputs,\n\t\tsource,\n\t);\n}\n\nexport class LineSource {\n\tconstructor(\n\t\tpublic readonly lineTokens: LineTokens[],\n\t\tpublic readonly lineBreakData: (ModelLineProjectionData | null)[] = lineTokens.map(t => null),\n\t\tpublic readonly mightContainNonBasicASCII: boolean = true,\n\t\tpublic readonly mightContainRTL: boolean = true,\n\t) { }\n}\n\nexport class RenderOptions {\n\tpublic static fromEditor(editor: ICodeEditor): RenderOptions {\n\n\t\tconst modifiedEditorOptions = editor.getOptions();\n\t\tconst fontInfo = modifiedEditorOptions.get(EditorOption.fontInfo);\n\t\tconst layoutInfo = modifiedEditorOptions.get(EditorOption.layoutInfo);\n\n\t\treturn new RenderOptions(\n\t\t\teditor.getModel()?.getOptions().tabSize || 0,\n\t\t\tfontInfo,\n\t\t\tmodifiedEditorOptions.get(EditorOption.disableMonospaceOptimizations),\n\t\t\tfontInfo.typicalHalfwidthCharacterWidth,\n\t\t\tmodifiedEditorOptions.get(EditorOption.scrollBeyondLastColumn),\n\n\t\t\tmodifiedEditorOptions.get(EditorOption.lineHeight),\n\n\t\t\tlayoutInfo.decorationsWidth,\n\t\t\tmodifiedEditorOptions.get(EditorOption.stopRenderingLineAfter),\n\t\t\tmodifiedEditorOptions.get(EditorOption.renderWhitespace),\n\t\t\tmodifiedEditorOptions.get(EditorOption.renderControlCharacters),\n\t\t\tmodifiedEditorOptions.get(EditorOption.fontLigatures),\n\t\t\tmodifiedEditorOptions.get(EditorOption.scrollbar).verticalScrollbarSize,\n\t\t);\n\t}\n\n\tconstructor(\n\t\tpublic readonly tabSize: number,\n\t\tpublic readonly fontInfo: FontInfo,\n\t\tpublic readonly disableMonospaceOptimizations: boolean,\n\t\tpublic readonly typicalHalfwidthCharacterWidth: number,\n\t\tpublic readonly scrollBeyondLastColumn: number,\n\t\tpublic readonly lineHeight: number,\n\t\tpublic readonly lineDecorationsWidth: number,\n\t\tpublic readonly stopRenderingLineAfter: number,\n\t\tpublic readonly renderWhitespace: FindComputedEditorOptionValueById<EditorOption.renderWhitespace>,\n\t\tpublic readonly renderControlCharacters: boolean,\n\t\tpublic readonly fontLigatures: FindComputedEditorOptionValueById<EditorOption.fontLigatures>,\n\t\tpublic readonly verticalScrollbarSize: number,\n\t\tpublic readonly setWidth = true,\n\t) { }\n\n\tpublic withSetWidth(setWidth: boolean): RenderOptions {\n\t\treturn new RenderOptions(\n\t\t\tthis.tabSize,\n\t\t\tthis.fontInfo,\n\t\t\tthis.disableMonospaceOptimizations,\n\t\t\tthis.typicalHalfwidthCharacterWidth,\n\t\t\tthis.scrollBeyondLastColumn,\n\t\t\tthis.lineHeight,\n\t\t\tthis.lineDecorationsWidth,\n\t\t\tthis.stopRenderingLineAfter,\n\t\t\tthis.renderWhitespace,\n\t\t\tthis.renderControlCharacters,\n\t\t\tthis.fontLigatures,\n\t\t\tthis.verticalScrollbarSize,\n\t\t\tsetWidth,\n\t\t);\n\t}\n\n\tpublic withScrollBeyondLastColumn(scrollBeyondLastColumn: number): RenderOptions {\n\t\treturn new RenderOptions(\n\t\t\tthis.tabSize,\n\t\t\tthis.fontInfo,\n\t\t\tthis.disableMonospaceOptimizations,\n\t\t\tthis.typicalHalfwidthCharacterWidth,\n\t\t\tscrollBeyondLastColumn,\n\t\t\tthis.lineHeight,\n\t\t\tthis.lineDecorationsWidth,\n\t\t\tthis.stopRenderingLineAfter,\n\t\t\tthis.renderWhitespace,\n\t\t\tthis.renderControlCharacters,\n\t\t\tthis.fontLigatures,\n\t\t\tthis.verticalScrollbarSize,\n\t\t\tthis.setWidth,\n\t\t);\n\t}\n}\n\nexport class RenderLinesResult {\n\tconstructor(\n\t\tpublic readonly heightInLines: number,\n\t\tpublic readonly minWidthInPx: number,\n\t\tpublic readonly viewLineCounts: number[],\n\t\tprivate readonly _renderOutputs: RenderLineOutputWithOffset[],\n\t\tprivate readonly _source: LineSource,\n\t) { }\n\n\t/**\n\t * Returns the model position for a given DOM node and offset within that node.\n\t * @param domNode The span node within a view-line where the offset is located\n\t * @param offset The offset within the span node\n\t * @returns The Position in the model, or undefined if the position cannot be determined\n\t */\n\tpublic getModelPositionAt(domNode: HTMLElement, offset: number): Position | undefined {\n\t\t// Find the view-line element that contains this span\n\t\tlet viewLineElement: HTMLElement | null = domNode;\n\t\twhile (viewLineElement && !viewLineElement.classList.contains('view-line')) {\n\t\t\tviewLineElement = viewLineElement.parentElement;\n\t\t}\n\n\t\tif (!viewLineElement) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Find the container that has all view lines\n\t\tconst container = viewLineElement.parentElement;\n\t\tif (!container) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Find the view line index based on the element\n\t\t// eslint-disable-next-line no-restricted-syntax\n\t\tconst viewLines = container.querySelectorAll('.view-line');\n\t\tlet viewLineIndex = -1;\n\t\tfor (let i = 0; i < viewLines.length; i++) {\n\t\t\tif (viewLines[i] === viewLineElement) {\n\t\t\t\tviewLineIndex = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif (viewLineIndex === -1 || viewLineIndex >= this._renderOutputs.length) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\t// Map view line index back to model line\n\t\tlet modelLineNumber = 1;\n\t\tlet remainingViewLines = viewLineIndex;\n\t\tfor (let i = 0; i < this.viewLineCounts.length; i++) {\n\t\t\tif (remainingViewLines < this.viewLineCounts[i]) {\n\t\t\t\tmodelLineNumber = i + 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tremainingViewLines -= this.viewLineCounts[i];\n\t\t}\n\n\t\tif (modelLineNumber > this._source.lineTokens.length) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst renderOutput = this._renderOutputs[viewLineIndex];\n\t\tif (!renderOutput) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst column = getColumnOfNodeOffset(renderOutput.characterMapping, domNode, offset) + renderOutput.offset;\n\n\t\treturn new Position(modelLineNumber, column);\n\t}\n}\n\nclass RenderLineOutputWithOffset extends RenderLineOutput {\n\tconstructor(characterMapping: CharacterMapping, containsForeignElements: ForeignElementType, public readonly offset: number) {\n\t\tsuper(characterMapping, containsForeignElements);\n\t}\n}\n\nfunction renderOriginalLine(\n\tviewLineIdx: number,\n\tlineTokens: IViewLineTokens,\n\tdecorations: LineDecoration[],\n\thasCharChanges: boolean,\n\tmightContainNonBasicASCII: boolean,\n\tmightContainRTL: boolean,\n\toptions: RenderOptions,\n\tsb: StringBuilder,\n\tnoExtra: boolean,\n): { output: RenderLineOutput; maxCharWidth: number } {\n\n\tsb.appendString('<div class=\"view-line');\n\tif (!noExtra && !hasCharChanges) {\n\t\t// No char changes\n\t\tsb.appendString(' char-delete');\n\t}\n\tsb.appendString('\" style=\"top:');\n\tsb.appendString(String(viewLineIdx * options.lineHeight));\n\tif (options.setWidth) {\n\t\tsb.appendString('px;width:1000000px;\">');\n\t} else {\n\t\tsb.appendString('px;\">');\n\t}\n\n\tconst lineContent = lineTokens.getLineContent();\n\tconst isBasicASCII = ViewLineRenderingData.isBasicASCII(lineContent, mightContainNonBasicASCII);\n\tconst containsRTL = ViewLineRenderingData.containsRTL(lineContent, isBasicASCII, mightContainRTL);\n\tconst output = renderViewLine(new RenderLineInput(\n\t\t(options.fontInfo.isMonospace && !options.disableMonospaceOptimizations),\n\t\toptions.fontInfo.canUseHalfwidthRightwardsArrow,\n\t\tlineContent,\n\t\tfalse,\n\t\tisBasicASCII,\n\t\tcontainsRTL,\n\t\t0,\n\t\tlineTokens,\n\t\tdecorations,\n\t\toptions.tabSize,\n\t\t0,\n\t\toptions.fontInfo.spaceWidth,\n\t\toptions.fontInfo.middotWidth,\n\t\toptions.fontInfo.wsmiddotWidth,\n\t\toptions.stopRenderingLineAfter,\n\t\toptions.renderWhitespace,\n\t\toptions.renderControlCharacters,\n\t\toptions.fontLigatures !== EditorFontLigatures.OFF,\n\t\tnull, // Send no selections, original line cannot be selected\n\t\tnull,\n\t\toptions.verticalScrollbarSize\n\t), sb);\n\n\tsb.appendString('</div>');\n\n\tconst maxCharWidth = output.characterMapping.getHorizontalOffset(output.characterMapping.length);\n\treturn { output, maxCharWidth };\n}\n"]}
|
|
@@ -16,7 +16,7 @@ registerAction2(ToggleUseInlineViewWhenSpaceIsLimited);
|
|
|
16
16
|
MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
|
|
17
17
|
command: {
|
|
18
18
|
id: new ToggleUseInlineViewWhenSpaceIsLimited().desc.id,
|
|
19
|
-
title: localize(
|
|
19
|
+
title: localize(119, "Use Inline View When Space Is Limited"),
|
|
20
20
|
toggled: ContextKeyExpr.has('config.diffEditor.useInlineViewWhenSpaceIsLimited'),
|
|
21
21
|
precondition: ContextKeyExpr.has('isInDiffEditor'),
|
|
22
22
|
},
|
|
@@ -27,7 +27,7 @@ MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
|
|
|
27
27
|
MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
|
|
28
28
|
command: {
|
|
29
29
|
id: new ToggleShowMovedCodeBlocks().desc.id,
|
|
30
|
-
title: localize(
|
|
30
|
+
title: localize(120, "Show Moved Code Blocks"),
|
|
31
31
|
icon: Codicon.move,
|
|
32
32
|
toggled: ContextKeyEqualsExpr.create('config.diffEditor.experimental.showMoves', true),
|
|
33
33
|
precondition: ContextKeyExpr.has('isInDiffEditor'),
|
|
@@ -44,7 +44,7 @@ for (const ctx of [
|
|
|
44
44
|
MenuRegistry.appendMenuItem(MenuId.DiffEditorHunkToolbar, {
|
|
45
45
|
command: {
|
|
46
46
|
id: new RevertHunkOrSelection().desc.id,
|
|
47
|
-
title: localize(
|
|
47
|
+
title: localize(121, "Revert Block"),
|
|
48
48
|
icon: ctx.icon,
|
|
49
49
|
},
|
|
50
50
|
when: ContextKeyExpr.and(EditorContextKeys.diffEditorModifiedWritable, ctx.key),
|
|
@@ -54,7 +54,7 @@ for (const ctx of [
|
|
|
54
54
|
MenuRegistry.appendMenuItem(MenuId.DiffEditorSelectionToolbar, {
|
|
55
55
|
command: {
|
|
56
56
|
id: new RevertHunkOrSelection().desc.id,
|
|
57
|
-
title: localize(
|
|
57
|
+
title: localize(122, "Revert Selection"),
|
|
58
58
|
icon: ctx.icon,
|
|
59
59
|
},
|
|
60
60
|
when: ContextKeyExpr.and(EditorContextKeys.diffEditorModifiedWritable, ctx.key),
|
|
@@ -69,7 +69,7 @@ registerAction2(ShowAllUnchangedRegions);
|
|
|
69
69
|
MenuRegistry.appendMenuItem(MenuId.EditorTitle, {
|
|
70
70
|
command: {
|
|
71
71
|
id: AccessibleDiffViewerNext.id,
|
|
72
|
-
title: localize(
|
|
72
|
+
title: localize(123, "Open Accessible Diff Viewer"),
|
|
73
73
|
precondition: ContextKeyExpr.has('isInDiffEditor'),
|
|
74
74
|
},
|
|
75
75
|
order: 10,
|
|
@@ -145,7 +145,7 @@ let HideUnchangedRegionsFeature = class HideUnchangedRegionsFeature extends Disp
|
|
|
145
145
|
const unchangedLinesDecorationShow = {
|
|
146
146
|
description: 'Fold Unchanged',
|
|
147
147
|
glyphMarginHoverMessage: new MarkdownString(undefined, { isTrusted: true, supportThemeIcons: true })
|
|
148
|
-
.appendMarkdown(localize(
|
|
148
|
+
.appendMarkdown(localize(124, 'Fold Unchanged Region')),
|
|
149
149
|
glyphMarginClassName: 'fold-unchanged ' + ThemeIcon.asClassName(Codicon.fold),
|
|
150
150
|
zIndex: 10001,
|
|
151
151
|
};
|
|
@@ -252,7 +252,7 @@ class CompactCollapsedCodeOverlayWidget extends ViewZoneOverlayWidget {
|
|
|
252
252
|
/** @description update labels */
|
|
253
253
|
if (!this._hide) {
|
|
254
254
|
const lineCount = this._unchangedRegion.getHiddenModifiedRange(reader).length;
|
|
255
|
-
const linesHiddenText = localize(
|
|
255
|
+
const linesHiddenText = localize(125, '{0} hidden lines', lineCount);
|
|
256
256
|
this._nodes.text.innerText = linesHiddenText;
|
|
257
257
|
}
|
|
258
258
|
}));
|
|
@@ -270,12 +270,12 @@ class CollapsedCodeOverlayWidget extends ViewZoneOverlayWidget {
|
|
|
270
270
|
this._revealModifiedHiddenLine = _revealModifiedHiddenLine;
|
|
271
271
|
this._options = _options;
|
|
272
272
|
this._nodes = h('div.diff-hidden-lines', [
|
|
273
|
-
h('div.top@top', { title: localize(
|
|
273
|
+
h('div.top@top', { title: localize(126, 'Click or drag to show more above') }),
|
|
274
274
|
h('div.center@content', { style: { display: 'flex' } }, [
|
|
275
|
-
h('div@first', { style: { display: 'flex', justifyContent: 'center', alignItems: 'center', flexShrink: '0' } }, [$('a', { title: localize(
|
|
275
|
+
h('div@first', { style: { display: 'flex', justifyContent: 'center', alignItems: 'center', flexShrink: '0' } }, [$('a', { title: localize(127, 'Show Unchanged Region'), role: 'button', onclick: () => { this._unchangedRegion.showAll(undefined); } }, ...renderLabelWithIcons('$(unfold)'))]),
|
|
276
276
|
h('div@others', { style: { display: 'flex', justifyContent: 'center', alignItems: 'center' } }),
|
|
277
277
|
]),
|
|
278
|
-
h('div.bottom@bottom', { title: localize(
|
|
278
|
+
h('div.bottom@bottom', { title: localize(128, 'Click or drag to show more below'), role: 'button' }),
|
|
279
279
|
]);
|
|
280
280
|
root.root.appendChild(this._nodes.root);
|
|
281
281
|
if (!this._hide) {
|
|
@@ -387,8 +387,8 @@ class CollapsedCodeOverlayWidget extends ViewZoneOverlayWidget {
|
|
|
387
387
|
const children = [];
|
|
388
388
|
if (!this._hide) {
|
|
389
389
|
const lineCount = _unchangedRegion.getHiddenModifiedRange(reader).length;
|
|
390
|
-
const linesHiddenText = localize(
|
|
391
|
-
const span = $('span', { title: localize(
|
|
390
|
+
const linesHiddenText = localize(129, '{0} hidden lines', lineCount);
|
|
391
|
+
const span = $('span', { title: localize(130, 'Double click to unfold') }, linesHiddenText);
|
|
392
392
|
span.addEventListener('dblclick', e => {
|
|
393
393
|
if (e.button !== 0) {
|
|
394
394
|
return;
|
|
@@ -244,10 +244,10 @@ class MovedBlockOverlayWidget extends ViewZoneOverlayWidget {
|
|
|
244
244
|
}));
|
|
245
245
|
let text;
|
|
246
246
|
if (_move.changes.length > 0) {
|
|
247
|
-
text = this._kind === 'original' ? localize(
|
|
247
|
+
text = this._kind === 'original' ? localize(131, 'Code moved with changes to line {0}-{1}', this._move.lineRangeMapping.modified.startLineNumber, this._move.lineRangeMapping.modified.endLineNumberExclusive - 1) : localize(132, 'Code moved with changes from line {0}-{1}', this._move.lineRangeMapping.original.startLineNumber, this._move.lineRangeMapping.original.endLineNumberExclusive - 1);
|
|
248
248
|
}
|
|
249
249
|
else {
|
|
250
|
-
text = this._kind === 'original' ? localize(
|
|
250
|
+
text = this._kind === 'original' ? localize(133, 'Code moved to line {0}-{1}', this._move.lineRangeMapping.modified.startLineNumber, this._move.lineRangeMapping.modified.endLineNumberExclusive - 1) : localize(134, 'Code moved from line {0}-{1}', this._move.lineRangeMapping.original.startLineNumber, this._move.lineRangeMapping.original.endLineNumberExclusive - 1);
|
|
251
251
|
}
|
|
252
252
|
const actionBar = this._register(new ActionBar(this._nodes.actionBar, {
|
|
253
253
|
highlightToggledItems: true,
|
|
@@ -95,8 +95,8 @@ export class RevertButton extends Disposable {
|
|
|
95
95
|
this._id = `revertButton${RevertButton.counter++}`;
|
|
96
96
|
this._domNode = h('div.revertButton', {
|
|
97
97
|
title: this._revertSelection
|
|
98
|
-
? localize(
|
|
99
|
-
: localize(
|
|
98
|
+
? localize(135, 'Revert Selected Changes')
|
|
99
|
+
: localize(136, 'Revert Change')
|
|
100
100
|
}, [renderIcon(Codicon.arrowRight)]).root;
|
|
101
101
|
this._register(addDisposableListener(this._domNode, EventType.MOUSE_DOWN, e => {
|
|
102
102
|
// don't prevent context menu from showing up
|
|
@@ -8,11 +8,11 @@ import { ModelDecorationOptions } from '../../../common/model/textModel.js';
|
|
|
8
8
|
import { localize } from '../../../../nls.js';
|
|
9
9
|
import { registerColor } from '../../../../platform/theme/common/colorRegistry.js';
|
|
10
10
|
import { registerIcon } from '../../../../platform/theme/common/iconRegistry.js';
|
|
11
|
-
export const diffMoveBorder = registerColor('diffEditor.move.border', '#8b8b8b9c', localize(
|
|
12
|
-
export const diffMoveBorderActive = registerColor('diffEditor.moveActive.border', '#FFA500', localize(
|
|
13
|
-
export const diffEditorUnchangedRegionShadow = registerColor('diffEditor.unchangedRegionShadow', { dark: '#000000', light: '#737373BF', hcDark: '#000000', hcLight: '#737373BF', }, localize(
|
|
14
|
-
export const diffInsertIcon = registerIcon('diff-insert', Codicon.add, localize(
|
|
15
|
-
export const diffRemoveIcon = registerIcon('diff-remove', Codicon.remove, localize(
|
|
11
|
+
export const diffMoveBorder = registerColor('diffEditor.move.border', '#8b8b8b9c', localize(137, 'The border color for text that got moved in the diff editor.'));
|
|
12
|
+
export const diffMoveBorderActive = registerColor('diffEditor.moveActive.border', '#FFA500', localize(138, 'The active border color for text that got moved in the diff editor.'));
|
|
13
|
+
export const diffEditorUnchangedRegionShadow = registerColor('diffEditor.unchangedRegionShadow', { dark: '#000000', light: '#737373BF', hcDark: '#000000', hcLight: '#737373BF', }, localize(139, 'The color of the shadow around unchanged region widgets.'));
|
|
14
|
+
export const diffInsertIcon = registerIcon('diff-insert', Codicon.add, localize(140, 'Line decoration for inserts in the diff editor.'));
|
|
15
|
+
export const diffRemoveIcon = registerIcon('diff-remove', Codicon.remove, localize(141, 'Line decoration for removals in the diff editor.'));
|
|
16
16
|
export const diffLineAddDecorationBackgroundWithIndicator = ModelDecorationOptions.register({
|
|
17
17
|
className: 'line-insert',
|
|
18
18
|
description: 'line-insert',
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { localize } from '../../../../nls.js';
|
|
6
6
|
import { registerColor, editorBackground } from '../../../../platform/theme/common/colorRegistry.js';
|
|
7
|
-
export const multiDiffEditorHeaderBackground = registerColor('multiDiffEditor.headerBackground', { dark: '#262626', light: 'tab.inactiveBackground', hcDark: 'tab.inactiveBackground', hcLight: 'tab.inactiveBackground', }, localize(
|
|
8
|
-
export const multiDiffEditorBackground = registerColor('multiDiffEditor.background', editorBackground, localize(
|
|
9
|
-
export const multiDiffEditorBorder = registerColor('multiDiffEditor.border', { dark: 'sideBarSectionHeader.border', light: '#cccccc', hcDark: 'sideBarSectionHeader.border', hcLight: '#cccccc', }, localize(
|
|
7
|
+
export const multiDiffEditorHeaderBackground = registerColor('multiDiffEditor.headerBackground', { dark: '#262626', light: 'tab.inactiveBackground', hcDark: 'tab.inactiveBackground', hcLight: 'tab.inactiveBackground', }, localize(142, 'The background color of the diff editor\'s header'));
|
|
8
|
+
export const multiDiffEditorBackground = registerColor('multiDiffEditor.background', editorBackground, localize(143, 'The background color of the multi file diff editor'));
|
|
9
|
+
export const multiDiffEditorBorder = registerColor('multiDiffEditor.border', { dark: 'sideBarSectionHeader.border', light: '#cccccc', hcDark: 'sideBarSectionHeader.border', hcLight: '#cccccc', }, localize(144, 'The border color of the multi file diff editor'));
|
|
10
10
|
//# sourceMappingURL=colors.js.map
|
|
@@ -142,7 +142,7 @@ let DiffEditorItemTemplate = class DiffEditorItemTemplate extends Disposable {
|
|
|
142
142
|
this._contextKeyService = this._register(_parentContextKeyService.createScoped(this._elements.actions));
|
|
143
143
|
const instantiationService = this._register(this._instantiationService.createChild(new ServiceCollection([IContextKeyService, this._contextKeyService])));
|
|
144
144
|
this._register(instantiationService.createInstance(MenuWorkbenchToolBar, this._elements.actions, MenuId.MultiDiffEditorFileToolbar, {
|
|
145
|
-
actionRunner: this._register(new ActionRunnerWithContext(() => (this._viewModel.get()?.modifiedUri))),
|
|
145
|
+
actionRunner: this._register(new ActionRunnerWithContext(() => (this._viewModel.get()?.modifiedUri ?? this._viewModel.get()?.originalUri))),
|
|
146
146
|
menuOptions: {
|
|
147
147
|
shouldForwardArgs: true,
|
|
148
148
|
},
|