@codingame/monaco-vscode-views-service-override 1.85.0 → 1.85.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/assets/index-no-csp.html +4 -0
- package/assets/index.html +5 -1
- package/index.d.ts +2 -2
- package/index.js +2 -2
- package/package.json +11 -9
- package/tools/editor.js +1 -1
- package/views.d.ts +9 -4
- package/views.js +32 -10
- package/vscode/src/vs/workbench/api/browser/viewsExtensionPoint.js +2 -2
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditorInputFactory.js +1 -1
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/commands.js +692 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/devCommands.js +240 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditor.contribution.js +77 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorSerializer.js +42 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/colors.js +71 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/conflictActions.js +346 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editorGutter.js +96 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/baseCodeEditorView.js +145 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/codeEditorView.js +103 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/inputCodeEditorView.js +399 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/resultCodeEditorView.js +196 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/fixedZoneWidget.js +41 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/lineAlignment.js +128 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/media/mergeEditor.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/mergeEditor.js +611 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/scrollSynchronizer.js +158 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewModel.js +262 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewZones.js +173 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/webview.contribution.js +79 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewFindWidget.js +1 -1
- package/vscode/src/vs/workbench/services/history/browser/historyService.js +3 -0
- package/override/vs/workbench/contrib/notebook/common/notebookEditorInput.js +0 -3
- package/vscode/src/vs/base/browser/ui/tree/treeDefaults.js +0 -16
- package/vscode/src/vs/workbench/browser/parts/views/checkbox.js +0 -107
- package/vscode/src/vs/workbench/browser/parts/views/media/views.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/views/treeView.js +0 -1604
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/find/simpleFindWidget.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/find/simpleFindWidget.js +0 -390
- package/vscode/src/vs/workbench/contrib/languageDetection/browser/languageDetection.contribution.js +0 -157
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookContextKeys.js +0 -5
- package/vscode/src/vs/workbench/contrib/remote/browser/media/tunnelView.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/remote/browser/remoteExplorer.js +0 -217
- package/vscode/src/vs/workbench/contrib/remote/browser/remoteIcons.js +0 -91
- package/vscode/src/vs/workbench/contrib/remote/browser/tunnelView.js +0 -1837
|
@@ -0,0 +1,611 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { reset } from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
3
|
+
import { SerializableGrid } from '../../../../../base/browser/ui/grid/grid.js';
|
|
4
|
+
import { Color } from 'monaco-editor/esm/vs/base/common/color.js';
|
|
5
|
+
import { BugIndicatingError, onUnexpectedError } from 'monaco-editor/esm/vs/base/common/errors.js';
|
|
6
|
+
import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
7
|
+
import { DisposableStore, MutableDisposable, toDisposable, Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
8
|
+
import { observableValue, transaction, autorunWithStore, autorun } from 'monaco-editor/esm/vs/base/common/observable.js';
|
|
9
|
+
import { isEqual, basename } from 'monaco-editor/esm/vs/base/common/resources.js';
|
|
10
|
+
import { isDefined } from 'monaco-editor/esm/vs/base/common/types.js';
|
|
11
|
+
import './media/mergeEditor.css.js';
|
|
12
|
+
import { ICodeEditorService } from 'monaco-editor/esm/vs/editor/browser/services/codeEditorService.js';
|
|
13
|
+
import { ITextResourceConfigurationService } from 'monaco-editor/esm/vs/editor/common/services/textResourceConfiguration.js';
|
|
14
|
+
import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
|
|
15
|
+
import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
16
|
+
import { IContextKeyService } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
|
|
17
|
+
import { IFileService } from 'monaco-editor/esm/vs/platform/files/common/files.js';
|
|
18
|
+
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
19
|
+
import { IStorageService } from 'monaco-editor/esm/vs/platform/storage/common/storage.js';
|
|
20
|
+
import { ITelemetryService } from 'monaco-editor/esm/vs/platform/telemetry/common/telemetry.js';
|
|
21
|
+
import { IThemeService } from 'monaco-editor/esm/vs/platform/theme/common/themeService.js';
|
|
22
|
+
import { AbstractTextEditor } from 'vscode/vscode/vs/workbench/browser/parts/editor/textEditor';
|
|
23
|
+
import { DEFAULT_EDITOR_ASSOCIATION } from 'vscode/vscode/vs/workbench/common/editor';
|
|
24
|
+
import { applyTextEditorOptions } from 'vscode/vscode/vs/workbench/common/editor/editorOptions';
|
|
25
|
+
import { readTransientState, writeTransientState } from 'vscode/vscode/vs/workbench/contrib/codeEditor/browser/toggleWordWrap';
|
|
26
|
+
import { MergeEditorInput } from 'vscode/vscode/vs/workbench/contrib/mergeEditor/browser/mergeEditorInput';
|
|
27
|
+
import { observableConfigValue, PersistentStore, deepMerge, thenIfNotDisposed } from 'vscode/vscode/vs/workbench/contrib/mergeEditor/browser/utils';
|
|
28
|
+
import { BaseCodeEditorView } from './editors/baseCodeEditorView.js';
|
|
29
|
+
import { ScrollSynchronizer } from './scrollSynchronizer.js';
|
|
30
|
+
import { MergeEditorViewModel } from './viewModel.js';
|
|
31
|
+
import { ViewZoneComputer } from './viewZones.js';
|
|
32
|
+
import { ctxIsMergeEditor, ctxMergeEditorLayout, ctxMergeEditorShowBase, ctxMergeEditorShowBaseAtTop, ctxMergeResultUri, ctxMergeBaseUri, ctxMergeEditorShowNonConflictingChanges } from 'vscode/vscode/vs/workbench/contrib/mergeEditor/common/mergeEditor';
|
|
33
|
+
import { settingsSashBorder } from 'vscode/vscode/vs/workbench/contrib/preferences/common/settingsEditorColorRegistry';
|
|
34
|
+
import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
|
|
35
|
+
import { RegisteredEditorPriority, IEditorResolverService } from 'vscode/vscode/vs/workbench/services/editor/common/editorResolverService';
|
|
36
|
+
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
37
|
+
import { InputCodeEditorView } from './editors/inputCodeEditorView.js';
|
|
38
|
+
import { ResultCodeEditorView } from './editors/resultCodeEditorView.js';
|
|
39
|
+
|
|
40
|
+
var MergeEditor_1, MergeEditorLayoutStore_1;
|
|
41
|
+
let MergeEditor = class MergeEditor extends AbstractTextEditor {
|
|
42
|
+
static { MergeEditor_1 = this; }
|
|
43
|
+
static { this.ID = 'mergeEditor'; }
|
|
44
|
+
get viewModel() {
|
|
45
|
+
return this._viewModel;
|
|
46
|
+
}
|
|
47
|
+
get inputModel() {
|
|
48
|
+
return this._inputModel;
|
|
49
|
+
}
|
|
50
|
+
get model() {
|
|
51
|
+
return this.inputModel.get()?.model;
|
|
52
|
+
}
|
|
53
|
+
get inputsWritable() {
|
|
54
|
+
return !!this._configurationService.getValue('mergeEditor.writableInputs');
|
|
55
|
+
}
|
|
56
|
+
constructor(instantiation, contextKeyService, telemetryService, storageService, themeService, textResourceConfigurationService, _configurationService, editorService, editorGroupService, fileService, _codeEditorService, configurationService) {
|
|
57
|
+
super(MergeEditor_1.ID, telemetryService, instantiation, storageService, textResourceConfigurationService, themeService, editorService, editorGroupService, fileService);
|
|
58
|
+
this.contextKeyService = contextKeyService;
|
|
59
|
+
this._configurationService = _configurationService;
|
|
60
|
+
this._codeEditorService = _codeEditorService;
|
|
61
|
+
this.configurationService = configurationService;
|
|
62
|
+
this._sessionDisposables = ( new DisposableStore());
|
|
63
|
+
this._viewModel = observableValue(this, undefined);
|
|
64
|
+
this._grid = this._register(( new MutableDisposable()));
|
|
65
|
+
this.input1View = this._register(this.instantiationService.createInstance(InputCodeEditorView, 1, this._viewModel));
|
|
66
|
+
this.baseView = observableValue(this, undefined);
|
|
67
|
+
this.baseViewOptions = observableValue(this, undefined);
|
|
68
|
+
this.input2View = this._register(this.instantiationService.createInstance(InputCodeEditorView, 2, this._viewModel));
|
|
69
|
+
this.inputResultView = this._register(this.instantiationService.createInstance(ResultCodeEditorView, this._viewModel));
|
|
70
|
+
this._layoutMode = this.instantiationService.createInstance(MergeEditorLayoutStore);
|
|
71
|
+
this._layoutModeObs = observableValue(this, this._layoutMode.value);
|
|
72
|
+
this._ctxIsMergeEditor = ctxIsMergeEditor.bindTo(this.contextKeyService);
|
|
73
|
+
this._ctxUsesColumnLayout = ctxMergeEditorLayout.bindTo(this.contextKeyService);
|
|
74
|
+
this._ctxShowBase = ctxMergeEditorShowBase.bindTo(this.contextKeyService);
|
|
75
|
+
this._ctxShowBaseAtTop = ctxMergeEditorShowBaseAtTop.bindTo(this.contextKeyService);
|
|
76
|
+
this._ctxResultUri = ctxMergeResultUri.bindTo(this.contextKeyService);
|
|
77
|
+
this._ctxBaseUri = ctxMergeBaseUri.bindTo(this.contextKeyService);
|
|
78
|
+
this._ctxShowNonConflictingChanges = ctxMergeEditorShowNonConflictingChanges.bindTo(this.contextKeyService);
|
|
79
|
+
this._inputModel = observableValue(this, undefined);
|
|
80
|
+
this.viewZoneComputer = ( new ViewZoneComputer(
|
|
81
|
+
this.input1View.editor,
|
|
82
|
+
this.input2View.editor,
|
|
83
|
+
this.inputResultView.editor
|
|
84
|
+
));
|
|
85
|
+
this.codeLensesVisible = observableConfigValue('mergeEditor.showCodeLenses', true, this.configurationService);
|
|
86
|
+
this.scrollSynchronizer = this._register(( new ScrollSynchronizer(
|
|
87
|
+
this._viewModel,
|
|
88
|
+
this.input1View,
|
|
89
|
+
this.input2View,
|
|
90
|
+
this.baseView,
|
|
91
|
+
this.inputResultView,
|
|
92
|
+
this._layoutModeObs
|
|
93
|
+
)));
|
|
94
|
+
this._onDidChangeSizeConstraints = ( new Emitter());
|
|
95
|
+
this.onDidChangeSizeConstraints = this._onDidChangeSizeConstraints.event;
|
|
96
|
+
this.baseViewDisposables = this._register(( new DisposableStore()));
|
|
97
|
+
this.showNonConflictingChangesStore = this.instantiationService.createInstance((PersistentStore), 'mergeEditor/showNonConflictingChanges');
|
|
98
|
+
this.showNonConflictingChanges = observableValue(this, this.showNonConflictingChangesStore.get() ?? false);
|
|
99
|
+
}
|
|
100
|
+
dispose() {
|
|
101
|
+
this._sessionDisposables.dispose();
|
|
102
|
+
this._ctxIsMergeEditor.reset();
|
|
103
|
+
this._ctxUsesColumnLayout.reset();
|
|
104
|
+
this._ctxShowNonConflictingChanges.reset();
|
|
105
|
+
super.dispose();
|
|
106
|
+
}
|
|
107
|
+
get minimumWidth() {
|
|
108
|
+
return this._layoutMode.value.kind === 'mixed'
|
|
109
|
+
? this.input1View.view.minimumWidth + this.input2View.view.minimumWidth
|
|
110
|
+
: this.input1View.view.minimumWidth + this.input2View.view.minimumWidth + this.inputResultView.view.minimumWidth;
|
|
111
|
+
}
|
|
112
|
+
getTitle() {
|
|
113
|
+
if (this.input) {
|
|
114
|
+
return this.input.getName();
|
|
115
|
+
}
|
|
116
|
+
return ( localizeWithPath(
|
|
117
|
+
'vs/workbench/contrib/mergeEditor/browser/view/mergeEditor',
|
|
118
|
+
'mergeEditor',
|
|
119
|
+
"Text Merge Editor"
|
|
120
|
+
));
|
|
121
|
+
}
|
|
122
|
+
createEditorControl(parent, initialOptions) {
|
|
123
|
+
this.rootHtmlElement = parent;
|
|
124
|
+
parent.classList.add('merge-editor');
|
|
125
|
+
this.applyLayout(this._layoutMode.value);
|
|
126
|
+
this.applyOptions(initialOptions);
|
|
127
|
+
}
|
|
128
|
+
updateEditorControlOptions(options) {
|
|
129
|
+
this.applyOptions(options);
|
|
130
|
+
}
|
|
131
|
+
applyOptions(options) {
|
|
132
|
+
const inputOptions = deepMerge(options, {
|
|
133
|
+
minimap: { enabled: false },
|
|
134
|
+
glyphMargin: false,
|
|
135
|
+
lineNumbersMinChars: 2,
|
|
136
|
+
readOnly: !this.inputsWritable
|
|
137
|
+
});
|
|
138
|
+
this.input1View.updateOptions(inputOptions);
|
|
139
|
+
this.input2View.updateOptions(inputOptions);
|
|
140
|
+
this.baseViewOptions.set({ ...this.input2View.editor.getRawOptions() }, undefined);
|
|
141
|
+
this.inputResultView.updateOptions(options);
|
|
142
|
+
}
|
|
143
|
+
getMainControl() {
|
|
144
|
+
return this.inputResultView.editor;
|
|
145
|
+
}
|
|
146
|
+
layout(dimension) {
|
|
147
|
+
this._grid.value?.layout(dimension.width, dimension.height);
|
|
148
|
+
}
|
|
149
|
+
async setInput(input, options, context, token) {
|
|
150
|
+
if (!(input instanceof MergeEditorInput)) {
|
|
151
|
+
throw new BugIndicatingError('ONLY MergeEditorInput is supported');
|
|
152
|
+
}
|
|
153
|
+
await super.setInput(input, options, context, token);
|
|
154
|
+
this._sessionDisposables.clear();
|
|
155
|
+
transaction(tx => {
|
|
156
|
+
this._viewModel.set(undefined, tx);
|
|
157
|
+
this._inputModel.set(undefined, tx);
|
|
158
|
+
});
|
|
159
|
+
const inputModel = await input.resolve();
|
|
160
|
+
const model = inputModel.model;
|
|
161
|
+
const viewModel = this.instantiationService.createInstance(MergeEditorViewModel, model, this.input1View, this.input2View, this.inputResultView, this.baseView, this.showNonConflictingChanges);
|
|
162
|
+
model.telemetry.reportMergeEditorOpened({
|
|
163
|
+
combinableConflictCount: model.combinableConflictCount,
|
|
164
|
+
conflictCount: model.conflictCount,
|
|
165
|
+
baseTop: this._layoutModeObs.get().showBaseAtTop,
|
|
166
|
+
baseVisible: this._layoutModeObs.get().showBase,
|
|
167
|
+
isColumnView: this._layoutModeObs.get().kind === 'columns',
|
|
168
|
+
});
|
|
169
|
+
transaction(tx => {
|
|
170
|
+
this._viewModel.set(viewModel, tx);
|
|
171
|
+
this._inputModel.set(inputModel, tx);
|
|
172
|
+
});
|
|
173
|
+
this._sessionDisposables.add(viewModel);
|
|
174
|
+
this._ctxResultUri.set(( inputModel.resultUri.toString()));
|
|
175
|
+
this._ctxBaseUri.set(( model.base.uri.toString()));
|
|
176
|
+
this._sessionDisposables.add(toDisposable(() => {
|
|
177
|
+
this._ctxBaseUri.reset();
|
|
178
|
+
this._ctxResultUri.reset();
|
|
179
|
+
}));
|
|
180
|
+
this._sessionDisposables.add(autorunWithStore((reader, store) => {
|
|
181
|
+
const baseView = this.baseView.read(reader);
|
|
182
|
+
this.inputResultView.editor.changeViewZones(resultViewZoneAccessor => {
|
|
183
|
+
const layout = this._layoutModeObs.read(reader);
|
|
184
|
+
const shouldAlignResult = layout.kind === 'columns';
|
|
185
|
+
const shouldAlignBase = layout.kind === 'mixed' && !layout.showBaseAtTop;
|
|
186
|
+
this.input1View.editor.changeViewZones(input1ViewZoneAccessor => {
|
|
187
|
+
this.input2View.editor.changeViewZones(input2ViewZoneAccessor => {
|
|
188
|
+
if (baseView) {
|
|
189
|
+
baseView.editor.changeViewZones(baseViewZoneAccessor => {
|
|
190
|
+
store.add(this.setViewZones(reader, viewModel, this.input1View.editor, input1ViewZoneAccessor, this.input2View.editor, input2ViewZoneAccessor, baseView.editor, baseViewZoneAccessor, shouldAlignBase, this.inputResultView.editor, resultViewZoneAccessor, shouldAlignResult));
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
store.add(this.setViewZones(reader, viewModel, this.input1View.editor, input1ViewZoneAccessor, this.input2View.editor, input2ViewZoneAccessor, undefined, undefined, false, this.inputResultView.editor, resultViewZoneAccessor, shouldAlignResult));
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
this.scrollSynchronizer.updateScrolling();
|
|
200
|
+
}));
|
|
201
|
+
const viewState = this.loadEditorViewState(input, context);
|
|
202
|
+
if (viewState) {
|
|
203
|
+
this._applyViewState(viewState);
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
this._sessionDisposables.add(thenIfNotDisposed(model.onInitialized, () => {
|
|
207
|
+
const firstConflict = model.modifiedBaseRanges.get().find(r => r.isConflicting);
|
|
208
|
+
if (!firstConflict) {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
this.input1View.editor.revealLineInCenter(firstConflict.input1Range.startLineNumber);
|
|
212
|
+
transaction(tx => {
|
|
213
|
+
viewModel.setActiveModifiedBaseRange(firstConflict, tx);
|
|
214
|
+
});
|
|
215
|
+
}));
|
|
216
|
+
}
|
|
217
|
+
const mirrorWordWrapTransientState = (candidate) => {
|
|
218
|
+
const candidateState = readTransientState(candidate, this._codeEditorService);
|
|
219
|
+
writeTransientState(model.input2.textModel, candidateState, this._codeEditorService);
|
|
220
|
+
writeTransientState(model.input1.textModel, candidateState, this._codeEditorService);
|
|
221
|
+
writeTransientState(model.resultTextModel, candidateState, this._codeEditorService);
|
|
222
|
+
const baseTextModel = this.baseView.get()?.editor.getModel();
|
|
223
|
+
if (baseTextModel) {
|
|
224
|
+
writeTransientState(baseTextModel, candidateState, this._codeEditorService);
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
this._sessionDisposables.add(this._codeEditorService.onDidChangeTransientModelProperty(candidate => {
|
|
228
|
+
mirrorWordWrapTransientState(candidate);
|
|
229
|
+
}));
|
|
230
|
+
mirrorWordWrapTransientState(this.inputResultView.editor.getModel());
|
|
231
|
+
const that = this;
|
|
232
|
+
this._sessionDisposables.add(new (class {
|
|
233
|
+
constructor() {
|
|
234
|
+
this._disposable = ( new DisposableStore());
|
|
235
|
+
for (const model of this.baseInput1Input2()) {
|
|
236
|
+
this._disposable.add(model.onDidChangeContent(() => this._checkBaseInput1Input2AllEmpty()));
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
dispose() {
|
|
240
|
+
this._disposable.dispose();
|
|
241
|
+
}
|
|
242
|
+
*baseInput1Input2() {
|
|
243
|
+
yield model.base;
|
|
244
|
+
yield model.input1.textModel;
|
|
245
|
+
yield model.input2.textModel;
|
|
246
|
+
}
|
|
247
|
+
_checkBaseInput1Input2AllEmpty() {
|
|
248
|
+
for (const model of this.baseInput1Input2()) {
|
|
249
|
+
if (model.getValueLength() > 0) {
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
that.editorService.replaceEditors([{ editor: input, replacement: { resource: input.result, options: { preserveFocus: true } }, forceReplaceDirty: true }], that.group ?? that.editorGroupService.activeGroup);
|
|
254
|
+
}
|
|
255
|
+
}));
|
|
256
|
+
}
|
|
257
|
+
setViewZones(reader, viewModel, input1Editor, input1ViewZoneAccessor, input2Editor, input2ViewZoneAccessor, baseEditor, baseViewZoneAccessor, shouldAlignBase, resultEditor, resultViewZoneAccessor, shouldAlignResult) {
|
|
258
|
+
const input1ViewZoneIds = [];
|
|
259
|
+
const input2ViewZoneIds = [];
|
|
260
|
+
const baseViewZoneIds = [];
|
|
261
|
+
const resultViewZoneIds = [];
|
|
262
|
+
const viewZones = this.viewZoneComputer.computeViewZones(reader, viewModel, {
|
|
263
|
+
codeLensesVisible: this.codeLensesVisible.read(reader),
|
|
264
|
+
showNonConflictingChanges: this.showNonConflictingChanges.read(reader),
|
|
265
|
+
shouldAlignBase,
|
|
266
|
+
shouldAlignResult,
|
|
267
|
+
});
|
|
268
|
+
const disposableStore = ( new DisposableStore());
|
|
269
|
+
if (baseViewZoneAccessor) {
|
|
270
|
+
for (const v of viewZones.baseViewZones) {
|
|
271
|
+
v.create(baseViewZoneAccessor, baseViewZoneIds, disposableStore);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
for (const v of viewZones.resultViewZones) {
|
|
275
|
+
v.create(resultViewZoneAccessor, resultViewZoneIds, disposableStore);
|
|
276
|
+
}
|
|
277
|
+
for (const v of viewZones.input1ViewZones) {
|
|
278
|
+
v.create(input1ViewZoneAccessor, input1ViewZoneIds, disposableStore);
|
|
279
|
+
}
|
|
280
|
+
for (const v of viewZones.input2ViewZones) {
|
|
281
|
+
v.create(input2ViewZoneAccessor, input2ViewZoneIds, disposableStore);
|
|
282
|
+
}
|
|
283
|
+
disposableStore.add({
|
|
284
|
+
dispose: () => {
|
|
285
|
+
input1Editor.changeViewZones(a => {
|
|
286
|
+
for (const zone of input1ViewZoneIds) {
|
|
287
|
+
a.removeZone(zone);
|
|
288
|
+
}
|
|
289
|
+
});
|
|
290
|
+
input2Editor.changeViewZones(a => {
|
|
291
|
+
for (const zone of input2ViewZoneIds) {
|
|
292
|
+
a.removeZone(zone);
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
baseEditor?.changeViewZones(a => {
|
|
296
|
+
for (const zone of baseViewZoneIds) {
|
|
297
|
+
a.removeZone(zone);
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
resultEditor.changeViewZones(a => {
|
|
301
|
+
for (const zone of resultViewZoneIds) {
|
|
302
|
+
a.removeZone(zone);
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
return disposableStore;
|
|
308
|
+
}
|
|
309
|
+
setOptions(options) {
|
|
310
|
+
super.setOptions(options);
|
|
311
|
+
if (options) {
|
|
312
|
+
applyTextEditorOptions(options, this.inputResultView.editor, 0 );
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
clearInput() {
|
|
316
|
+
super.clearInput();
|
|
317
|
+
this._sessionDisposables.clear();
|
|
318
|
+
for (const { editor } of [this.input1View, this.input2View, this.inputResultView]) {
|
|
319
|
+
editor.setModel(null);
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
focus() {
|
|
323
|
+
super.focus();
|
|
324
|
+
(this.getControl() ?? this.inputResultView.editor).focus();
|
|
325
|
+
}
|
|
326
|
+
hasFocus() {
|
|
327
|
+
for (const { editor } of [this.input1View, this.input2View, this.inputResultView]) {
|
|
328
|
+
if (editor.hasTextFocus()) {
|
|
329
|
+
return true;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
return super.hasFocus();
|
|
333
|
+
}
|
|
334
|
+
setEditorVisible(visible, group) {
|
|
335
|
+
super.setEditorVisible(visible, group);
|
|
336
|
+
for (const { editor } of [this.input1View, this.input2View, this.inputResultView]) {
|
|
337
|
+
if (visible) {
|
|
338
|
+
editor.onVisible();
|
|
339
|
+
}
|
|
340
|
+
else {
|
|
341
|
+
editor.onHide();
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
this._ctxIsMergeEditor.set(visible);
|
|
345
|
+
}
|
|
346
|
+
getControl() {
|
|
347
|
+
return this.inputResultView.editor;
|
|
348
|
+
}
|
|
349
|
+
get scopedContextKeyService() {
|
|
350
|
+
const control = this.getControl();
|
|
351
|
+
return control?.invokeWithinContext(accessor => accessor.get(IContextKeyService));
|
|
352
|
+
}
|
|
353
|
+
toggleBase() {
|
|
354
|
+
this.setLayout({
|
|
355
|
+
...this._layoutMode.value,
|
|
356
|
+
showBase: !this._layoutMode.value.showBase
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
toggleShowBaseTop() {
|
|
360
|
+
const showBaseTop = this._layoutMode.value.showBase && this._layoutMode.value.showBaseAtTop;
|
|
361
|
+
this.setLayout({
|
|
362
|
+
...this._layoutMode.value,
|
|
363
|
+
showBaseAtTop: true,
|
|
364
|
+
showBase: !showBaseTop,
|
|
365
|
+
});
|
|
366
|
+
}
|
|
367
|
+
toggleShowBaseCenter() {
|
|
368
|
+
const showBaseCenter = this._layoutMode.value.showBase && !this._layoutMode.value.showBaseAtTop;
|
|
369
|
+
this.setLayout({
|
|
370
|
+
...this._layoutMode.value,
|
|
371
|
+
showBaseAtTop: false,
|
|
372
|
+
showBase: !showBaseCenter,
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
setLayoutKind(kind) {
|
|
376
|
+
this.setLayout({
|
|
377
|
+
...this._layoutMode.value,
|
|
378
|
+
kind
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
setLayout(newLayout) {
|
|
382
|
+
const value = this._layoutMode.value;
|
|
383
|
+
if (JSON.stringify(value) === JSON.stringify(newLayout)) {
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
this.model?.telemetry.reportLayoutChange({
|
|
387
|
+
baseTop: newLayout.showBaseAtTop,
|
|
388
|
+
baseVisible: newLayout.showBase,
|
|
389
|
+
isColumnView: newLayout.kind === 'columns',
|
|
390
|
+
});
|
|
391
|
+
this.applyLayout(newLayout);
|
|
392
|
+
}
|
|
393
|
+
applyLayout(layout) {
|
|
394
|
+
transaction(tx => {
|
|
395
|
+
if (layout.showBase && !this.baseView.get()) {
|
|
396
|
+
this.baseViewDisposables.clear();
|
|
397
|
+
const baseView = this.baseViewDisposables.add(this.instantiationService.createInstance(BaseCodeEditorView, this.viewModel));
|
|
398
|
+
this.baseViewDisposables.add(autorun(reader => {
|
|
399
|
+
const options = this.baseViewOptions.read(reader);
|
|
400
|
+
if (options) {
|
|
401
|
+
baseView.updateOptions(options);
|
|
402
|
+
}
|
|
403
|
+
}));
|
|
404
|
+
this.baseView.set(baseView, tx);
|
|
405
|
+
}
|
|
406
|
+
else if (!layout.showBase && this.baseView.get()) {
|
|
407
|
+
this.baseView.set(undefined, tx);
|
|
408
|
+
this.baseViewDisposables.clear();
|
|
409
|
+
}
|
|
410
|
+
if (layout.kind === 'mixed') {
|
|
411
|
+
this.setGrid([
|
|
412
|
+
layout.showBaseAtTop && layout.showBase ? {
|
|
413
|
+
size: 38,
|
|
414
|
+
data: this.baseView.get().view
|
|
415
|
+
} : undefined,
|
|
416
|
+
{
|
|
417
|
+
size: 38,
|
|
418
|
+
groups: [
|
|
419
|
+
{ data: this.input1View.view },
|
|
420
|
+
!layout.showBaseAtTop && layout.showBase ? { data: this.baseView.get().view } : undefined,
|
|
421
|
+
{ data: this.input2View.view }
|
|
422
|
+
].filter(isDefined)
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
size: 62,
|
|
426
|
+
data: this.inputResultView.view
|
|
427
|
+
},
|
|
428
|
+
].filter(isDefined));
|
|
429
|
+
}
|
|
430
|
+
else if (layout.kind === 'columns') {
|
|
431
|
+
this.setGrid([
|
|
432
|
+
layout.showBase ? {
|
|
433
|
+
size: 40,
|
|
434
|
+
data: this.baseView.get().view
|
|
435
|
+
} : undefined,
|
|
436
|
+
{
|
|
437
|
+
size: 60,
|
|
438
|
+
groups: [{ data: this.input1View.view }, { data: this.inputResultView.view }, { data: this.input2View.view }]
|
|
439
|
+
},
|
|
440
|
+
].filter(isDefined));
|
|
441
|
+
}
|
|
442
|
+
this._layoutMode.value = layout;
|
|
443
|
+
this._ctxUsesColumnLayout.set(layout.kind);
|
|
444
|
+
this._ctxShowBase.set(layout.showBase);
|
|
445
|
+
this._ctxShowBaseAtTop.set(layout.showBaseAtTop);
|
|
446
|
+
this._onDidChangeSizeConstraints.fire();
|
|
447
|
+
this._layoutModeObs.set(layout, tx);
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
setGrid(descriptor) {
|
|
451
|
+
let width = -1;
|
|
452
|
+
let height = -1;
|
|
453
|
+
if (this._grid.value) {
|
|
454
|
+
width = this._grid.value.width;
|
|
455
|
+
height = this._grid.value.height;
|
|
456
|
+
}
|
|
457
|
+
this._grid.value = SerializableGrid.from({
|
|
458
|
+
orientation: 0 ,
|
|
459
|
+
size: 100,
|
|
460
|
+
groups: descriptor,
|
|
461
|
+
}, {
|
|
462
|
+
styles: { separatorBorder: this.theme.getColor(settingsSashBorder) ?? Color.transparent },
|
|
463
|
+
proportionalLayout: true
|
|
464
|
+
});
|
|
465
|
+
reset(this.rootHtmlElement, this._grid.value.element);
|
|
466
|
+
if (width !== -1) {
|
|
467
|
+
this._grid.value.layout(width, height);
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
_applyViewState(state) {
|
|
471
|
+
if (!state) {
|
|
472
|
+
return;
|
|
473
|
+
}
|
|
474
|
+
this.inputResultView.editor.restoreViewState(state);
|
|
475
|
+
if (state.input1State) {
|
|
476
|
+
this.input1View.editor.restoreViewState(state.input1State);
|
|
477
|
+
}
|
|
478
|
+
if (state.input2State) {
|
|
479
|
+
this.input2View.editor.restoreViewState(state.input2State);
|
|
480
|
+
}
|
|
481
|
+
if (state.focusIndex >= 0) {
|
|
482
|
+
[this.input1View.editor, this.input2View.editor, this.inputResultView.editor][state.focusIndex].focus();
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
computeEditorViewState(resource) {
|
|
486
|
+
if (!isEqual(this.inputModel.get()?.resultUri, resource)) {
|
|
487
|
+
return undefined;
|
|
488
|
+
}
|
|
489
|
+
const result = this.inputResultView.editor.saveViewState();
|
|
490
|
+
if (!result) {
|
|
491
|
+
return undefined;
|
|
492
|
+
}
|
|
493
|
+
const input1State = this.input1View.editor.saveViewState() ?? undefined;
|
|
494
|
+
const input2State = this.input2View.editor.saveViewState() ?? undefined;
|
|
495
|
+
const focusIndex = [this.input1View.editor, this.input2View.editor, this.inputResultView.editor].findIndex(editor => editor.hasWidgetFocus());
|
|
496
|
+
return { ...result, input1State, input2State, focusIndex };
|
|
497
|
+
}
|
|
498
|
+
tracksEditorViewState(input) {
|
|
499
|
+
return input instanceof MergeEditorInput;
|
|
500
|
+
}
|
|
501
|
+
toggleShowNonConflictingChanges() {
|
|
502
|
+
this.showNonConflictingChanges.set(!this.showNonConflictingChanges.get(), undefined);
|
|
503
|
+
this.showNonConflictingChangesStore.set(this.showNonConflictingChanges.get());
|
|
504
|
+
this._ctxShowNonConflictingChanges.set(this.showNonConflictingChanges.get());
|
|
505
|
+
}
|
|
506
|
+
};
|
|
507
|
+
MergeEditor = MergeEditor_1 = ( __decorate([
|
|
508
|
+
( __param(0, IInstantiationService)),
|
|
509
|
+
( __param(1, IContextKeyService)),
|
|
510
|
+
( __param(2, ITelemetryService)),
|
|
511
|
+
( __param(3, IStorageService)),
|
|
512
|
+
( __param(4, IThemeService)),
|
|
513
|
+
( __param(5, ITextResourceConfigurationService)),
|
|
514
|
+
( __param(6, IConfigurationService)),
|
|
515
|
+
( __param(7, IEditorService)),
|
|
516
|
+
( __param(8, IEditorGroupsService)),
|
|
517
|
+
( __param(9, IFileService)),
|
|
518
|
+
( __param(10, ICodeEditorService)),
|
|
519
|
+
( __param(11, IConfigurationService))
|
|
520
|
+
], MergeEditor));
|
|
521
|
+
let MergeEditorLayoutStore = class MergeEditorLayoutStore {
|
|
522
|
+
static { MergeEditorLayoutStore_1 = this; }
|
|
523
|
+
static { this._key = 'mergeEditor/layout'; }
|
|
524
|
+
constructor(_storageService) {
|
|
525
|
+
this._storageService = _storageService;
|
|
526
|
+
this._value = { kind: 'mixed', showBase: false, showBaseAtTop: true };
|
|
527
|
+
const value = _storageService.get(MergeEditorLayoutStore_1._key, 0 , 'mixed');
|
|
528
|
+
if (value === 'mixed' || value === 'columns') {
|
|
529
|
+
this._value = { kind: value, showBase: false, showBaseAtTop: true };
|
|
530
|
+
}
|
|
531
|
+
else if (value) {
|
|
532
|
+
try {
|
|
533
|
+
this._value = JSON.parse(value);
|
|
534
|
+
}
|
|
535
|
+
catch (e) {
|
|
536
|
+
onUnexpectedError(e);
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
get value() {
|
|
541
|
+
return this._value;
|
|
542
|
+
}
|
|
543
|
+
set value(value) {
|
|
544
|
+
if (this._value !== value) {
|
|
545
|
+
this._value = value;
|
|
546
|
+
this._storageService.store(MergeEditorLayoutStore_1._key, JSON.stringify(this._value), 0 , 0 );
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
};
|
|
550
|
+
MergeEditorLayoutStore = MergeEditorLayoutStore_1 = ( __decorate([
|
|
551
|
+
( __param(0, IStorageService))
|
|
552
|
+
], MergeEditorLayoutStore));
|
|
553
|
+
let MergeEditorOpenHandlerContribution = class MergeEditorOpenHandlerContribution extends Disposable {
|
|
554
|
+
constructor(_editorService, codeEditorService) {
|
|
555
|
+
super();
|
|
556
|
+
this._editorService = _editorService;
|
|
557
|
+
this._store.add(codeEditorService.registerCodeEditorOpenHandler(this.openCodeEditorFromMergeEditor.bind(this)));
|
|
558
|
+
}
|
|
559
|
+
async openCodeEditorFromMergeEditor(input, _source, sideBySide) {
|
|
560
|
+
const activePane = this._editorService.activeEditorPane;
|
|
561
|
+
if (!sideBySide
|
|
562
|
+
&& input.options
|
|
563
|
+
&& activePane instanceof MergeEditor
|
|
564
|
+
&& activePane.getControl()
|
|
565
|
+
&& activePane.input instanceof MergeEditorInput
|
|
566
|
+
&& isEqual(input.resource, activePane.input.result)) {
|
|
567
|
+
const targetEditor = activePane.getControl();
|
|
568
|
+
applyTextEditorOptions(input.options, targetEditor, 0 );
|
|
569
|
+
return targetEditor;
|
|
570
|
+
}
|
|
571
|
+
return null;
|
|
572
|
+
}
|
|
573
|
+
};
|
|
574
|
+
MergeEditorOpenHandlerContribution = ( __decorate([
|
|
575
|
+
( __param(0, IEditorService)),
|
|
576
|
+
( __param(1, ICodeEditorService))
|
|
577
|
+
], MergeEditorOpenHandlerContribution));
|
|
578
|
+
let MergeEditorResolverContribution = class MergeEditorResolverContribution extends Disposable {
|
|
579
|
+
constructor(editorResolverService, instantiationService) {
|
|
580
|
+
super();
|
|
581
|
+
const mergeEditorInputFactory = (mergeEditor) => {
|
|
582
|
+
return {
|
|
583
|
+
editor: instantiationService.createInstance(MergeEditorInput, mergeEditor.base.resource, {
|
|
584
|
+
uri: mergeEditor.input1.resource,
|
|
585
|
+
title: mergeEditor.input1.label ?? basename(mergeEditor.input1.resource),
|
|
586
|
+
description: mergeEditor.input1.description ?? '',
|
|
587
|
+
detail: mergeEditor.input1.detail
|
|
588
|
+
}, {
|
|
589
|
+
uri: mergeEditor.input2.resource,
|
|
590
|
+
title: mergeEditor.input2.label ?? basename(mergeEditor.input2.resource),
|
|
591
|
+
description: mergeEditor.input2.description ?? '',
|
|
592
|
+
detail: mergeEditor.input2.detail
|
|
593
|
+
}, mergeEditor.result.resource)
|
|
594
|
+
};
|
|
595
|
+
};
|
|
596
|
+
this._register(editorResolverService.registerEditor(`*`, {
|
|
597
|
+
id: DEFAULT_EDITOR_ASSOCIATION.id,
|
|
598
|
+
label: DEFAULT_EDITOR_ASSOCIATION.displayName,
|
|
599
|
+
detail: DEFAULT_EDITOR_ASSOCIATION.providerDisplayName,
|
|
600
|
+
priority: RegisteredEditorPriority.builtin
|
|
601
|
+
}, {}, {
|
|
602
|
+
createMergeEditorInput: mergeEditorInputFactory
|
|
603
|
+
}));
|
|
604
|
+
}
|
|
605
|
+
};
|
|
606
|
+
MergeEditorResolverContribution = ( __decorate([
|
|
607
|
+
( __param(0, IEditorResolverService)),
|
|
608
|
+
( __param(1, IInstantiationService))
|
|
609
|
+
], MergeEditorResolverContribution));
|
|
610
|
+
|
|
611
|
+
export { MergeEditor, MergeEditorOpenHandlerContribution, MergeEditorResolverContribution };
|