@codingame/monaco-vscode-api 2.0.0-rework-ci.1 → 2.0.0
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/package.json +8 -8
- package/services.js +0 -1
- package/editor.api.d.ts +0 -8
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/colors.js +0 -7
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/diffEditorItemTemplate.js +0 -199
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/multiDiffEditorViewModel.js +0 -62
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/multiDiffEditorWidget.js +0 -59
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/multiDiffEditorWidgetImpl.js +0 -225
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/objectPool.js +0 -46
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/style.css.js +0 -4
- package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/utils.js +0 -11
- package/vscode/src/vs/editor/editor.api.js +0 -49
- package/vscode/src/vs/editor/standalone/browser/colorizer.js +0 -174
- package/vscode/src/vs/editor/standalone/browser/standalone-tokens.css.js +0 -4
- package/vscode/src/vs/editor/standalone/browser/standaloneEditor.js +0 -342
- package/vscode/src/vs/editor/standalone/browser/standaloneLanguages.js +0 -425
- package/vscode/src/vs/editor/standalone/common/monarch/monarchCommon.js +0 -88
- package/vscode/src/vs/editor/standalone/common/monarch/monarchCompile.js +0 -446
- package/vscode/src/vs/editor/standalone/common/monarch/monarchLexer.js +0 -703
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-api",
|
|
3
|
-
"version": "2.0.0
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "VSCode public API plugged on the monaco editor",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"author": {
|
|
@@ -96,12 +96,12 @@
|
|
|
96
96
|
"dependencies": {
|
|
97
97
|
"vscode-marked": "npm:marked@=3.0.2",
|
|
98
98
|
"vscode-semver": "npm:semver@=5.5.0",
|
|
99
|
-
"@codingame/monaco-vscode-
|
|
100
|
-
"@codingame/monaco-vscode-files-service-override": "2.0.0
|
|
101
|
-
"@codingame/monaco-vscode-
|
|
102
|
-
"@codingame/monaco-vscode-environment-service-override": "2.0.0
|
|
103
|
-
"@codingame/monaco-vscode-layout-service-override": "2.0.0
|
|
104
|
-
"@codingame/monaco-vscode-host-service-override": "2.0.0
|
|
105
|
-
"@codingame/monaco-vscode-base-service-override": "2.0.0
|
|
99
|
+
"@codingame/monaco-vscode-quickaccess-service-override": "2.0.0",
|
|
100
|
+
"@codingame/monaco-vscode-files-service-override": "2.0.0",
|
|
101
|
+
"@codingame/monaco-vscode-extensions-service-override": "2.0.0",
|
|
102
|
+
"@codingame/monaco-vscode-environment-service-override": "2.0.0",
|
|
103
|
+
"@codingame/monaco-vscode-layout-service-override": "2.0.0",
|
|
104
|
+
"@codingame/monaco-vscode-host-service-override": "2.0.0",
|
|
105
|
+
"@codingame/monaco-vscode-base-service-override": "2.0.0"
|
|
106
106
|
}
|
|
107
107
|
}
|
package/services.js
CHANGED
|
@@ -59,7 +59,6 @@ import './vscode/src/vs/editor/common/standaloneStrings.js';
|
|
|
59
59
|
import './vscode/src/vs/base/browser/ui/codicons/codicon/codicon.css.js';
|
|
60
60
|
import './vscode/src/vs/base/browser/ui/codicons/codicon/codicon-modifiers.css.js';
|
|
61
61
|
import './vscode/src/vs/editor/standalone/browser/iPadShowKeyboard/iPadShowKeyboard.js';
|
|
62
|
-
import './vscode/src/vs/editor/editor.api.js';
|
|
63
62
|
export { default as Severity } from './vscode/src/vs/base/common/severity.js';
|
|
64
63
|
export { IStorageService, StorageScope, StorageTarget } from './vscode/src/vs/platform/storage/common/storage.js';
|
|
65
64
|
import { StandaloneServices } from './vscode/src/vs/editor/standalone/browser/standaloneServices.js';
|
package/editor.api.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { localizeWithPath } from '../../../../nls.js';
|
|
2
|
-
import { registerColor } from '../../../../platform/theme/common/colorRegistry.js';
|
|
3
|
-
registerColor('multiDiffEditor.headerBackground', { dark: '#808080', light: '#b4b4b4', hcDark: '#808080', hcLight: '#b4b4b4', }, ( localizeWithPath(
|
|
4
|
-
'vs/editor/browser/widget/multiDiffEditorWidget/colors',
|
|
5
|
-
'multiDiffEditor.headerBackground',
|
|
6
|
-
'The background color of the diff editor\'s header'
|
|
7
|
-
)));
|
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { h } from '../../../../base/browser/dom.js';
|
|
3
|
-
import { Button } from '../../../../base/browser/ui/button/button.js';
|
|
4
|
-
import { Codicon } from '../../../../base/common/codicons.js';
|
|
5
|
-
import { Disposable, DisposableStore } from '../../../../base/common/lifecycle.js';
|
|
6
|
-
import { observableValue, globalTransaction } from '../../../../base/common/observableInternal/base.js';
|
|
7
|
-
import { DiffEditorWidget } from '../diffEditor/diffEditorWidget.js';
|
|
8
|
-
import { MenuWorkbenchToolBar } from '../../../../platform/actions/browser/toolbar.js';
|
|
9
|
-
import { MenuId } from '../../../../platform/actions/common/actions.js';
|
|
10
|
-
import { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';
|
|
11
|
-
import { ActionRunnerWithContext } from './utils.js';
|
|
12
|
-
import { derived } from '../../../../base/common/observableInternal/derived.js';
|
|
13
|
-
import { autorun } from '../../../../base/common/observableInternal/autorun.js';
|
|
14
|
-
import { observableFromEvent } from '../../../../base/common/observableInternal/utils.js';
|
|
15
|
-
class TemplateData {
|
|
16
|
-
constructor(viewModel) {
|
|
17
|
-
this.viewModel = viewModel;
|
|
18
|
-
}
|
|
19
|
-
getId() {
|
|
20
|
-
return this.viewModel;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
let DiffEditorItemTemplate = class DiffEditorItemTemplate extends Disposable {
|
|
24
|
-
constructor(_container, _overflowWidgetsDomNode, _workbenchUIElementFactory, _instantiationService) {
|
|
25
|
-
super();
|
|
26
|
-
this._container = _container;
|
|
27
|
-
this._overflowWidgetsDomNode = _overflowWidgetsDomNode;
|
|
28
|
-
this._workbenchUIElementFactory = _workbenchUIElementFactory;
|
|
29
|
-
this._instantiationService = _instantiationService;
|
|
30
|
-
this._viewModel = observableValue(this, undefined);
|
|
31
|
-
this._collapsed = derived(this, reader => this._viewModel.read(reader)?.collapsed.read(reader));
|
|
32
|
-
this._contentHeight = observableValue(this, 500);
|
|
33
|
-
this.height = derived(this, reader => {
|
|
34
|
-
const h = this._collapsed.read(reader) ? 0 : this._contentHeight.read(reader);
|
|
35
|
-
return h + this._outerEditorHeight;
|
|
36
|
-
});
|
|
37
|
-
this._modifiedContentWidth = observableValue(this, 0);
|
|
38
|
-
this._modifiedWidth = observableValue(this, 0);
|
|
39
|
-
this._originalContentWidth = observableValue(this, 0);
|
|
40
|
-
this._originalWidth = observableValue(this, 0);
|
|
41
|
-
this.maxScroll = derived(this, reader => {
|
|
42
|
-
const scroll1 = this._modifiedContentWidth.read(reader) - this._modifiedWidth.read(reader);
|
|
43
|
-
const scroll2 = this._originalContentWidth.read(reader) - this._originalWidth.read(reader);
|
|
44
|
-
if (scroll1 > scroll2) {
|
|
45
|
-
return { maxScroll: scroll1, width: this._modifiedWidth.read(reader) };
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
return { maxScroll: scroll2, width: this._originalWidth.read(reader) };
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
this._elements = h('div.multiDiffEntry', [
|
|
52
|
-
h('div.content', {
|
|
53
|
-
style: {
|
|
54
|
-
display: 'flex',
|
|
55
|
-
flexDirection: 'column',
|
|
56
|
-
flex: '1',
|
|
57
|
-
overflow: 'hidden',
|
|
58
|
-
}
|
|
59
|
-
}, [
|
|
60
|
-
h('div.header@header', [
|
|
61
|
-
h('div.collapse-button@collapseButton'),
|
|
62
|
-
h('div.title.show-file-icons@title', []),
|
|
63
|
-
h('div.actions@actions'),
|
|
64
|
-
]),
|
|
65
|
-
h('div.editorParent', {
|
|
66
|
-
style: {
|
|
67
|
-
flex: '1',
|
|
68
|
-
display: 'flex',
|
|
69
|
-
flexDirection: 'column',
|
|
70
|
-
}
|
|
71
|
-
}, [
|
|
72
|
-
h('div.editorContainer@editor', { style: { flex: '1' } }),
|
|
73
|
-
])
|
|
74
|
-
])
|
|
75
|
-
]);
|
|
76
|
-
this.editor = this._register(this._instantiationService.createInstance(DiffEditorWidget, this._elements.editor, {
|
|
77
|
-
overflowWidgetsDomNode: this._overflowWidgetsDomNode,
|
|
78
|
-
}, {}));
|
|
79
|
-
this.isModifedFocused = isFocused(this.editor.getModifiedEditor());
|
|
80
|
-
this.isOriginalFocused = isFocused(this.editor.getOriginalEditor());
|
|
81
|
-
this.isFocused = derived(this, reader => this.isModifedFocused.read(reader) || this.isOriginalFocused.read(reader));
|
|
82
|
-
this._resourceLabel = this._workbenchUIElementFactory.createResourceLabel
|
|
83
|
-
? this._register(this._workbenchUIElementFactory.createResourceLabel(this._elements.title))
|
|
84
|
-
: undefined;
|
|
85
|
-
this._dataStore = ( new DisposableStore());
|
|
86
|
-
this._headerHeight = this._elements.header.clientHeight;
|
|
87
|
-
const btn = ( new Button(this._elements.collapseButton, {}));
|
|
88
|
-
this._register(autorun(reader => {
|
|
89
|
-
btn.element.className = '';
|
|
90
|
-
btn.icon = this._collapsed.read(reader) ? Codicon.chevronRight : Codicon.chevronDown;
|
|
91
|
-
}));
|
|
92
|
-
this._register(btn.onDidClick(() => {
|
|
93
|
-
this._viewModel.get()?.collapsed.set(!this._collapsed.get(), undefined);
|
|
94
|
-
}));
|
|
95
|
-
this._register(autorun(reader => {
|
|
96
|
-
this._elements.editor.style.display = this._collapsed.read(reader) ? 'none' : 'block';
|
|
97
|
-
}));
|
|
98
|
-
this.editor.getModifiedEditor().onDidLayoutChange(e => {
|
|
99
|
-
const width = this.editor.getModifiedEditor().getLayoutInfo().contentWidth;
|
|
100
|
-
this._modifiedWidth.set(width, undefined);
|
|
101
|
-
});
|
|
102
|
-
this.editor.getOriginalEditor().onDidLayoutChange(e => {
|
|
103
|
-
const width = this.editor.getOriginalEditor().getLayoutInfo().contentWidth;
|
|
104
|
-
this._originalWidth.set(width, undefined);
|
|
105
|
-
});
|
|
106
|
-
this._register(this.editor.onDidContentSizeChange(e => {
|
|
107
|
-
globalTransaction(tx => {
|
|
108
|
-
this._contentHeight.set(e.contentHeight, tx);
|
|
109
|
-
this._modifiedContentWidth.set(this.editor.getModifiedEditor().getContentWidth(), tx);
|
|
110
|
-
this._originalContentWidth.set(this.editor.getOriginalEditor().getContentWidth(), tx);
|
|
111
|
-
});
|
|
112
|
-
}));
|
|
113
|
-
this._register(autorun(reader => {
|
|
114
|
-
const isFocused = this.isFocused.read(reader);
|
|
115
|
-
this._elements.root.classList.toggle('focused', isFocused);
|
|
116
|
-
}));
|
|
117
|
-
this._container.appendChild(this._elements.root);
|
|
118
|
-
this._outerEditorHeight = 38;
|
|
119
|
-
this._register(this._instantiationService.createInstance(MenuWorkbenchToolBar, this._elements.actions, MenuId.MultiDiffEditorFileToolbar, {
|
|
120
|
-
actionRunner: this._register(( new ActionRunnerWithContext(() => (this._viewModel.get()?.diffEditorViewModel?.model.modified.uri)))),
|
|
121
|
-
menuOptions: {
|
|
122
|
-
shouldForwardArgs: true,
|
|
123
|
-
}
|
|
124
|
-
}));
|
|
125
|
-
}
|
|
126
|
-
setScrollLeft(left) {
|
|
127
|
-
if (this._modifiedContentWidth.get() - this._modifiedWidth.get() > this._originalContentWidth.get() - this._originalWidth.get()) {
|
|
128
|
-
this.editor.getModifiedEditor().setScrollLeft(left);
|
|
129
|
-
}
|
|
130
|
-
else {
|
|
131
|
-
this.editor.getOriginalEditor().setScrollLeft(left);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
setData(data) {
|
|
135
|
-
function updateOptions(options) {
|
|
136
|
-
return {
|
|
137
|
-
...options,
|
|
138
|
-
scrollBeyondLastLine: false,
|
|
139
|
-
hideUnchangedRegions: {
|
|
140
|
-
enabled: true,
|
|
141
|
-
},
|
|
142
|
-
scrollbar: {
|
|
143
|
-
vertical: 'hidden',
|
|
144
|
-
horizontal: 'hidden',
|
|
145
|
-
handleMouseWheel: false,
|
|
146
|
-
useShadows: false,
|
|
147
|
-
},
|
|
148
|
-
renderOverviewRuler: false,
|
|
149
|
-
fixedOverflowWidgets: true,
|
|
150
|
-
};
|
|
151
|
-
}
|
|
152
|
-
const value = data.viewModel.entry.value;
|
|
153
|
-
if (value.onOptionsDidChange) {
|
|
154
|
-
this._dataStore.add(value.onOptionsDidChange(() => {
|
|
155
|
-
this.editor.updateOptions(updateOptions(value.options ?? {}));
|
|
156
|
-
}));
|
|
157
|
-
}
|
|
158
|
-
globalTransaction(tx => {
|
|
159
|
-
this._resourceLabel?.setUri(data.viewModel.diffEditorViewModel.model.modified.uri);
|
|
160
|
-
this._dataStore.clear();
|
|
161
|
-
this._viewModel.set(data.viewModel, tx);
|
|
162
|
-
this.editor.setModel(data.viewModel.diffEditorViewModel, tx);
|
|
163
|
-
this.editor.updateOptions(updateOptions(value.options ?? {}));
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
render(verticalRange, width, editorScroll, viewPort) {
|
|
167
|
-
this._elements.root.style.visibility = 'visible';
|
|
168
|
-
this._elements.root.style.top = `${verticalRange.start}px`;
|
|
169
|
-
this._elements.root.style.height = `${verticalRange.length}px`;
|
|
170
|
-
this._elements.root.style.width = `${width}px`;
|
|
171
|
-
this._elements.root.style.position = 'absolute';
|
|
172
|
-
const delta = Math.max(0, Math.min(verticalRange.length - this._headerHeight, viewPort.start - verticalRange.start));
|
|
173
|
-
this._elements.header.style.transform = `translateY(${delta}px)`;
|
|
174
|
-
globalTransaction(tx => {
|
|
175
|
-
this.editor.layout({
|
|
176
|
-
width: width,
|
|
177
|
-
height: verticalRange.length - this._outerEditorHeight,
|
|
178
|
-
});
|
|
179
|
-
});
|
|
180
|
-
this.editor.getOriginalEditor().setScrollTop(editorScroll);
|
|
181
|
-
this._elements.header.classList.toggle('shadow', delta > 0 || editorScroll > 0);
|
|
182
|
-
}
|
|
183
|
-
hide() {
|
|
184
|
-
this._elements.root.style.top = `-100000px`;
|
|
185
|
-
this._elements.root.style.visibility = 'hidden';
|
|
186
|
-
}
|
|
187
|
-
};
|
|
188
|
-
DiffEditorItemTemplate = ( __decorate([
|
|
189
|
-
( __param(3, IInstantiationService))
|
|
190
|
-
], DiffEditorItemTemplate));
|
|
191
|
-
function isFocused(editor) {
|
|
192
|
-
return observableFromEvent(h => {
|
|
193
|
-
const store = ( new DisposableStore());
|
|
194
|
-
store.add(editor.onDidFocusEditorWidget(() => h(true)));
|
|
195
|
-
store.add(editor.onDidBlurEditorWidget(() => h(false)));
|
|
196
|
-
return store;
|
|
197
|
-
}, () => editor.hasWidgetFocus());
|
|
198
|
-
}
|
|
199
|
-
export { DiffEditorItemTemplate, TemplateData };
|
package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/multiDiffEditorViewModel.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { Disposable } from '../../../../base/common/lifecycle.js';
|
|
2
|
-
import { DiffEditorOptions } from '../diffEditor/diffEditorOptions.js';
|
|
3
|
-
import { DiffEditorViewModel } from '../diffEditor/diffEditorViewModel.js';
|
|
4
|
-
import { transaction, observableValue } from '../../../../base/common/observableInternal/base.js';
|
|
5
|
-
import { observableFromEvent } from '../../../../base/common/observableInternal/utils.js';
|
|
6
|
-
import { derivedWithStore } from '../../../../base/common/observableInternal/derived.js';
|
|
7
|
-
class MultiDiffEditorViewModel extends Disposable {
|
|
8
|
-
async waitForDiffs() {
|
|
9
|
-
for (const d of this.items.get()) {
|
|
10
|
-
await d.diffEditorViewModel.waitForDiff();
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
collapseAll() {
|
|
14
|
-
transaction(tx => {
|
|
15
|
-
for (const d of this.items.get()) {
|
|
16
|
-
d.collapsed.set(true, tx);
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
expandAll() {
|
|
21
|
-
transaction(tx => {
|
|
22
|
-
for (const d of this.items.get()) {
|
|
23
|
-
d.collapsed.set(false, tx);
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
constructor(_model, _instantiationService) {
|
|
28
|
-
super();
|
|
29
|
-
this._model = _model;
|
|
30
|
-
this._instantiationService = _instantiationService;
|
|
31
|
-
this._documents = observableFromEvent(this._model.onDidChange, () => this._model.documents);
|
|
32
|
-
this.items = derivedWithStore(this, (reader, store) => ( this._documents.read(reader).map(d => store.add(( new DocumentDiffItemViewModel(d, this._instantiationService)))))).recomputeInitiallyAndOnChange(this._store);
|
|
33
|
-
this.activeDiffItem = observableValue(this, undefined);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
class DocumentDiffItemViewModel extends Disposable {
|
|
37
|
-
constructor(entry, _instantiationService) {
|
|
38
|
-
super();
|
|
39
|
-
this.entry = entry;
|
|
40
|
-
this._instantiationService = _instantiationService;
|
|
41
|
-
this.collapsed = observableValue(this, false);
|
|
42
|
-
function updateOptions(options) {
|
|
43
|
-
return {
|
|
44
|
-
...options,
|
|
45
|
-
hideUnchangedRegions: {
|
|
46
|
-
enabled: true,
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
const options = ( new DiffEditorOptions(updateOptions(this.entry.value.options || {})));
|
|
51
|
-
if (this.entry.value.onOptionsDidChange) {
|
|
52
|
-
this._register(this.entry.value.onOptionsDidChange(() => {
|
|
53
|
-
options.updateOptions(updateOptions(this.entry.value.options || {}));
|
|
54
|
-
}));
|
|
55
|
-
}
|
|
56
|
-
this.diffEditorViewModel = this._register(this._instantiationService.createInstance(DiffEditorViewModel, {
|
|
57
|
-
original: entry.value.original,
|
|
58
|
-
modified: entry.value.modified,
|
|
59
|
-
}, options));
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
export { DocumentDiffItemViewModel, MultiDiffEditorViewModel };
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { Disposable } from '../../../../base/common/lifecycle.js';
|
|
3
|
-
import { readHotReloadableExport } from '../diffEditor/utils.js';
|
|
4
|
-
import { MultiDiffEditorWidgetImpl } from './multiDiffEditorWidgetImpl.js';
|
|
5
|
-
import { MultiDiffEditorViewModel } from './multiDiffEditorViewModel.js';
|
|
6
|
-
import { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';
|
|
7
|
-
import './colors.js';
|
|
8
|
-
import { DiffEditorItemTemplate } from './diffEditorItemTemplate.js';
|
|
9
|
-
import { Event } from '../../../../base/common/event.js';
|
|
10
|
-
import { observableValue } from '../../../../base/common/observableInternal/base.js';
|
|
11
|
-
import { derivedWithStore, derived } from '../../../../base/common/observableInternal/derived.js';
|
|
12
|
-
import { recomputeInitiallyAndOnChange } from '../../../../base/common/observableInternal/utils.js';
|
|
13
|
-
let MultiDiffEditorWidget = class MultiDiffEditorWidget extends Disposable {
|
|
14
|
-
constructor(_element, _workbenchUIElementFactory, _instantiationService) {
|
|
15
|
-
super();
|
|
16
|
-
this._element = _element;
|
|
17
|
-
this._workbenchUIElementFactory = _workbenchUIElementFactory;
|
|
18
|
-
this._instantiationService = _instantiationService;
|
|
19
|
-
this._dimension = observableValue(this, undefined);
|
|
20
|
-
this._viewModel = observableValue(this, undefined);
|
|
21
|
-
this._widgetImpl = derivedWithStore(this, (reader, store) => {
|
|
22
|
-
readHotReloadableExport(DiffEditorItemTemplate, reader);
|
|
23
|
-
return store.add(this._instantiationService.createInstance((readHotReloadableExport(MultiDiffEditorWidgetImpl, reader)), this._element, this._dimension, this._viewModel, this._workbenchUIElementFactory));
|
|
24
|
-
});
|
|
25
|
-
this._activeControl = derived(this, (reader) => this._widgetImpl.read(reader).activeControl.read(reader));
|
|
26
|
-
this.onDidChangeActiveControl = Event.fromObservableLight(this._activeControl);
|
|
27
|
-
this._scrollState = derived(this, (reader) => {
|
|
28
|
-
const w = this._widgetImpl.read(reader);
|
|
29
|
-
const top = w.scrollTop.read(reader);
|
|
30
|
-
const left = w.scrollLeft.read(reader);
|
|
31
|
-
return { top, left };
|
|
32
|
-
});
|
|
33
|
-
this.onDidChangeScrollState = Event.fromObservableLight(this._scrollState);
|
|
34
|
-
this._register(recomputeInitiallyAndOnChange(this._widgetImpl));
|
|
35
|
-
}
|
|
36
|
-
createViewModel(model) {
|
|
37
|
-
return ( new MultiDiffEditorViewModel(model, this._instantiationService));
|
|
38
|
-
}
|
|
39
|
-
setViewModel(viewModel) {
|
|
40
|
-
this._viewModel.set(viewModel, undefined);
|
|
41
|
-
}
|
|
42
|
-
layout(dimension) {
|
|
43
|
-
this._dimension.set(dimension, undefined);
|
|
44
|
-
}
|
|
45
|
-
getActiveControl() {
|
|
46
|
-
return this._activeControl.get();
|
|
47
|
-
}
|
|
48
|
-
getScrollState() {
|
|
49
|
-
return this._scrollState.get();
|
|
50
|
-
}
|
|
51
|
-
setScrollState(scrollState) {
|
|
52
|
-
const w = this._widgetImpl.get();
|
|
53
|
-
w.setScrollState(scrollState);
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
MultiDiffEditorWidget = ( __decorate([
|
|
57
|
-
( __param(2, IInstantiationService))
|
|
58
|
-
], MultiDiffEditorWidget));
|
|
59
|
-
export { MultiDiffEditorWidget };
|
package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/multiDiffEditorWidgetImpl.js
DELETED
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { h, scheduleAtNextAnimationFrame, getWindow } from '../../../../base/browser/dom.js';
|
|
3
|
-
import { SmoothScrollableElement } from '../../../../base/browser/ui/scrollbar/scrollableElement.js';
|
|
4
|
-
import { findFirstMaxBy } from '../../../../base/common/arraysFind.js';
|
|
5
|
-
import { Disposable, toDisposable } from '../../../../base/common/lifecycle.js';
|
|
6
|
-
import { transaction, globalTransaction, observableValue, disposableObservableValue } from '../../../../base/common/observableInternal/base.js';
|
|
7
|
-
import { Scrollable } from '../../../../base/common/scrollable.js';
|
|
8
|
-
import './style.css.js';
|
|
9
|
-
import { ObservableElementSizeObserver } from '../diffEditor/utils.js';
|
|
10
|
-
import { OffsetRange } from '../../../common/core/offsetRange.js';
|
|
11
|
-
import { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';
|
|
12
|
-
import { DiffEditorItemTemplate, TemplateData } from './diffEditorItemTemplate.js';
|
|
13
|
-
import { ObjectPool } from './objectPool.js';
|
|
14
|
-
import { IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js';
|
|
15
|
-
import { ServiceCollection } from '../../../../platform/instantiation/common/serviceCollection.js';
|
|
16
|
-
import { EditorContextKeys } from '../../../common/editorContextKeys.js';
|
|
17
|
-
import { observableFromEvent, derivedObservableWithCache } from '../../../../base/common/observableInternal/utils.js';
|
|
18
|
-
import { derivedWithStore, derived } from '../../../../base/common/observableInternal/derived.js';
|
|
19
|
-
import { autorun } from '../../../../base/common/observableInternal/autorun.js';
|
|
20
|
-
let MultiDiffEditorWidgetImpl = class MultiDiffEditorWidgetImpl extends Disposable {
|
|
21
|
-
constructor(_element, _dimension, _viewModel, _workbenchUIElementFactory, _parentContextKeyService, _parentInstantiationService) {
|
|
22
|
-
super();
|
|
23
|
-
this._element = _element;
|
|
24
|
-
this._dimension = _dimension;
|
|
25
|
-
this._viewModel = _viewModel;
|
|
26
|
-
this._workbenchUIElementFactory = _workbenchUIElementFactory;
|
|
27
|
-
this._parentContextKeyService = _parentContextKeyService;
|
|
28
|
-
this._parentInstantiationService = _parentInstantiationService;
|
|
29
|
-
this._elements = h('div', {
|
|
30
|
-
style: {
|
|
31
|
-
overflowY: 'hidden',
|
|
32
|
-
}
|
|
33
|
-
}, [
|
|
34
|
-
h('div@content', {
|
|
35
|
-
style: {
|
|
36
|
-
overflow: 'hidden',
|
|
37
|
-
}
|
|
38
|
-
}),
|
|
39
|
-
h('div.monaco-editor@overflowWidgetsDomNode', {}),
|
|
40
|
-
]);
|
|
41
|
-
this._sizeObserver = this._register(( new ObservableElementSizeObserver(this._element, undefined)));
|
|
42
|
-
this._objectPool = this._register(( new ObjectPool((data) => {
|
|
43
|
-
const template = this._instantiationService.createInstance(DiffEditorItemTemplate, this._elements.content, this._elements.overflowWidgetsDomNode, this._workbenchUIElementFactory);
|
|
44
|
-
template.setData(data);
|
|
45
|
-
return template;
|
|
46
|
-
})));
|
|
47
|
-
this._scrollable = this._register(( new Scrollable({
|
|
48
|
-
forceIntegerValues: false,
|
|
49
|
-
scheduleAtNextAnimationFrame: (cb) => scheduleAtNextAnimationFrame(getWindow(this._element), cb),
|
|
50
|
-
smoothScrollDuration: 100,
|
|
51
|
-
})));
|
|
52
|
-
this._scrollableElement = this._register(( new SmoothScrollableElement(this._elements.root, {
|
|
53
|
-
vertical: 1 ,
|
|
54
|
-
horizontal: 1 ,
|
|
55
|
-
className: 'monaco-component',
|
|
56
|
-
useShadows: false,
|
|
57
|
-
}, this._scrollable)));
|
|
58
|
-
this.scrollTop = observableFromEvent(this._scrollableElement.onScroll, () => this._scrollableElement.getScrollPosition().scrollTop);
|
|
59
|
-
this.scrollLeft = observableFromEvent(this._scrollableElement.onScroll, () => this._scrollableElement.getScrollPosition().scrollLeft);
|
|
60
|
-
this._viewItems = derivedWithStore(this, (reader, store) => {
|
|
61
|
-
const vm = this._viewModel.read(reader);
|
|
62
|
-
if (!vm) {
|
|
63
|
-
return [];
|
|
64
|
-
}
|
|
65
|
-
const items = vm.items.read(reader);
|
|
66
|
-
return ( items.map(d => store.add(( new VirtualizedViewItem(d, this._objectPool, this.scrollLeft)))));
|
|
67
|
-
});
|
|
68
|
-
this._totalHeight = ( this._viewItems.map(
|
|
69
|
-
this,
|
|
70
|
-
(items, reader) => items.reduce((r, i) => r + i.contentHeight.read(reader), 0)
|
|
71
|
-
));
|
|
72
|
-
this.activeDiffItem = derived(this, reader => this._viewItems.read(reader).find(i => i.template.read(reader)?.isFocused.read(reader)));
|
|
73
|
-
this.lastActiveDiffItem = derivedObservableWithCache((reader, lastValue) => this.activeDiffItem.read(reader) ?? lastValue);
|
|
74
|
-
this.activeControl = derived(this, reader => this.lastActiveDiffItem.read(reader)?.template.read(reader)?.editor);
|
|
75
|
-
this._contextKeyService = this._register(this._parentContextKeyService.createScoped(this._element));
|
|
76
|
-
this._instantiationService = this._parentInstantiationService.createChild(( new ServiceCollection([IContextKeyService, this._contextKeyService])));
|
|
77
|
-
this._contextKeyService.createKey(EditorContextKeys.inMultiDiffEditor.key, true);
|
|
78
|
-
const ctxAllCollapsed = this._parentContextKeyService.createKey(EditorContextKeys.multiDiffEditorAllCollapsed.key, false);
|
|
79
|
-
this._register(autorun((reader) => {
|
|
80
|
-
const viewModel = this._viewModel.read(reader);
|
|
81
|
-
if (viewModel) {
|
|
82
|
-
const allCollapsed = viewModel.items.read(reader).every(item => item.collapsed.read(reader));
|
|
83
|
-
ctxAllCollapsed.set(allCollapsed);
|
|
84
|
-
}
|
|
85
|
-
}));
|
|
86
|
-
this._register(autorun((reader) => {
|
|
87
|
-
const lastActiveDiffItem = this.lastActiveDiffItem.read(reader);
|
|
88
|
-
transaction(tx => {
|
|
89
|
-
this._viewModel.read(reader)?.activeDiffItem.set(lastActiveDiffItem?.viewModel, tx);
|
|
90
|
-
});
|
|
91
|
-
}));
|
|
92
|
-
this._register(autorun((reader) => {
|
|
93
|
-
const dimension = this._dimension.read(reader);
|
|
94
|
-
this._sizeObserver.observe(dimension);
|
|
95
|
-
}));
|
|
96
|
-
this._elements.content.style.position = 'relative';
|
|
97
|
-
this._register(autorun((reader) => {
|
|
98
|
-
const height = this._sizeObserver.height.read(reader);
|
|
99
|
-
this._elements.root.style.height = `${height}px`;
|
|
100
|
-
const totalHeight = this._totalHeight.read(reader);
|
|
101
|
-
this._elements.content.style.height = `${totalHeight}px`;
|
|
102
|
-
const width = this._sizeObserver.width.read(reader);
|
|
103
|
-
let scrollWidth = width;
|
|
104
|
-
const viewItems = this._viewItems.read(reader);
|
|
105
|
-
const max = findFirstMaxBy(viewItems, i => i.maxScroll.read(reader).maxScroll);
|
|
106
|
-
if (max) {
|
|
107
|
-
const maxScroll = max.maxScroll.read(reader);
|
|
108
|
-
scrollWidth = width + maxScroll.maxScroll;
|
|
109
|
-
}
|
|
110
|
-
this._scrollableElement.setScrollDimensions({
|
|
111
|
-
width: width,
|
|
112
|
-
height: height,
|
|
113
|
-
scrollHeight: totalHeight,
|
|
114
|
-
scrollWidth,
|
|
115
|
-
});
|
|
116
|
-
}));
|
|
117
|
-
_element.replaceChildren(this._scrollableElement.getDomNode());
|
|
118
|
-
this._register(toDisposable(() => {
|
|
119
|
-
_element.replaceChildren();
|
|
120
|
-
}));
|
|
121
|
-
this._register(this._register(autorun(reader => {
|
|
122
|
-
globalTransaction(tx => {
|
|
123
|
-
this.render(reader);
|
|
124
|
-
});
|
|
125
|
-
})));
|
|
126
|
-
}
|
|
127
|
-
setScrollState(scrollState) {
|
|
128
|
-
this._scrollableElement.setScrollPosition({ scrollLeft: scrollState.left, scrollTop: scrollState.top });
|
|
129
|
-
}
|
|
130
|
-
render(reader) {
|
|
131
|
-
const scrollTop = this.scrollTop.read(reader);
|
|
132
|
-
let contentScrollOffsetToScrollOffset = 0;
|
|
133
|
-
let itemHeightSumBefore = 0;
|
|
134
|
-
let itemContentHeightSumBefore = 0;
|
|
135
|
-
const viewPortHeight = this._sizeObserver.height.read(reader);
|
|
136
|
-
const contentViewPort = OffsetRange.ofStartAndLength(scrollTop, viewPortHeight);
|
|
137
|
-
const width = this._sizeObserver.width.read(reader);
|
|
138
|
-
for (const v of this._viewItems.read(reader)) {
|
|
139
|
-
const itemContentHeight = v.contentHeight.read(reader);
|
|
140
|
-
const itemHeight = Math.min(itemContentHeight, viewPortHeight);
|
|
141
|
-
const itemRange = OffsetRange.ofStartAndLength(itemHeightSumBefore, itemHeight);
|
|
142
|
-
const itemContentRange = OffsetRange.ofStartAndLength(itemContentHeightSumBefore, itemContentHeight);
|
|
143
|
-
if (itemContentRange.isBefore(contentViewPort)) {
|
|
144
|
-
contentScrollOffsetToScrollOffset -= itemContentHeight - itemHeight;
|
|
145
|
-
v.hide();
|
|
146
|
-
}
|
|
147
|
-
else if (itemContentRange.isAfter(contentViewPort)) {
|
|
148
|
-
v.hide();
|
|
149
|
-
}
|
|
150
|
-
else {
|
|
151
|
-
const scroll = Math.max(0, Math.min(contentViewPort.start - itemContentRange.start, itemContentHeight - itemHeight));
|
|
152
|
-
contentScrollOffsetToScrollOffset -= scroll;
|
|
153
|
-
const viewPort = OffsetRange.ofStartAndLength(scrollTop + contentScrollOffsetToScrollOffset, viewPortHeight);
|
|
154
|
-
v.render(itemRange, scroll, width, viewPort);
|
|
155
|
-
}
|
|
156
|
-
itemHeightSumBefore += itemHeight;
|
|
157
|
-
itemContentHeightSumBefore += itemContentHeight;
|
|
158
|
-
}
|
|
159
|
-
this._elements.content.style.transform = `translateY(${-(scrollTop + contentScrollOffsetToScrollOffset)}px)`;
|
|
160
|
-
}
|
|
161
|
-
};
|
|
162
|
-
MultiDiffEditorWidgetImpl = ( __decorate([
|
|
163
|
-
( __param(4, IContextKeyService)),
|
|
164
|
-
( __param(5, IInstantiationService))
|
|
165
|
-
], MultiDiffEditorWidgetImpl));
|
|
166
|
-
class VirtualizedViewItem extends Disposable {
|
|
167
|
-
constructor(viewModel, _objectPool, _scrollLeft) {
|
|
168
|
-
super();
|
|
169
|
-
this.viewModel = viewModel;
|
|
170
|
-
this._objectPool = _objectPool;
|
|
171
|
-
this._scrollLeft = _scrollLeft;
|
|
172
|
-
this._lastTemplateData = observableValue(this, { contentHeight: 500, maxScroll: { maxScroll: 0, width: 0 }, });
|
|
173
|
-
this._templateRef = this._register(disposableObservableValue(this, undefined));
|
|
174
|
-
this.contentHeight = derived(this, reader => this._templateRef.read(reader)?.object.height?.read(reader) ?? this._lastTemplateData.read(reader).contentHeight);
|
|
175
|
-
this.maxScroll = derived(this, reader => this._templateRef.read(reader)?.object.maxScroll.read(reader) ?? this._lastTemplateData.read(reader).maxScroll);
|
|
176
|
-
this.template = derived(this, reader => this._templateRef.read(reader)?.object);
|
|
177
|
-
this._isHidden = observableValue(this, false);
|
|
178
|
-
this._register(autorun((reader) => {
|
|
179
|
-
const scrollLeft = this._scrollLeft.read(reader);
|
|
180
|
-
this._templateRef.read(reader)?.object.setScrollLeft(scrollLeft);
|
|
181
|
-
}));
|
|
182
|
-
this._register(autorun(reader => {
|
|
183
|
-
const ref = this._templateRef.read(reader);
|
|
184
|
-
if (!ref) {
|
|
185
|
-
return;
|
|
186
|
-
}
|
|
187
|
-
const isHidden = this._isHidden.read(reader);
|
|
188
|
-
if (!isHidden) {
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
|
-
const isFocused = ref.object.isFocused.read(reader);
|
|
192
|
-
if (isFocused) {
|
|
193
|
-
return;
|
|
194
|
-
}
|
|
195
|
-
transaction(tx => {
|
|
196
|
-
this._lastTemplateData.set({
|
|
197
|
-
contentHeight: ref.object.height.get(),
|
|
198
|
-
maxScroll: { maxScroll: 0, width: 0, }
|
|
199
|
-
}, tx);
|
|
200
|
-
ref.object.hide();
|
|
201
|
-
this._templateRef.set(undefined, tx);
|
|
202
|
-
});
|
|
203
|
-
}));
|
|
204
|
-
}
|
|
205
|
-
dispose() {
|
|
206
|
-
this.hide();
|
|
207
|
-
super.dispose();
|
|
208
|
-
}
|
|
209
|
-
toString() {
|
|
210
|
-
return `VirtualViewItem(${this.viewModel.entry.value.title})`;
|
|
211
|
-
}
|
|
212
|
-
hide() {
|
|
213
|
-
this._isHidden.set(true, undefined);
|
|
214
|
-
}
|
|
215
|
-
render(verticalSpace, offset, width, viewPort) {
|
|
216
|
-
this._isHidden.set(false, undefined);
|
|
217
|
-
let ref = this._templateRef.get();
|
|
218
|
-
if (!ref) {
|
|
219
|
-
ref = this._objectPool.getUnusedObj(( new TemplateData(this.viewModel)));
|
|
220
|
-
this._templateRef.set(ref, undefined);
|
|
221
|
-
}
|
|
222
|
-
ref.object.render(verticalSpace, width, offset, viewPort);
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
export { MultiDiffEditorWidgetImpl };
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
class ObjectPool {
|
|
2
|
-
constructor(_create) {
|
|
3
|
-
this._create = _create;
|
|
4
|
-
this._unused = ( new Set());
|
|
5
|
-
this._used = ( new Set());
|
|
6
|
-
this._itemData = ( new Map());
|
|
7
|
-
}
|
|
8
|
-
getUnusedObj(data) {
|
|
9
|
-
let obj;
|
|
10
|
-
if (this._unused.size === 0) {
|
|
11
|
-
obj = this._create(data);
|
|
12
|
-
this._itemData.set(obj, data);
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
const values = [...( this._unused.values())];
|
|
16
|
-
obj = values.find(obj => this._itemData.get(obj).getId() === data.getId()) ?? values[0];
|
|
17
|
-
this._unused.delete(obj);
|
|
18
|
-
this._itemData.set(obj, data);
|
|
19
|
-
obj.setData(data);
|
|
20
|
-
}
|
|
21
|
-
this._used.add(obj);
|
|
22
|
-
return {
|
|
23
|
-
object: obj,
|
|
24
|
-
dispose: () => {
|
|
25
|
-
this._used.delete(obj);
|
|
26
|
-
if (this._unused.size > 5) {
|
|
27
|
-
obj.dispose();
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
this._unused.add(obj);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
dispose() {
|
|
36
|
-
for (const obj of this._used) {
|
|
37
|
-
obj.dispose();
|
|
38
|
-
}
|
|
39
|
-
for (const obj of this._unused) {
|
|
40
|
-
obj.dispose();
|
|
41
|
-
}
|
|
42
|
-
this._used.clear();
|
|
43
|
-
this._unused.clear();
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
export { ObjectPool };
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import n from '../../../../../../../external/rollup-plugin-styles/dist/runtime/inject-css.js';
|
|
2
|
-
var css = ".monaco-component .multiDiffEntry{display:flex;flex-direction:column}.monaco-component .multiDiffEntry .editorParent{border-left:2px solid var(--vscode-tab-inactiveBackground)}.monaco-component .multiDiffEntry.focused .editorParent{border-left:2px solid var(--vscode-notebook-focusedCellBorder)}.monaco-component .multiDiffEntry .editorParent .editorContainer{border-left:17px solid var(--vscode-tab-inactiveBackground)}.monaco-component .multiDiffEntry .collapse-button{cursor:pointer;margin:0 5px}.monaco-component .multiDiffEntry .collapse-button a{display:block}.monaco-component .multiDiffEntry .header{align-items:center;background:var(--vscode-editor-background);border-bottom:1px solid var(--vscode-sideBarSectionHeader-border);border-left:2px solid var(--vscode-editor-background);border-top:1px solid var(--vscode-sideBarSectionHeader-border);color:var(--vscode-foreground);display:flex;padding:8px 5px;z-index:1000}.monaco-component .multiDiffEntry.focused .header{border-left:2px solid var(--vscode-notebook-focusedCellBorder)}.monaco-component .multiDiffEntry .header.shadow{box-shadow:var(--vscode-scrollbar-shadow) 0 6px 6px -6px}.monaco-component .multiDiffEntry .header .title{flex:1;font-size:14px;line-height:22px}.monaco-component .multiDiffEntry .header .actions{padding:0 8px}";
|
|
3
|
-
n(css,{});
|
|
4
|
-
export { css, css as default };
|