@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,234 @@
|
|
|
1
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
+
import { Dimension, getWindow, EventType, addDisposableListener, findParentWithClass } from 'vscode/vscode/vs/base/browser/dom';
|
|
3
|
+
import { CancellationTokenSource } from 'vscode/vscode/vs/base/common/cancellation';
|
|
4
|
+
import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
5
|
+
import { MutableDisposable, DisposableStore, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
6
|
+
import { MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
7
|
+
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
|
|
8
|
+
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
9
|
+
import { IContextMenuService } from 'vscode/vscode/vs/platform/contextview/browser/contextView.service';
|
|
10
|
+
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
11
|
+
import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding.service';
|
|
12
|
+
import { IOpenerService } from 'vscode/vscode/vs/platform/opener/common/opener.service';
|
|
13
|
+
import { IProgressService } from 'vscode/vscode/vs/platform/progress/common/progress.service';
|
|
14
|
+
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
15
|
+
import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry.service';
|
|
16
|
+
import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService.service';
|
|
17
|
+
import { ViewPane, ViewPaneShowActions } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPane';
|
|
18
|
+
import { Memento } from 'vscode/vscode/vs/workbench/common/memento';
|
|
19
|
+
import { IViewDescriptorService } from 'vscode/vscode/vs/workbench/common/views.service';
|
|
20
|
+
import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService.service';
|
|
21
|
+
import { ExtensionKeyedWebviewOriginStore } from 'vscode/vscode/vs/workbench/contrib/webview/browser/webview';
|
|
22
|
+
import { IWebviewService } from 'vscode/vscode/vs/workbench/contrib/webview/browser/webview.service';
|
|
23
|
+
import { WebviewWindowDragMonitor } from 'vscode/vscode/vs/workbench/contrib/webview/browser/webviewWindowDragMonitor';
|
|
24
|
+
import { IWebviewViewService } from 'vscode/vscode/vs/workbench/contrib/webviewView/browser/webviewViewService.service';
|
|
25
|
+
import { NumberBadge } from 'vscode/vscode/vs/workbench/services/activity/common/activity';
|
|
26
|
+
import { IActivityService } from 'vscode/vscode/vs/workbench/services/activity/common/activity.service';
|
|
27
|
+
import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions.service';
|
|
28
|
+
|
|
29
|
+
var WebviewViewPane_1;
|
|
30
|
+
const storageKeys = {
|
|
31
|
+
webviewState: 'webviewState',
|
|
32
|
+
};
|
|
33
|
+
let WebviewViewPane = class WebviewViewPane extends ViewPane {
|
|
34
|
+
static { WebviewViewPane_1 = this; }
|
|
35
|
+
static getOriginStore(storageService) {
|
|
36
|
+
this._originStore ??= ( new ExtensionKeyedWebviewOriginStore('webviewViews.origins', storageService));
|
|
37
|
+
return this._originStore;
|
|
38
|
+
}
|
|
39
|
+
constructor(options, configurationService, contextKeyService, contextMenuService, instantiationService, keybindingService, openerService, telemetryService, themeService, viewDescriptorService, activityService, extensionService, progressService, storageService, viewService, webviewService, webviewViewService) {
|
|
40
|
+
super({ ...options, titleMenuId: MenuId.ViewTitle, showActions: ViewPaneShowActions.WhenExpanded }, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService);
|
|
41
|
+
this.activityService = activityService;
|
|
42
|
+
this.extensionService = extensionService;
|
|
43
|
+
this.progressService = progressService;
|
|
44
|
+
this.storageService = storageService;
|
|
45
|
+
this.viewService = viewService;
|
|
46
|
+
this.webviewService = webviewService;
|
|
47
|
+
this.webviewViewService = webviewViewService;
|
|
48
|
+
this._webview = this._register(( new MutableDisposable()));
|
|
49
|
+
this._webviewDisposables = this._register(( new DisposableStore()));
|
|
50
|
+
this._activated = false;
|
|
51
|
+
this.activity = this._register(( new MutableDisposable()));
|
|
52
|
+
this._onDidChangeVisibility = this._register(( new Emitter()));
|
|
53
|
+
this.onDidChangeVisibility = this._onDidChangeVisibility.event;
|
|
54
|
+
this._onDispose = this._register(( new Emitter()));
|
|
55
|
+
this.onDispose = this._onDispose.event;
|
|
56
|
+
this.extensionId = options.fromExtensionId;
|
|
57
|
+
this.defaultTitle = this.title;
|
|
58
|
+
this.memento = ( new Memento(`webviewView.${this.id}`, storageService));
|
|
59
|
+
this.viewState = this.memento.getMemento(1 , 1 );
|
|
60
|
+
this._register(this.onDidChangeBodyVisibility(() => this.updateTreeVisibility()));
|
|
61
|
+
this._register(this.webviewViewService.onNewResolverRegistered(e => {
|
|
62
|
+
if (e.viewType === this.id) {
|
|
63
|
+
this.updateTreeVisibility();
|
|
64
|
+
}
|
|
65
|
+
}));
|
|
66
|
+
this.updateTreeVisibility();
|
|
67
|
+
}
|
|
68
|
+
dispose() {
|
|
69
|
+
this._onDispose.fire();
|
|
70
|
+
clearTimeout(this._repositionTimeout);
|
|
71
|
+
super.dispose();
|
|
72
|
+
}
|
|
73
|
+
focus() {
|
|
74
|
+
super.focus();
|
|
75
|
+
this._webview.value?.focus();
|
|
76
|
+
}
|
|
77
|
+
renderBody(container) {
|
|
78
|
+
super.renderBody(container);
|
|
79
|
+
this._container = container;
|
|
80
|
+
this._rootContainer = undefined;
|
|
81
|
+
if (!this._resizeObserver) {
|
|
82
|
+
this._resizeObserver = ( new ResizeObserver(() => {
|
|
83
|
+
setTimeout(() => {
|
|
84
|
+
this.layoutWebview();
|
|
85
|
+
}, 0);
|
|
86
|
+
}));
|
|
87
|
+
this._register(toDisposable(() => {
|
|
88
|
+
this._resizeObserver.disconnect();
|
|
89
|
+
}));
|
|
90
|
+
this._resizeObserver.observe(container);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
saveState() {
|
|
94
|
+
if (this._webview.value) {
|
|
95
|
+
this.viewState[storageKeys.webviewState] = this._webview.value.state;
|
|
96
|
+
}
|
|
97
|
+
this.memento.saveMemento();
|
|
98
|
+
super.saveState();
|
|
99
|
+
}
|
|
100
|
+
layoutBody(height, width) {
|
|
101
|
+
super.layoutBody(height, width);
|
|
102
|
+
this.layoutWebview(( new Dimension(width, height)));
|
|
103
|
+
}
|
|
104
|
+
updateTreeVisibility() {
|
|
105
|
+
if (this.isBodyVisible()) {
|
|
106
|
+
this.activate();
|
|
107
|
+
this._webview.value?.claim(this, getWindow(this.element), undefined);
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
this._webview.value?.release(this);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
activate() {
|
|
114
|
+
if (this._activated) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
this._activated = true;
|
|
118
|
+
const origin = this.extensionId ? WebviewViewPane_1.getOriginStore(this.storageService).getOrigin(this.id, this.extensionId) : undefined;
|
|
119
|
+
const webview = this.webviewService.createWebviewOverlay({
|
|
120
|
+
origin,
|
|
121
|
+
providedViewType: this.id,
|
|
122
|
+
title: this.title,
|
|
123
|
+
options: { purpose: "webviewView" },
|
|
124
|
+
contentOptions: {},
|
|
125
|
+
extension: this.extensionId ? { id: this.extensionId } : undefined
|
|
126
|
+
});
|
|
127
|
+
webview.state = this.viewState[storageKeys.webviewState];
|
|
128
|
+
this._webview.value = webview;
|
|
129
|
+
if (this._container) {
|
|
130
|
+
this.layoutWebview();
|
|
131
|
+
}
|
|
132
|
+
this._webviewDisposables.add(toDisposable(() => {
|
|
133
|
+
this._webview.value?.release(this);
|
|
134
|
+
}));
|
|
135
|
+
this._webviewDisposables.add(webview.onDidUpdateState(() => {
|
|
136
|
+
this.viewState[storageKeys.webviewState] = webview.state;
|
|
137
|
+
}));
|
|
138
|
+
for (const event of [EventType.DRAG, EventType.DRAG_END, EventType.DRAG_ENTER, EventType.DRAG_LEAVE, EventType.DRAG_START]) {
|
|
139
|
+
this._webviewDisposables.add(addDisposableListener(this._webview.value.container, event, e => {
|
|
140
|
+
e.preventDefault();
|
|
141
|
+
e.stopImmediatePropagation();
|
|
142
|
+
this.dropTargetElement.dispatchEvent(( new DragEvent(e.type, e)));
|
|
143
|
+
}));
|
|
144
|
+
}
|
|
145
|
+
this._webviewDisposables.add(( new WebviewWindowDragMonitor(getWindow(this.element), () => this._webview.value)));
|
|
146
|
+
const source = this._webviewDisposables.add(( new CancellationTokenSource()));
|
|
147
|
+
this.withProgress(async () => {
|
|
148
|
+
await this.extensionService.activateByEvent(`onView:${this.id}`);
|
|
149
|
+
const self = this;
|
|
150
|
+
const webviewView = {
|
|
151
|
+
webview,
|
|
152
|
+
onDidChangeVisibility: this.onDidChangeBodyVisibility,
|
|
153
|
+
onDispose: this.onDispose,
|
|
154
|
+
get title() { return self.setTitle; },
|
|
155
|
+
set title(value) { self.updateTitle(value); },
|
|
156
|
+
get description() { return self.titleDescription; },
|
|
157
|
+
set description(value) { self.updateTitleDescription(value); },
|
|
158
|
+
get badge() { return self.badge; },
|
|
159
|
+
set badge(badge) { self.updateBadge(badge); },
|
|
160
|
+
dispose: () => {
|
|
161
|
+
this._activated = false;
|
|
162
|
+
this._webview.clear();
|
|
163
|
+
this._webviewDisposables.clear();
|
|
164
|
+
},
|
|
165
|
+
show: (preserveFocus) => {
|
|
166
|
+
this.viewService.openView(this.id, !preserveFocus);
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
await this.webviewViewService.resolve(this.id, webviewView, source.token);
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
updateTitle(value) {
|
|
173
|
+
this.setTitle = value;
|
|
174
|
+
super.updateTitle(typeof value === 'string' ? value : this.defaultTitle);
|
|
175
|
+
}
|
|
176
|
+
updateBadge(badge) {
|
|
177
|
+
if (this.badge?.value === badge?.value &&
|
|
178
|
+
this.badge?.tooltip === badge?.tooltip) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
this.badge = badge;
|
|
182
|
+
if (badge) {
|
|
183
|
+
const activity = {
|
|
184
|
+
badge: ( new NumberBadge(badge.value, () => badge.tooltip)),
|
|
185
|
+
priority: 150
|
|
186
|
+
};
|
|
187
|
+
this.activity.value = this.activityService.showViewActivity(this.id, activity);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
async withProgress(task) {
|
|
191
|
+
return this.progressService.withProgress({ location: this.id, delay: 500 }, task);
|
|
192
|
+
}
|
|
193
|
+
onDidScrollRoot() {
|
|
194
|
+
this.layoutWebview();
|
|
195
|
+
}
|
|
196
|
+
doLayoutWebview(dimension) {
|
|
197
|
+
const webviewEntry = this._webview.value;
|
|
198
|
+
if (!this._container || !webviewEntry) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
if (!this._rootContainer || !this._rootContainer.isConnected) {
|
|
202
|
+
this._rootContainer = this.findRootContainer(this._container);
|
|
203
|
+
}
|
|
204
|
+
webviewEntry.layoutWebviewOverElement(this._container, dimension, this._rootContainer);
|
|
205
|
+
}
|
|
206
|
+
layoutWebview(dimension) {
|
|
207
|
+
this.doLayoutWebview(dimension);
|
|
208
|
+
clearTimeout(this._repositionTimeout);
|
|
209
|
+
this._repositionTimeout = setTimeout(() => this.doLayoutWebview(dimension), 200);
|
|
210
|
+
}
|
|
211
|
+
findRootContainer(container) {
|
|
212
|
+
return findParentWithClass(container, 'monaco-scrollable-element') ?? undefined;
|
|
213
|
+
}
|
|
214
|
+
};
|
|
215
|
+
WebviewViewPane = WebviewViewPane_1 = ( __decorate([
|
|
216
|
+
( __param(1, IConfigurationService)),
|
|
217
|
+
( __param(2, IContextKeyService)),
|
|
218
|
+
( __param(3, IContextMenuService)),
|
|
219
|
+
( __param(4, IInstantiationService)),
|
|
220
|
+
( __param(5, IKeybindingService)),
|
|
221
|
+
( __param(6, IOpenerService)),
|
|
222
|
+
( __param(7, ITelemetryService)),
|
|
223
|
+
( __param(8, IThemeService)),
|
|
224
|
+
( __param(9, IViewDescriptorService)),
|
|
225
|
+
( __param(10, IActivityService)),
|
|
226
|
+
( __param(11, IExtensionService)),
|
|
227
|
+
( __param(12, IProgressService)),
|
|
228
|
+
( __param(13, IStorageService)),
|
|
229
|
+
( __param(14, IViewsService)),
|
|
230
|
+
( __param(15, IWebviewService)),
|
|
231
|
+
( __param(16, IWebviewViewService))
|
|
232
|
+
], WebviewViewPane));
|
|
233
|
+
|
|
234
|
+
export { WebviewViewPane };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { promiseWithResolvers } from 'vscode/vscode/vs/base/common/async';
|
|
2
|
+
import { CancellationToken } from 'vscode/vscode/vs/base/common/cancellation';
|
|
3
|
+
import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
4
|
+
import { Disposable, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
5
|
+
|
|
6
|
+
class WebviewViewService extends Disposable {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this._resolvers = ( new Map());
|
|
10
|
+
this._awaitingRevival = ( new Map());
|
|
11
|
+
this._onNewResolverRegistered = this._register(( new Emitter()));
|
|
12
|
+
this.onNewResolverRegistered = this._onNewResolverRegistered.event;
|
|
13
|
+
}
|
|
14
|
+
register(viewType, resolver) {
|
|
15
|
+
if (( this._resolvers.has(viewType))) {
|
|
16
|
+
throw new Error(`View resolver already registered for ${viewType}`);
|
|
17
|
+
}
|
|
18
|
+
this._resolvers.set(viewType, resolver);
|
|
19
|
+
this._onNewResolverRegistered.fire({ viewType: viewType });
|
|
20
|
+
const pending = this._awaitingRevival.get(viewType);
|
|
21
|
+
if (pending) {
|
|
22
|
+
resolver.resolve(pending.webview, CancellationToken.None).then(() => {
|
|
23
|
+
this._awaitingRevival.delete(viewType);
|
|
24
|
+
pending.resolve();
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return toDisposable(() => {
|
|
28
|
+
this._resolvers.delete(viewType);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
resolve(viewType, webview, cancellation) {
|
|
32
|
+
const resolver = this._resolvers.get(viewType);
|
|
33
|
+
if (!resolver) {
|
|
34
|
+
if (( this._awaitingRevival.has(viewType))) {
|
|
35
|
+
throw new Error('View already awaiting revival');
|
|
36
|
+
}
|
|
37
|
+
const { promise, resolve } = promiseWithResolvers();
|
|
38
|
+
this._awaitingRevival.set(viewType, { webview, resolve });
|
|
39
|
+
return promise;
|
|
40
|
+
}
|
|
41
|
+
return resolver.resolve(webview, cancellation);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export { WebviewViewService };
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
+
import { IActivityService } from 'vscode/vscode/vs/workbench/services/activity/common/activity.service';
|
|
3
|
+
import { Disposable, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
4
|
+
import { IViewDescriptorService } from 'vscode/vscode/vs/workbench/common/views.service';
|
|
5
|
+
import { ACCOUNTS_ACTIVITY_ID, GLOBAL_ACTIVITY_ID } from 'vscode/vscode/vs/workbench/common/activity';
|
|
6
|
+
import { Event, Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
7
|
+
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
8
|
+
import { isUndefined } from 'vscode/vscode/vs/base/common/types';
|
|
9
|
+
|
|
10
|
+
let ViewContainerActivityByView = class ViewContainerActivityByView extends Disposable {
|
|
11
|
+
constructor(viewId, viewDescriptorService, activityService) {
|
|
12
|
+
super();
|
|
13
|
+
this.viewId = viewId;
|
|
14
|
+
this.viewDescriptorService = viewDescriptorService;
|
|
15
|
+
this.activityService = activityService;
|
|
16
|
+
this.activity = undefined;
|
|
17
|
+
this.activityDisposable = Disposable.None;
|
|
18
|
+
this._register(Event.filter(this.viewDescriptorService.onDidChangeContainer, e => ( e.views.some(view => view.id === viewId)))(() => this.update()));
|
|
19
|
+
this._register(Event.filter(this.viewDescriptorService.onDidChangeLocation, e => ( e.views.some(view => view.id === viewId)))(() => this.update()));
|
|
20
|
+
}
|
|
21
|
+
setActivity(activity) {
|
|
22
|
+
this.activity = activity;
|
|
23
|
+
this.update();
|
|
24
|
+
}
|
|
25
|
+
clearActivity() {
|
|
26
|
+
this.activity = undefined;
|
|
27
|
+
this.update();
|
|
28
|
+
}
|
|
29
|
+
update() {
|
|
30
|
+
this.activityDisposable.dispose();
|
|
31
|
+
const container = this.viewDescriptorService.getViewContainerByViewId(this.viewId);
|
|
32
|
+
if (container && this.activity) {
|
|
33
|
+
this.activityDisposable = this.activityService.showViewContainerActivity(container.id, this.activity);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
dispose() {
|
|
37
|
+
this.activityDisposable.dispose();
|
|
38
|
+
super.dispose();
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
ViewContainerActivityByView = ( __decorate([
|
|
42
|
+
( __param(1, IViewDescriptorService)),
|
|
43
|
+
( __param(2, IActivityService))
|
|
44
|
+
], ViewContainerActivityByView));
|
|
45
|
+
let ActivityService = class ActivityService extends Disposable {
|
|
46
|
+
constructor(viewDescriptorService, instantiationService) {
|
|
47
|
+
super();
|
|
48
|
+
this.viewDescriptorService = viewDescriptorService;
|
|
49
|
+
this.instantiationService = instantiationService;
|
|
50
|
+
this.viewActivities = ( new Map());
|
|
51
|
+
this._onDidChangeActivity = this._register(( new Emitter()));
|
|
52
|
+
this.onDidChangeActivity = this._onDidChangeActivity.event;
|
|
53
|
+
this.viewContainerActivities = ( new Map());
|
|
54
|
+
this.globalActivities = ( new Map());
|
|
55
|
+
}
|
|
56
|
+
showViewContainerActivity(viewContainerId, activity) {
|
|
57
|
+
const viewContainer = this.viewDescriptorService.getViewContainerById(viewContainerId);
|
|
58
|
+
if (viewContainer) {
|
|
59
|
+
let activities = this.viewContainerActivities.get(viewContainerId);
|
|
60
|
+
if (!activities) {
|
|
61
|
+
activities = [];
|
|
62
|
+
this.viewContainerActivities.set(viewContainerId, activities);
|
|
63
|
+
}
|
|
64
|
+
for (let i = 0; i <= activities.length; i++) {
|
|
65
|
+
if (i === activities.length || isUndefined(activity.priority)) {
|
|
66
|
+
activities.push(activity);
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
else if (isUndefined(activities[i].priority) || activities[i].priority <= activity.priority) {
|
|
70
|
+
activities.splice(i, 0, activity);
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
this._onDidChangeActivity.fire(viewContainer);
|
|
75
|
+
return toDisposable(() => {
|
|
76
|
+
activities.splice(activities.indexOf(activity), 1);
|
|
77
|
+
if (activities.length === 0) {
|
|
78
|
+
this.viewContainerActivities.delete(viewContainerId);
|
|
79
|
+
}
|
|
80
|
+
this._onDidChangeActivity.fire(viewContainer);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
return Disposable.None;
|
|
84
|
+
}
|
|
85
|
+
getViewContainerActivities(viewContainerId) {
|
|
86
|
+
const viewContainer = this.viewDescriptorService.getViewContainerById(viewContainerId);
|
|
87
|
+
if (viewContainer) {
|
|
88
|
+
return this.viewContainerActivities.get(viewContainerId) ?? [];
|
|
89
|
+
}
|
|
90
|
+
return [];
|
|
91
|
+
}
|
|
92
|
+
showViewActivity(viewId, activity) {
|
|
93
|
+
let maybeItem = this.viewActivities.get(viewId);
|
|
94
|
+
if (maybeItem) {
|
|
95
|
+
maybeItem.id++;
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
maybeItem = {
|
|
99
|
+
id: 1,
|
|
100
|
+
activity: this.instantiationService.createInstance(ViewContainerActivityByView, viewId)
|
|
101
|
+
};
|
|
102
|
+
this.viewActivities.set(viewId, maybeItem);
|
|
103
|
+
}
|
|
104
|
+
const id = maybeItem.id;
|
|
105
|
+
maybeItem.activity.setActivity(activity);
|
|
106
|
+
const item = maybeItem;
|
|
107
|
+
return toDisposable(() => {
|
|
108
|
+
if (item.id === id) {
|
|
109
|
+
item.activity.dispose();
|
|
110
|
+
this.viewActivities.delete(viewId);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
showAccountsActivity(activity) {
|
|
115
|
+
return this.showActivity(ACCOUNTS_ACTIVITY_ID, activity);
|
|
116
|
+
}
|
|
117
|
+
showGlobalActivity(activity) {
|
|
118
|
+
return this.showActivity(GLOBAL_ACTIVITY_ID, activity);
|
|
119
|
+
}
|
|
120
|
+
getActivity(id) {
|
|
121
|
+
return this.globalActivities.get(id) ?? [];
|
|
122
|
+
}
|
|
123
|
+
showActivity(id, activity) {
|
|
124
|
+
let activities = this.globalActivities.get(id);
|
|
125
|
+
if (!activities) {
|
|
126
|
+
activities = [];
|
|
127
|
+
this.globalActivities.set(id, activities);
|
|
128
|
+
}
|
|
129
|
+
activities.push(activity);
|
|
130
|
+
this._onDidChangeActivity.fire(id);
|
|
131
|
+
return toDisposable(() => {
|
|
132
|
+
activities.splice(activities.indexOf(activity), 1);
|
|
133
|
+
if (activities.length === 0) {
|
|
134
|
+
this.globalActivities.delete(id);
|
|
135
|
+
}
|
|
136
|
+
this._onDidChangeActivity.fire(id);
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
ActivityService = ( __decorate([
|
|
141
|
+
( __param(0, IViewDescriptorService)),
|
|
142
|
+
( __param(1, IInstantiationService))
|
|
143
|
+
], ActivityService));
|
|
144
|
+
|
|
145
|
+
export { ActivityService };
|