@codingame/monaco-vscode-editor-api 2.0.3-improve-modularity.1 → 2.1.0-update-vscode-1.86.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/vs/editor/editor.api.js +219 -80
- package/package.json +2 -2
|
@@ -18,7 +18,7 @@ import { PLAINTEXT_LANGUAGE_ID, ModesRegistry } from 'vscode/vscode/vs/editor/co
|
|
|
18
18
|
import { nullTokenize, nullTokenizeEncoded, NullState } from 'vscode/vscode/vs/editor/common/languages/nullTokenize';
|
|
19
19
|
import { TextModelResolvedOptions, FindMatch } from 'vscode/vscode/vs/editor/common/model';
|
|
20
20
|
import { IModelService } from 'vscode/vscode/vs/editor/common/services/model';
|
|
21
|
-
import { AccessibilitySupport, ContentWidgetPositionPreference, CursorChangeReason, DefaultEndOfLine, EditorAutoIndentStrategy, EditorOption, EndOfLinePreference, EndOfLineSequence, MinimapPosition, MouseTargetType, OverlayWidgetPositionPreference, OverviewRulerLane, GlyphMarginLane, RenderLineNumbersType, RenderMinimap, ScrollbarVisibility, ScrollType, TextEditorCursorBlinkingStyle, TextEditorCursorStyle, TrackedRangeStickiness, WrappingIndent, InjectedTextCursorStops, PositionAffinity,
|
|
21
|
+
import { AccessibilitySupport, ContentWidgetPositionPreference, CursorChangeReason, DefaultEndOfLine, EditorAutoIndentStrategy, EditorOption, EndOfLinePreference, EndOfLineSequence, MinimapPosition, MouseTargetType, OverlayWidgetPositionPreference, OverviewRulerLane, GlyphMarginLane, RenderLineNumbersType, RenderMinimap, ScrollbarVisibility, ScrollType, TextEditorCursorBlinkingStyle, TextEditorCursorStyle, TrackedRangeStickiness, WrappingIndent, InjectedTextCursorStops, PositionAffinity, ShowLightbulbIconMode, DocumentHighlightKind, CompletionItemKind, CompletionItemTag, CompletionItemInsertTextRule, SymbolKind, SymbolTag, IndentAction, CompletionTriggerKind, SignatureHelpTriggerKind, InlayHintKind, InlineCompletionTriggerKind, CodeActionTriggerType } from 'vscode/vscode/vs/editor/common/standalone/standaloneEnums';
|
|
22
22
|
import { createTrustedTypesPolicy } from 'vscode/vscode/vs/base/browser/trustedTypes';
|
|
23
23
|
import { LineTokens } from 'vscode/vscode/vs/editor/common/tokens/lineTokens';
|
|
24
24
|
import { renderViewLine2, RenderLineInput } from 'vscode/vscode/vs/editor/common/viewLayout/viewLineRenderer';
|
|
@@ -47,10 +47,11 @@ import { DiffEditorWidget } from 'vscode/vscode/vs/editor/browser/widget/diffEdi
|
|
|
47
47
|
import { MenuWorkbenchToolBar } from 'vscode/vscode/vs/platform/actions/browser/toolbar';
|
|
48
48
|
import { ActionRunner } from 'vscode/vscode/vs/base/common/actions';
|
|
49
49
|
import { derived, derivedWithStore } from 'vscode/vscode/vs/base/common/observableInternal/derived';
|
|
50
|
-
import { autorun } from 'vscode/vscode/vs/base/common/observableInternal/autorun';
|
|
51
|
-
import { observableFromEvent, derivedObservableWithCache, recomputeInitiallyAndOnChange } from 'vscode/vscode/vs/base/common/observableInternal/utils';
|
|
50
|
+
import { autorun, autorunWithStore } from 'vscode/vscode/vs/base/common/observableInternal/autorun';
|
|
51
|
+
import { observableFromEvent, derivedObservableWithCache, mapObservableArrayCached, recomputeInitiallyAndOnChange } from 'vscode/vscode/vs/base/common/observableInternal/utils';
|
|
52
52
|
import { ServiceCollection } from 'vscode/vscode/vs/platform/instantiation/common/serviceCollection';
|
|
53
53
|
import { EditorContextKeys } from 'vscode/vscode/vs/editor/common/editorContextKeys';
|
|
54
|
+
import { Selection as Selection$1 } from 'vscode/vscode/vs/editor/common/core/selection';
|
|
54
55
|
import { DiffEditorOptions } from 'vscode/vscode/vs/editor/browser/widget/diffEditor/diffEditorOptions';
|
|
55
56
|
import { DiffEditorViewModel } from 'vscode/vscode/vs/editor/browser/widget/diffEditor/diffEditorViewModel';
|
|
56
57
|
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
@@ -64,7 +65,7 @@ import { createConfiguredEditor, createConfiguredDiffEditor, createModelReferenc
|
|
|
64
65
|
|
|
65
66
|
var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=( Object.keys(r.attributes)),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
|
|
66
67
|
|
|
67
|
-
var css$1 = ".monaco-editor{--monaco-monospace-font:\"SF Mono\",Monaco,Menlo,Consolas,\"Ubuntu Mono\",\"Liberation Mono\",\"DejaVu Sans Mono\",\"Courier New\",monospace;font-family:-apple-system,BlinkMacSystemFont,Segoe WPC,Segoe UI,HelveticaNeue-Light,system-ui,Ubuntu,Droid Sans,sans-serif}.monaco-editor.hc-black .monaco-menu .monaco-action-bar.vertical .action-menu-item:focus .action-label,.monaco-editor.hc-light .monaco-menu .monaco-action-bar.vertical .action-menu-item:focus .action-label,.monaco-editor.vs-dark .monaco-menu .monaco-action-bar.vertical .action-menu-item:focus .action-label,.monaco-menu .monaco-action-bar.vertical .action-item .action-menu-item:focus .action-label{stroke-width:1.2px}.monaco-hover p{margin:0}.monaco-aria-container{clip:rect(1px,1px,1px,1px);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute!important;top:0;width:1px}";
|
|
68
|
+
var css$1 = ".monaco-editor{--monaco-monospace-font:\"SF Mono\",Monaco,Menlo,Consolas,\"Ubuntu Mono\",\"Liberation Mono\",\"DejaVu Sans Mono\",\"Courier New\",monospace;font-family:-apple-system,BlinkMacSystemFont,Segoe WPC,Segoe UI,HelveticaNeue-Light,system-ui,Ubuntu,Droid Sans,sans-serif}.monaco-editor.hc-black .monaco-menu .monaco-action-bar.vertical .action-menu-item:focus .action-label,.monaco-editor.hc-light .monaco-menu .monaco-action-bar.vertical .action-menu-item:focus .action-label,.monaco-editor.vs-dark .monaco-menu .monaco-action-bar.vertical .action-menu-item:focus .action-label,.monaco-menu .monaco-action-bar.vertical .action-item .action-menu-item:focus .action-label{stroke-width:1.2px}.monaco-hover p{margin:0}.monaco-aria-container{clip:rect(1px,1px,1px,1px);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute!important;top:0;width:1px}.monaco-diff-editor .synthetic-focus,.monaco-diff-editor [tabindex=\"-1\"]:focus,.monaco-diff-editor [tabindex=\"0\"]:focus,.monaco-diff-editor button:focus,.monaco-diff-editor input[type=button]:focus,.monaco-diff-editor input[type=checkbox]:focus,.monaco-diff-editor input[type=search]:focus,.monaco-diff-editor input[type=text]:focus,.monaco-diff-editor select:focus,.monaco-diff-editor textarea:focus,.monaco-editor{opacity:1;outline-color:var(--vscode-focusBorder);outline-offset:-1px;outline-style:solid;outline-width:1px}";
|
|
68
69
|
n(css$1,{});
|
|
69
70
|
|
|
70
71
|
function __decorate(decorators, target, key, desc) {
|
|
@@ -1029,7 +1030,7 @@ function _actualColorize(lines, tabSize, tokenizationSupport, languageIdCodec) {
|
|
|
1029
1030
|
return html.join('');
|
|
1030
1031
|
}
|
|
1031
1032
|
|
|
1032
|
-
var css = ".monaco-component
|
|
1033
|
+
var css = ".monaco-component.multiDiffEditor{background:var(--vscode-multiDiffEditor-background);overflow-y:hidden}.monaco-component .multiDiffEntry{border-bottom:1px solid var(--vscode-multiDiffEditor-border);display:flex;flex:1;flex-direction:column;overflow:hidden}.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-top:1px solid var(--vscode-multiDiffEditor-border);color:var(--vscode-foreground);display:flex;padding:8px 5px;z-index:1000}.monaco-component .multiDiffEntry .header.shadow{box-shadow:var(--vscode-scrollbar-shadow) 0 6px 6px -6px}.monaco-component .multiDiffEntry .header .file-path{display:flex;flex:1;min-width:0}.monaco-component .multiDiffEntry .header .file-path .title{font-size:14px;line-height:22px}.monaco-component .multiDiffEntry .header .file-path .status{font-weight:600;line-height:22px;margin:0 10px;opacity:.75}.monaco-component .multiDiffEntry .header .file-path .title.original{flex:1;min-width:0;text-overflow:ellipsis}.monaco-component .multiDiffEntry .header .actions{padding:0 8px}.monaco-component .multiDiffEntry .editorParent{display:flex;flex:1;flex-direction:column}.monaco-component .multiDiffEntry .editorContainer{flex:1}";
|
|
1033
1034
|
n(css,{});
|
|
1034
1035
|
|
|
1035
1036
|
class ActionRunnerWithContext extends ActionRunner {
|
|
@@ -1059,9 +1060,9 @@ let DiffEditorItemTemplate = class DiffEditorItemTemplate extends Disposable {
|
|
|
1059
1060
|
this._instantiationService = _instantiationService;
|
|
1060
1061
|
this._viewModel = observableValue(this, undefined);
|
|
1061
1062
|
this._collapsed = derived(this, reader => this._viewModel.read(reader)?.collapsed.read(reader));
|
|
1062
|
-
this.
|
|
1063
|
-
this.
|
|
1064
|
-
const h = this._collapsed.read(reader) ? 0 : this.
|
|
1063
|
+
this._editorContentHeight = observableValue(this, 500);
|
|
1064
|
+
this.contentHeight = derived(this, reader => {
|
|
1065
|
+
const h = this._collapsed.read(reader) ? 0 : this._editorContentHeight.read(reader);
|
|
1065
1066
|
return h + this._outerEditorHeight;
|
|
1066
1067
|
});
|
|
1067
1068
|
this._modifiedContentWidth = observableValue(this, 0);
|
|
@@ -1079,28 +1080,17 @@ let DiffEditorItemTemplate = class DiffEditorItemTemplate extends Disposable {
|
|
|
1079
1080
|
}
|
|
1080
1081
|
});
|
|
1081
1082
|
this._elements = h('div.multiDiffEntry', [
|
|
1082
|
-
h('div.
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
}
|
|
1089
|
-
}, [
|
|
1090
|
-
h('div.header@header', [
|
|
1091
|
-
h('div.collapse-button@collapseButton'),
|
|
1092
|
-
h('div.title.show-file-icons@title', []),
|
|
1093
|
-
h('div.actions@actions'),
|
|
1083
|
+
h('div.header@header', [
|
|
1084
|
+
h('div.collapse-button@collapseButton'),
|
|
1085
|
+
h('div.file-path', [
|
|
1086
|
+
h('div.title.modified.show-file-icons@primaryPath', []),
|
|
1087
|
+
h('div.status.deleted@status', ['R']),
|
|
1088
|
+
h('div.title.original.show-file-icons@secondaryPath', []),
|
|
1094
1089
|
]),
|
|
1095
|
-
h('div.
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
flexDirection: 'column',
|
|
1100
|
-
}
|
|
1101
|
-
}, [
|
|
1102
|
-
h('div.editorContainer@editor', { style: { flex: '1' } }),
|
|
1103
|
-
])
|
|
1090
|
+
h('div.actions@actions'),
|
|
1091
|
+
]),
|
|
1092
|
+
h('div.editorParent', [
|
|
1093
|
+
h('div.editorContainer@editor'),
|
|
1104
1094
|
])
|
|
1105
1095
|
]);
|
|
1106
1096
|
this.editor = this._register(this._instantiationService.createInstance(DiffEditorWidget, this._elements.editor, {
|
|
@@ -1110,10 +1100,13 @@ let DiffEditorItemTemplate = class DiffEditorItemTemplate extends Disposable {
|
|
|
1110
1100
|
this.isOriginalFocused = isFocused(this.editor.getOriginalEditor());
|
|
1111
1101
|
this.isFocused = derived(this, reader => this.isModifedFocused.read(reader) || this.isOriginalFocused.read(reader));
|
|
1112
1102
|
this._resourceLabel = this._workbenchUIElementFactory.createResourceLabel
|
|
1113
|
-
? this._register(this._workbenchUIElementFactory.createResourceLabel(this._elements.
|
|
1103
|
+
? this._register(this._workbenchUIElementFactory.createResourceLabel(this._elements.primaryPath))
|
|
1104
|
+
: undefined;
|
|
1105
|
+
this._resourceLabel2 = this._workbenchUIElementFactory.createResourceLabel
|
|
1106
|
+
? this._register(this._workbenchUIElementFactory.createResourceLabel(this._elements.secondaryPath))
|
|
1114
1107
|
: undefined;
|
|
1115
1108
|
this._dataStore = ( new DisposableStore());
|
|
1116
|
-
this._headerHeight =
|
|
1109
|
+
this._headerHeight = 38;
|
|
1117
1110
|
const btn = ( new Button(this._elements.collapseButton, {}));
|
|
1118
1111
|
this._register(autorun(reader => {
|
|
1119
1112
|
btn.element.className = '';
|
|
@@ -1135,7 +1128,7 @@ let DiffEditorItemTemplate = class DiffEditorItemTemplate extends Disposable {
|
|
|
1135
1128
|
});
|
|
1136
1129
|
this._register(this.editor.onDidContentSizeChange(e => {
|
|
1137
1130
|
globalTransaction(tx => {
|
|
1138
|
-
this.
|
|
1131
|
+
this._editorContentHeight.set(e.contentHeight, tx);
|
|
1139
1132
|
this._modifiedContentWidth.set(this.editor.getModifiedEditor().getContentWidth(), tx);
|
|
1140
1133
|
this._originalContentWidth.set(this.editor.getOriginalEditor().getContentWidth(), tx);
|
|
1141
1134
|
});
|
|
@@ -1147,10 +1140,11 @@ let DiffEditorItemTemplate = class DiffEditorItemTemplate extends Disposable {
|
|
|
1147
1140
|
this._container.appendChild(this._elements.root);
|
|
1148
1141
|
this._outerEditorHeight = 38;
|
|
1149
1142
|
this._register(this._instantiationService.createInstance(MenuWorkbenchToolBar, this._elements.actions, MenuId.MultiDiffEditorFileToolbar, {
|
|
1150
|
-
actionRunner: this._register(( new ActionRunnerWithContext(() => (this._viewModel.get()?.
|
|
1143
|
+
actionRunner: this._register(( new ActionRunnerWithContext(() => (this._viewModel.get()?.modifiedUri)))),
|
|
1151
1144
|
menuOptions: {
|
|
1152
1145
|
shouldForwardArgs: true,
|
|
1153
|
-
}
|
|
1146
|
+
},
|
|
1147
|
+
toolbarOptions: { primaryGroup: g => g.startsWith('navigation') },
|
|
1154
1148
|
}));
|
|
1155
1149
|
}
|
|
1156
1150
|
setScrollLeft(left) {
|
|
@@ -1177,6 +1171,7 @@ let DiffEditorItemTemplate = class DiffEditorItemTemplate extends Disposable {
|
|
|
1177
1171
|
},
|
|
1178
1172
|
renderOverviewRuler: false,
|
|
1179
1173
|
fixedOverflowWidgets: true,
|
|
1174
|
+
overviewRulerBorder: false,
|
|
1180
1175
|
};
|
|
1181
1176
|
}
|
|
1182
1177
|
const value = data.viewModel.entry.value;
|
|
@@ -1186,7 +1181,28 @@ let DiffEditorItemTemplate = class DiffEditorItemTemplate extends Disposable {
|
|
|
1186
1181
|
}));
|
|
1187
1182
|
}
|
|
1188
1183
|
globalTransaction(tx => {
|
|
1189
|
-
this._resourceLabel?.setUri(data.viewModel.
|
|
1184
|
+
this._resourceLabel?.setUri(data.viewModel.modifiedUri ?? data.viewModel.originalUri, { strikethrough: data.viewModel.modifiedUri === undefined });
|
|
1185
|
+
let isRenamed = false;
|
|
1186
|
+
let isDeleted = false;
|
|
1187
|
+
let isAdded = false;
|
|
1188
|
+
let flag = '';
|
|
1189
|
+
if (data.viewModel.modifiedUri && data.viewModel.originalUri && data.viewModel.modifiedUri.path !== data.viewModel.originalUri.path) {
|
|
1190
|
+
flag = 'R';
|
|
1191
|
+
isRenamed = true;
|
|
1192
|
+
}
|
|
1193
|
+
else if (!data.viewModel.modifiedUri) {
|
|
1194
|
+
flag = 'D';
|
|
1195
|
+
isDeleted = true;
|
|
1196
|
+
}
|
|
1197
|
+
else if (!data.viewModel.originalUri) {
|
|
1198
|
+
flag = 'A';
|
|
1199
|
+
isAdded = true;
|
|
1200
|
+
}
|
|
1201
|
+
this._elements.status.classList.toggle('renamed', isRenamed);
|
|
1202
|
+
this._elements.status.classList.toggle('deleted', isDeleted);
|
|
1203
|
+
this._elements.status.classList.toggle('added', isAdded);
|
|
1204
|
+
this._elements.status.innerText = flag;
|
|
1205
|
+
this._resourceLabel2?.setUri(isRenamed ? data.viewModel.originalUri : undefined, { strikethrough: true });
|
|
1190
1206
|
this._dataStore.clear();
|
|
1191
1207
|
this._viewModel.set(data.viewModel, tx);
|
|
1192
1208
|
this.editor.setModel(data.viewModel.diffEditorViewModel, tx);
|
|
@@ -1282,11 +1298,7 @@ let MultiDiffEditorWidgetImpl = class MultiDiffEditorWidgetImpl extends Disposab
|
|
|
1282
1298
|
this._workbenchUIElementFactory = _workbenchUIElementFactory;
|
|
1283
1299
|
this._parentContextKeyService = _parentContextKeyService;
|
|
1284
1300
|
this._parentInstantiationService = _parentInstantiationService;
|
|
1285
|
-
this._elements = h('div',
|
|
1286
|
-
style: {
|
|
1287
|
-
overflowY: 'hidden',
|
|
1288
|
-
}
|
|
1289
|
-
}, [
|
|
1301
|
+
this._elements = h('div.monaco-component.multiDiffEditor', [
|
|
1290
1302
|
h('div@content', {
|
|
1291
1303
|
style: {
|
|
1292
1304
|
overflow: 'hidden',
|
|
@@ -1308,7 +1320,6 @@ let MultiDiffEditorWidgetImpl = class MultiDiffEditorWidgetImpl extends Disposab
|
|
|
1308
1320
|
this._scrollableElement = this._register(( new SmoothScrollableElement(this._elements.root, {
|
|
1309
1321
|
vertical: 1 ,
|
|
1310
1322
|
horizontal: 1 ,
|
|
1311
|
-
className: 'monaco-component',
|
|
1312
1323
|
useShadows: false,
|
|
1313
1324
|
}, this._scrollable)));
|
|
1314
1325
|
this.scrollTop = observableFromEvent(this._scrollableElement.onScroll, () => this._scrollableElement.getScrollPosition().scrollTop);
|
|
@@ -1319,18 +1330,39 @@ let MultiDiffEditorWidgetImpl = class MultiDiffEditorWidgetImpl extends Disposab
|
|
|
1319
1330
|
return [];
|
|
1320
1331
|
}
|
|
1321
1332
|
const items = vm.items.read(reader);
|
|
1322
|
-
return ( items.map(d =>
|
|
1333
|
+
return ( items.map(d => {
|
|
1334
|
+
const item = store.add(( new VirtualizedViewItem(d, this._objectPool, this.scrollLeft)));
|
|
1335
|
+
const data = this._lastDocStates?.[item.getKey()];
|
|
1336
|
+
if (data) {
|
|
1337
|
+
transaction(tx => {
|
|
1338
|
+
item.setViewState(data, tx);
|
|
1339
|
+
});
|
|
1340
|
+
}
|
|
1341
|
+
return item;
|
|
1342
|
+
}));
|
|
1323
1343
|
});
|
|
1344
|
+
this._spaceBetweenPx = 10;
|
|
1324
1345
|
this._totalHeight = ( this._viewItems.map(
|
|
1325
1346
|
this,
|
|
1326
|
-
(items, reader) => items.reduce((r, i) => r + i.contentHeight.read(reader), 0)
|
|
1347
|
+
(items, reader) => items.reduce((r, i) => r + i.contentHeight.read(reader) + this._spaceBetweenPx, 0)
|
|
1327
1348
|
));
|
|
1328
1349
|
this.activeDiffItem = derived(this, reader => this._viewItems.read(reader).find(i => i.template.read(reader)?.isFocused.read(reader)));
|
|
1329
1350
|
this.lastActiveDiffItem = derivedObservableWithCache((reader, lastValue) => this.activeDiffItem.read(reader) ?? lastValue);
|
|
1330
1351
|
this.activeControl = derived(this, reader => this.lastActiveDiffItem.read(reader)?.template.read(reader)?.editor);
|
|
1331
1352
|
this._contextKeyService = this._register(this._parentContextKeyService.createScoped(this._element));
|
|
1332
1353
|
this._instantiationService = this._parentInstantiationService.createChild(( new ServiceCollection([IContextKeyService, this._contextKeyService])));
|
|
1354
|
+
this._lastDocStates = {};
|
|
1333
1355
|
this._contextKeyService.createKey(EditorContextKeys.inMultiDiffEditor.key, true);
|
|
1356
|
+
this._register(autorunWithStore((reader, store) => {
|
|
1357
|
+
const viewModel = this._viewModel.read(reader);
|
|
1358
|
+
if (viewModel && viewModel.contextKeys) {
|
|
1359
|
+
for (const [key, value] of Object.entries(viewModel.contextKeys)) {
|
|
1360
|
+
const contextKey = this._contextKeyService.createKey(key, undefined);
|
|
1361
|
+
contextKey.set(value);
|
|
1362
|
+
store.add(toDisposable(() => contextKey.reset()));
|
|
1363
|
+
}
|
|
1364
|
+
}
|
|
1365
|
+
}));
|
|
1334
1366
|
const ctxAllCollapsed = this._parentContextKeyService.createKey(EditorContextKeys.multiDiffEditorAllCollapsed.key, false);
|
|
1335
1367
|
this._register(autorun((reader) => {
|
|
1336
1368
|
const viewModel = this._viewModel.read(reader);
|
|
@@ -1383,6 +1415,43 @@ let MultiDiffEditorWidgetImpl = class MultiDiffEditorWidgetImpl extends Disposab
|
|
|
1383
1415
|
setScrollState(scrollState) {
|
|
1384
1416
|
this._scrollableElement.setScrollPosition({ scrollLeft: scrollState.left, scrollTop: scrollState.top });
|
|
1385
1417
|
}
|
|
1418
|
+
getViewState() {
|
|
1419
|
+
return {
|
|
1420
|
+
scrollState: {
|
|
1421
|
+
top: this.scrollTop.get(),
|
|
1422
|
+
left: this.scrollLeft.get(),
|
|
1423
|
+
},
|
|
1424
|
+
docStates: Object.fromEntries(( this._viewItems.get().map(i => [i.getKey(), i.getViewState()]))),
|
|
1425
|
+
};
|
|
1426
|
+
}
|
|
1427
|
+
setViewState(viewState) {
|
|
1428
|
+
this.setScrollState(viewState.scrollState);
|
|
1429
|
+
this._lastDocStates = viewState.docStates;
|
|
1430
|
+
transaction(tx => {
|
|
1431
|
+
if (viewState.docStates) {
|
|
1432
|
+
for (const i of this._viewItems.get()) {
|
|
1433
|
+
const state = viewState.docStates[i.getKey()];
|
|
1434
|
+
if (state) {
|
|
1435
|
+
i.setViewState(state, tx);
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
});
|
|
1440
|
+
}
|
|
1441
|
+
tryGetCodeEditor(resource) {
|
|
1442
|
+
const item = this._viewItems.get().find(v => ( v.viewModel.diffEditorViewModel.model.modified.uri.toString()) === ( resource.toString())
|
|
1443
|
+
|| ( v.viewModel.diffEditorViewModel.model.original.uri.toString()) === ( resource.toString()));
|
|
1444
|
+
const editor = item?.template.get()?.editor;
|
|
1445
|
+
if (!editor) {
|
|
1446
|
+
return undefined;
|
|
1447
|
+
}
|
|
1448
|
+
if (( item.viewModel.diffEditorViewModel.model.modified.uri.toString()) === ( resource.toString())) {
|
|
1449
|
+
return { diffEditor: editor, editor: editor.getModifiedEditor() };
|
|
1450
|
+
}
|
|
1451
|
+
else {
|
|
1452
|
+
return { diffEditor: editor, editor: editor.getOriginalEditor() };
|
|
1453
|
+
}
|
|
1454
|
+
}
|
|
1386
1455
|
render(reader) {
|
|
1387
1456
|
const scrollTop = this.scrollTop.read(reader);
|
|
1388
1457
|
let contentScrollOffsetToScrollOffset = 0;
|
|
@@ -1409,8 +1478,8 @@ let MultiDiffEditorWidgetImpl = class MultiDiffEditorWidgetImpl extends Disposab
|
|
|
1409
1478
|
const viewPort = OffsetRange.ofStartAndLength(scrollTop + contentScrollOffsetToScrollOffset, viewPortHeight);
|
|
1410
1479
|
v.render(itemRange, scroll, width, viewPort);
|
|
1411
1480
|
}
|
|
1412
|
-
itemHeightSumBefore += itemHeight;
|
|
1413
|
-
itemContentHeightSumBefore += itemContentHeight;
|
|
1481
|
+
itemHeightSumBefore += itemHeight + this._spaceBetweenPx;
|
|
1482
|
+
itemContentHeightSumBefore += itemContentHeight + this._spaceBetweenPx;
|
|
1414
1483
|
}
|
|
1415
1484
|
this._elements.content.style.transform = `translateY(${-(scrollTop + contentScrollOffsetToScrollOffset)}px)`;
|
|
1416
1485
|
}
|
|
@@ -1425,10 +1494,9 @@ class VirtualizedViewItem extends Disposable {
|
|
|
1425
1494
|
this.viewModel = viewModel;
|
|
1426
1495
|
this._objectPool = _objectPool;
|
|
1427
1496
|
this._scrollLeft = _scrollLeft;
|
|
1428
|
-
this._lastTemplateData = observableValue(this, { contentHeight: 500, maxScroll: { maxScroll: 0, width: 0 }, });
|
|
1429
1497
|
this._templateRef = this._register(disposableObservableValue(this, undefined));
|
|
1430
|
-
this.contentHeight = derived(this, reader => this._templateRef.read(reader)?.object.
|
|
1431
|
-
this.maxScroll = derived(this, reader => this._templateRef.read(reader)?.object.maxScroll.read(reader) ??
|
|
1498
|
+
this.contentHeight = derived(this, reader => this._templateRef.read(reader)?.object.contentHeight?.read(reader) ?? this.viewModel.lastTemplateData.read(reader).contentHeight);
|
|
1499
|
+
this.maxScroll = derived(this, reader => this._templateRef.read(reader)?.object.maxScroll.read(reader) ?? { maxScroll: 0, scrollWidth: 0 });
|
|
1432
1500
|
this.template = derived(this, reader => this._templateRef.read(reader)?.object);
|
|
1433
1501
|
this._isHidden = observableValue(this, false);
|
|
1434
1502
|
this._register(autorun((reader) => {
|
|
@@ -1448,22 +1516,64 @@ class VirtualizedViewItem extends Disposable {
|
|
|
1448
1516
|
if (isFocused) {
|
|
1449
1517
|
return;
|
|
1450
1518
|
}
|
|
1451
|
-
|
|
1452
|
-
this._lastTemplateData.set({
|
|
1453
|
-
contentHeight: ref.object.height.get(),
|
|
1454
|
-
maxScroll: { maxScroll: 0, width: 0, }
|
|
1455
|
-
}, tx);
|
|
1456
|
-
ref.object.hide();
|
|
1457
|
-
this._templateRef.set(undefined, tx);
|
|
1458
|
-
});
|
|
1519
|
+
this._clear();
|
|
1459
1520
|
}));
|
|
1460
1521
|
}
|
|
1461
1522
|
dispose() {
|
|
1462
|
-
this.
|
|
1523
|
+
this._clear();
|
|
1463
1524
|
super.dispose();
|
|
1464
1525
|
}
|
|
1465
1526
|
toString() {
|
|
1466
|
-
return `VirtualViewItem(${this.viewModel.entry.value.
|
|
1527
|
+
return `VirtualViewItem(${this.viewModel.entry.value.modified?.uri.toString()})`;
|
|
1528
|
+
}
|
|
1529
|
+
getKey() {
|
|
1530
|
+
return this.viewModel.getKey();
|
|
1531
|
+
}
|
|
1532
|
+
getViewState() {
|
|
1533
|
+
transaction(tx => {
|
|
1534
|
+
this._updateTemplateData(tx);
|
|
1535
|
+
});
|
|
1536
|
+
return {
|
|
1537
|
+
collapsed: this.viewModel.collapsed.get(),
|
|
1538
|
+
selections: this.viewModel.lastTemplateData.get().selections,
|
|
1539
|
+
};
|
|
1540
|
+
}
|
|
1541
|
+
setViewState(viewState, tx) {
|
|
1542
|
+
this.viewModel.collapsed.set(viewState.collapsed, tx);
|
|
1543
|
+
this._updateTemplateData(tx);
|
|
1544
|
+
const data = this.viewModel.lastTemplateData.get();
|
|
1545
|
+
const selections = viewState.selections?.map(Selection$1.liftSelection);
|
|
1546
|
+
this.viewModel.lastTemplateData.set({
|
|
1547
|
+
...data,
|
|
1548
|
+
selections,
|
|
1549
|
+
}, tx);
|
|
1550
|
+
const ref = this._templateRef.get();
|
|
1551
|
+
if (ref) {
|
|
1552
|
+
if (selections) {
|
|
1553
|
+
ref.object.editor.setSelections(selections);
|
|
1554
|
+
}
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
_updateTemplateData(tx) {
|
|
1558
|
+
const ref = this._templateRef.get();
|
|
1559
|
+
if (!ref) {
|
|
1560
|
+
return;
|
|
1561
|
+
}
|
|
1562
|
+
this.viewModel.lastTemplateData.set({
|
|
1563
|
+
contentHeight: ref.object.contentHeight.get(),
|
|
1564
|
+
selections: ref.object.editor.getSelections() ?? undefined,
|
|
1565
|
+
}, tx);
|
|
1566
|
+
}
|
|
1567
|
+
_clear() {
|
|
1568
|
+
const ref = this._templateRef.get();
|
|
1569
|
+
if (!ref) {
|
|
1570
|
+
return;
|
|
1571
|
+
}
|
|
1572
|
+
transaction(tx => {
|
|
1573
|
+
this._updateTemplateData(tx);
|
|
1574
|
+
ref.object.hide();
|
|
1575
|
+
this._templateRef.set(undefined, tx);
|
|
1576
|
+
});
|
|
1467
1577
|
}
|
|
1468
1578
|
hide() {
|
|
1469
1579
|
this._isHidden.set(true, undefined);
|
|
@@ -1474,6 +1584,10 @@ class VirtualizedViewItem extends Disposable {
|
|
|
1474
1584
|
if (!ref) {
|
|
1475
1585
|
ref = this._objectPool.getUnusedObj(( new TemplateData(this.viewModel)));
|
|
1476
1586
|
this._templateRef.set(ref, undefined);
|
|
1587
|
+
const selections = this.viewModel.lastTemplateData.get().selections;
|
|
1588
|
+
if (selections) {
|
|
1589
|
+
ref.object.editor.setSelections(selections);
|
|
1590
|
+
}
|
|
1477
1591
|
}
|
|
1478
1592
|
ref.object.render(verticalSpace, width, offset, viewPort);
|
|
1479
1593
|
}
|
|
@@ -1499,21 +1613,29 @@ class MultiDiffEditorViewModel extends Disposable {
|
|
|
1499
1613
|
}
|
|
1500
1614
|
});
|
|
1501
1615
|
}
|
|
1502
|
-
|
|
1616
|
+
get contextKeys() {
|
|
1617
|
+
return this.model.contextKeys;
|
|
1618
|
+
}
|
|
1619
|
+
constructor(model, _instantiationService) {
|
|
1503
1620
|
super();
|
|
1504
|
-
this.
|
|
1621
|
+
this.model = model;
|
|
1505
1622
|
this._instantiationService = _instantiationService;
|
|
1506
|
-
this._documents = observableFromEvent(this.
|
|
1507
|
-
this.items =
|
|
1623
|
+
this._documents = observableFromEvent(this.model.onDidChange, () => this.model.documents);
|
|
1624
|
+
this.items = mapObservableArrayCached(this, this._documents, (d, store) => store.add(this._instantiationService.createInstance(DocumentDiffItemViewModel, d)))
|
|
1625
|
+
.recomputeInitiallyAndOnChange(this._store);
|
|
1508
1626
|
this.activeDiffItem = observableValue(this, undefined);
|
|
1509
1627
|
}
|
|
1510
1628
|
}
|
|
1511
|
-
class DocumentDiffItemViewModel extends Disposable {
|
|
1512
|
-
|
|
1629
|
+
let DocumentDiffItemViewModel = class DocumentDiffItemViewModel extends Disposable {
|
|
1630
|
+
get originalUri() { return this.entry.value.original?.uri; }
|
|
1631
|
+
get modifiedUri() { return this.entry.value.modified?.uri; }
|
|
1632
|
+
constructor(entry, _instantiationService, _modelService) {
|
|
1513
1633
|
super();
|
|
1514
1634
|
this.entry = entry;
|
|
1515
1635
|
this._instantiationService = _instantiationService;
|
|
1636
|
+
this._modelService = _modelService;
|
|
1516
1637
|
this.collapsed = observableValue(this, false);
|
|
1638
|
+
this.lastTemplateData = observableValue(this, { contentHeight: 500, selections: undefined, });
|
|
1517
1639
|
function updateOptions(options) {
|
|
1518
1640
|
return {
|
|
1519
1641
|
...options,
|
|
@@ -1528,18 +1650,40 @@ class DocumentDiffItemViewModel extends Disposable {
|
|
|
1528
1650
|
options.updateOptions(updateOptions(this.entry.value.options || {}));
|
|
1529
1651
|
}));
|
|
1530
1652
|
}
|
|
1653
|
+
const originalTextModel = this.entry.value.original ?? this._register(this._modelService.createModel('', null));
|
|
1654
|
+
const modifiedTextModel = this.entry.value.modified ?? this._register(this._modelService.createModel('', null));
|
|
1531
1655
|
this.diffEditorViewModel = this._register(this._instantiationService.createInstance(DiffEditorViewModel, {
|
|
1532
|
-
original:
|
|
1533
|
-
modified:
|
|
1656
|
+
original: originalTextModel,
|
|
1657
|
+
modified: modifiedTextModel,
|
|
1534
1658
|
}, options));
|
|
1535
1659
|
}
|
|
1536
|
-
|
|
1660
|
+
getKey() {
|
|
1661
|
+
return JSON.stringify([
|
|
1662
|
+
this.originalUri?.toString(),
|
|
1663
|
+
this.modifiedUri?.toString()
|
|
1664
|
+
]);
|
|
1665
|
+
}
|
|
1666
|
+
};
|
|
1667
|
+
DocumentDiffItemViewModel = ( __decorate([
|
|
1668
|
+
( __param(1, IInstantiationService)),
|
|
1669
|
+
( __param(2, IModelService))
|
|
1670
|
+
], DocumentDiffItemViewModel));
|
|
1537
1671
|
|
|
1538
1672
|
registerColor('multiDiffEditor.headerBackground', { dark: '#808080', light: '#b4b4b4', hcDark: '#808080', hcLight: '#b4b4b4', }, ( localizeWithPath(
|
|
1539
1673
|
'vs/editor/browser/widget/multiDiffEditorWidget/colors',
|
|
1540
1674
|
'multiDiffEditor.headerBackground',
|
|
1541
1675
|
'The background color of the diff editor\'s header'
|
|
1542
1676
|
)));
|
|
1677
|
+
registerColor('multiDiffEditor.background', { dark: '#000000', light: '#e5e5e5', hcDark: '#000000', hcLight: '#e5e5e5', }, ( localizeWithPath(
|
|
1678
|
+
'vs/editor/browser/widget/multiDiffEditorWidget/colors',
|
|
1679
|
+
'multiDiffEditor.background',
|
|
1680
|
+
'The background color of the multi file diff editor'
|
|
1681
|
+
)));
|
|
1682
|
+
registerColor('multiDiffEditor.border', { dark: 'sideBarSectionHeader.border', light: '#cccccc', hcDark: 'sideBarSectionHeader.border', hcLight: '#cccccc', }, ( localizeWithPath(
|
|
1683
|
+
'vs/editor/browser/widget/multiDiffEditorWidget/colors',
|
|
1684
|
+
'multiDiffEditor.border',
|
|
1685
|
+
'The border color of the multi file diff editor'
|
|
1686
|
+
)));
|
|
1543
1687
|
|
|
1544
1688
|
let MultiDiffEditorWidget = class MultiDiffEditorWidget extends Disposable {
|
|
1545
1689
|
constructor(_element, _workbenchUIElementFactory, _instantiationService) {
|
|
@@ -1555,13 +1699,6 @@ let MultiDiffEditorWidget = class MultiDiffEditorWidget extends Disposable {
|
|
|
1555
1699
|
});
|
|
1556
1700
|
this._activeControl = derived(this, (reader) => this._widgetImpl.read(reader).activeControl.read(reader));
|
|
1557
1701
|
this.onDidChangeActiveControl = Event.fromObservableLight(this._activeControl);
|
|
1558
|
-
this._scrollState = derived(this, (reader) => {
|
|
1559
|
-
const w = this._widgetImpl.read(reader);
|
|
1560
|
-
const top = w.scrollTop.read(reader);
|
|
1561
|
-
const left = w.scrollLeft.read(reader);
|
|
1562
|
-
return { top, left };
|
|
1563
|
-
});
|
|
1564
|
-
this.onDidChangeScrollState = Event.fromObservableLight(this._scrollState);
|
|
1565
1702
|
this._register(recomputeInitiallyAndOnChange(this._widgetImpl));
|
|
1566
1703
|
}
|
|
1567
1704
|
createViewModel(model) {
|
|
@@ -1576,12 +1713,14 @@ let MultiDiffEditorWidget = class MultiDiffEditorWidget extends Disposable {
|
|
|
1576
1713
|
getActiveControl() {
|
|
1577
1714
|
return this._activeControl.get();
|
|
1578
1715
|
}
|
|
1579
|
-
|
|
1580
|
-
return this.
|
|
1716
|
+
getViewState() {
|
|
1717
|
+
return this._widgetImpl.get().getViewState();
|
|
1581
1718
|
}
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1719
|
+
setViewState(viewState) {
|
|
1720
|
+
this._widgetImpl.get().setViewState(viewState);
|
|
1721
|
+
}
|
|
1722
|
+
tryGetCodeEditor(resource) {
|
|
1723
|
+
return this._widgetImpl.get().tryGetCodeEditor(resource);
|
|
1585
1724
|
}
|
|
1586
1725
|
};
|
|
1587
1726
|
MultiDiffEditorWidget = ( __decorate([
|
|
@@ -1884,7 +2023,7 @@ function createMonacoEditorAPI() {
|
|
|
1884
2023
|
WrappingIndent: WrappingIndent,
|
|
1885
2024
|
InjectedTextCursorStops: InjectedTextCursorStops,
|
|
1886
2025
|
PositionAffinity: PositionAffinity,
|
|
1887
|
-
|
|
2026
|
+
ShowLightbulbIconMode: ShowLightbulbIconMode,
|
|
1888
2027
|
ConfigurationChangedEvent: ConfigurationChangedEvent,
|
|
1889
2028
|
BareFontInfo: BareFontInfo,
|
|
1890
2029
|
FontInfo: FontInfo,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-editor-api",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0-update-vscode-1.86.1",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -18,6 +18,6 @@
|
|
|
18
18
|
"module": "esm/vs/editor/editor.api.js",
|
|
19
19
|
"types": "esm/vs/editor/editor.api.d.ts",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"vscode": "npm:@codingame/monaco-vscode-api@2.0
|
|
21
|
+
"vscode": "npm:@codingame/monaco-vscode-api@2.1.0-update-vscode-1.86.1"
|
|
22
22
|
}
|
|
23
23
|
}
|