@codingame/monaco-vscode-views-service-override 2.1.4 → 2.2.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +11 -9
- package/index.js +8 -6
- package/package.json +11 -11
- package/tools/views.d.ts +102 -0
- package/tools/views.js +253 -0
- package/views.d.ts +4 -99
- package/views.js +52 -280
- package/external/rollup-plugin-styles/dist/runtime/inject-css.js +0 -3
- package/vscode/src/vs/base/browser/ui/centered/centeredViewLayout.js +0 -180
- package/vscode/src/vs/base/browser/ui/grid/grid.js +0 -494
- package/vscode/src/vs/base/browser/ui/grid/gridview.css.js +0 -6
- package/vscode/src/vs/base/browser/ui/grid/gridview.js +0 -1112
- package/vscode/src/vs/base/common/codicons.d.ts +0 -579
- package/vscode/src/vs/platform/webview/common/mimeTypes.js +0 -24
- package/vscode/src/vs/platform/webview/common/webviewPortMapping.js +0 -64
- package/vscode/src/vs/workbench/api/browser/viewsExtensionPoint.js +0 -790
- package/vscode/src/vs/workbench/browser/actions/listCommands.js +0 -764
- package/vscode/src/vs/workbench/browser/layout.d.ts +0 -26
- package/vscode/src/vs/workbench/browser/parts/activitybar/activitybarPart.js +0 -612
- package/vscode/src/vs/workbench/browser/parts/activitybar/media/activityaction.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/auxiliarybar/auxiliaryBarPart.js +0 -150
- package/vscode/src/vs/workbench/browser/parts/auxiliarybar/media/auxiliaryBarPart.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/compositeBar.js +0 -605
- package/vscode/src/vs/workbench/browser/parts/compositePart.js +0 -335
- package/vscode/src/vs/workbench/browser/parts/editor/auxiliaryEditorPart.js +0 -223
- package/vscode/src/vs/workbench/browser/parts/editor/editor.contribution.js +0 -1407
- package/vscode/src/vs/workbench/browser/parts/editor/editorConfiguration.js +0 -186
- package/vscode/src/vs/workbench/browser/parts/editor/editorDropTarget.js +0 -511
- package/vscode/src/vs/workbench/browser/parts/editor/editorPane.d.ts +0 -112
- package/vscode/src/vs/workbench/browser/parts/editor/editorPart.js +0 -1020
- package/vscode/src/vs/workbench/browser/parts/editor/editorParts.js +0 -391
- package/vscode/src/vs/workbench/browser/parts/editor/media/editordroptarget.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/media/compositepart.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/media/paneCompositePart.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/paneCompositeBar.js +0 -645
- package/vscode/src/vs/workbench/browser/parts/paneCompositePart.js +0 -379
- package/vscode/src/vs/workbench/browser/parts/paneCompositePartService.js +0 -68
- package/vscode/src/vs/workbench/browser/parts/panel/panelPart.js +0 -146
- package/vscode/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/sidebar/sidebarPart.js +0 -222
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.js +0 -299
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.js +0 -365
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyTree.js +0 -135
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/media/callHierarchy.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditor.contribution.js +0 -17
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditorInputFactory.js +0 -145
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditors.js +0 -214
- package/vscode/src/vs/workbench/contrib/customEditor/browser/media/customEditor.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/customEditor/common/contributedCustomEditors.js +0 -78
- package/vscode/src/vs/workbench/contrib/customEditor/common/customEditorModelManager.js +0 -63
- package/vscode/src/vs/workbench/contrib/customEditor/common/extensionPoint.js +0 -119
- package/vscode/src/vs/workbench/contrib/externalUriOpener/common/externalUriOpener.contribution.js +0 -6
- package/vscode/src/vs/workbench/contrib/files/browser/editors/binaryFileEditor.js +0 -79
- package/vscode/src/vs/workbench/contrib/files/browser/editors/fileEditorHandler.js +0 -74
- package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditor.js +0 -256
- package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditorTracker.js +0 -99
- package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.js +0 -444
- package/vscode/src/vs/workbench/contrib/files/browser/explorerService.js +0 -432
- package/vscode/src/vs/workbench/contrib/files/browser/fileActions.contribution.js +0 -786
- package/vscode/src/vs/workbench/contrib/files/browser/fileCommands.js +0 -488
- package/vscode/src/vs/workbench/contrib/files/browser/files.contribution.js +0 -522
- package/vscode/src/vs/workbench/contrib/files/browser/workspaceWatcher.js +0 -152
- package/vscode/src/vs/workbench/contrib/files/common/dirtyFilesIndicator.js +0 -63
- package/vscode/src/vs/workbench/contrib/languageStatus/browser/languageStatus.contribution.js +0 -409
- package/vscode/src/vs/workbench/contrib/languageStatus/browser/media/languageStatus.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/commands.js +0 -693
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/devCommands.js +0 -240
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditor.contribution.js +0 -77
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorSerializer.js +0 -42
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/colors.js +0 -71
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/conflictActions.js +0 -348
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editorGutter.js +0 -98
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/baseCodeEditorView.js +0 -146
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/codeEditorView.js +0 -105
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/inputCodeEditorView.js +0 -401
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/resultCodeEditorView.js +0 -197
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/fixedZoneWidget.js +0 -41
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/lineAlignment.js +0 -128
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/media/mergeEditor.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/mergeEditor.js +0 -612
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/scrollSynchronizer.js +0 -158
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewModel.js +0 -264
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewZones.js +0 -173
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/media/typeHierarchy.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchy.contribution.js +0 -282
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek.js +0 -360
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyTree.js +0 -133
- package/vscode/src/vs/workbench/contrib/webview/browser/overlayWebview.js +0 -290
- package/vscode/src/vs/workbench/contrib/webview/browser/resourceLoading.js +0 -96
- package/vscode/src/vs/workbench/contrib/webview/browser/themeing.js +0 -88
- package/vscode/src/vs/workbench/contrib/webview/browser/webview.contribution.js +0 -79
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewElement.js +0 -648
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewFindWidget.js +0 -65
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewService.js +0 -59
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewCommands.js +0 -142
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewEditorInputSerializer.js +0 -121
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewPanel.contribution.js +0 -68
- package/vscode/src/vs/workbench/contrib/webviewView/browser/webviewViewPane.js +0 -235
- package/vscode/src/vs/workbench/services/activity/browser/activityService.js +0 -145
- package/vscode/src/vs/workbench/services/editor/browser/editorResolverService.js +0 -670
- package/vscode/src/vs/workbench/services/history/browser/historyService.js +0 -1484
- package/vscode/src/vs/workbench/services/progress/browser/media/progressService.css.js +0 -6
- package/vscode/src/vs/workbench/services/progress/browser/progressService.js +0 -523
- package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorHandler.js +0 -101
- package/vscode/src/vs/workbench/services/views/browser/viewDescriptorService.js +0 -713
- package/vscode/src/vs/workbench/services/views/common/viewContainerModel.js +0 -598
|
@@ -1,713 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { VIEWS_LOG_ID, VIEWS_LOG_NAME, Extensions, ViewVisibilityState, defaultViewIcon, ViewContainerLocationToString } from 'vscode/vscode/vs/workbench/common/views';
|
|
3
|
-
import { ContextKeyExpr, RawContextKey, IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
4
|
-
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
5
|
-
import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
|
|
6
|
-
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
7
|
-
import { Disposable, DisposableMap, DisposableStore, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
8
|
-
import { ViewPaneContainer, ViewPaneContainerAction, ViewsSubMenu } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPaneContainer';
|
|
9
|
-
import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
|
|
10
|
-
import { Emitter, Event } from 'vscode/vscode/vs/base/common/event';
|
|
11
|
-
import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
|
|
12
|
-
import { generateUuid } from 'vscode/vscode/vs/base/common/uuid';
|
|
13
|
-
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
14
|
-
import { getViewsStateStorageId, ViewContainerModel } from '../common/viewContainerModel.js';
|
|
15
|
-
import { registerAction2, MenuId, Action2 } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
16
|
-
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
17
|
-
import { ILoggerService } from 'vscode/vscode/vs/platform/log/common/log';
|
|
18
|
-
|
|
19
|
-
var ViewDescriptorService_1;
|
|
20
|
-
function getViewContainerStorageId(viewContainerId) { return `${viewContainerId}.state`; }
|
|
21
|
-
let ViewDescriptorService = class ViewDescriptorService extends Disposable {
|
|
22
|
-
static { ViewDescriptorService_1 = this; }
|
|
23
|
-
static { this.VIEWS_CUSTOMIZATIONS = 'views.customizations'; }
|
|
24
|
-
static { this.COMMON_CONTAINER_ID_PREFIX = 'workbench.views.service'; }
|
|
25
|
-
get viewContainers() { return this.viewContainersRegistry.all; }
|
|
26
|
-
constructor(instantiationService, contextKeyService, storageService, extensionService, telemetryService, loggerService) {
|
|
27
|
-
super();
|
|
28
|
-
this.instantiationService = instantiationService;
|
|
29
|
-
this.contextKeyService = contextKeyService;
|
|
30
|
-
this.storageService = storageService;
|
|
31
|
-
this.extensionService = extensionService;
|
|
32
|
-
this.telemetryService = telemetryService;
|
|
33
|
-
this._onDidChangeContainer = this._register(( new Emitter()));
|
|
34
|
-
this.onDidChangeContainer = this._onDidChangeContainer.event;
|
|
35
|
-
this._onDidChangeLocation = this._register(( new Emitter()));
|
|
36
|
-
this.onDidChangeLocation = this._onDidChangeLocation.event;
|
|
37
|
-
this._onDidChangeContainerLocation = this._register(( new Emitter()));
|
|
38
|
-
this.onDidChangeContainerLocation = this._onDidChangeContainerLocation.event;
|
|
39
|
-
this.viewContainerModels = this._register(( new DisposableMap()));
|
|
40
|
-
this.viewsVisibilityActionDisposables = this._register(( new DisposableMap()));
|
|
41
|
-
this.canRegisterViewsVisibilityActions = false;
|
|
42
|
-
this._onDidChangeViewContainers = this._register(( new Emitter()));
|
|
43
|
-
this.onDidChangeViewContainers = this._onDidChangeViewContainers.event;
|
|
44
|
-
this.logger = loggerService.createLogger(VIEWS_LOG_ID, { name: VIEWS_LOG_NAME, hidden: true });
|
|
45
|
-
this.activeViewContextKeys = ( new Map());
|
|
46
|
-
this.movableViewContextKeys = ( new Map());
|
|
47
|
-
this.defaultViewLocationContextKeys = ( new Map());
|
|
48
|
-
this.defaultViewContainerLocationContextKeys = ( new Map());
|
|
49
|
-
this.viewContainersRegistry = ( Registry.as(Extensions.ViewContainersRegistry));
|
|
50
|
-
this.viewsRegistry = ( Registry.as(Extensions.ViewsRegistry));
|
|
51
|
-
this.migrateToViewsCustomizationsStorage();
|
|
52
|
-
this.viewContainersCustomLocations = ( new Map(Object.entries(this.viewCustomizations.viewContainerLocations)));
|
|
53
|
-
this.viewDescriptorsCustomLocations = ( new Map(Object.entries(this.viewCustomizations.viewLocations)));
|
|
54
|
-
this.viewContainerBadgeEnablementStates = ( new Map(Object.entries(this.viewCustomizations.viewContainerBadgeEnablementStates)));
|
|
55
|
-
this.viewContainers.forEach(viewContainer => this.onDidRegisterViewContainer(viewContainer));
|
|
56
|
-
this._register(this.viewsRegistry.onViewsRegistered(views => this.onDidRegisterViews(views)));
|
|
57
|
-
this._register(this.viewsRegistry.onViewsDeregistered(({ views, viewContainer }) => this.onDidDeregisterViews(views, viewContainer)));
|
|
58
|
-
this._register(this.viewsRegistry.onDidChangeContainer(({ views, from, to }) => this.onDidChangeDefaultContainer(views, from, to)));
|
|
59
|
-
this._register(this.viewContainersRegistry.onDidRegister(({ viewContainer }) => {
|
|
60
|
-
this.onDidRegisterViewContainer(viewContainer);
|
|
61
|
-
this._onDidChangeViewContainers.fire({ added: [{ container: viewContainer, location: this.getViewContainerLocation(viewContainer) }], removed: [] });
|
|
62
|
-
}));
|
|
63
|
-
this._register(this.viewContainersRegistry.onDidDeregister(({ viewContainer, viewContainerLocation }) => {
|
|
64
|
-
this.onDidDeregisterViewContainer(viewContainer);
|
|
65
|
-
this._onDidChangeViewContainers.fire({ removed: [{ container: viewContainer, location: viewContainerLocation }], added: [] });
|
|
66
|
-
}));
|
|
67
|
-
this._register(this.storageService.onDidChangeValue(0 , ViewDescriptorService_1.VIEWS_CUSTOMIZATIONS, this._register(( new DisposableStore())))(() => this.onDidStorageChange()));
|
|
68
|
-
this.extensionService.whenInstalledExtensionsRegistered().then(() => this.whenExtensionsRegistered());
|
|
69
|
-
}
|
|
70
|
-
migrateToViewsCustomizationsStorage() {
|
|
71
|
-
if (this.storageService.get(ViewDescriptorService_1.VIEWS_CUSTOMIZATIONS, 0 )) {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
const viewContainerLocationsValue = this.storageService.get('views.cachedViewContainerLocations', 0 );
|
|
75
|
-
const viewDescriptorLocationsValue = this.storageService.get('views.cachedViewPositions', 0 );
|
|
76
|
-
if (!viewContainerLocationsValue && !viewDescriptorLocationsValue) {
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
const viewContainerLocations = viewContainerLocationsValue ? JSON.parse(viewContainerLocationsValue) : [];
|
|
80
|
-
const viewDescriptorLocations = viewDescriptorLocationsValue ? JSON.parse(viewDescriptorLocationsValue) : [];
|
|
81
|
-
const viewsCustomizations = {
|
|
82
|
-
viewContainerLocations: viewContainerLocations.reduce((result, [id, location]) => { result[id] = location; return result; }, {}),
|
|
83
|
-
viewLocations: viewDescriptorLocations.reduce((result, [id, { containerId }]) => { result[id] = containerId; return result; }, {}),
|
|
84
|
-
viewContainerBadgeEnablementStates: {}
|
|
85
|
-
};
|
|
86
|
-
this.storageService.store(ViewDescriptorService_1.VIEWS_CUSTOMIZATIONS, JSON.stringify(viewsCustomizations), 0 , 0 );
|
|
87
|
-
this.storageService.remove('views.cachedViewContainerLocations', 0 );
|
|
88
|
-
this.storageService.remove('views.cachedViewPositions', 0 );
|
|
89
|
-
}
|
|
90
|
-
registerGroupedViews(groupedViews) {
|
|
91
|
-
for (const [containerId, views] of groupedViews.entries()) {
|
|
92
|
-
const viewContainer = this.viewContainersRegistry.get(containerId);
|
|
93
|
-
if (!viewContainer || !( this.viewContainerModels.has(viewContainer))) {
|
|
94
|
-
if (this.isGeneratedContainerId(containerId)) {
|
|
95
|
-
const viewContainerLocation = this.viewContainersCustomLocations.get(containerId);
|
|
96
|
-
if (viewContainerLocation !== undefined) {
|
|
97
|
-
this.registerGeneratedViewContainer(viewContainerLocation, containerId);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
continue;
|
|
101
|
-
}
|
|
102
|
-
const viewsToAdd = views.filter(view => this.getViewContainerModel(viewContainer).allViewDescriptors.filter(vd => vd.id === view.id).length === 0);
|
|
103
|
-
this.addViews(viewContainer, viewsToAdd);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
deregisterGroupedViews(groupedViews) {
|
|
107
|
-
for (const [viewContainerId, views] of groupedViews.entries()) {
|
|
108
|
-
const viewContainer = this.viewContainersRegistry.get(viewContainerId);
|
|
109
|
-
if (!viewContainer || !( this.viewContainerModels.has(viewContainer))) {
|
|
110
|
-
continue;
|
|
111
|
-
}
|
|
112
|
-
this.removeViews(viewContainer, views);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
moveOrphanViewsToDefaultLocation() {
|
|
116
|
-
for (const [viewId, containerId] of this.viewDescriptorsCustomLocations.entries()) {
|
|
117
|
-
if (this.viewContainersRegistry.get(containerId)) {
|
|
118
|
-
continue;
|
|
119
|
-
}
|
|
120
|
-
const viewContainer = this.viewsRegistry.getViewContainer(viewId);
|
|
121
|
-
const viewDescriptor = this.getViewDescriptorById(viewId);
|
|
122
|
-
if (viewContainer && viewDescriptor) {
|
|
123
|
-
this.addViews(viewContainer, [viewDescriptor]);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
whenExtensionsRegistered() {
|
|
128
|
-
this.moveOrphanViewsToDefaultLocation();
|
|
129
|
-
for (const viewContainerId of [...( this.viewContainersCustomLocations.keys())]) {
|
|
130
|
-
this.cleanUpGeneratedViewContainer(viewContainerId);
|
|
131
|
-
}
|
|
132
|
-
this.saveViewCustomizations();
|
|
133
|
-
for (const [key, value] of this.viewContainerModels) {
|
|
134
|
-
this.registerViewsVisibilityActions(key, value);
|
|
135
|
-
}
|
|
136
|
-
this.canRegisterViewsVisibilityActions = true;
|
|
137
|
-
}
|
|
138
|
-
onDidRegisterViews(views) {
|
|
139
|
-
this.contextKeyService.bufferChangeEvents(() => {
|
|
140
|
-
views.forEach(({ views, viewContainer }) => {
|
|
141
|
-
const regroupedViews = this.regroupViews(viewContainer.id, views);
|
|
142
|
-
this.registerGroupedViews(regroupedViews);
|
|
143
|
-
views.forEach(viewDescriptor => this.getOrCreateMovableViewContextKey(viewDescriptor).set(!!viewDescriptor.canMoveView));
|
|
144
|
-
});
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
isGeneratedContainerId(id) {
|
|
148
|
-
return id.startsWith(ViewDescriptorService_1.COMMON_CONTAINER_ID_PREFIX);
|
|
149
|
-
}
|
|
150
|
-
onDidDeregisterViews(views, viewContainer) {
|
|
151
|
-
const regroupedViews = this.regroupViews(viewContainer.id, views);
|
|
152
|
-
this.deregisterGroupedViews(regroupedViews);
|
|
153
|
-
this.contextKeyService.bufferChangeEvents(() => {
|
|
154
|
-
views.forEach(viewDescriptor => this.getOrCreateMovableViewContextKey(viewDescriptor).set(false));
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
regroupViews(containerId, views) {
|
|
158
|
-
const viewsByContainer = ( new Map());
|
|
159
|
-
for (const viewDescriptor of views) {
|
|
160
|
-
const correctContainerId = this.viewDescriptorsCustomLocations.get(viewDescriptor.id) ?? containerId;
|
|
161
|
-
let containerViews = viewsByContainer.get(correctContainerId);
|
|
162
|
-
if (!containerViews) {
|
|
163
|
-
viewsByContainer.set(correctContainerId, containerViews = []);
|
|
164
|
-
}
|
|
165
|
-
containerViews.push(viewDescriptor);
|
|
166
|
-
}
|
|
167
|
-
return viewsByContainer;
|
|
168
|
-
}
|
|
169
|
-
getViewDescriptorById(viewId) {
|
|
170
|
-
return this.viewsRegistry.getView(viewId);
|
|
171
|
-
}
|
|
172
|
-
getViewLocationById(viewId) {
|
|
173
|
-
const container = this.getViewContainerByViewId(viewId);
|
|
174
|
-
if (container === null) {
|
|
175
|
-
return null;
|
|
176
|
-
}
|
|
177
|
-
return this.getViewContainerLocation(container);
|
|
178
|
-
}
|
|
179
|
-
getViewContainerByViewId(viewId) {
|
|
180
|
-
const containerId = this.viewDescriptorsCustomLocations.get(viewId);
|
|
181
|
-
return containerId ?
|
|
182
|
-
this.viewContainersRegistry.get(containerId) ?? null :
|
|
183
|
-
this.getDefaultContainerById(viewId);
|
|
184
|
-
}
|
|
185
|
-
getViewContainerLocation(viewContainer) {
|
|
186
|
-
return this.viewContainersCustomLocations.get(viewContainer.id) ?? this.getDefaultViewContainerLocation(viewContainer);
|
|
187
|
-
}
|
|
188
|
-
getDefaultViewContainerLocation(viewContainer) {
|
|
189
|
-
return this.viewContainersRegistry.getViewContainerLocation(viewContainer);
|
|
190
|
-
}
|
|
191
|
-
getDefaultContainerById(viewId) {
|
|
192
|
-
return this.viewsRegistry.getViewContainer(viewId) ?? null;
|
|
193
|
-
}
|
|
194
|
-
getViewContainerModel(container) {
|
|
195
|
-
return this.getOrRegisterViewContainerModel(container);
|
|
196
|
-
}
|
|
197
|
-
getViewContainerById(id) {
|
|
198
|
-
return this.viewContainersRegistry.get(id) || null;
|
|
199
|
-
}
|
|
200
|
-
getViewContainersByLocation(location) {
|
|
201
|
-
return this.viewContainers.filter(v => this.getViewContainerLocation(v) === location);
|
|
202
|
-
}
|
|
203
|
-
getDefaultViewContainer(location) {
|
|
204
|
-
return this.viewContainersRegistry.getDefaultViewContainer(location);
|
|
205
|
-
}
|
|
206
|
-
moveViewContainerToLocation(viewContainer, location, requestedIndex, reason) {
|
|
207
|
-
this.logger.info(`moveViewContainerToLocation: viewContainer:${viewContainer.id} location:${location} reason:${reason}`);
|
|
208
|
-
this.moveViewContainerToLocationWithoutSaving(viewContainer, location, requestedIndex);
|
|
209
|
-
this.saveViewCustomizations();
|
|
210
|
-
}
|
|
211
|
-
getViewContainerBadgeEnablementState(id) {
|
|
212
|
-
return this.viewContainerBadgeEnablementStates.get(id) ?? true;
|
|
213
|
-
}
|
|
214
|
-
setViewContainerBadgeEnablementState(id, badgesEnabled) {
|
|
215
|
-
this.viewContainerBadgeEnablementStates.set(id, badgesEnabled);
|
|
216
|
-
this.saveViewCustomizations();
|
|
217
|
-
}
|
|
218
|
-
moveViewToLocation(view, location, reason) {
|
|
219
|
-
this.logger.info(`moveViewToLocation: view:${view.id} location:${location} reason:${reason}`);
|
|
220
|
-
const container = this.registerGeneratedViewContainer(location);
|
|
221
|
-
this.moveViewsToContainer([view], container);
|
|
222
|
-
}
|
|
223
|
-
moveViewsToContainer(views, viewContainer, visibilityState, reason) {
|
|
224
|
-
if (!views.length) {
|
|
225
|
-
return;
|
|
226
|
-
}
|
|
227
|
-
this.logger.info(`moveViewsToContainer: views:${( views.map(view => view.id)).join(',')} viewContainer:${viewContainer.id} reason:${reason}`);
|
|
228
|
-
const from = this.getViewContainerByViewId(views[0].id);
|
|
229
|
-
const to = viewContainer;
|
|
230
|
-
if (from && to && from !== to) {
|
|
231
|
-
this.moveViewsWithoutSaving(views, from, to, visibilityState);
|
|
232
|
-
this.cleanUpGeneratedViewContainer(from.id);
|
|
233
|
-
this.saveViewCustomizations();
|
|
234
|
-
this.reportMovedViews(views, from, to);
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
reset() {
|
|
238
|
-
for (const viewContainer of this.viewContainers) {
|
|
239
|
-
const viewContainerModel = this.getViewContainerModel(viewContainer);
|
|
240
|
-
for (const viewDescriptor of viewContainerModel.allViewDescriptors) {
|
|
241
|
-
const defaultContainer = this.getDefaultContainerById(viewDescriptor.id);
|
|
242
|
-
const currentContainer = this.getViewContainerByViewId(viewDescriptor.id);
|
|
243
|
-
if (currentContainer && defaultContainer && currentContainer !== defaultContainer) {
|
|
244
|
-
this.moveViewsWithoutSaving([viewDescriptor], currentContainer, defaultContainer);
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
const defaultContainerLocation = this.getDefaultViewContainerLocation(viewContainer);
|
|
248
|
-
const currentContainerLocation = this.getViewContainerLocation(viewContainer);
|
|
249
|
-
if (defaultContainerLocation !== null && currentContainerLocation !== defaultContainerLocation) {
|
|
250
|
-
this.moveViewContainerToLocationWithoutSaving(viewContainer, defaultContainerLocation);
|
|
251
|
-
}
|
|
252
|
-
this.cleanUpGeneratedViewContainer(viewContainer.id);
|
|
253
|
-
}
|
|
254
|
-
this.viewContainersCustomLocations.clear();
|
|
255
|
-
this.viewDescriptorsCustomLocations.clear();
|
|
256
|
-
this.saveViewCustomizations();
|
|
257
|
-
}
|
|
258
|
-
isViewContainerRemovedPermanently(viewContainerId) {
|
|
259
|
-
return this.isGeneratedContainerId(viewContainerId) && !( this.viewContainersCustomLocations.has(viewContainerId));
|
|
260
|
-
}
|
|
261
|
-
onDidChangeDefaultContainer(views, from, to) {
|
|
262
|
-
const viewsToMove = views.filter(view => !( this.viewDescriptorsCustomLocations.has(view.id))
|
|
263
|
-
|| (!this.viewContainers.includes(from) && this.viewDescriptorsCustomLocations.get(view.id) === from.id)
|
|
264
|
-
);
|
|
265
|
-
if (viewsToMove.length) {
|
|
266
|
-
this.moveViewsWithoutSaving(viewsToMove, from, to);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
reportMovedViews(views, from, to) {
|
|
270
|
-
const containerToString = (container) => {
|
|
271
|
-
if (container.id.startsWith(ViewDescriptorService_1.COMMON_CONTAINER_ID_PREFIX)) {
|
|
272
|
-
return 'custom';
|
|
273
|
-
}
|
|
274
|
-
if (!container.extensionId) {
|
|
275
|
-
return container.id;
|
|
276
|
-
}
|
|
277
|
-
return 'extension';
|
|
278
|
-
};
|
|
279
|
-
const oldLocation = this.getViewContainerLocation(from);
|
|
280
|
-
const newLocation = this.getViewContainerLocation(to);
|
|
281
|
-
const viewCount = views.length;
|
|
282
|
-
const fromContainer = containerToString(from);
|
|
283
|
-
const toContainer = containerToString(to);
|
|
284
|
-
const fromLocation = oldLocation === 1 ? 'panel' : 'sidebar';
|
|
285
|
-
const toLocation = newLocation === 1 ? 'panel' : 'sidebar';
|
|
286
|
-
this.telemetryService.publicLog2('viewDescriptorService.moveViews', { viewCount, fromContainer, toContainer, fromLocation, toLocation });
|
|
287
|
-
}
|
|
288
|
-
moveViewsWithoutSaving(views, from, to, visibilityState = ViewVisibilityState.Expand) {
|
|
289
|
-
this.removeViews(from, views);
|
|
290
|
-
this.addViews(to, views, visibilityState);
|
|
291
|
-
const oldLocation = this.getViewContainerLocation(from);
|
|
292
|
-
const newLocation = this.getViewContainerLocation(to);
|
|
293
|
-
if (oldLocation !== newLocation) {
|
|
294
|
-
this._onDidChangeLocation.fire({ views, from: oldLocation, to: newLocation });
|
|
295
|
-
}
|
|
296
|
-
this._onDidChangeContainer.fire({ views, from, to });
|
|
297
|
-
}
|
|
298
|
-
moveViewContainerToLocationWithoutSaving(viewContainer, location, requestedIndex) {
|
|
299
|
-
const from = this.getViewContainerLocation(viewContainer);
|
|
300
|
-
const to = location;
|
|
301
|
-
if (from !== to) {
|
|
302
|
-
const isGeneratedViewContainer = this.isGeneratedContainerId(viewContainer.id);
|
|
303
|
-
const isDefaultViewContainerLocation = to === this.getDefaultViewContainerLocation(viewContainer);
|
|
304
|
-
if (isGeneratedViewContainer || !isDefaultViewContainerLocation) {
|
|
305
|
-
this.viewContainersCustomLocations.set(viewContainer.id, to);
|
|
306
|
-
}
|
|
307
|
-
else {
|
|
308
|
-
this.viewContainersCustomLocations.delete(viewContainer.id);
|
|
309
|
-
}
|
|
310
|
-
this.getOrCreateDefaultViewContainerLocationContextKey(viewContainer).set(isGeneratedViewContainer || isDefaultViewContainerLocation);
|
|
311
|
-
viewContainer.requestedIndex = requestedIndex;
|
|
312
|
-
this._onDidChangeContainerLocation.fire({ viewContainer, from, to });
|
|
313
|
-
const views = this.getViewsByContainer(viewContainer);
|
|
314
|
-
this._onDidChangeLocation.fire({ views, from, to });
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
cleanUpGeneratedViewContainer(viewContainerId) {
|
|
318
|
-
if (!this.isGeneratedContainerId(viewContainerId)) {
|
|
319
|
-
return;
|
|
320
|
-
}
|
|
321
|
-
const viewContainer = this.getViewContainerById(viewContainerId);
|
|
322
|
-
if (viewContainer && this.getViewContainerModel(viewContainer)?.allViewDescriptors.length) {
|
|
323
|
-
return;
|
|
324
|
-
}
|
|
325
|
-
if ([...( this.viewDescriptorsCustomLocations.values())].includes(viewContainerId)) {
|
|
326
|
-
return;
|
|
327
|
-
}
|
|
328
|
-
if (viewContainer) {
|
|
329
|
-
this.viewContainersRegistry.deregisterViewContainer(viewContainer);
|
|
330
|
-
}
|
|
331
|
-
this.viewContainersCustomLocations.delete(viewContainerId);
|
|
332
|
-
this.viewContainerBadgeEnablementStates.delete(viewContainerId);
|
|
333
|
-
this.storageService.remove(getViewsStateStorageId(viewContainer?.storageId || getViewContainerStorageId(viewContainerId)), 0 );
|
|
334
|
-
}
|
|
335
|
-
registerGeneratedViewContainer(location, existingId) {
|
|
336
|
-
const id = existingId || this.generateContainerId(location);
|
|
337
|
-
const container = this.viewContainersRegistry.registerViewContainer({
|
|
338
|
-
id,
|
|
339
|
-
ctorDescriptor: ( new SyncDescriptor(ViewPaneContainer, [id, { mergeViewWithContainerWhenSingleView: true }])),
|
|
340
|
-
title: { value: id, original: id },
|
|
341
|
-
icon: location === 0 ? defaultViewIcon : undefined,
|
|
342
|
-
storageId: getViewContainerStorageId(id),
|
|
343
|
-
hideIfEmpty: true
|
|
344
|
-
}, location, { doNotRegisterOpenCommand: true });
|
|
345
|
-
if (this.viewContainersCustomLocations.get(container.id) !== location) {
|
|
346
|
-
this.viewContainersCustomLocations.set(container.id, location);
|
|
347
|
-
}
|
|
348
|
-
this.getOrCreateDefaultViewContainerLocationContextKey(container).set(true);
|
|
349
|
-
return container;
|
|
350
|
-
}
|
|
351
|
-
onDidStorageChange() {
|
|
352
|
-
if (JSON.stringify(this.viewCustomizations) !== this.getStoredViewCustomizationsValue() ) {
|
|
353
|
-
this.onDidViewCustomizationsStorageChange();
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
onDidViewCustomizationsStorageChange() {
|
|
357
|
-
this._viewCustomizations = undefined;
|
|
358
|
-
const newViewContainerCustomizations = ( new Map(Object.entries(this.viewCustomizations.viewContainerLocations)));
|
|
359
|
-
const newViewDescriptorCustomizations = ( new Map(Object.entries(this.viewCustomizations.viewLocations)));
|
|
360
|
-
const viewContainersToMove = [];
|
|
361
|
-
const viewsToMove = [];
|
|
362
|
-
for (const [containerId, location] of newViewContainerCustomizations.entries()) {
|
|
363
|
-
const container = this.getViewContainerById(containerId);
|
|
364
|
-
if (container) {
|
|
365
|
-
if (location !== this.getViewContainerLocation(container)) {
|
|
366
|
-
viewContainersToMove.push([container, location]);
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
else if (this.isGeneratedContainerId(containerId)) {
|
|
370
|
-
this.registerGeneratedViewContainer(location, containerId);
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
for (const viewContainer of this.viewContainers) {
|
|
374
|
-
if (!( newViewContainerCustomizations.has(viewContainer.id))) {
|
|
375
|
-
const currentLocation = this.getViewContainerLocation(viewContainer);
|
|
376
|
-
const defaultLocation = this.getDefaultViewContainerLocation(viewContainer);
|
|
377
|
-
if (currentLocation !== defaultLocation) {
|
|
378
|
-
viewContainersToMove.push([viewContainer, defaultLocation]);
|
|
379
|
-
}
|
|
380
|
-
}
|
|
381
|
-
}
|
|
382
|
-
for (const [viewId, viewContainerId] of newViewDescriptorCustomizations.entries()) {
|
|
383
|
-
const viewDescriptor = this.getViewDescriptorById(viewId);
|
|
384
|
-
if (viewDescriptor) {
|
|
385
|
-
const prevViewContainer = this.getViewContainerByViewId(viewId);
|
|
386
|
-
const newViewContainer = this.viewContainersRegistry.get(viewContainerId);
|
|
387
|
-
if (prevViewContainer && newViewContainer && newViewContainer !== prevViewContainer) {
|
|
388
|
-
viewsToMove.push({ views: [viewDescriptor], from: prevViewContainer, to: newViewContainer });
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
for (const viewContainer of this.viewContainers) {
|
|
393
|
-
const viewContainerModel = this.getViewContainerModel(viewContainer);
|
|
394
|
-
for (const viewDescriptor of viewContainerModel.allViewDescriptors) {
|
|
395
|
-
if (!( newViewDescriptorCustomizations.has(viewDescriptor.id))) {
|
|
396
|
-
const currentContainer = this.getViewContainerByViewId(viewDescriptor.id);
|
|
397
|
-
const defaultContainer = this.getDefaultContainerById(viewDescriptor.id);
|
|
398
|
-
if (currentContainer && defaultContainer && currentContainer !== defaultContainer) {
|
|
399
|
-
viewsToMove.push({ views: [viewDescriptor], from: currentContainer, to: defaultContainer });
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
for (const [container, location] of viewContainersToMove) {
|
|
405
|
-
this.moveViewContainerToLocationWithoutSaving(container, location);
|
|
406
|
-
}
|
|
407
|
-
for (const { views, from, to } of viewsToMove) {
|
|
408
|
-
this.moveViewsWithoutSaving(views, from, to, ViewVisibilityState.Default);
|
|
409
|
-
}
|
|
410
|
-
this.viewContainersCustomLocations = newViewContainerCustomizations;
|
|
411
|
-
this.viewDescriptorsCustomLocations = newViewDescriptorCustomizations;
|
|
412
|
-
}
|
|
413
|
-
generateContainerId(location) {
|
|
414
|
-
return `${ViewDescriptorService_1.COMMON_CONTAINER_ID_PREFIX}.${ViewContainerLocationToString(location)}.${generateUuid()}`;
|
|
415
|
-
}
|
|
416
|
-
saveViewCustomizations() {
|
|
417
|
-
const viewCustomizations = { viewContainerLocations: {}, viewLocations: {}, viewContainerBadgeEnablementStates: {} };
|
|
418
|
-
for (const [containerId, location] of this.viewContainersCustomLocations) {
|
|
419
|
-
const container = this.getViewContainerById(containerId);
|
|
420
|
-
if (container && !this.isGeneratedContainerId(containerId) && location === this.getDefaultViewContainerLocation(container)) {
|
|
421
|
-
continue;
|
|
422
|
-
}
|
|
423
|
-
viewCustomizations.viewContainerLocations[containerId] = location;
|
|
424
|
-
}
|
|
425
|
-
for (const [viewId, viewContainerId] of this.viewDescriptorsCustomLocations) {
|
|
426
|
-
const viewContainer = this.getViewContainerById(viewContainerId);
|
|
427
|
-
if (viewContainer) {
|
|
428
|
-
const defaultContainer = this.getDefaultContainerById(viewId);
|
|
429
|
-
if (defaultContainer?.id === viewContainer.id) {
|
|
430
|
-
continue;
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
viewCustomizations.viewLocations[viewId] = viewContainerId;
|
|
434
|
-
}
|
|
435
|
-
for (const [viewContainerId, badgeEnablementState] of this.viewContainerBadgeEnablementStates) {
|
|
436
|
-
if (badgeEnablementState === false) {
|
|
437
|
-
viewCustomizations.viewContainerBadgeEnablementStates[viewContainerId] = badgeEnablementState;
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
this.viewCustomizations = viewCustomizations;
|
|
441
|
-
}
|
|
442
|
-
get viewCustomizations() {
|
|
443
|
-
if (!this._viewCustomizations) {
|
|
444
|
-
this._viewCustomizations = JSON.parse(this.getStoredViewCustomizationsValue());
|
|
445
|
-
this._viewCustomizations.viewContainerLocations = this._viewCustomizations.viewContainerLocations ?? {};
|
|
446
|
-
this._viewCustomizations.viewLocations = this._viewCustomizations.viewLocations ?? {};
|
|
447
|
-
this._viewCustomizations.viewContainerBadgeEnablementStates = this._viewCustomizations.viewContainerBadgeEnablementStates ?? {};
|
|
448
|
-
}
|
|
449
|
-
return this._viewCustomizations;
|
|
450
|
-
}
|
|
451
|
-
set viewCustomizations(viewCustomizations) {
|
|
452
|
-
const value = JSON.stringify(viewCustomizations);
|
|
453
|
-
if (JSON.stringify(this.viewCustomizations) !== value) {
|
|
454
|
-
this._viewCustomizations = viewCustomizations;
|
|
455
|
-
this.setStoredViewCustomizationsValue(value);
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
getStoredViewCustomizationsValue() {
|
|
459
|
-
return this.storageService.get(ViewDescriptorService_1.VIEWS_CUSTOMIZATIONS, 0 , '{}');
|
|
460
|
-
}
|
|
461
|
-
setStoredViewCustomizationsValue(value) {
|
|
462
|
-
this.storageService.store(ViewDescriptorService_1.VIEWS_CUSTOMIZATIONS, value, 0 , 0 );
|
|
463
|
-
}
|
|
464
|
-
getViewsByContainer(viewContainer) {
|
|
465
|
-
const result = this.viewsRegistry.getViews(viewContainer).filter(viewDescriptor => {
|
|
466
|
-
const viewDescriptorViewContainerId = this.viewDescriptorsCustomLocations.get(viewDescriptor.id) ?? viewContainer.id;
|
|
467
|
-
return viewDescriptorViewContainerId === viewContainer.id;
|
|
468
|
-
});
|
|
469
|
-
for (const [viewId, viewContainerId] of this.viewDescriptorsCustomLocations.entries()) {
|
|
470
|
-
if (viewContainerId !== viewContainer.id) {
|
|
471
|
-
continue;
|
|
472
|
-
}
|
|
473
|
-
if (this.viewsRegistry.getViewContainer(viewId) === viewContainer) {
|
|
474
|
-
continue;
|
|
475
|
-
}
|
|
476
|
-
const viewDescriptor = this.getViewDescriptorById(viewId);
|
|
477
|
-
if (viewDescriptor) {
|
|
478
|
-
result.push(viewDescriptor);
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
return result;
|
|
482
|
-
}
|
|
483
|
-
onDidRegisterViewContainer(viewContainer) {
|
|
484
|
-
const defaultLocation = this.isGeneratedContainerId(viewContainer.id) ? true : this.getViewContainerLocation(viewContainer) === this.getDefaultViewContainerLocation(viewContainer);
|
|
485
|
-
this.getOrCreateDefaultViewContainerLocationContextKey(viewContainer).set(defaultLocation);
|
|
486
|
-
this.getOrRegisterViewContainerModel(viewContainer);
|
|
487
|
-
}
|
|
488
|
-
getOrRegisterViewContainerModel(viewContainer) {
|
|
489
|
-
let viewContainerModel = this.viewContainerModels.get(viewContainer)?.viewContainerModel;
|
|
490
|
-
if (!viewContainerModel) {
|
|
491
|
-
const disposables = ( new DisposableStore());
|
|
492
|
-
viewContainerModel = disposables.add(this.instantiationService.createInstance(ViewContainerModel, viewContainer));
|
|
493
|
-
this.onDidChangeActiveViews({ added: viewContainerModel.activeViewDescriptors, removed: [] });
|
|
494
|
-
viewContainerModel.onDidChangeActiveViewDescriptors(changed => this.onDidChangeActiveViews(changed), this, disposables);
|
|
495
|
-
this.onDidChangeVisibleViews({ added: [...viewContainerModel.visibleViewDescriptors], removed: [] });
|
|
496
|
-
viewContainerModel.onDidAddVisibleViewDescriptors(added => this.onDidChangeVisibleViews({ added: ( added.map(({ viewDescriptor }) => viewDescriptor)), removed: [] }), this, disposables);
|
|
497
|
-
viewContainerModel.onDidRemoveVisibleViewDescriptors(removed => this.onDidChangeVisibleViews({ added: [], removed: ( removed.map(({ viewDescriptor }) => viewDescriptor)) }), this, disposables);
|
|
498
|
-
disposables.add(toDisposable(() => this.viewsVisibilityActionDisposables.deleteAndDispose(viewContainer)));
|
|
499
|
-
disposables.add(this.registerResetViewContainerAction(viewContainer));
|
|
500
|
-
const value = { viewContainerModel: viewContainerModel, disposables, dispose: () => disposables.dispose() };
|
|
501
|
-
this.viewContainerModels.set(viewContainer, value);
|
|
502
|
-
this.onDidRegisterViews([{ views: this.viewsRegistry.getViews(viewContainer), viewContainer }]);
|
|
503
|
-
const viewsToRegister = this.getViewsByContainer(viewContainer).filter(view => this.getDefaultContainerById(view.id) !== viewContainer);
|
|
504
|
-
if (viewsToRegister.length) {
|
|
505
|
-
this.addViews(viewContainer, viewsToRegister);
|
|
506
|
-
this.contextKeyService.bufferChangeEvents(() => {
|
|
507
|
-
viewsToRegister.forEach(viewDescriptor => this.getOrCreateMovableViewContextKey(viewDescriptor).set(!!viewDescriptor.canMoveView));
|
|
508
|
-
});
|
|
509
|
-
}
|
|
510
|
-
if (this.canRegisterViewsVisibilityActions) {
|
|
511
|
-
this.registerViewsVisibilityActions(viewContainer, value);
|
|
512
|
-
}
|
|
513
|
-
}
|
|
514
|
-
return viewContainerModel;
|
|
515
|
-
}
|
|
516
|
-
onDidDeregisterViewContainer(viewContainer) {
|
|
517
|
-
this.viewContainerModels.deleteAndDispose(viewContainer);
|
|
518
|
-
this.viewsVisibilityActionDisposables.deleteAndDispose(viewContainer);
|
|
519
|
-
}
|
|
520
|
-
onDidChangeActiveViews({ added, removed }) {
|
|
521
|
-
this.contextKeyService.bufferChangeEvents(() => {
|
|
522
|
-
added.forEach(viewDescriptor => this.getOrCreateActiveViewContextKey(viewDescriptor).set(true));
|
|
523
|
-
removed.forEach(viewDescriptor => this.getOrCreateActiveViewContextKey(viewDescriptor).set(false));
|
|
524
|
-
});
|
|
525
|
-
}
|
|
526
|
-
onDidChangeVisibleViews({ added, removed }) {
|
|
527
|
-
this.contextKeyService.bufferChangeEvents(() => {
|
|
528
|
-
added.forEach(viewDescriptor => this.getOrCreateVisibleViewContextKey(viewDescriptor).set(true));
|
|
529
|
-
removed.forEach(viewDescriptor => this.getOrCreateVisibleViewContextKey(viewDescriptor).set(false));
|
|
530
|
-
});
|
|
531
|
-
}
|
|
532
|
-
registerViewsVisibilityActions(viewContainer, { viewContainerModel, disposables }) {
|
|
533
|
-
this.viewsVisibilityActionDisposables.deleteAndDispose(viewContainer);
|
|
534
|
-
this.viewsVisibilityActionDisposables.set(viewContainer, this.registerViewsVisibilityActionsForContainer(viewContainerModel));
|
|
535
|
-
disposables.add(Event.any(viewContainerModel.onDidChangeActiveViewDescriptors, viewContainerModel.onDidAddVisibleViewDescriptors, viewContainerModel.onDidRemoveVisibleViewDescriptors, viewContainerModel.onDidMoveVisibleViewDescriptors)(e => {
|
|
536
|
-
this.viewsVisibilityActionDisposables.deleteAndDispose(viewContainer);
|
|
537
|
-
this.viewsVisibilityActionDisposables.set(viewContainer, this.registerViewsVisibilityActionsForContainer(viewContainerModel));
|
|
538
|
-
}));
|
|
539
|
-
}
|
|
540
|
-
registerViewsVisibilityActionsForContainer(viewContainerModel) {
|
|
541
|
-
const disposables = ( new DisposableStore());
|
|
542
|
-
viewContainerModel.activeViewDescriptors.forEach((viewDescriptor, index) => {
|
|
543
|
-
if (!viewDescriptor.remoteAuthority) {
|
|
544
|
-
disposables.add(registerAction2(class extends ViewPaneContainerAction {
|
|
545
|
-
constructor() {
|
|
546
|
-
super({
|
|
547
|
-
id: `${viewDescriptor.id}.toggleVisibility`,
|
|
548
|
-
viewPaneContainerId: viewContainerModel.viewContainer.id,
|
|
549
|
-
precondition: viewDescriptor.canToggleVisibility && (!viewContainerModel.isVisible(viewDescriptor.id) || viewContainerModel.visibleViewDescriptors.length > 1) ? ContextKeyExpr.true() : ( ContextKeyExpr.false()),
|
|
550
|
-
toggled: ( ContextKeyExpr.has(`${viewDescriptor.id}.visible`)),
|
|
551
|
-
title: viewDescriptor.name,
|
|
552
|
-
menu: [{
|
|
553
|
-
id: ViewsSubMenu,
|
|
554
|
-
when: ( ContextKeyExpr.equals('viewContainer', viewContainerModel.viewContainer.id)),
|
|
555
|
-
order: index,
|
|
556
|
-
}, {
|
|
557
|
-
id: MenuId.ViewContainerTitleContext,
|
|
558
|
-
when: ( ContextKeyExpr.and(( ContextKeyExpr.equals('viewContainer', viewContainerModel.viewContainer.id)))),
|
|
559
|
-
order: index,
|
|
560
|
-
group: '1_toggleVisibility'
|
|
561
|
-
}, {
|
|
562
|
-
id: MenuId.ViewTitleContext,
|
|
563
|
-
when: ( ContextKeyExpr.and(( ContextKeyExpr.or(...( viewContainerModel.visibleViewDescriptors.map(v => ( ContextKeyExpr.equals('view', v.id)))))))),
|
|
564
|
-
order: index,
|
|
565
|
-
group: '2_toggleVisibility'
|
|
566
|
-
}]
|
|
567
|
-
});
|
|
568
|
-
}
|
|
569
|
-
async runInViewPaneContainer(serviceAccessor, viewPaneContainer) {
|
|
570
|
-
viewPaneContainer.toggleViewVisibility(viewDescriptor.id);
|
|
571
|
-
}
|
|
572
|
-
}));
|
|
573
|
-
disposables.add(registerAction2(class extends ViewPaneContainerAction {
|
|
574
|
-
constructor() {
|
|
575
|
-
super({
|
|
576
|
-
id: `${viewDescriptor.id}.removeView`,
|
|
577
|
-
viewPaneContainerId: viewContainerModel.viewContainer.id,
|
|
578
|
-
title: ( localizeWithPath(
|
|
579
|
-
'vs/workbench/services/views/browser/viewDescriptorService',
|
|
580
|
-
'hideView',
|
|
581
|
-
"Hide '{0}'",
|
|
582
|
-
viewDescriptor.name.value
|
|
583
|
-
)),
|
|
584
|
-
precondition: viewDescriptor.canToggleVisibility && (!viewContainerModel.isVisible(viewDescriptor.id) || viewContainerModel.visibleViewDescriptors.length > 1) ? ContextKeyExpr.true() : ( ContextKeyExpr.false()),
|
|
585
|
-
menu: [{
|
|
586
|
-
id: MenuId.ViewTitleContext,
|
|
587
|
-
when: ( ContextKeyExpr.and(( ContextKeyExpr.equals('view', viewDescriptor.id)), ( ContextKeyExpr.has(`${viewDescriptor.id}.visible`)))),
|
|
588
|
-
group: '1_hide',
|
|
589
|
-
order: 1
|
|
590
|
-
}]
|
|
591
|
-
});
|
|
592
|
-
}
|
|
593
|
-
async runInViewPaneContainer(serviceAccessor, viewPaneContainer) {
|
|
594
|
-
viewPaneContainer.toggleViewVisibility(viewDescriptor.id);
|
|
595
|
-
}
|
|
596
|
-
}));
|
|
597
|
-
}
|
|
598
|
-
});
|
|
599
|
-
return disposables;
|
|
600
|
-
}
|
|
601
|
-
registerResetViewContainerAction(viewContainer) {
|
|
602
|
-
const that = this;
|
|
603
|
-
return registerAction2(class ResetViewLocationAction extends Action2 {
|
|
604
|
-
constructor() {
|
|
605
|
-
super({
|
|
606
|
-
id: `${viewContainer.id}.resetViewContainerLocation`,
|
|
607
|
-
title: {
|
|
608
|
-
original: 'Reset Location',
|
|
609
|
-
value: ( localizeWithPath(
|
|
610
|
-
'vs/workbench/services/views/browser/viewDescriptorService',
|
|
611
|
-
'resetViewLocation',
|
|
612
|
-
"Reset Location"
|
|
613
|
-
))
|
|
614
|
-
},
|
|
615
|
-
menu: [{
|
|
616
|
-
id: MenuId.ViewContainerTitleContext,
|
|
617
|
-
when: ( ContextKeyExpr.or(( ContextKeyExpr.and(( ContextKeyExpr.equals('viewContainer', viewContainer.id)), ( ContextKeyExpr.equals(`${viewContainer.id}.defaultViewContainerLocation`, false))))))
|
|
618
|
-
}],
|
|
619
|
-
});
|
|
620
|
-
}
|
|
621
|
-
run() {
|
|
622
|
-
that.moveViewContainerToLocation(viewContainer, that.getDefaultViewContainerLocation(viewContainer), undefined, this.desc.id);
|
|
623
|
-
}
|
|
624
|
-
});
|
|
625
|
-
}
|
|
626
|
-
addViews(container, views, visibilityState = ViewVisibilityState.Default) {
|
|
627
|
-
this.contextKeyService.bufferChangeEvents(() => {
|
|
628
|
-
views.forEach(view => {
|
|
629
|
-
const isDefaultContainer = this.getDefaultContainerById(view.id) === container;
|
|
630
|
-
this.getOrCreateDefaultViewLocationContextKey(view).set(isDefaultContainer);
|
|
631
|
-
if (isDefaultContainer) {
|
|
632
|
-
this.viewDescriptorsCustomLocations.delete(view.id);
|
|
633
|
-
}
|
|
634
|
-
else {
|
|
635
|
-
this.viewDescriptorsCustomLocations.set(view.id, container.id);
|
|
636
|
-
}
|
|
637
|
-
});
|
|
638
|
-
});
|
|
639
|
-
this.getViewContainerModel(container).add(( views.map(view => {
|
|
640
|
-
return {
|
|
641
|
-
viewDescriptor: view,
|
|
642
|
-
collapsed: visibilityState === ViewVisibilityState.Default ? undefined : false,
|
|
643
|
-
visible: visibilityState === ViewVisibilityState.Default ? undefined : true
|
|
644
|
-
};
|
|
645
|
-
})));
|
|
646
|
-
}
|
|
647
|
-
removeViews(container, views) {
|
|
648
|
-
this.contextKeyService.bufferChangeEvents(() => {
|
|
649
|
-
views.forEach(view => {
|
|
650
|
-
if (this.viewDescriptorsCustomLocations.get(view.id) === container.id) {
|
|
651
|
-
this.viewDescriptorsCustomLocations.delete(view.id);
|
|
652
|
-
}
|
|
653
|
-
this.getOrCreateDefaultViewLocationContextKey(view).set(false);
|
|
654
|
-
});
|
|
655
|
-
});
|
|
656
|
-
this.getViewContainerModel(container).remove(views);
|
|
657
|
-
}
|
|
658
|
-
getOrCreateActiveViewContextKey(viewDescriptor) {
|
|
659
|
-
const activeContextKeyId = `${viewDescriptor.id}.active`;
|
|
660
|
-
let contextKey = this.activeViewContextKeys.get(activeContextKeyId);
|
|
661
|
-
if (!contextKey) {
|
|
662
|
-
contextKey = ( new RawContextKey(activeContextKeyId, false)).bindTo(this.contextKeyService);
|
|
663
|
-
this.activeViewContextKeys.set(activeContextKeyId, contextKey);
|
|
664
|
-
}
|
|
665
|
-
return contextKey;
|
|
666
|
-
}
|
|
667
|
-
getOrCreateVisibleViewContextKey(viewDescriptor) {
|
|
668
|
-
const activeContextKeyId = `${viewDescriptor.id}.visible`;
|
|
669
|
-
let contextKey = this.activeViewContextKeys.get(activeContextKeyId);
|
|
670
|
-
if (!contextKey) {
|
|
671
|
-
contextKey = ( new RawContextKey(activeContextKeyId, false)).bindTo(this.contextKeyService);
|
|
672
|
-
this.activeViewContextKeys.set(activeContextKeyId, contextKey);
|
|
673
|
-
}
|
|
674
|
-
return contextKey;
|
|
675
|
-
}
|
|
676
|
-
getOrCreateMovableViewContextKey(viewDescriptor) {
|
|
677
|
-
const movableViewContextKeyId = `${viewDescriptor.id}.canMove`;
|
|
678
|
-
let contextKey = this.movableViewContextKeys.get(movableViewContextKeyId);
|
|
679
|
-
if (!contextKey) {
|
|
680
|
-
contextKey = ( new RawContextKey(movableViewContextKeyId, false)).bindTo(this.contextKeyService);
|
|
681
|
-
this.movableViewContextKeys.set(movableViewContextKeyId, contextKey);
|
|
682
|
-
}
|
|
683
|
-
return contextKey;
|
|
684
|
-
}
|
|
685
|
-
getOrCreateDefaultViewLocationContextKey(viewDescriptor) {
|
|
686
|
-
const defaultViewLocationContextKeyId = `${viewDescriptor.id}.defaultViewLocation`;
|
|
687
|
-
let contextKey = this.defaultViewLocationContextKeys.get(defaultViewLocationContextKeyId);
|
|
688
|
-
if (!contextKey) {
|
|
689
|
-
contextKey = ( new RawContextKey(defaultViewLocationContextKeyId, false)).bindTo(this.contextKeyService);
|
|
690
|
-
this.defaultViewLocationContextKeys.set(defaultViewLocationContextKeyId, contextKey);
|
|
691
|
-
}
|
|
692
|
-
return contextKey;
|
|
693
|
-
}
|
|
694
|
-
getOrCreateDefaultViewContainerLocationContextKey(viewContainer) {
|
|
695
|
-
const defaultViewContainerLocationContextKeyId = `${viewContainer.id}.defaultViewContainerLocation`;
|
|
696
|
-
let contextKey = this.defaultViewContainerLocationContextKeys.get(defaultViewContainerLocationContextKeyId);
|
|
697
|
-
if (!contextKey) {
|
|
698
|
-
contextKey = ( new RawContextKey(defaultViewContainerLocationContextKeyId, false)).bindTo(this.contextKeyService);
|
|
699
|
-
this.defaultViewContainerLocationContextKeys.set(defaultViewContainerLocationContextKeyId, contextKey);
|
|
700
|
-
}
|
|
701
|
-
return contextKey;
|
|
702
|
-
}
|
|
703
|
-
};
|
|
704
|
-
ViewDescriptorService = ViewDescriptorService_1 = ( __decorate([
|
|
705
|
-
( __param(0, IInstantiationService)),
|
|
706
|
-
( __param(1, IContextKeyService)),
|
|
707
|
-
( __param(2, IStorageService)),
|
|
708
|
-
( __param(3, IExtensionService)),
|
|
709
|
-
( __param(4, ITelemetryService)),
|
|
710
|
-
( __param(5, ILoggerService))
|
|
711
|
-
], ViewDescriptorService));
|
|
712
|
-
|
|
713
|
-
export { ViewDescriptorService };
|