@codingame/monaco-vscode-view-common-service-override 4.5.0-improve-code-splitting.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/assets/fake.html +10 -0
- package/assets/index-no-csp.html +1230 -0
- package/assets/index.html +1231 -0
- package/assets/service-worker.js +457 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/override/vs/workbench/browser/parts/editor/textEditor.js +5 -0
- package/override/vs/workbench/browser/parts/editor/textEditor.weak.js +11 -0
- package/package.json +32 -0
- package/tools/editorAssets.js +4 -0
- package/tools/url.js +10 -0
- package/viewCommon.d.ts +5 -0
- package/viewCommon.js +105 -0
- package/vscode/src/vs/base/browser/deviceAccess.js +61 -0
- package/vscode/src/vs/base/browser/ui/centered/centeredViewLayout.js +180 -0
- package/vscode/src/vs/base/browser/ui/grid/grid.js +494 -0
- package/vscode/src/vs/base/browser/ui/grid/gridview.css.js +6 -0
- package/vscode/src/vs/base/browser/ui/grid/gridview.js +1113 -0
- package/vscode/src/vs/platform/languagePacks/common/localizedStrings.js +12 -0
- package/vscode/src/vs/platform/webview/common/mimeTypes.js +24 -0
- package/vscode/src/vs/platform/webview/common/webviewPortMapping.js +64 -0
- package/vscode/src/vs/workbench/api/browser/viewsExtensionPoint.js +907 -0
- package/vscode/src/vs/workbench/browser/actions/listCommands.js +764 -0
- package/vscode/src/vs/workbench/browser/actions/navigationActions.js +301 -0
- package/vscode/src/vs/workbench/browser/media/style.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/activitybar/activitybarPart.js +671 -0
- package/vscode/src/vs/workbench/browser/parts/activitybar/media/activityaction.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/auxiliarybar/auxiliaryBarPart.js +229 -0
- package/vscode/src/vs/workbench/browser/parts/auxiliarybar/media/auxiliaryBarPart.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/compositeBar.js +606 -0
- package/vscode/src/vs/workbench/browser/parts/compositePart.js +346 -0
- package/vscode/src/vs/workbench/browser/parts/editor/auxiliaryEditorPart.js +246 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editor.contribution.js +1403 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorConfiguration.js +188 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorDropTarget.js +523 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorPart.js +1030 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorParts.js +391 -0
- package/vscode/src/vs/workbench/browser/parts/editor/media/editordroptarget.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/media/compositepart.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/media/paneCompositePart.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/paneCompositeBar.js +643 -0
- package/vscode/src/vs/workbench/browser/parts/paneCompositePart.js +472 -0
- package/vscode/src/vs/workbench/browser/parts/paneCompositePartService.js +68 -0
- package/vscode/src/vs/workbench/browser/parts/panel/panelPart.js +160 -0
- package/vscode/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css.js +6 -0
- package/vscode/src/vs/workbench/browser/parts/sidebar/sidebarActions.js +39 -0
- package/vscode/src/vs/workbench/browser/parts/sidebar/sidebarPart.js +238 -0
- package/vscode/src/vs/workbench/browser/style.js +54 -0
- package/vscode/src/vs/workbench/browser/window.js +381 -0
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.js +300 -0
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.js +367 -0
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyTree.js +135 -0
- package/vscode/src/vs/workbench/contrib/callHierarchy/browser/media/callHierarchy.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditor.contribution.js +18 -0
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditorInputFactory.js +146 -0
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditors.js +215 -0
- package/vscode/src/vs/workbench/contrib/customEditor/browser/media/customEditor.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/customEditor/common/contributedCustomEditors.js +78 -0
- package/vscode/src/vs/workbench/contrib/customEditor/common/customEditor.js +56 -0
- package/vscode/src/vs/workbench/contrib/customEditor/common/customEditorModelManager.js +63 -0
- package/vscode/src/vs/workbench/contrib/customEditor/common/extensionPoint.js +183 -0
- package/vscode/src/vs/workbench/contrib/externalUriOpener/common/externalUriOpener.contribution.js +8 -0
- package/vscode/src/vs/workbench/contrib/languageStatus/browser/languageStatus.contribution.js +408 -0
- package/vscode/src/vs/workbench/contrib/languageStatus/browser/media/languageStatus.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/limitIndicator/browser/limitIndicator.contribution.js +147 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/commands.js +635 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/devCommands.js +230 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditor.contribution.js +75 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorSerializer.js +42 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/colors.js +81 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/conflictActions.js +350 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editorGutter.js +100 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/baseCodeEditorView.js +148 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/codeEditorView.js +106 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/inputCodeEditorView.js +403 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/resultCodeEditorView.js +199 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/fixedZoneWidget.js +41 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/lineAlignment.js +128 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/media/mergeEditor.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/mergeEditor.js +619 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/scrollSynchronizer.js +161 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewModel.js +266 -0
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewZones.js +173 -0
- package/vscode/src/vs/workbench/contrib/preferences/browser/keyboardLayoutPicker.js +195 -0
- package/vscode/src/vs/workbench/contrib/sash/browser/sash.contribution.js +38 -0
- package/vscode/src/vs/workbench/contrib/sash/browser/sash.js +41 -0
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/media/typeHierarchy.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchy.contribution.js +283 -0
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek.js +362 -0
- package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyTree.js +133 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/overlayWebview.js +314 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/resourceLoading.js +96 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/themeing.js +98 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewElement.js +656 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewFindWidget.js +65 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewService.js +59 -0
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewCommands.js +143 -0
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewEditorInputSerializer.js +121 -0
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewPanel.contribution.js +67 -0
- package/vscode/src/vs/workbench/contrib/webviewView/browser/webviewViewPane.js +234 -0
- package/vscode/src/vs/workbench/contrib/webviewView/browser/webviewViewService.js +45 -0
- package/vscode/src/vs/workbench/services/activity/browser/activityService.js +145 -0
- package/vscode/src/vs/workbench/services/auxiliaryWindow/browser/auxiliaryWindowService.js +341 -0
- package/vscode/src/vs/workbench/services/driver/browser/driver.js +186 -0
- package/vscode/src/vs/workbench/services/editor/browser/editorPaneService.js +13 -0
- package/vscode/src/vs/workbench/services/editor/browser/editorResolverService.js +676 -0
- package/vscode/src/vs/workbench/services/history/browser/historyService.js +1516 -0
- package/vscode/src/vs/workbench/services/progress/browser/media/progressService.css.js +6 -0
- package/vscode/src/vs/workbench/services/progress/browser/progressService.js +527 -0
- package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorHandler.js +102 -0
- package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorService.js +133 -0
- package/vscode/src/vs/workbench/services/views/browser/viewDescriptorService.js +711 -0
- package/vscode/src/vs/workbench/services/views/common/viewContainerModel.js +603 -0
|
@@ -0,0 +1,643 @@
|
|
|
1
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
+
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
3
|
+
import { IActivityService } from 'vscode/vscode/vs/workbench/services/activity/common/activity.service';
|
|
4
|
+
import { IWorkbenchLayoutService } from 'vscode/vscode/vs/workbench/services/layout/browser/layoutService.service';
|
|
5
|
+
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
6
|
+
import { Disposable, DisposableMap, DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
7
|
+
import { CompositeDragAndDrop, CompositeBar } from './compositeBar.js';
|
|
8
|
+
import { asCSSUrl, createCSSRule, Dimension, isMouseEvent } from 'vscode/vscode/vs/base/browser/dom';
|
|
9
|
+
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
10
|
+
import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions.service';
|
|
11
|
+
import { URI } from 'vscode/vscode/vs/base/common/uri';
|
|
12
|
+
import { ToggleCompositePinnedAction, ToggleCompositeBadgeAction, CompositeBarAction } from 'vscode/vscode/vs/workbench/browser/parts/compositeBarActions';
|
|
13
|
+
import { IViewDescriptorService } from 'vscode/vscode/vs/workbench/common/views.service';
|
|
14
|
+
import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
15
|
+
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
16
|
+
import { isString } from 'vscode/vscode/vs/base/common/types';
|
|
17
|
+
import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService.service';
|
|
18
|
+
import { isNative } from 'vscode/vscode/vs/base/common/platform';
|
|
19
|
+
import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
|
|
20
|
+
import { toAction } from 'vscode/vscode/vs/base/common/actions';
|
|
21
|
+
import { StringSHA1 } from 'vscode/vscode/vs/base/common/hash';
|
|
22
|
+
import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry.service';
|
|
23
|
+
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
|
|
24
|
+
|
|
25
|
+
var ViewContainerActivityAction_1;
|
|
26
|
+
let PaneCompositeBar = class PaneCompositeBar extends Disposable {
|
|
27
|
+
constructor(options, part, paneCompositePart, instantiationService, storageService, extensionService, viewDescriptorService, contextKeyService, environmentService, layoutService) {
|
|
28
|
+
super();
|
|
29
|
+
this.options = options;
|
|
30
|
+
this.part = part;
|
|
31
|
+
this.paneCompositePart = paneCompositePart;
|
|
32
|
+
this.instantiationService = instantiationService;
|
|
33
|
+
this.storageService = storageService;
|
|
34
|
+
this.extensionService = extensionService;
|
|
35
|
+
this.viewDescriptorService = viewDescriptorService;
|
|
36
|
+
this.contextKeyService = contextKeyService;
|
|
37
|
+
this.environmentService = environmentService;
|
|
38
|
+
this.layoutService = layoutService;
|
|
39
|
+
this.viewContainerDisposables = this._register(( new DisposableMap()));
|
|
40
|
+
this.compositeActions = ( new Map());
|
|
41
|
+
this.hasExtensionsRegistered = false;
|
|
42
|
+
this._cachedViewContainers = undefined;
|
|
43
|
+
this.location = paneCompositePart.partId === "workbench.parts.panel"
|
|
44
|
+
? 1 : paneCompositePart.partId === "workbench.parts.auxiliarybar"
|
|
45
|
+
? 2 : 0 ;
|
|
46
|
+
this.dndHandler = ( new CompositeDragAndDrop(
|
|
47
|
+
this.viewDescriptorService,
|
|
48
|
+
this.location,
|
|
49
|
+
this.options.orientation,
|
|
50
|
+
async (id, focus) => { return (await this.paneCompositePart.openPaneComposite(id, focus)) ?? null; },
|
|
51
|
+
(from, to, before) => this.compositeBar.move(from, to, this.options.orientation === 1 ? before?.verticallyBefore : before?.horizontallyBefore),
|
|
52
|
+
() => this.compositeBar.getCompositeBarItems()
|
|
53
|
+
));
|
|
54
|
+
const cachedItems = ( this.cachedViewContainers
|
|
55
|
+
.map(container => ({
|
|
56
|
+
id: container.id,
|
|
57
|
+
name: container.name,
|
|
58
|
+
visible: !this.shouldBeHidden(container.id, container),
|
|
59
|
+
order: container.order,
|
|
60
|
+
pinned: container.pinned,
|
|
61
|
+
})));
|
|
62
|
+
this.compositeBar = this.createCompositeBar(cachedItems);
|
|
63
|
+
this.onDidRegisterViewContainers(this.getViewContainers());
|
|
64
|
+
this.registerListeners();
|
|
65
|
+
}
|
|
66
|
+
createCompositeBar(cachedItems) {
|
|
67
|
+
return this._register(this.instantiationService.createInstance(CompositeBar, cachedItems, {
|
|
68
|
+
icon: this.options.icon,
|
|
69
|
+
compact: this.options.compact,
|
|
70
|
+
orientation: this.options.orientation,
|
|
71
|
+
activityHoverOptions: this.options.activityHoverOptions,
|
|
72
|
+
preventLoopNavigation: this.options.preventLoopNavigation,
|
|
73
|
+
openComposite: async (compositeId, preserveFocus) => {
|
|
74
|
+
return (await this.paneCompositePart.openPaneComposite(compositeId, !preserveFocus)) ?? null;
|
|
75
|
+
},
|
|
76
|
+
getActivityAction: compositeId => this.getCompositeActions(compositeId).activityAction,
|
|
77
|
+
getCompositePinnedAction: compositeId => this.getCompositeActions(compositeId).pinnedAction,
|
|
78
|
+
getCompositeBadgeAction: compositeId => this.getCompositeActions(compositeId).badgeAction,
|
|
79
|
+
getOnCompositeClickAction: compositeId => this.getCompositeActions(compositeId).activityAction,
|
|
80
|
+
fillExtraContextMenuActions: (actions, e) => this.options.fillExtraContextMenuActions(actions, e),
|
|
81
|
+
getContextMenuActionsForComposite: compositeId => this.getContextMenuActionsForComposite(compositeId),
|
|
82
|
+
getDefaultCompositeId: () => this.viewDescriptorService.getDefaultViewContainer(this.location)?.id,
|
|
83
|
+
dndHandler: this.dndHandler,
|
|
84
|
+
compositeSize: this.options.compositeSize,
|
|
85
|
+
overflowActionSize: this.options.overflowActionSize,
|
|
86
|
+
colors: theme => this.options.colors(theme),
|
|
87
|
+
}));
|
|
88
|
+
}
|
|
89
|
+
getContextMenuActionsForComposite(compositeId) {
|
|
90
|
+
const actions = [];
|
|
91
|
+
const viewContainer = this.viewDescriptorService.getViewContainerById(compositeId);
|
|
92
|
+
const defaultLocation = this.viewDescriptorService.getDefaultViewContainerLocation(viewContainer);
|
|
93
|
+
if (defaultLocation !== this.viewDescriptorService.getViewContainerLocation(viewContainer)) {
|
|
94
|
+
actions.push(toAction({ id: 'resetLocationAction', label: ( localizeWithPath(
|
|
95
|
+
'vs/workbench/browser/parts/paneCompositeBar',
|
|
96
|
+
'resetLocation',
|
|
97
|
+
"Reset Location"
|
|
98
|
+
)), run: () => this.viewDescriptorService.moveViewContainerToLocation(viewContainer, defaultLocation, undefined, 'resetLocationAction') }));
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
const viewContainerModel = this.viewDescriptorService.getViewContainerModel(viewContainer);
|
|
102
|
+
if (viewContainerModel.allViewDescriptors.length === 1) {
|
|
103
|
+
const viewToReset = viewContainerModel.allViewDescriptors[0];
|
|
104
|
+
const defaultContainer = this.viewDescriptorService.getDefaultContainerById(viewToReset.id);
|
|
105
|
+
if (defaultContainer !== viewContainer) {
|
|
106
|
+
actions.push(toAction({ id: 'resetLocationAction', label: ( localizeWithPath(
|
|
107
|
+
'vs/workbench/browser/parts/paneCompositeBar',
|
|
108
|
+
'resetLocation',
|
|
109
|
+
"Reset Location"
|
|
110
|
+
)), run: () => this.viewDescriptorService.moveViewsToContainer([viewToReset], defaultContainer, undefined, 'resetLocationAction') }));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return actions;
|
|
115
|
+
}
|
|
116
|
+
registerListeners() {
|
|
117
|
+
this._register(this.viewDescriptorService.onDidChangeViewContainers(({ added, removed }) => this.onDidChangeViewContainers(added, removed)));
|
|
118
|
+
this._register(this.viewDescriptorService.onDidChangeContainerLocation(({ viewContainer, from, to }) => this.onDidChangeViewContainerLocation(viewContainer, from, to)));
|
|
119
|
+
this._register(this.paneCompositePart.onDidPaneCompositeOpen(e => this.onDidChangeViewContainerVisibility(e.getId(), true)));
|
|
120
|
+
this._register(this.paneCompositePart.onDidPaneCompositeClose(e => this.onDidChangeViewContainerVisibility(e.getId(), false)));
|
|
121
|
+
this.extensionService.whenInstalledExtensionsRegistered().then(() => {
|
|
122
|
+
if (this._store.isDisposed) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
this.onDidRegisterExtensions();
|
|
126
|
+
this._register(this.compositeBar.onDidChange(() => this.saveCachedViewContainers()));
|
|
127
|
+
this._register(this.storageService.onDidChangeValue(0 , this.options.pinnedViewContainersKey, this._store)(e => this.onDidPinnedViewContainersStorageValueChange(e)));
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
onDidChangeViewContainers(added, removed) {
|
|
131
|
+
removed.filter(({ location }) => location === this.location).forEach(({ container }) => this.onDidDeregisterViewContainer(container));
|
|
132
|
+
this.onDidRegisterViewContainers(( added.filter(({ location }) => location === this.location).map(({ container }) => container)));
|
|
133
|
+
}
|
|
134
|
+
onDidChangeViewContainerLocation(container, from, to) {
|
|
135
|
+
if (from === this.location) {
|
|
136
|
+
this.onDidDeregisterViewContainer(container);
|
|
137
|
+
}
|
|
138
|
+
if (to === this.location) {
|
|
139
|
+
this.onDidRegisterViewContainers([container]);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
onDidChangeViewContainerVisibility(id, visible) {
|
|
143
|
+
if (visible) {
|
|
144
|
+
this.onDidViewContainerVisible(id);
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
this.compositeBar.deactivateComposite(id);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
onDidRegisterExtensions() {
|
|
151
|
+
this.hasExtensionsRegistered = true;
|
|
152
|
+
for (const { id } of this.cachedViewContainers) {
|
|
153
|
+
const viewContainer = this.getViewContainer(id);
|
|
154
|
+
if (viewContainer) {
|
|
155
|
+
this.showOrHideViewContainer(viewContainer);
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
if (this.viewDescriptorService.isViewContainerRemovedPermanently(id)) {
|
|
159
|
+
this.removeComposite(id);
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
this.hideComposite(id);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
this.saveCachedViewContainers();
|
|
167
|
+
}
|
|
168
|
+
onDidViewContainerVisible(id) {
|
|
169
|
+
const viewContainer = this.getViewContainer(id);
|
|
170
|
+
if (viewContainer) {
|
|
171
|
+
this.addComposite(viewContainer);
|
|
172
|
+
this.compositeBar.activateComposite(viewContainer.id);
|
|
173
|
+
if (this.shouldBeHidden(viewContainer)) {
|
|
174
|
+
const viewContainerModel = this.viewDescriptorService.getViewContainerModel(viewContainer);
|
|
175
|
+
if (viewContainerModel.activeViewDescriptors.length === 0) {
|
|
176
|
+
this.hideComposite(viewContainer.id);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
create(parent) {
|
|
182
|
+
return this.compositeBar.create(parent);
|
|
183
|
+
}
|
|
184
|
+
getCompositeActions(compositeId) {
|
|
185
|
+
let compositeActions = this.compositeActions.get(compositeId);
|
|
186
|
+
if (!compositeActions) {
|
|
187
|
+
const viewContainer = this.getViewContainer(compositeId);
|
|
188
|
+
if (viewContainer) {
|
|
189
|
+
const viewContainerModel = this.viewDescriptorService.getViewContainerModel(viewContainer);
|
|
190
|
+
compositeActions = {
|
|
191
|
+
activityAction: this._register(this.instantiationService.createInstance(ViewContainerActivityAction, this.toCompositeBarActionItemFrom(viewContainerModel), this.part, this.paneCompositePart)),
|
|
192
|
+
pinnedAction: this._register(( new ToggleCompositePinnedAction(this.toCompositeBarActionItemFrom(viewContainerModel), this.compositeBar))),
|
|
193
|
+
badgeAction: this._register(( new ToggleCompositeBadgeAction(this.toCompositeBarActionItemFrom(viewContainerModel), this.compositeBar)))
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
const cachedComposite = this.cachedViewContainers.filter(c => c.id === compositeId)[0];
|
|
198
|
+
compositeActions = {
|
|
199
|
+
activityAction: this._register(this.instantiationService.createInstance(PlaceHolderViewContainerActivityAction, this.toCompositeBarActionItem(compositeId, cachedComposite?.name ?? compositeId, cachedComposite?.icon, undefined), this.part, this.paneCompositePart)),
|
|
200
|
+
pinnedAction: this._register(( new PlaceHolderToggleCompositePinnedAction(compositeId, this.compositeBar))),
|
|
201
|
+
badgeAction: this._register(( new PlaceHolderToggleCompositeBadgeAction(compositeId, this.compositeBar)))
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
this.compositeActions.set(compositeId, compositeActions);
|
|
205
|
+
}
|
|
206
|
+
return compositeActions;
|
|
207
|
+
}
|
|
208
|
+
onDidRegisterViewContainers(viewContainers) {
|
|
209
|
+
for (const viewContainer of viewContainers) {
|
|
210
|
+
this.addComposite(viewContainer);
|
|
211
|
+
const cachedViewContainer = this.cachedViewContainers.filter(({ id }) => id === viewContainer.id)[0];
|
|
212
|
+
if (!cachedViewContainer) {
|
|
213
|
+
this.compositeBar.pin(viewContainer.id);
|
|
214
|
+
}
|
|
215
|
+
const visibleViewContainer = this.paneCompositePart.getActivePaneComposite();
|
|
216
|
+
if (visibleViewContainer?.getId() === viewContainer.id) {
|
|
217
|
+
this.compositeBar.activateComposite(viewContainer.id);
|
|
218
|
+
}
|
|
219
|
+
const viewContainerModel = this.viewDescriptorService.getViewContainerModel(viewContainer);
|
|
220
|
+
this.updateCompositeBarActionItem(viewContainer, viewContainerModel);
|
|
221
|
+
this.showOrHideViewContainer(viewContainer);
|
|
222
|
+
const disposables = ( new DisposableStore());
|
|
223
|
+
disposables.add(viewContainerModel.onDidChangeContainerInfo(() => this.updateCompositeBarActionItem(viewContainer, viewContainerModel)));
|
|
224
|
+
disposables.add(viewContainerModel.onDidChangeActiveViewDescriptors(() => this.showOrHideViewContainer(viewContainer)));
|
|
225
|
+
this.viewContainerDisposables.set(viewContainer.id, disposables);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
onDidDeregisterViewContainer(viewContainer) {
|
|
229
|
+
this.viewContainerDisposables.deleteAndDispose(viewContainer.id);
|
|
230
|
+
this.removeComposite(viewContainer.id);
|
|
231
|
+
}
|
|
232
|
+
updateCompositeBarActionItem(viewContainer, viewContainerModel) {
|
|
233
|
+
const compositeBarActionItem = this.toCompositeBarActionItemFrom(viewContainerModel);
|
|
234
|
+
const { activityAction, pinnedAction } = this.getCompositeActions(viewContainer.id);
|
|
235
|
+
activityAction.updateCompositeBarActionItem(compositeBarActionItem);
|
|
236
|
+
if (pinnedAction instanceof PlaceHolderToggleCompositePinnedAction) {
|
|
237
|
+
pinnedAction.setActivity(compositeBarActionItem);
|
|
238
|
+
}
|
|
239
|
+
if (this.options.recomputeSizes) {
|
|
240
|
+
this.compositeBar.recomputeSizes();
|
|
241
|
+
}
|
|
242
|
+
this.saveCachedViewContainers();
|
|
243
|
+
}
|
|
244
|
+
toCompositeBarActionItemFrom(viewContainerModel) {
|
|
245
|
+
return this.toCompositeBarActionItem(viewContainerModel.viewContainer.id, viewContainerModel.title, viewContainerModel.icon, viewContainerModel.keybindingId);
|
|
246
|
+
}
|
|
247
|
+
toCompositeBarActionItem(id, name, icon, keybindingId) {
|
|
248
|
+
let classNames = undefined;
|
|
249
|
+
let iconUrl = undefined;
|
|
250
|
+
if (this.options.icon) {
|
|
251
|
+
if (URI.isUri(icon)) {
|
|
252
|
+
iconUrl = icon;
|
|
253
|
+
const cssUrl = asCSSUrl(icon);
|
|
254
|
+
const hash = ( new StringSHA1());
|
|
255
|
+
hash.update(cssUrl);
|
|
256
|
+
const iconId = `activity-${id.replace(/\./g, '-')}-${hash.digest()}`;
|
|
257
|
+
const iconClass = `.monaco-workbench .${this.options.partContainerClass} .monaco-action-bar .action-label.${iconId}`;
|
|
258
|
+
classNames = [iconId, 'uri-icon'];
|
|
259
|
+
createCSSRule(iconClass, `
|
|
260
|
+
mask: ${cssUrl} no-repeat 50% 50%;
|
|
261
|
+
mask-size: ${this.options.iconSize}px;
|
|
262
|
+
-webkit-mask: ${cssUrl} no-repeat 50% 50%;
|
|
263
|
+
-webkit-mask-size: ${this.options.iconSize}px;
|
|
264
|
+
mask-origin: padding;
|
|
265
|
+
-webkit-mask-origin: padding;
|
|
266
|
+
`);
|
|
267
|
+
}
|
|
268
|
+
else if (ThemeIcon.isThemeIcon(icon)) {
|
|
269
|
+
classNames = ThemeIcon.asClassNameArray(icon);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
return { id, name, classNames, iconUrl, keybindingId };
|
|
273
|
+
}
|
|
274
|
+
showOrHideViewContainer(viewContainer) {
|
|
275
|
+
if (this.shouldBeHidden(viewContainer)) {
|
|
276
|
+
this.hideComposite(viewContainer.id);
|
|
277
|
+
}
|
|
278
|
+
else {
|
|
279
|
+
this.addComposite(viewContainer);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
shouldBeHidden(viewContainerOrId, cachedViewContainer) {
|
|
283
|
+
const viewContainer = isString(viewContainerOrId) ? this.getViewContainer(viewContainerOrId) : viewContainerOrId;
|
|
284
|
+
const viewContainerId = isString(viewContainerOrId) ? viewContainerOrId : viewContainerOrId.id;
|
|
285
|
+
if (viewContainer) {
|
|
286
|
+
if (viewContainer.hideIfEmpty) {
|
|
287
|
+
if (this.viewDescriptorService.getViewContainerModel(viewContainer).activeViewDescriptors.length > 0) {
|
|
288
|
+
return false;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
else {
|
|
292
|
+
return false;
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
if (!this.hasExtensionsRegistered && !(this.part === "workbench.parts.sidebar" && this.environmentService.remoteAuthority && isNative)) {
|
|
296
|
+
cachedViewContainer = cachedViewContainer || this.cachedViewContainers.find(({ id }) => id === viewContainerId);
|
|
297
|
+
if (!viewContainer && cachedViewContainer?.isBuiltin && cachedViewContainer?.visible) {
|
|
298
|
+
return false;
|
|
299
|
+
}
|
|
300
|
+
if (cachedViewContainer?.views?.length) {
|
|
301
|
+
return cachedViewContainer.views.every(({ when }) => !!when && !this.contextKeyService.contextMatchesRules(ContextKeyExpr.deserialize(when)));
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
return true;
|
|
305
|
+
}
|
|
306
|
+
addComposite(viewContainer) {
|
|
307
|
+
this.compositeBar.addComposite({ id: viewContainer.id, name: typeof viewContainer.title === 'string' ? viewContainer.title : viewContainer.title.value, order: viewContainer.order, requestedIndex: viewContainer.requestedIndex });
|
|
308
|
+
}
|
|
309
|
+
hideComposite(compositeId) {
|
|
310
|
+
this.compositeBar.hideComposite(compositeId);
|
|
311
|
+
const compositeActions = this.compositeActions.get(compositeId);
|
|
312
|
+
if (compositeActions) {
|
|
313
|
+
compositeActions.activityAction.dispose();
|
|
314
|
+
compositeActions.pinnedAction.dispose();
|
|
315
|
+
this.compositeActions.delete(compositeId);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
removeComposite(compositeId) {
|
|
319
|
+
this.compositeBar.removeComposite(compositeId);
|
|
320
|
+
const compositeActions = this.compositeActions.get(compositeId);
|
|
321
|
+
if (compositeActions) {
|
|
322
|
+
compositeActions.activityAction.dispose();
|
|
323
|
+
compositeActions.pinnedAction.dispose();
|
|
324
|
+
this.compositeActions.delete(compositeId);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
getPinnedPaneCompositeIds() {
|
|
328
|
+
const pinnedCompositeIds = ( this.compositeBar.getPinnedComposites().map(v => v.id));
|
|
329
|
+
return ( this.getViewContainers()
|
|
330
|
+
.filter(v => this.compositeBar.isPinned(v.id))
|
|
331
|
+
.sort((v1, v2) => pinnedCompositeIds.indexOf(v1.id) - pinnedCompositeIds.indexOf(v2.id))
|
|
332
|
+
.map(v => v.id));
|
|
333
|
+
}
|
|
334
|
+
getVisiblePaneCompositeIds() {
|
|
335
|
+
return ( this.compositeBar.getVisibleComposites()
|
|
336
|
+
.filter(v => this.paneCompositePart.getActivePaneComposite()?.getId() === v.id || this.compositeBar.isPinned(v.id))
|
|
337
|
+
.map(v => v.id));
|
|
338
|
+
}
|
|
339
|
+
getContextMenuActions() {
|
|
340
|
+
return this.compositeBar.getContextMenuActions();
|
|
341
|
+
}
|
|
342
|
+
focus(index) {
|
|
343
|
+
this.compositeBar.focus(index);
|
|
344
|
+
}
|
|
345
|
+
layout(width, height) {
|
|
346
|
+
this.compositeBar.layout(( new Dimension(width, height)));
|
|
347
|
+
}
|
|
348
|
+
getViewContainer(id) {
|
|
349
|
+
const viewContainer = this.viewDescriptorService.getViewContainerById(id);
|
|
350
|
+
return viewContainer && this.viewDescriptorService.getViewContainerLocation(viewContainer) === this.location ? viewContainer : undefined;
|
|
351
|
+
}
|
|
352
|
+
getViewContainers() {
|
|
353
|
+
return this.viewDescriptorService.getViewContainersByLocation(this.location);
|
|
354
|
+
}
|
|
355
|
+
onDidPinnedViewContainersStorageValueChange(e) {
|
|
356
|
+
if (this.pinnedViewContainersValue !== this.getStoredPinnedViewContainersValue() ) {
|
|
357
|
+
this._placeholderViewContainersValue = undefined;
|
|
358
|
+
this._pinnedViewContainersValue = undefined;
|
|
359
|
+
this._cachedViewContainers = undefined;
|
|
360
|
+
const newCompositeItems = [];
|
|
361
|
+
const compositeItems = this.compositeBar.getCompositeBarItems();
|
|
362
|
+
for (const cachedViewContainer of this.cachedViewContainers) {
|
|
363
|
+
newCompositeItems.push({
|
|
364
|
+
id: cachedViewContainer.id,
|
|
365
|
+
name: cachedViewContainer.name,
|
|
366
|
+
order: cachedViewContainer.order,
|
|
367
|
+
pinned: cachedViewContainer.pinned,
|
|
368
|
+
visible: cachedViewContainer.visible && !!this.getViewContainer(cachedViewContainer.id),
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
for (const viewContainer of this.getViewContainers()) {
|
|
372
|
+
if (!( newCompositeItems.some(({ id }) => id === viewContainer.id))) {
|
|
373
|
+
const index = compositeItems.findIndex(({ id }) => id === viewContainer.id);
|
|
374
|
+
if (index !== -1) {
|
|
375
|
+
const compositeItem = compositeItems[index];
|
|
376
|
+
newCompositeItems.splice(index, 0, {
|
|
377
|
+
id: viewContainer.id,
|
|
378
|
+
name: typeof viewContainer.title === 'string' ? viewContainer.title : viewContainer.title.value,
|
|
379
|
+
order: compositeItem.order,
|
|
380
|
+
pinned: compositeItem.pinned,
|
|
381
|
+
visible: compositeItem.visible,
|
|
382
|
+
});
|
|
383
|
+
}
|
|
384
|
+
else {
|
|
385
|
+
newCompositeItems.push({
|
|
386
|
+
id: viewContainer.id,
|
|
387
|
+
name: typeof viewContainer.title === 'string' ? viewContainer.title : viewContainer.title.value,
|
|
388
|
+
order: viewContainer.order,
|
|
389
|
+
pinned: true,
|
|
390
|
+
visible: !this.shouldBeHidden(viewContainer),
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
this.compositeBar.setCompositeBarItems(newCompositeItems);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
saveCachedViewContainers() {
|
|
399
|
+
const state = [];
|
|
400
|
+
const compositeItems = this.compositeBar.getCompositeBarItems();
|
|
401
|
+
for (const compositeItem of compositeItems) {
|
|
402
|
+
const viewContainer = this.getViewContainer(compositeItem.id);
|
|
403
|
+
if (viewContainer) {
|
|
404
|
+
const viewContainerModel = this.viewDescriptorService.getViewContainerModel(viewContainer);
|
|
405
|
+
const views = [];
|
|
406
|
+
for (const { when } of viewContainerModel.allViewDescriptors) {
|
|
407
|
+
views.push({ when: when ? when.serialize() : undefined });
|
|
408
|
+
}
|
|
409
|
+
state.push({
|
|
410
|
+
id: compositeItem.id,
|
|
411
|
+
name: viewContainerModel.title,
|
|
412
|
+
icon: URI.isUri(viewContainerModel.icon) && this.environmentService.remoteAuthority ? undefined : viewContainerModel.icon,
|
|
413
|
+
views,
|
|
414
|
+
pinned: compositeItem.pinned,
|
|
415
|
+
order: compositeItem.order,
|
|
416
|
+
visible: compositeItem.visible,
|
|
417
|
+
isBuiltin: !viewContainer.extensionId
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
else {
|
|
421
|
+
state.push({ id: compositeItem.id, name: compositeItem.name, pinned: compositeItem.pinned, order: compositeItem.order, visible: false, isBuiltin: false });
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
this.storeCachedViewContainersState(state);
|
|
425
|
+
}
|
|
426
|
+
get cachedViewContainers() {
|
|
427
|
+
if (this._cachedViewContainers === undefined) {
|
|
428
|
+
this._cachedViewContainers = this.getPinnedViewContainers();
|
|
429
|
+
for (const placeholderViewContainer of this.getPlaceholderViewContainers()) {
|
|
430
|
+
const cachedViewContainer = this._cachedViewContainers.find(cached => cached.id === placeholderViewContainer.id);
|
|
431
|
+
if (cachedViewContainer) {
|
|
432
|
+
cachedViewContainer.visible = placeholderViewContainer.visible ?? cachedViewContainer.visible;
|
|
433
|
+
cachedViewContainer.name = placeholderViewContainer.name;
|
|
434
|
+
cachedViewContainer.icon = placeholderViewContainer.themeIcon ? placeholderViewContainer.themeIcon :
|
|
435
|
+
placeholderViewContainer.iconUrl ? URI.revive(placeholderViewContainer.iconUrl) : undefined;
|
|
436
|
+
if (URI.isUri(cachedViewContainer.icon) && this.environmentService.remoteAuthority) {
|
|
437
|
+
cachedViewContainer.icon = undefined;
|
|
438
|
+
}
|
|
439
|
+
cachedViewContainer.views = placeholderViewContainer.views;
|
|
440
|
+
cachedViewContainer.isBuiltin = placeholderViewContainer.isBuiltin;
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
for (const viewContainerWorkspaceState of this.getViewContainersWorkspaceState()) {
|
|
444
|
+
const cachedViewContainer = this._cachedViewContainers.find(cached => cached.id === viewContainerWorkspaceState.id);
|
|
445
|
+
if (cachedViewContainer) {
|
|
446
|
+
cachedViewContainer.visible = viewContainerWorkspaceState.visible ?? cachedViewContainer.visible;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
return this._cachedViewContainers;
|
|
451
|
+
}
|
|
452
|
+
storeCachedViewContainersState(cachedViewContainers) {
|
|
453
|
+
const pinnedViewContainers = this.getPinnedViewContainers();
|
|
454
|
+
this.setPinnedViewContainers(( cachedViewContainers.map(({ id, pinned, order }) => ({
|
|
455
|
+
id,
|
|
456
|
+
pinned,
|
|
457
|
+
visible: pinnedViewContainers.find(({ id: pinnedId }) => pinnedId === id)?.visible,
|
|
458
|
+
order
|
|
459
|
+
}))));
|
|
460
|
+
this.setPlaceholderViewContainers(( cachedViewContainers.map(({ id, icon, name, views, isBuiltin }) => ({
|
|
461
|
+
id,
|
|
462
|
+
iconUrl: URI.isUri(icon) ? icon : undefined,
|
|
463
|
+
themeIcon: ThemeIcon.isThemeIcon(icon) ? icon : undefined,
|
|
464
|
+
name,
|
|
465
|
+
isBuiltin,
|
|
466
|
+
views
|
|
467
|
+
}))));
|
|
468
|
+
this.setViewContainersWorkspaceState(( cachedViewContainers.map(({ id, visible }) => ({
|
|
469
|
+
id,
|
|
470
|
+
visible,
|
|
471
|
+
}))));
|
|
472
|
+
}
|
|
473
|
+
getPinnedViewContainers() {
|
|
474
|
+
return JSON.parse(this.pinnedViewContainersValue);
|
|
475
|
+
}
|
|
476
|
+
setPinnedViewContainers(pinnedViewContainers) {
|
|
477
|
+
this.pinnedViewContainersValue = JSON.stringify(pinnedViewContainers);
|
|
478
|
+
}
|
|
479
|
+
get pinnedViewContainersValue() {
|
|
480
|
+
if (!this._pinnedViewContainersValue) {
|
|
481
|
+
this._pinnedViewContainersValue = this.getStoredPinnedViewContainersValue();
|
|
482
|
+
}
|
|
483
|
+
return this._pinnedViewContainersValue;
|
|
484
|
+
}
|
|
485
|
+
set pinnedViewContainersValue(pinnedViewContainersValue) {
|
|
486
|
+
if (this.pinnedViewContainersValue !== pinnedViewContainersValue) {
|
|
487
|
+
this._pinnedViewContainersValue = pinnedViewContainersValue;
|
|
488
|
+
this.setStoredPinnedViewContainersValue(pinnedViewContainersValue);
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
getStoredPinnedViewContainersValue() {
|
|
492
|
+
return this.storageService.get(this.options.pinnedViewContainersKey, 0 , '[]');
|
|
493
|
+
}
|
|
494
|
+
setStoredPinnedViewContainersValue(value) {
|
|
495
|
+
this.storageService.store(this.options.pinnedViewContainersKey, value, 0 , 0 );
|
|
496
|
+
}
|
|
497
|
+
getPlaceholderViewContainers() {
|
|
498
|
+
return JSON.parse(this.placeholderViewContainersValue);
|
|
499
|
+
}
|
|
500
|
+
setPlaceholderViewContainers(placeholderViewContainers) {
|
|
501
|
+
this.placeholderViewContainersValue = JSON.stringify(placeholderViewContainers);
|
|
502
|
+
}
|
|
503
|
+
get placeholderViewContainersValue() {
|
|
504
|
+
if (!this._placeholderViewContainersValue) {
|
|
505
|
+
this._placeholderViewContainersValue = this.getStoredPlaceholderViewContainersValue();
|
|
506
|
+
}
|
|
507
|
+
return this._placeholderViewContainersValue;
|
|
508
|
+
}
|
|
509
|
+
set placeholderViewContainersValue(placeholderViewContainesValue) {
|
|
510
|
+
if (this.placeholderViewContainersValue !== placeholderViewContainesValue) {
|
|
511
|
+
this._placeholderViewContainersValue = placeholderViewContainesValue;
|
|
512
|
+
this.setStoredPlaceholderViewContainersValue(placeholderViewContainesValue);
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
getStoredPlaceholderViewContainersValue() {
|
|
516
|
+
return this.storageService.get(this.options.placeholderViewContainersKey, 0 , '[]');
|
|
517
|
+
}
|
|
518
|
+
setStoredPlaceholderViewContainersValue(value) {
|
|
519
|
+
this.storageService.store(this.options.placeholderViewContainersKey, value, 0 , 1 );
|
|
520
|
+
}
|
|
521
|
+
getViewContainersWorkspaceState() {
|
|
522
|
+
return JSON.parse(this.viewContainersWorkspaceStateValue);
|
|
523
|
+
}
|
|
524
|
+
setViewContainersWorkspaceState(viewContainersWorkspaceState) {
|
|
525
|
+
this.viewContainersWorkspaceStateValue = JSON.stringify(viewContainersWorkspaceState);
|
|
526
|
+
}
|
|
527
|
+
get viewContainersWorkspaceStateValue() {
|
|
528
|
+
if (!this._viewContainersWorkspaceStateValue) {
|
|
529
|
+
this._viewContainersWorkspaceStateValue = this.getStoredViewContainersWorkspaceStateValue();
|
|
530
|
+
}
|
|
531
|
+
return this._viewContainersWorkspaceStateValue;
|
|
532
|
+
}
|
|
533
|
+
set viewContainersWorkspaceStateValue(viewContainersWorkspaceStateValue) {
|
|
534
|
+
if (this.viewContainersWorkspaceStateValue !== viewContainersWorkspaceStateValue) {
|
|
535
|
+
this._viewContainersWorkspaceStateValue = viewContainersWorkspaceStateValue;
|
|
536
|
+
this.setStoredViewContainersWorkspaceStateValue(viewContainersWorkspaceStateValue);
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
getStoredViewContainersWorkspaceStateValue() {
|
|
540
|
+
return this.storageService.get(this.options.viewContainersWorkspaceStateKey, 1 , '[]');
|
|
541
|
+
}
|
|
542
|
+
setStoredViewContainersWorkspaceStateValue(value) {
|
|
543
|
+
this.storageService.store(this.options.viewContainersWorkspaceStateKey, value, 1 , 1 );
|
|
544
|
+
}
|
|
545
|
+
};
|
|
546
|
+
PaneCompositeBar = ( __decorate([
|
|
547
|
+
( __param(3, IInstantiationService)),
|
|
548
|
+
( __param(4, IStorageService)),
|
|
549
|
+
( __param(5, IExtensionService)),
|
|
550
|
+
( __param(6, IViewDescriptorService)),
|
|
551
|
+
( __param(7, IContextKeyService)),
|
|
552
|
+
( __param(8, IWorkbenchEnvironmentService)),
|
|
553
|
+
( __param(9, IWorkbenchLayoutService))
|
|
554
|
+
], PaneCompositeBar));
|
|
555
|
+
let ViewContainerActivityAction = class ViewContainerActivityAction extends CompositeBarAction {
|
|
556
|
+
static { ViewContainerActivityAction_1 = this; }
|
|
557
|
+
static { this.preventDoubleClickDelay = 300; }
|
|
558
|
+
constructor(compositeBarActionItem, part, paneCompositePart, layoutService, telemetryService, configurationService, activityService) {
|
|
559
|
+
super(compositeBarActionItem);
|
|
560
|
+
this.part = part;
|
|
561
|
+
this.paneCompositePart = paneCompositePart;
|
|
562
|
+
this.layoutService = layoutService;
|
|
563
|
+
this.telemetryService = telemetryService;
|
|
564
|
+
this.configurationService = configurationService;
|
|
565
|
+
this.activityService = activityService;
|
|
566
|
+
this.lastRun = 0;
|
|
567
|
+
this.updateActivity();
|
|
568
|
+
this._register(this.activityService.onDidChangeActivity(viewContainerOrAction => {
|
|
569
|
+
if (!isString(viewContainerOrAction) && viewContainerOrAction.id === this.compositeBarActionItem.id) {
|
|
570
|
+
this.updateActivity();
|
|
571
|
+
}
|
|
572
|
+
}));
|
|
573
|
+
}
|
|
574
|
+
updateCompositeBarActionItem(compositeBarActionItem) {
|
|
575
|
+
this.compositeBarActionItem = compositeBarActionItem;
|
|
576
|
+
}
|
|
577
|
+
updateActivity() {
|
|
578
|
+
const activities = this.activityService.getViewContainerActivities(this.compositeBarActionItem.id);
|
|
579
|
+
this.activity = activities[0];
|
|
580
|
+
}
|
|
581
|
+
async run(event) {
|
|
582
|
+
if (isMouseEvent(event) && event.button === 2) {
|
|
583
|
+
return;
|
|
584
|
+
}
|
|
585
|
+
const now = Date.now();
|
|
586
|
+
if (now > this.lastRun && now - this.lastRun < ViewContainerActivityAction_1.preventDoubleClickDelay) {
|
|
587
|
+
return;
|
|
588
|
+
}
|
|
589
|
+
this.lastRun = now;
|
|
590
|
+
const focus = (event && 'preserveFocus' in event) ? !event.preserveFocus : true;
|
|
591
|
+
if (this.part === "workbench.parts.activitybar" ) {
|
|
592
|
+
const sideBarVisible = this.layoutService.isVisible("workbench.parts.sidebar" );
|
|
593
|
+
const activeViewlet = this.paneCompositePart.getActivePaneComposite();
|
|
594
|
+
const focusBehavior = this.configurationService.getValue('workbench.activityBar.iconClickBehavior');
|
|
595
|
+
if (sideBarVisible && activeViewlet?.getId() === this.compositeBarActionItem.id) {
|
|
596
|
+
switch (focusBehavior) {
|
|
597
|
+
case 'focus':
|
|
598
|
+
this.logAction('refocus');
|
|
599
|
+
this.paneCompositePart.openPaneComposite(this.compositeBarActionItem.id, focus);
|
|
600
|
+
break;
|
|
601
|
+
case 'toggle':
|
|
602
|
+
default:
|
|
603
|
+
this.logAction('hide');
|
|
604
|
+
this.layoutService.setPartHidden(true, "workbench.parts.sidebar" );
|
|
605
|
+
break;
|
|
606
|
+
}
|
|
607
|
+
return;
|
|
608
|
+
}
|
|
609
|
+
this.logAction('show');
|
|
610
|
+
}
|
|
611
|
+
await this.paneCompositePart.openPaneComposite(this.compositeBarActionItem.id, focus);
|
|
612
|
+
return this.activate();
|
|
613
|
+
}
|
|
614
|
+
logAction(action) {
|
|
615
|
+
this.telemetryService.publicLog2('activityBarAction', { viewletId: this.compositeBarActionItem.id, action });
|
|
616
|
+
}
|
|
617
|
+
};
|
|
618
|
+
ViewContainerActivityAction = ViewContainerActivityAction_1 = ( __decorate([
|
|
619
|
+
( __param(3, IWorkbenchLayoutService)),
|
|
620
|
+
( __param(4, ITelemetryService)),
|
|
621
|
+
( __param(5, IConfigurationService)),
|
|
622
|
+
( __param(6, IActivityService))
|
|
623
|
+
], ViewContainerActivityAction));
|
|
624
|
+
class PlaceHolderViewContainerActivityAction extends ViewContainerActivityAction {
|
|
625
|
+
}
|
|
626
|
+
class PlaceHolderToggleCompositePinnedAction extends ToggleCompositePinnedAction {
|
|
627
|
+
constructor(id, compositeBar) {
|
|
628
|
+
super({ id, name: id, classNames: undefined }, compositeBar);
|
|
629
|
+
}
|
|
630
|
+
setActivity(activity) {
|
|
631
|
+
this.label = activity.name;
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
class PlaceHolderToggleCompositeBadgeAction extends ToggleCompositeBadgeAction {
|
|
635
|
+
constructor(id, compositeBar) {
|
|
636
|
+
super({ id, name: id, classNames: undefined }, compositeBar);
|
|
637
|
+
}
|
|
638
|
+
setCompositeBarActionItem(actionItem) {
|
|
639
|
+
this.label = actionItem.name;
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
export { PaneCompositeBar };
|