@codingame/monaco-vscode-views-service-override 2.1.4 → 2.2.0-next.2
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/index.d.ts +11 -9
- package/index.js +8 -6
- package/package.json +11 -11
- package/tools/views.d.ts +102 -0
- package/tools/views.js +253 -0
- package/views.d.ts +4 -99
- package/views.js +52 -280
- package/external/rollup-plugin-styles/dist/runtime/inject-css.js +0 -3
- package/vscode/src/vs/base/browser/ui/centered/centeredViewLayout.js +0 -180
- package/vscode/src/vs/base/browser/ui/grid/grid.js +0 -494
- package/vscode/src/vs/base/browser/ui/grid/gridview.css.js +0 -6
- package/vscode/src/vs/base/browser/ui/grid/gridview.js +0 -1112
- package/vscode/src/vs/base/common/codicons.d.ts +0 -579
- package/vscode/src/vs/platform/webview/common/mimeTypes.js +0 -24
- package/vscode/src/vs/platform/webview/common/webviewPortMapping.js +0 -64
- package/vscode/src/vs/workbench/api/browser/viewsExtensionPoint.js +0 -790
- package/vscode/src/vs/workbench/browser/actions/listCommands.js +0 -764
- package/vscode/src/vs/workbench/browser/layout.d.ts +0 -26
- package/vscode/src/vs/workbench/browser/parts/activitybar/activitybarPart.js +0 -612
- package/vscode/src/vs/workbench/browser/parts/activitybar/media/activityaction.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/auxiliarybar/auxiliaryBarPart.js +0 -150
- package/vscode/src/vs/workbench/browser/parts/auxiliarybar/media/auxiliaryBarPart.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/compositeBar.js +0 -605
- package/vscode/src/vs/workbench/browser/parts/compositePart.js +0 -335
- package/vscode/src/vs/workbench/browser/parts/editor/auxiliaryEditorPart.js +0 -223
- package/vscode/src/vs/workbench/browser/parts/editor/editor.contribution.js +0 -1407
- package/vscode/src/vs/workbench/browser/parts/editor/editorConfiguration.js +0 -186
- package/vscode/src/vs/workbench/browser/parts/editor/editorDropTarget.js +0 -511
- package/vscode/src/vs/workbench/browser/parts/editor/editorPane.d.ts +0 -112
- package/vscode/src/vs/workbench/browser/parts/editor/editorPart.js +0 -1020
- package/vscode/src/vs/workbench/browser/parts/editor/editorParts.js +0 -391
- package/vscode/src/vs/workbench/browser/parts/editor/media/editordroptarget.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/media/compositepart.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/media/paneCompositePart.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/paneCompositeBar.js +0 -645
- package/vscode/src/vs/workbench/browser/parts/paneCompositePart.js +0 -379
- package/vscode/src/vs/workbench/browser/parts/paneCompositePartService.js +0 -68
- package/vscode/src/vs/workbench/browser/parts/panel/panelPart.js +0 -146
- package/vscode/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/sidebar/sidebarPart.js +0 -222
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.js +0 -299
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.js +0 -365
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyTree.js +0 -135
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/media/callHierarchy.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditor.contribution.js +0 -17
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditorInputFactory.js +0 -145
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditors.js +0 -214
- package/vscode/src/vs/workbench/contrib/customEditor/browser/media/customEditor.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/customEditor/common/contributedCustomEditors.js +0 -78
- package/vscode/src/vs/workbench/contrib/customEditor/common/customEditorModelManager.js +0 -63
- package/vscode/src/vs/workbench/contrib/customEditor/common/extensionPoint.js +0 -119
- package/vscode/src/vs/workbench/contrib/externalUriOpener/common/externalUriOpener.contribution.js +0 -6
- package/vscode/src/vs/workbench/contrib/files/browser/editors/binaryFileEditor.js +0 -79
- package/vscode/src/vs/workbench/contrib/files/browser/editors/fileEditorHandler.js +0 -74
- package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditor.js +0 -256
- package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditorTracker.js +0 -99
- package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.js +0 -444
- package/vscode/src/vs/workbench/contrib/files/browser/explorerService.js +0 -432
- package/vscode/src/vs/workbench/contrib/files/browser/fileActions.contribution.js +0 -786
- package/vscode/src/vs/workbench/contrib/files/browser/fileCommands.js +0 -488
- package/vscode/src/vs/workbench/contrib/files/browser/files.contribution.js +0 -522
- package/vscode/src/vs/workbench/contrib/files/browser/workspaceWatcher.js +0 -152
- package/vscode/src/vs/workbench/contrib/files/common/dirtyFilesIndicator.js +0 -63
- package/vscode/src/vs/workbench/contrib/languageStatus/browser/languageStatus.contribution.js +0 -409
- package/vscode/src/vs/workbench/contrib/languageStatus/browser/media/languageStatus.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/commands.js +0 -693
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/devCommands.js +0 -240
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditor.contribution.js +0 -77
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorSerializer.js +0 -42
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/colors.js +0 -71
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/conflictActions.js +0 -348
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editorGutter.js +0 -98
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/baseCodeEditorView.js +0 -146
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/codeEditorView.js +0 -105
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/inputCodeEditorView.js +0 -401
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/resultCodeEditorView.js +0 -197
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/fixedZoneWidget.js +0 -41
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/lineAlignment.js +0 -128
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/media/mergeEditor.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/mergeEditor.js +0 -612
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/scrollSynchronizer.js +0 -158
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewModel.js +0 -264
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewZones.js +0 -173
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/media/typeHierarchy.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchy.contribution.js +0 -282
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek.js +0 -360
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyTree.js +0 -133
- package/vscode/src/vs/workbench/contrib/webview/browser/overlayWebview.js +0 -290
- package/vscode/src/vs/workbench/contrib/webview/browser/resourceLoading.js +0 -96
- package/vscode/src/vs/workbench/contrib/webview/browser/themeing.js +0 -88
- package/vscode/src/vs/workbench/contrib/webview/browser/webview.contribution.js +0 -79
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewElement.js +0 -648
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewFindWidget.js +0 -65
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewService.js +0 -59
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewCommands.js +0 -142
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewEditorInputSerializer.js +0 -121
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewPanel.contribution.js +0 -68
- package/vscode/src/vs/workbench/contrib/webviewView/browser/webviewViewPane.js +0 -235
- package/vscode/src/vs/workbench/services/activity/browser/activityService.js +0 -145
- package/vscode/src/vs/workbench/services/editor/browser/editorResolverService.js +0 -670
- package/vscode/src/vs/workbench/services/history/browser/historyService.js +0 -1484
- package/vscode/src/vs/workbench/services/progress/browser/media/progressService.css.js +0 -6
- package/vscode/src/vs/workbench/services/progress/browser/progressService.js +0 -523
- package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorHandler.js +0 -101
- package/vscode/src/vs/workbench/services/views/browser/viewDescriptorService.js +0 -713
- package/vscode/src/vs/workbench/services/views/common/viewContainerModel.js +0 -598
|
@@ -1,348 +0,0 @@
|
|
|
1
|
-
import { createStyleSheet, isInShadowDOM, h, $, reset } from 'vscode/vscode/vs/base/browser/dom';
|
|
2
|
-
import { renderLabelWithIcons } from 'vscode/vscode/vs/base/browser/ui/iconLabel/iconLabels';
|
|
3
|
-
import { hash } from 'vscode/vscode/vs/base/common/hash';
|
|
4
|
-
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
5
|
-
import { EDITOR_FONT_DEFAULTS } from 'vscode/vscode/vs/editor/common/config/editorOptions';
|
|
6
|
-
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
7
|
-
import { ModifiedBaseRangeStateKind, ModifiedBaseRangeState } from 'vscode/vscode/vs/workbench/contrib/mergeEditor/browser/model/modifiedBaseRange';
|
|
8
|
-
import { FixedZoneWidget } from './fixedZoneWidget.js';
|
|
9
|
-
import { autorun } from 'vscode/vscode/vs/base/common/observableInternal/autorun';
|
|
10
|
-
import { derived } from 'vscode/vscode/vs/base/common/observableInternal/derived';
|
|
11
|
-
import { transaction } from 'vscode/vscode/vs/base/common/observableInternal/base';
|
|
12
|
-
|
|
13
|
-
class ConflictActionsFactory extends Disposable {
|
|
14
|
-
constructor(_editor) {
|
|
15
|
-
super();
|
|
16
|
-
this._editor = _editor;
|
|
17
|
-
this._register(this._editor.onDidChangeConfiguration((e) => {
|
|
18
|
-
if (e.hasChanged(50 ) || e.hasChanged(19 ) || e.hasChanged(18 )) {
|
|
19
|
-
this._updateLensStyle();
|
|
20
|
-
}
|
|
21
|
-
}));
|
|
22
|
-
this._styleClassName = '_conflictActionsFactory_' + ( hash(this._editor.getId()).toString(16));
|
|
23
|
-
this._styleElement = createStyleSheet(isInShadowDOM(this._editor.getContainerDomNode())
|
|
24
|
-
? this._editor.getContainerDomNode()
|
|
25
|
-
: undefined, undefined, this._store);
|
|
26
|
-
this._updateLensStyle();
|
|
27
|
-
}
|
|
28
|
-
_updateLensStyle() {
|
|
29
|
-
const { codeLensHeight, fontSize } = this._getLayoutInfo();
|
|
30
|
-
const fontFamily = this._editor.getOption(18 );
|
|
31
|
-
const editorFontInfo = this._editor.getOption(50 );
|
|
32
|
-
const fontFamilyVar = `--codelens-font-family${this._styleClassName}`;
|
|
33
|
-
const fontFeaturesVar = `--codelens-font-features${this._styleClassName}`;
|
|
34
|
-
let newStyle = `
|
|
35
|
-
.${this._styleClassName} { line-height: ${codeLensHeight}px; font-size: ${fontSize}px; padding-right: ${Math.round(fontSize * 0.5)}px; font-feature-settings: var(${fontFeaturesVar}) }
|
|
36
|
-
.monaco-workbench .${this._styleClassName} span.codicon { line-height: ${codeLensHeight}px; font-size: ${fontSize}px; }
|
|
37
|
-
`;
|
|
38
|
-
if (fontFamily) {
|
|
39
|
-
newStyle += `${this._styleClassName} { font-family: var(${fontFamilyVar}), ${EDITOR_FONT_DEFAULTS.fontFamily}}`;
|
|
40
|
-
}
|
|
41
|
-
this._styleElement.textContent = newStyle;
|
|
42
|
-
this._editor.getContainerDomNode().style.setProperty(fontFamilyVar, fontFamily ?? 'inherit');
|
|
43
|
-
this._editor.getContainerDomNode().style.setProperty(fontFeaturesVar, editorFontInfo.fontFeatureSettings);
|
|
44
|
-
}
|
|
45
|
-
_getLayoutInfo() {
|
|
46
|
-
const lineHeightFactor = Math.max(1.3, this._editor.getOption(66 ) / this._editor.getOption(52 ));
|
|
47
|
-
let fontSize = this._editor.getOption(19 );
|
|
48
|
-
if (!fontSize || fontSize < 5) {
|
|
49
|
-
fontSize = (this._editor.getOption(52 ) * .9) | 0;
|
|
50
|
-
}
|
|
51
|
-
return {
|
|
52
|
-
fontSize,
|
|
53
|
-
codeLensHeight: (fontSize * lineHeightFactor) | 0,
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
createWidget(viewZoneChangeAccessor, lineNumber, items, viewZoneIdsToCleanUp) {
|
|
57
|
-
const layoutInfo = this._getLayoutInfo();
|
|
58
|
-
return ( new ActionsContentWidget(
|
|
59
|
-
this._editor,
|
|
60
|
-
viewZoneChangeAccessor,
|
|
61
|
-
lineNumber,
|
|
62
|
-
layoutInfo.codeLensHeight + 2,
|
|
63
|
-
this._styleClassName,
|
|
64
|
-
items,
|
|
65
|
-
viewZoneIdsToCleanUp
|
|
66
|
-
));
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
class ActionsSource {
|
|
70
|
-
constructor(viewModel, modifiedBaseRange) {
|
|
71
|
-
this.viewModel = viewModel;
|
|
72
|
-
this.modifiedBaseRange = modifiedBaseRange;
|
|
73
|
-
this.itemsInput1 = this.getItemsInput(1);
|
|
74
|
-
this.itemsInput2 = this.getItemsInput(2);
|
|
75
|
-
this.resultItems = derived(this, reader => {
|
|
76
|
-
const viewModel = this.viewModel;
|
|
77
|
-
const modifiedBaseRange = this.modifiedBaseRange;
|
|
78
|
-
const state = viewModel.model.getState(modifiedBaseRange).read(reader);
|
|
79
|
-
const model = viewModel.model;
|
|
80
|
-
const result = [];
|
|
81
|
-
if (state.kind === ModifiedBaseRangeStateKind.unrecognized) {
|
|
82
|
-
result.push({
|
|
83
|
-
text: ( localizeWithPath(
|
|
84
|
-
'vs/workbench/contrib/mergeEditor/browser/view/conflictActions',
|
|
85
|
-
'manualResolution',
|
|
86
|
-
"Manual Resolution"
|
|
87
|
-
)),
|
|
88
|
-
tooltip: ( localizeWithPath(
|
|
89
|
-
'vs/workbench/contrib/mergeEditor/browser/view/conflictActions',
|
|
90
|
-
'manualResolutionTooltip',
|
|
91
|
-
"This conflict has been resolved manually."
|
|
92
|
-
)),
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
else if (state.kind === ModifiedBaseRangeStateKind.base) {
|
|
96
|
-
result.push({
|
|
97
|
-
text: ( localizeWithPath(
|
|
98
|
-
'vs/workbench/contrib/mergeEditor/browser/view/conflictActions',
|
|
99
|
-
'noChangesAccepted',
|
|
100
|
-
'No Changes Accepted'
|
|
101
|
-
)),
|
|
102
|
-
tooltip: ( localizeWithPath(
|
|
103
|
-
'vs/workbench/contrib/mergeEditor/browser/view/conflictActions',
|
|
104
|
-
'noChangesAcceptedTooltip',
|
|
105
|
-
'The current resolution of this conflict equals the common ancestor of both the right and left changes.'
|
|
106
|
-
)),
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
const labels = [];
|
|
111
|
-
if (state.includesInput1) {
|
|
112
|
-
labels.push(model.input1.title);
|
|
113
|
-
}
|
|
114
|
-
if (state.includesInput2) {
|
|
115
|
-
labels.push(model.input2.title);
|
|
116
|
-
}
|
|
117
|
-
if (state.kind === ModifiedBaseRangeStateKind.both && state.firstInput === 2) {
|
|
118
|
-
labels.reverse();
|
|
119
|
-
}
|
|
120
|
-
result.push({
|
|
121
|
-
text: `${labels.join(' + ')}`
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
const stateToggles = [];
|
|
125
|
-
if (state.includesInput1) {
|
|
126
|
-
stateToggles.push(command(( localizeWithPath(
|
|
127
|
-
'vs/workbench/contrib/mergeEditor/browser/view/conflictActions',
|
|
128
|
-
'remove',
|
|
129
|
-
'Remove {0}',
|
|
130
|
-
model.input1.title
|
|
131
|
-
)), async () => {
|
|
132
|
-
transaction((tx) => {
|
|
133
|
-
model.setState(modifiedBaseRange, state.withInputValue(1, false), true, tx);
|
|
134
|
-
model.telemetry.reportRemoveInvoked(1, state.includesInput(2));
|
|
135
|
-
});
|
|
136
|
-
}, ( localizeWithPath(
|
|
137
|
-
'vs/workbench/contrib/mergeEditor/browser/view/conflictActions',
|
|
138
|
-
'removeTooltip',
|
|
139
|
-
'Remove {0} from the result document.',
|
|
140
|
-
model.input1.title
|
|
141
|
-
))));
|
|
142
|
-
}
|
|
143
|
-
if (state.includesInput2) {
|
|
144
|
-
stateToggles.push(command(( localizeWithPath(
|
|
145
|
-
'vs/workbench/contrib/mergeEditor/browser/view/conflictActions',
|
|
146
|
-
'remove',
|
|
147
|
-
'Remove {0}',
|
|
148
|
-
model.input2.title
|
|
149
|
-
)), async () => {
|
|
150
|
-
transaction((tx) => {
|
|
151
|
-
model.setState(modifiedBaseRange, state.withInputValue(2, false), true, tx);
|
|
152
|
-
model.telemetry.reportRemoveInvoked(2, state.includesInput(1));
|
|
153
|
-
});
|
|
154
|
-
}, ( localizeWithPath(
|
|
155
|
-
'vs/workbench/contrib/mergeEditor/browser/view/conflictActions',
|
|
156
|
-
'removeTooltip',
|
|
157
|
-
'Remove {0} from the result document.',
|
|
158
|
-
model.input2.title
|
|
159
|
-
))));
|
|
160
|
-
}
|
|
161
|
-
if (state.kind === ModifiedBaseRangeStateKind.both &&
|
|
162
|
-
state.firstInput === 2) {
|
|
163
|
-
stateToggles.reverse();
|
|
164
|
-
}
|
|
165
|
-
result.push(...stateToggles);
|
|
166
|
-
if (state.kind === ModifiedBaseRangeStateKind.unrecognized) {
|
|
167
|
-
result.push(command(( localizeWithPath(
|
|
168
|
-
'vs/workbench/contrib/mergeEditor/browser/view/conflictActions',
|
|
169
|
-
'resetToBase',
|
|
170
|
-
'Reset to base'
|
|
171
|
-
)), async () => {
|
|
172
|
-
transaction((tx) => {
|
|
173
|
-
model.setState(modifiedBaseRange, ModifiedBaseRangeState.base, true, tx);
|
|
174
|
-
model.telemetry.reportResetToBaseInvoked();
|
|
175
|
-
});
|
|
176
|
-
}, ( localizeWithPath(
|
|
177
|
-
'vs/workbench/contrib/mergeEditor/browser/view/conflictActions',
|
|
178
|
-
'resetToBaseTooltip',
|
|
179
|
-
'Reset this conflict to the common ancestor of both the right and left changes.'
|
|
180
|
-
))));
|
|
181
|
-
}
|
|
182
|
-
return result;
|
|
183
|
-
});
|
|
184
|
-
this.isEmpty = derived(this, reader => {
|
|
185
|
-
return this.itemsInput1.read(reader).length + this.itemsInput2.read(reader).length + this.resultItems.read(reader).length === 0;
|
|
186
|
-
});
|
|
187
|
-
this.inputIsEmpty = derived(this, reader => {
|
|
188
|
-
return this.itemsInput1.read(reader).length + this.itemsInput2.read(reader).length === 0;
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
getItemsInput(inputNumber) {
|
|
192
|
-
return derived(reader => {
|
|
193
|
-
const viewModel = this.viewModel;
|
|
194
|
-
const modifiedBaseRange = this.modifiedBaseRange;
|
|
195
|
-
if (!viewModel.model.hasBaseRange(modifiedBaseRange)) {
|
|
196
|
-
return [];
|
|
197
|
-
}
|
|
198
|
-
const state = viewModel.model.getState(modifiedBaseRange).read(reader);
|
|
199
|
-
const handled = viewModel.model.isHandled(modifiedBaseRange).read(reader);
|
|
200
|
-
const model = viewModel.model;
|
|
201
|
-
const result = [];
|
|
202
|
-
const inputData = inputNumber === 1 ? viewModel.model.input1 : viewModel.model.input2;
|
|
203
|
-
const showNonConflictingChanges = viewModel.showNonConflictingChanges.read(reader);
|
|
204
|
-
if (!modifiedBaseRange.isConflicting && handled && !showNonConflictingChanges) {
|
|
205
|
-
return [];
|
|
206
|
-
}
|
|
207
|
-
const otherInputNumber = inputNumber === 1 ? 2 : 1;
|
|
208
|
-
if (state.kind !== ModifiedBaseRangeStateKind.unrecognized && !state.isInputIncluded(inputNumber)) {
|
|
209
|
-
if (!state.isInputIncluded(otherInputNumber) || !this.viewModel.shouldUseAppendInsteadOfAccept.read(reader)) {
|
|
210
|
-
result.push(command(( localizeWithPath(
|
|
211
|
-
'vs/workbench/contrib/mergeEditor/browser/view/conflictActions',
|
|
212
|
-
'accept',
|
|
213
|
-
"Accept {0}",
|
|
214
|
-
inputData.title
|
|
215
|
-
)), async () => {
|
|
216
|
-
transaction((tx) => {
|
|
217
|
-
model.setState(modifiedBaseRange, state.withInputValue(inputNumber, true, false), inputNumber, tx);
|
|
218
|
-
model.telemetry.reportAcceptInvoked(inputNumber, state.includesInput(otherInputNumber));
|
|
219
|
-
});
|
|
220
|
-
}, ( localizeWithPath(
|
|
221
|
-
'vs/workbench/contrib/mergeEditor/browser/view/conflictActions',
|
|
222
|
-
'acceptTooltip',
|
|
223
|
-
"Accept {0} in the result document.",
|
|
224
|
-
inputData.title
|
|
225
|
-
))));
|
|
226
|
-
if (modifiedBaseRange.canBeCombined) {
|
|
227
|
-
const commandName = modifiedBaseRange.isOrderRelevant
|
|
228
|
-
? ( localizeWithPath(
|
|
229
|
-
'vs/workbench/contrib/mergeEditor/browser/view/conflictActions',
|
|
230
|
-
'acceptBoth0First',
|
|
231
|
-
"Accept Combination ({0} First)",
|
|
232
|
-
inputData.title
|
|
233
|
-
))
|
|
234
|
-
: ( localizeWithPath(
|
|
235
|
-
'vs/workbench/contrib/mergeEditor/browser/view/conflictActions',
|
|
236
|
-
'acceptBoth',
|
|
237
|
-
"Accept Combination"
|
|
238
|
-
));
|
|
239
|
-
result.push(command(commandName, async () => {
|
|
240
|
-
transaction((tx) => {
|
|
241
|
-
model.setState(modifiedBaseRange, ModifiedBaseRangeState.base
|
|
242
|
-
.withInputValue(inputNumber, true)
|
|
243
|
-
.withInputValue(otherInputNumber, true, true), true, tx);
|
|
244
|
-
model.telemetry.reportSmartCombinationInvoked(state.includesInput(otherInputNumber));
|
|
245
|
-
});
|
|
246
|
-
}, ( localizeWithPath(
|
|
247
|
-
'vs/workbench/contrib/mergeEditor/browser/view/conflictActions',
|
|
248
|
-
'acceptBothTooltip',
|
|
249
|
-
"Accept an automatic combination of both sides in the result document."
|
|
250
|
-
))));
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
else {
|
|
254
|
-
result.push(command(( localizeWithPath(
|
|
255
|
-
'vs/workbench/contrib/mergeEditor/browser/view/conflictActions',
|
|
256
|
-
'append',
|
|
257
|
-
"Append {0}",
|
|
258
|
-
inputData.title
|
|
259
|
-
)), async () => {
|
|
260
|
-
transaction((tx) => {
|
|
261
|
-
model.setState(modifiedBaseRange, state.withInputValue(inputNumber, true, false), inputNumber, tx);
|
|
262
|
-
model.telemetry.reportAcceptInvoked(inputNumber, state.includesInput(otherInputNumber));
|
|
263
|
-
});
|
|
264
|
-
}, ( localizeWithPath(
|
|
265
|
-
'vs/workbench/contrib/mergeEditor/browser/view/conflictActions',
|
|
266
|
-
'appendTooltip',
|
|
267
|
-
"Append {0} to the result document.",
|
|
268
|
-
inputData.title
|
|
269
|
-
))));
|
|
270
|
-
if (modifiedBaseRange.canBeCombined) {
|
|
271
|
-
result.push(command(( localizeWithPath(
|
|
272
|
-
'vs/workbench/contrib/mergeEditor/browser/view/conflictActions',
|
|
273
|
-
'combine',
|
|
274
|
-
"Accept Combination",
|
|
275
|
-
inputData.title
|
|
276
|
-
)), async () => {
|
|
277
|
-
transaction((tx) => {
|
|
278
|
-
model.setState(modifiedBaseRange, state.withInputValue(inputNumber, true, true), inputNumber, tx);
|
|
279
|
-
model.telemetry.reportSmartCombinationInvoked(state.includesInput(otherInputNumber));
|
|
280
|
-
});
|
|
281
|
-
}, ( localizeWithPath(
|
|
282
|
-
'vs/workbench/contrib/mergeEditor/browser/view/conflictActions',
|
|
283
|
-
'acceptBothTooltip',
|
|
284
|
-
"Accept an automatic combination of both sides in the result document."
|
|
285
|
-
))));
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
if (!model.isInputHandled(modifiedBaseRange, inputNumber).read(reader)) {
|
|
289
|
-
result.push(command(( localizeWithPath(
|
|
290
|
-
'vs/workbench/contrib/mergeEditor/browser/view/conflictActions',
|
|
291
|
-
'ignore',
|
|
292
|
-
'Ignore'
|
|
293
|
-
)), async () => {
|
|
294
|
-
transaction((tx) => {
|
|
295
|
-
model.setInputHandled(modifiedBaseRange, inputNumber, true, tx);
|
|
296
|
-
});
|
|
297
|
-
}, ( localizeWithPath(
|
|
298
|
-
'vs/workbench/contrib/mergeEditor/browser/view/conflictActions',
|
|
299
|
-
'markAsHandledTooltip',
|
|
300
|
-
"Don't take this side of the conflict."
|
|
301
|
-
))));
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
return result;
|
|
305
|
-
});
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
function command(title, action, tooltip) {
|
|
309
|
-
return {
|
|
310
|
-
text: title,
|
|
311
|
-
action,
|
|
312
|
-
tooltip,
|
|
313
|
-
};
|
|
314
|
-
}
|
|
315
|
-
class ActionsContentWidget extends FixedZoneWidget {
|
|
316
|
-
constructor(editor, viewZoneAccessor, afterLineNumber, height, className, items, viewZoneIdsToCleanUp) {
|
|
317
|
-
super(editor, viewZoneAccessor, afterLineNumber, height, viewZoneIdsToCleanUp);
|
|
318
|
-
this._domNode = h('div.merge-editor-conflict-actions').root;
|
|
319
|
-
this.widgetDomNode.appendChild(this._domNode);
|
|
320
|
-
this._domNode.classList.add(className);
|
|
321
|
-
this._register(autorun(reader => {
|
|
322
|
-
const i = items.read(reader);
|
|
323
|
-
this.setState(i);
|
|
324
|
-
}));
|
|
325
|
-
}
|
|
326
|
-
setState(items) {
|
|
327
|
-
const children = [];
|
|
328
|
-
let isFirst = true;
|
|
329
|
-
for (const item of items) {
|
|
330
|
-
if (isFirst) {
|
|
331
|
-
isFirst = false;
|
|
332
|
-
}
|
|
333
|
-
else {
|
|
334
|
-
children.push($('span', undefined, '\u00a0|\u00a0'));
|
|
335
|
-
}
|
|
336
|
-
const title = renderLabelWithIcons(item.text);
|
|
337
|
-
if (item.action) {
|
|
338
|
-
children.push($('a', { title: item.tooltip, role: 'button', onclick: () => item.action() }, ...title));
|
|
339
|
-
}
|
|
340
|
-
else {
|
|
341
|
-
children.push($('span', { title: item.tooltip }, ...title));
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
reset(this._domNode, ...children);
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
export { ActionsSource, ConflictActionsFactory };
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { h, reset } from 'vscode/vscode/vs/base/browser/dom';
|
|
2
|
-
import { Disposable, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
3
|
-
import { LineRange } from 'vscode/vscode/vs/workbench/contrib/mergeEditor/browser/model/lineRange';
|
|
4
|
-
import { observableFromEvent, observableSignalFromEvent, observableSignal } from 'vscode/vscode/vs/base/common/observableInternal/utils';
|
|
5
|
-
import { autorun } from 'vscode/vscode/vs/base/common/observableInternal/autorun';
|
|
6
|
-
import { transaction } from 'vscode/vscode/vs/base/common/observableInternal/base';
|
|
7
|
-
|
|
8
|
-
class EditorGutter extends Disposable {
|
|
9
|
-
constructor(_editor, _domNode, itemProvider) {
|
|
10
|
-
super();
|
|
11
|
-
this._editor = _editor;
|
|
12
|
-
this._domNode = _domNode;
|
|
13
|
-
this.itemProvider = itemProvider;
|
|
14
|
-
this.scrollTop = observableFromEvent(this._editor.onDidScrollChange, (e) => this._editor.getScrollTop());
|
|
15
|
-
this.isScrollTopZero = ( this.scrollTop.map((scrollTop) => scrollTop === 0));
|
|
16
|
-
this.modelAttached = observableFromEvent(this._editor.onDidChangeModel, (e) => this._editor.hasModel());
|
|
17
|
-
this.editorOnDidChangeViewZones = observableSignalFromEvent('onDidChangeViewZones', this._editor.onDidChangeViewZones);
|
|
18
|
-
this.editorOnDidContentSizeChange = observableSignalFromEvent('onDidContentSizeChange', this._editor.onDidContentSizeChange);
|
|
19
|
-
this.domNodeSizeChanged = observableSignal('domNodeSizeChanged');
|
|
20
|
-
this.views = ( new Map());
|
|
21
|
-
this._domNode.className = 'gutter monaco-editor';
|
|
22
|
-
const scrollDecoration = this._domNode.appendChild(h('div.scroll-decoration', { role: 'presentation', ariaHidden: 'true', style: { width: '100%' } })
|
|
23
|
-
.root);
|
|
24
|
-
const o = ( new ResizeObserver(() => {
|
|
25
|
-
transaction(tx => {
|
|
26
|
-
this.domNodeSizeChanged.trigger(tx);
|
|
27
|
-
});
|
|
28
|
-
}));
|
|
29
|
-
o.observe(this._domNode);
|
|
30
|
-
this._register(toDisposable(() => o.disconnect()));
|
|
31
|
-
this._register(autorun(reader => {
|
|
32
|
-
scrollDecoration.className = this.isScrollTopZero.read(reader) ? '' : 'scroll-decoration';
|
|
33
|
-
}));
|
|
34
|
-
this._register(autorun(reader => this.render(reader)));
|
|
35
|
-
}
|
|
36
|
-
dispose() {
|
|
37
|
-
super.dispose();
|
|
38
|
-
reset(this._domNode);
|
|
39
|
-
}
|
|
40
|
-
render(reader) {
|
|
41
|
-
if (!this.modelAttached.read(reader)) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
this.domNodeSizeChanged.read(reader);
|
|
45
|
-
this.editorOnDidChangeViewZones.read(reader);
|
|
46
|
-
this.editorOnDidContentSizeChange.read(reader);
|
|
47
|
-
const scrollTop = this.scrollTop.read(reader);
|
|
48
|
-
const visibleRanges = this._editor.getVisibleRanges();
|
|
49
|
-
const unusedIds = ( new Set(( this.views.keys())));
|
|
50
|
-
if (visibleRanges.length > 0) {
|
|
51
|
-
const visibleRange = visibleRanges[0];
|
|
52
|
-
const visibleRange2 = ( new LineRange(
|
|
53
|
-
visibleRange.startLineNumber,
|
|
54
|
-
visibleRange.endLineNumber - visibleRange.startLineNumber
|
|
55
|
-
)).deltaEnd(1);
|
|
56
|
-
const gutterItems = this.itemProvider.getIntersectingGutterItems(visibleRange2, reader);
|
|
57
|
-
for (const gutterItem of gutterItems) {
|
|
58
|
-
if (!gutterItem.range.touches(visibleRange2)) {
|
|
59
|
-
continue;
|
|
60
|
-
}
|
|
61
|
-
unusedIds.delete(gutterItem.id);
|
|
62
|
-
let view = this.views.get(gutterItem.id);
|
|
63
|
-
if (!view) {
|
|
64
|
-
const viewDomNode = document.createElement('div');
|
|
65
|
-
this._domNode.appendChild(viewDomNode);
|
|
66
|
-
const itemView = this.itemProvider.createView(gutterItem, viewDomNode);
|
|
67
|
-
view = ( new ManagedGutterItemView(itemView, viewDomNode));
|
|
68
|
-
this.views.set(gutterItem.id, view);
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
view.gutterItemView.update(gutterItem);
|
|
72
|
-
}
|
|
73
|
-
const top = gutterItem.range.startLineNumber <= this._editor.getModel().getLineCount()
|
|
74
|
-
? this._editor.getTopForLineNumber(gutterItem.range.startLineNumber, true) - scrollTop
|
|
75
|
-
: this._editor.getBottomForLineNumber(gutterItem.range.startLineNumber - 1, false) - scrollTop;
|
|
76
|
-
const bottom = this._editor.getBottomForLineNumber(gutterItem.range.endLineNumberExclusive - 1, true) - scrollTop;
|
|
77
|
-
const height = bottom - top;
|
|
78
|
-
view.domNode.style.top = `${top}px`;
|
|
79
|
-
view.domNode.style.height = `${height}px`;
|
|
80
|
-
view.gutterItemView.layout(top, height, 0, this._domNode.clientHeight);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
for (const id of unusedIds) {
|
|
84
|
-
const view = this.views.get(id);
|
|
85
|
-
view.gutterItemView.dispose();
|
|
86
|
-
this._domNode.removeChild(view.domNode);
|
|
87
|
-
this.views.delete(id);
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
class ManagedGutterItemView {
|
|
92
|
-
constructor(gutterItemView, domNode) {
|
|
93
|
-
this.gutterItemView = gutterItemView;
|
|
94
|
-
this.domNode = domNode;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export { EditorGutter };
|
package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/baseCodeEditorView.js
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { reset, h } from 'vscode/vscode/vs/base/browser/dom';
|
|
3
|
-
import { renderLabelWithIcons } from 'vscode/vscode/vs/base/browser/ui/iconLabel/iconLabels';
|
|
4
|
-
import { BugIndicatingError } from 'vscode/vscode/vs/base/common/errors';
|
|
5
|
-
import { MinimapPosition, OverviewRulerLane } from 'vscode/vscode/vs/editor/common/model';
|
|
6
|
-
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
7
|
-
import { MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
8
|
-
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
9
|
-
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
10
|
-
import { applyObservableDecorations } from 'vscode/vscode/vs/workbench/contrib/mergeEditor/browser/utils';
|
|
11
|
-
import { handledConflictMinimapOverViewRulerColor, unhandledConflictMinimapOverViewRulerColor } from '../colors.js';
|
|
12
|
-
import { EditorGutter } from '../editorGutter.js';
|
|
13
|
-
import { CodeEditorView, createSelectionsAutorun, TitleMenu } from './codeEditorView.js';
|
|
14
|
-
import { derived } from 'vscode/vscode/vs/base/common/observableInternal/derived';
|
|
15
|
-
import { autorunWithStore, autorun } from 'vscode/vscode/vs/base/common/observableInternal/autorun';
|
|
16
|
-
|
|
17
|
-
let BaseCodeEditorView = class BaseCodeEditorView extends CodeEditorView {
|
|
18
|
-
constructor(viewModel, instantiationService, configurationService) {
|
|
19
|
-
super(instantiationService, viewModel, configurationService);
|
|
20
|
-
this.decorations = derived(this, reader => {
|
|
21
|
-
const viewModel = this.viewModel.read(reader);
|
|
22
|
-
if (!viewModel) {
|
|
23
|
-
return [];
|
|
24
|
-
}
|
|
25
|
-
const model = viewModel.model;
|
|
26
|
-
const textModel = model.base;
|
|
27
|
-
const activeModifiedBaseRange = viewModel.activeModifiedBaseRange.read(reader);
|
|
28
|
-
const showNonConflictingChanges = viewModel.showNonConflictingChanges.read(reader);
|
|
29
|
-
const showDeletionMarkers = this.showDeletionMarkers.read(reader);
|
|
30
|
-
const result = [];
|
|
31
|
-
for (const modifiedBaseRange of model.modifiedBaseRanges.read(reader)) {
|
|
32
|
-
const range = modifiedBaseRange.baseRange;
|
|
33
|
-
if (!range) {
|
|
34
|
-
continue;
|
|
35
|
-
}
|
|
36
|
-
const isHandled = model.isHandled(modifiedBaseRange).read(reader);
|
|
37
|
-
if (!modifiedBaseRange.isConflicting && isHandled && !showNonConflictingChanges) {
|
|
38
|
-
continue;
|
|
39
|
-
}
|
|
40
|
-
const blockClassNames = ['merge-editor-block'];
|
|
41
|
-
let blockPadding = [0, 0, 0, 0];
|
|
42
|
-
if (isHandled) {
|
|
43
|
-
blockClassNames.push('handled');
|
|
44
|
-
}
|
|
45
|
-
if (modifiedBaseRange === activeModifiedBaseRange) {
|
|
46
|
-
blockClassNames.push('focused');
|
|
47
|
-
blockPadding = [0, 2, 0, 2];
|
|
48
|
-
}
|
|
49
|
-
blockClassNames.push('base');
|
|
50
|
-
const inputToDiffAgainst = viewModel.baseShowDiffAgainst.read(reader);
|
|
51
|
-
if (inputToDiffAgainst) {
|
|
52
|
-
for (const diff of modifiedBaseRange.getInputDiffs(inputToDiffAgainst)) {
|
|
53
|
-
const range = diff.inputRange.toInclusiveRange();
|
|
54
|
-
if (range) {
|
|
55
|
-
result.push({
|
|
56
|
-
range,
|
|
57
|
-
options: {
|
|
58
|
-
className: `merge-editor-diff base`,
|
|
59
|
-
description: 'Merge Editor',
|
|
60
|
-
isWholeLine: true,
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
for (const diff2 of diff.rangeMappings) {
|
|
65
|
-
if (showDeletionMarkers || !diff2.inputRange.isEmpty()) {
|
|
66
|
-
result.push({
|
|
67
|
-
range: diff2.inputRange,
|
|
68
|
-
options: {
|
|
69
|
-
className: diff2.inputRange.isEmpty() ? `merge-editor-diff-empty-word base` : `merge-editor-diff-word base`,
|
|
70
|
-
description: 'Merge Editor',
|
|
71
|
-
showIfCollapsed: true,
|
|
72
|
-
},
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
result.push({
|
|
79
|
-
range: range.toInclusiveRangeOrEmpty(),
|
|
80
|
-
options: {
|
|
81
|
-
showIfCollapsed: true,
|
|
82
|
-
blockClassName: blockClassNames.join(' '),
|
|
83
|
-
blockPadding,
|
|
84
|
-
blockIsAfterEnd: range.startLineNumber > textModel.getLineCount(),
|
|
85
|
-
description: 'Merge Editor',
|
|
86
|
-
minimap: {
|
|
87
|
-
position: MinimapPosition.Gutter,
|
|
88
|
-
color: { id: isHandled ? handledConflictMinimapOverViewRulerColor : unhandledConflictMinimapOverViewRulerColor },
|
|
89
|
-
},
|
|
90
|
-
overviewRuler: modifiedBaseRange.isConflicting ? {
|
|
91
|
-
position: OverviewRulerLane.Center,
|
|
92
|
-
color: { id: isHandled ? handledConflictMinimapOverViewRulerColor : unhandledConflictMinimapOverViewRulerColor },
|
|
93
|
-
} : undefined
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
return result;
|
|
98
|
-
});
|
|
99
|
-
this._register(createSelectionsAutorun(this, (baseRange, viewModel) => baseRange));
|
|
100
|
-
this._register(instantiationService.createInstance(TitleMenu, MenuId.MergeBaseToolbar, this.htmlElements.title));
|
|
101
|
-
this._register(autorunWithStore((reader, store) => {
|
|
102
|
-
if (this.checkboxesVisible.read(reader)) {
|
|
103
|
-
store.add(( new EditorGutter(this.editor, this.htmlElements.gutterDiv, {
|
|
104
|
-
getIntersectingGutterItems: (range, reader) => [],
|
|
105
|
-
createView: (item, target) => { throw new BugIndicatingError(); },
|
|
106
|
-
})));
|
|
107
|
-
}
|
|
108
|
-
}));
|
|
109
|
-
this._register(autorun(reader => {
|
|
110
|
-
const vm = this.viewModel.read(reader);
|
|
111
|
-
if (!vm) {
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
this.editor.setModel(vm.model.base);
|
|
115
|
-
reset(this.htmlElements.title, ...renderLabelWithIcons(( localizeWithPath(
|
|
116
|
-
'vs/workbench/contrib/mergeEditor/browser/view/editors/baseCodeEditorView',
|
|
117
|
-
'base',
|
|
118
|
-
'Base'
|
|
119
|
-
))));
|
|
120
|
-
const baseShowDiffAgainst = vm.baseShowDiffAgainst.read(reader);
|
|
121
|
-
let node = undefined;
|
|
122
|
-
if (baseShowDiffAgainst) {
|
|
123
|
-
const label = ( localizeWithPath(
|
|
124
|
-
'vs/workbench/contrib/mergeEditor/browser/view/editors/baseCodeEditorView',
|
|
125
|
-
'compareWith',
|
|
126
|
-
'Comparing with {0}',
|
|
127
|
-
baseShowDiffAgainst === 1 ? vm.model.input1.title : vm.model.input2.title
|
|
128
|
-
));
|
|
129
|
-
const tooltip = ( localizeWithPath(
|
|
130
|
-
'vs/workbench/contrib/mergeEditor/browser/view/editors/baseCodeEditorView',
|
|
131
|
-
'compareWithTooltip',
|
|
132
|
-
'Differences are highlighted with a background color.'
|
|
133
|
-
));
|
|
134
|
-
node = h('span', { title: tooltip }, [label]).root;
|
|
135
|
-
}
|
|
136
|
-
reset(this.htmlElements.description, ...(node ? [node] : []));
|
|
137
|
-
}));
|
|
138
|
-
this._register(applyObservableDecorations(this.editor, this.decorations));
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
BaseCodeEditorView = ( __decorate([
|
|
142
|
-
( __param(1, IInstantiationService)),
|
|
143
|
-
( __param(2, IConfigurationService))
|
|
144
|
-
], BaseCodeEditorView));
|
|
145
|
-
|
|
146
|
-
export { BaseCodeEditorView };
|