@codingame/monaco-vscode-views-service-override 1.83.10-next.0 → 1.83.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-views-service-override",
|
|
3
|
-
"version": "1.83.
|
|
3
|
+
"version": "1.83.11",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -18,14 +18,14 @@
|
|
|
18
18
|
"module": "index.js",
|
|
19
19
|
"types": "index.d.ts",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"vscode": "npm:@codingame/monaco-vscode-api@1.83.
|
|
21
|
+
"vscode": "npm:@codingame/monaco-vscode-api@1.83.11",
|
|
22
22
|
"monaco-editor": "0.44.0",
|
|
23
|
-
"@codingame/monaco-vscode-bulk-edit-service-override": "1.83.
|
|
24
|
-
"@codingame/monaco-vscode-layout-service-override": "1.83.
|
|
25
|
-
"@codingame/monaco-vscode-quickaccess-service-override": "1.83.
|
|
26
|
-
"@codingame/monaco-vscode-keybindings-service-override": "1.83.
|
|
27
|
-
"@codingame/monaco-vscode-environment-service-override": "1.83.
|
|
28
|
-
"@codingame/monaco-vscode-extensions-service-override": "1.83.
|
|
29
|
-
"@codingame/monaco-vscode-files-service-override": "1.83.
|
|
23
|
+
"@codingame/monaco-vscode-bulk-edit-service-override": "1.83.11",
|
|
24
|
+
"@codingame/monaco-vscode-layout-service-override": "1.83.11",
|
|
25
|
+
"@codingame/monaco-vscode-quickaccess-service-override": "1.83.11",
|
|
26
|
+
"@codingame/monaco-vscode-keybindings-service-override": "1.83.11",
|
|
27
|
+
"@codingame/monaco-vscode-environment-service-override": "1.83.11",
|
|
28
|
+
"@codingame/monaco-vscode-extensions-service-override": "1.83.11",
|
|
29
|
+
"@codingame/monaco-vscode-files-service-override": "1.83.11"
|
|
30
30
|
}
|
|
31
31
|
}
|
package/views.js
CHANGED
|
@@ -88,6 +88,8 @@ export { ConfirmResult } from './override/vs/platform/dialogs/common/dialogs.js'
|
|
|
88
88
|
import { ILayoutService } from 'monaco-editor/esm/vs/platform/layout/browser/layoutService.js';
|
|
89
89
|
import { IBannerService } from 'vscode/vscode/vs/workbench/services/banner/browser/bannerService';
|
|
90
90
|
import { ITitleService } from 'vscode/vscode/vs/workbench/services/title/common/titleService';
|
|
91
|
+
import { IProgressService } from 'monaco-editor/esm/vs/platform/progress/common/progress.js';
|
|
92
|
+
import { ProgressService } from './vscode/src/vs/workbench/services/progress/browser/progressService.js';
|
|
91
93
|
import { DomScrollableElement } from 'monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollableElement.js';
|
|
92
94
|
import { assertAllDefined, assertIsDefined } from 'monaco-editor/esm/vs/base/common/types.js';
|
|
93
95
|
export { AbstractResourceEditorInput } from 'vscode/vscode/vs/workbench/common/editor/resourceEditorInput';
|
|
@@ -544,7 +546,8 @@ function getServiceOverride(openEditorFallback, _webviewIframeAlternateDomains,
|
|
|
544
546
|
[( ICustomEditorService.toString())]: new SyncDescriptor(CustomEditorService, [], true),
|
|
545
547
|
[( IWebviewService.toString())]: new SyncDescriptor(WebviewService, [], true),
|
|
546
548
|
[( IWebviewViewService.toString())]: new SyncDescriptor(WebviewViewService, [], true),
|
|
547
|
-
[( IWebviewWorkbenchService.toString())]: new SyncDescriptor(WebviewEditorService, [], true)
|
|
549
|
+
[( IWebviewWorkbenchService.toString())]: new SyncDescriptor(WebviewEditorService, [], true),
|
|
550
|
+
[( IProgressService.toString())]: new SyncDescriptor(ProgressService, [], true)
|
|
548
551
|
};
|
|
549
552
|
}
|
|
550
553
|
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import n from '../../../../../../../../external/rollup-plugin-styles/dist/runtime/inject-css.js';
|
|
2
|
+
|
|
3
|
+
var css = ".monaco-workbench .progress-badge>.badge-content:before{background-color:currentColor;bottom:0;content:\"\";height:14px;left:0;margin:auto;mask:url(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNCIgaGVpZ2h0PSIxNCIgdmlld0JveD0iMiAyIDE0IDE0Ij48cGF0aCBmaWxsPSIjZmZmIiBkPSJNOSAxNmMtMy44NiAwLTctMy4xNC03LTdzMy4xNC03IDctN2MzLjg1OSAwIDcgMy4xNDEgNyA3cy0zLjE0MSA3LTcgN3pNOSAzLjRDNS45MTIgMy40IDMuNCA1LjkxMyAzLjQgOXMyLjUxMiA1LjYgNS42IDUuNiA1LjYtMi41MTIgNS42LTUuNlMxMi4wODggMy40IDkgMy40em0zLjg2IDcuMUw5LjcgOC42MDRWNC44SDguM3Y0LjU5NmwzLjg0IDIuMzA1LjcyLTEuMjAxeiIvPjwvc3ZnPg==\");-webkit-mask:url(\"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNCIgaGVpZ2h0PSIxNCIgdmlld0JveD0iMiAyIDE0IDE0Ij48cGF0aCBmaWxsPSIjZmZmIiBkPSJNOSAxNmMtMy44NiAwLTctMy4xNC03LTdzMy4xNC03IDctN2MzLjg1OSAwIDcgMy4xNDEgNyA3cy0zLjE0MSA3LTcgN3pNOSAzLjRDNS45MTIgMy40IDMuNCA1LjkxMyAzLjQgOXMyLjUxMiA1LjYgNS42IDUuNiA1LjYtMi41MTIgNS42LTUuNlMxMi4wODggMy40IDkgMy40em0zLjg2IDcuMUw5LjcgOC42MDRWNC44SDguM3Y0LjU5NmwzLjg0IDIuMzA1LjcyLTEuMjAxeiIvPjwvc3ZnPg==\");position:absolute;right:0;top:0;width:14px}";
|
|
4
|
+
n(css,{});
|
|
5
|
+
|
|
6
|
+
export { css, css as default };
|
|
@@ -0,0 +1,512 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import './media/progressService.css.js';
|
|
3
|
+
import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
|
|
4
|
+
import { Disposable, dispose, DisposableStore, toDisposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
5
|
+
import { Progress } from 'monaco-editor/esm/vs/platform/progress/common/progress.js';
|
|
6
|
+
import { IStatusbarService } from 'vscode/vscode/vs/workbench/services/statusbar/browser/statusbar';
|
|
7
|
+
import { timeout, RunOnceScheduler, DeferredPromise } from 'monaco-editor/esm/vs/base/common/async.js';
|
|
8
|
+
import { ProgressBadge, IActivityService } from 'vscode/vscode/vs/workbench/services/activity/common/activity';
|
|
9
|
+
import { NotificationPriority, INotificationService, Severity } from 'monaco-editor/esm/vs/platform/notification/common/notification.js';
|
|
10
|
+
import { Action } from 'monaco-editor/esm/vs/base/common/actions.js';
|
|
11
|
+
import { Emitter, Event } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
12
|
+
import { ILayoutService } from 'monaco-editor/esm/vs/platform/layout/browser/layoutService.js';
|
|
13
|
+
import { Dialog } from 'monaco-editor/esm/vs/base/browser/ui/dialog/dialog.js';
|
|
14
|
+
import { IKeybindingService } from 'monaco-editor/esm/vs/platform/keybinding/common/keybinding.js';
|
|
15
|
+
import { EventHelper } from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
16
|
+
import { parseLinkedText } from 'monaco-editor/esm/vs/base/common/linkedText.js';
|
|
17
|
+
import { IViewDescriptorService, IViewsService } from 'vscode/vscode/vs/workbench/common/views';
|
|
18
|
+
import { IPaneCompositePartService } from 'vscode/vscode/vs/workbench/services/panecomposite/browser/panecomposite';
|
|
19
|
+
import { stripIcons } from 'monaco-editor/esm/vs/base/common/iconLabels.js';
|
|
20
|
+
import { defaultButtonStyles, defaultCheckboxStyles, defaultInputBoxStyles, defaultDialogStyles } from 'monaco-editor/esm/vs/platform/theme/browser/defaultStyles.js';
|
|
21
|
+
|
|
22
|
+
let ProgressService = class ProgressService extends Disposable {
|
|
23
|
+
constructor(activityService, paneCompositeService, viewDescriptorService, viewsService, notificationService, statusbarService, layoutService, keybindingService) {
|
|
24
|
+
super();
|
|
25
|
+
this.activityService = activityService;
|
|
26
|
+
this.paneCompositeService = paneCompositeService;
|
|
27
|
+
this.viewDescriptorService = viewDescriptorService;
|
|
28
|
+
this.viewsService = viewsService;
|
|
29
|
+
this.notificationService = notificationService;
|
|
30
|
+
this.statusbarService = statusbarService;
|
|
31
|
+
this.layoutService = layoutService;
|
|
32
|
+
this.keybindingService = keybindingService;
|
|
33
|
+
this.windowProgressStack = [];
|
|
34
|
+
this.windowProgressStatusEntry = undefined;
|
|
35
|
+
}
|
|
36
|
+
async withProgress(options, task, onDidCancel) {
|
|
37
|
+
const { location } = options;
|
|
38
|
+
const handleStringLocation = (location) => {
|
|
39
|
+
const viewContainer = this.viewDescriptorService.getViewContainerById(location);
|
|
40
|
+
if (viewContainer) {
|
|
41
|
+
const viewContainerLocation = this.viewDescriptorService.getViewContainerLocation(viewContainer);
|
|
42
|
+
if (viewContainerLocation !== null) {
|
|
43
|
+
return this.withPaneCompositeProgress(location, viewContainerLocation, task, { ...options, location });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (this.viewDescriptorService.getViewDescriptorById(location) !== null) {
|
|
47
|
+
return this.withViewProgress(location, task, { ...options, location });
|
|
48
|
+
}
|
|
49
|
+
throw new Error(`Bad progress location: ${location}`);
|
|
50
|
+
};
|
|
51
|
+
if (typeof location === 'string') {
|
|
52
|
+
return handleStringLocation(location);
|
|
53
|
+
}
|
|
54
|
+
switch (location) {
|
|
55
|
+
case 15 :
|
|
56
|
+
return this.withNotificationProgress({ ...options, location, priority: this.notificationService.doNotDisturbMode ? NotificationPriority.SILENT : undefined }, task, onDidCancel);
|
|
57
|
+
case 10 : {
|
|
58
|
+
const type = options.type;
|
|
59
|
+
if (options.command) {
|
|
60
|
+
return this.withWindowProgress({ ...options, location, type }, task);
|
|
61
|
+
}
|
|
62
|
+
return this.withNotificationProgress({ delay: 150 , ...options, priority: NotificationPriority.SILENT, location: 15 , type }, task, onDidCancel);
|
|
63
|
+
}
|
|
64
|
+
case 1 :
|
|
65
|
+
return this.withPaneCompositeProgress('workbench.view.explorer', 0 , task, { ...options, location });
|
|
66
|
+
case 3 :
|
|
67
|
+
return handleStringLocation('workbench.scm');
|
|
68
|
+
case 5 :
|
|
69
|
+
return this.withPaneCompositeProgress('workbench.view.extensions', 0 , task, { ...options, location });
|
|
70
|
+
case 20 :
|
|
71
|
+
return this.withDialogProgress(options, task, onDidCancel);
|
|
72
|
+
default:
|
|
73
|
+
throw new Error(`Bad progress location: ${location}`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
withWindowProgress(options, callback) {
|
|
77
|
+
const task = [options, ( new Progress(() => this.updateWindowProgress()))];
|
|
78
|
+
const promise = callback(task[1]);
|
|
79
|
+
let delayHandle = setTimeout(() => {
|
|
80
|
+
delayHandle = undefined;
|
|
81
|
+
this.windowProgressStack.unshift(task);
|
|
82
|
+
this.updateWindowProgress();
|
|
83
|
+
Promise.all([
|
|
84
|
+
timeout(150),
|
|
85
|
+
promise
|
|
86
|
+
]).finally(() => {
|
|
87
|
+
const idx = this.windowProgressStack.indexOf(task);
|
|
88
|
+
this.windowProgressStack.splice(idx, 1);
|
|
89
|
+
this.updateWindowProgress();
|
|
90
|
+
});
|
|
91
|
+
}, 150);
|
|
92
|
+
return promise.finally(() => clearTimeout(delayHandle));
|
|
93
|
+
}
|
|
94
|
+
updateWindowProgress(idx = 0) {
|
|
95
|
+
if (idx < this.windowProgressStack.length) {
|
|
96
|
+
const [options, progress] = this.windowProgressStack[idx];
|
|
97
|
+
const progressTitle = options.title;
|
|
98
|
+
const progressMessage = progress.value && progress.value.message;
|
|
99
|
+
const progressCommand = options.command;
|
|
100
|
+
let text;
|
|
101
|
+
let title;
|
|
102
|
+
const source = options.source && typeof options.source !== 'string' ? options.source.label : options.source;
|
|
103
|
+
if (progressTitle && progressMessage) {
|
|
104
|
+
text = ( localizeWithPath(
|
|
105
|
+
'vs/workbench/services/progress/browser/progressService',
|
|
106
|
+
'progress.text2',
|
|
107
|
+
"{0}: {1}",
|
|
108
|
+
progressTitle,
|
|
109
|
+
progressMessage
|
|
110
|
+
));
|
|
111
|
+
title = source ? ( localizeWithPath(
|
|
112
|
+
'vs/workbench/services/progress/browser/progressService',
|
|
113
|
+
'progress.title3',
|
|
114
|
+
"[{0}] {1}: {2}",
|
|
115
|
+
source,
|
|
116
|
+
progressTitle,
|
|
117
|
+
progressMessage
|
|
118
|
+
)) : text;
|
|
119
|
+
}
|
|
120
|
+
else if (progressTitle) {
|
|
121
|
+
text = progressTitle;
|
|
122
|
+
title = source ? ( localizeWithPath(
|
|
123
|
+
'vs/workbench/services/progress/browser/progressService',
|
|
124
|
+
'progress.title2',
|
|
125
|
+
"[{0}]: {1}",
|
|
126
|
+
source,
|
|
127
|
+
progressTitle
|
|
128
|
+
)) : text;
|
|
129
|
+
}
|
|
130
|
+
else if (progressMessage) {
|
|
131
|
+
text = progressMessage;
|
|
132
|
+
title = source ? ( localizeWithPath(
|
|
133
|
+
'vs/workbench/services/progress/browser/progressService',
|
|
134
|
+
'progress.title2',
|
|
135
|
+
"[{0}]: {1}",
|
|
136
|
+
source,
|
|
137
|
+
progressMessage
|
|
138
|
+
)) : text;
|
|
139
|
+
}
|
|
140
|
+
else {
|
|
141
|
+
this.updateWindowProgress(idx + 1);
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
const statusEntryProperties = {
|
|
145
|
+
name: ( localizeWithPath(
|
|
146
|
+
'vs/workbench/services/progress/browser/progressService',
|
|
147
|
+
'status.progress',
|
|
148
|
+
"Progress Message"
|
|
149
|
+
)),
|
|
150
|
+
text,
|
|
151
|
+
showProgress: options.type || true,
|
|
152
|
+
ariaLabel: text,
|
|
153
|
+
tooltip: title,
|
|
154
|
+
command: progressCommand
|
|
155
|
+
};
|
|
156
|
+
if (this.windowProgressStatusEntry) {
|
|
157
|
+
this.windowProgressStatusEntry.update(statusEntryProperties);
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
this.windowProgressStatusEntry = this.statusbarService.addEntry(statusEntryProperties, 'status.progress', 0 );
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
this.windowProgressStatusEntry?.dispose();
|
|
165
|
+
this.windowProgressStatusEntry = undefined;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
withNotificationProgress(options, callback, onDidCancel) {
|
|
169
|
+
const progressStateModel = new (class extends Disposable {
|
|
170
|
+
get step() { return this._step; }
|
|
171
|
+
get done() { return this._done; }
|
|
172
|
+
constructor() {
|
|
173
|
+
super();
|
|
174
|
+
this._onDidReport = this._register(( new Emitter()));
|
|
175
|
+
this.onDidReport = this._onDidReport.event;
|
|
176
|
+
this._onWillDispose = this._register(( new Emitter()));
|
|
177
|
+
this.onWillDispose = this._onWillDispose.event;
|
|
178
|
+
this._step = undefined;
|
|
179
|
+
this._done = false;
|
|
180
|
+
this.promise = callback(this);
|
|
181
|
+
this.promise.finally(() => {
|
|
182
|
+
this.dispose();
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
report(step) {
|
|
186
|
+
this._step = step;
|
|
187
|
+
this._onDidReport.fire(step);
|
|
188
|
+
}
|
|
189
|
+
cancel(choice) {
|
|
190
|
+
onDidCancel?.(choice);
|
|
191
|
+
this.dispose();
|
|
192
|
+
}
|
|
193
|
+
dispose() {
|
|
194
|
+
this._done = true;
|
|
195
|
+
this._onWillDispose.fire();
|
|
196
|
+
super.dispose();
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
const createWindowProgress = () => {
|
|
200
|
+
const promise = ( new DeferredPromise());
|
|
201
|
+
this.withWindowProgress({
|
|
202
|
+
location: 10 ,
|
|
203
|
+
title: options.title ? ( parseLinkedText(options.title).toString()) : undefined,
|
|
204
|
+
command: 'notifications.showList',
|
|
205
|
+
type: options.type
|
|
206
|
+
}, progress => {
|
|
207
|
+
function reportProgress(step) {
|
|
208
|
+
if (step.message) {
|
|
209
|
+
progress.report({
|
|
210
|
+
message: ( parseLinkedText(step.message).toString())
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
if (progressStateModel.step) {
|
|
215
|
+
reportProgress(progressStateModel.step);
|
|
216
|
+
}
|
|
217
|
+
const onDidReportListener = progressStateModel.onDidReport(step => reportProgress(step));
|
|
218
|
+
promise.p.finally(() => onDidReportListener.dispose());
|
|
219
|
+
Event.once(progressStateModel.onWillDispose)(() => promise.complete());
|
|
220
|
+
return promise.p;
|
|
221
|
+
});
|
|
222
|
+
return toDisposable(() => promise.complete());
|
|
223
|
+
};
|
|
224
|
+
const createNotification = (message, priority, increment) => {
|
|
225
|
+
const notificationDisposables = ( new DisposableStore());
|
|
226
|
+
const primaryActions = options.primaryActions ? Array.from(options.primaryActions) : [];
|
|
227
|
+
const secondaryActions = options.secondaryActions ? Array.from(options.secondaryActions) : [];
|
|
228
|
+
if (options.buttons) {
|
|
229
|
+
options.buttons.forEach((button, index) => {
|
|
230
|
+
const buttonAction = new (class extends Action {
|
|
231
|
+
constructor() {
|
|
232
|
+
super(`progress.button.${button}`, button, undefined, true);
|
|
233
|
+
}
|
|
234
|
+
async run() {
|
|
235
|
+
progressStateModel.cancel(index);
|
|
236
|
+
}
|
|
237
|
+
});
|
|
238
|
+
notificationDisposables.add(buttonAction);
|
|
239
|
+
primaryActions.push(buttonAction);
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
if (options.cancellable) {
|
|
243
|
+
const cancelAction = new (class extends Action {
|
|
244
|
+
constructor() {
|
|
245
|
+
super('progress.cancel', ( localizeWithPath(
|
|
246
|
+
'vs/workbench/services/progress/browser/progressService',
|
|
247
|
+
'cancel',
|
|
248
|
+
"Cancel"
|
|
249
|
+
)), undefined, true);
|
|
250
|
+
}
|
|
251
|
+
async run() {
|
|
252
|
+
progressStateModel.cancel();
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
notificationDisposables.add(cancelAction);
|
|
256
|
+
primaryActions.push(cancelAction);
|
|
257
|
+
}
|
|
258
|
+
const notification = this.notificationService.notify({
|
|
259
|
+
severity: Severity.Info,
|
|
260
|
+
message: stripIcons(message),
|
|
261
|
+
source: options.source,
|
|
262
|
+
actions: { primary: primaryActions, secondary: secondaryActions },
|
|
263
|
+
progress: typeof increment === 'number' && increment >= 0 ? { total: 100, worked: increment } : { infinite: true },
|
|
264
|
+
priority
|
|
265
|
+
});
|
|
266
|
+
let windowProgressDisposable = undefined;
|
|
267
|
+
const onVisibilityChange = (visible) => {
|
|
268
|
+
dispose(windowProgressDisposable);
|
|
269
|
+
if (!visible && !progressStateModel.done) {
|
|
270
|
+
windowProgressDisposable = createWindowProgress();
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
notificationDisposables.add(notification.onDidChangeVisibility(onVisibilityChange));
|
|
274
|
+
if (priority === NotificationPriority.SILENT) {
|
|
275
|
+
onVisibilityChange(false);
|
|
276
|
+
}
|
|
277
|
+
Event.once(notification.onDidClose)(() => notificationDisposables.dispose());
|
|
278
|
+
return notification;
|
|
279
|
+
};
|
|
280
|
+
const updateProgress = (notification, increment) => {
|
|
281
|
+
if (typeof increment === 'number' && increment >= 0) {
|
|
282
|
+
notification.progress.total(100);
|
|
283
|
+
notification.progress.worked(increment);
|
|
284
|
+
}
|
|
285
|
+
else {
|
|
286
|
+
notification.progress.infinite();
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
let notificationHandle;
|
|
290
|
+
let notificationTimeout;
|
|
291
|
+
let titleAndMessage;
|
|
292
|
+
const updateNotification = (step) => {
|
|
293
|
+
if (step?.message && options.title) {
|
|
294
|
+
titleAndMessage = `${options.title}: ${step.message}`;
|
|
295
|
+
}
|
|
296
|
+
else {
|
|
297
|
+
titleAndMessage = options.title || step?.message;
|
|
298
|
+
}
|
|
299
|
+
if (!notificationHandle && titleAndMessage) {
|
|
300
|
+
if (typeof options.delay === 'number' && options.delay > 0) {
|
|
301
|
+
if (typeof notificationTimeout !== 'number') {
|
|
302
|
+
notificationTimeout = setTimeout(() => notificationHandle = createNotification(titleAndMessage, options.priority, step?.increment), options.delay);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
else {
|
|
306
|
+
notificationHandle = createNotification(titleAndMessage, options.priority, step?.increment);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
if (notificationHandle) {
|
|
310
|
+
if (titleAndMessage) {
|
|
311
|
+
notificationHandle.updateMessage(titleAndMessage);
|
|
312
|
+
}
|
|
313
|
+
if (typeof step?.increment === 'number') {
|
|
314
|
+
updateProgress(notificationHandle, step.increment);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
updateNotification(progressStateModel.step);
|
|
319
|
+
const listener = progressStateModel.onDidReport(step => updateNotification(step));
|
|
320
|
+
Event.once(progressStateModel.onWillDispose)(() => listener.dispose());
|
|
321
|
+
(async () => {
|
|
322
|
+
try {
|
|
323
|
+
if (typeof options.delay === 'number' && options.delay > 0) {
|
|
324
|
+
await progressStateModel.promise;
|
|
325
|
+
}
|
|
326
|
+
else {
|
|
327
|
+
await Promise.all([timeout(800), progressStateModel.promise]);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
finally {
|
|
331
|
+
clearTimeout(notificationTimeout);
|
|
332
|
+
notificationHandle?.close();
|
|
333
|
+
}
|
|
334
|
+
})();
|
|
335
|
+
return progressStateModel.promise;
|
|
336
|
+
}
|
|
337
|
+
withPaneCompositeProgress(paneCompositeId, viewContainerLocation, task, options) {
|
|
338
|
+
const progressIndicator = this.paneCompositeService.getProgressIndicator(paneCompositeId, viewContainerLocation);
|
|
339
|
+
const promise = progressIndicator ? this.withCompositeProgress(progressIndicator, task, options) : task({ report: () => { } });
|
|
340
|
+
if (viewContainerLocation === 0 ) {
|
|
341
|
+
this.showOnActivityBar(paneCompositeId, options, promise);
|
|
342
|
+
}
|
|
343
|
+
return promise;
|
|
344
|
+
}
|
|
345
|
+
withViewProgress(viewId, task, options) {
|
|
346
|
+
const progressIndicator = this.viewsService.getViewProgressIndicator(viewId);
|
|
347
|
+
const promise = progressIndicator ? this.withCompositeProgress(progressIndicator, task, options) : task({ report: () => { } });
|
|
348
|
+
const location = this.viewDescriptorService.getViewLocationById(viewId);
|
|
349
|
+
if (location !== 0 ) {
|
|
350
|
+
return promise;
|
|
351
|
+
}
|
|
352
|
+
const viewletId = this.viewDescriptorService.getViewContainerByViewId(viewId)?.id;
|
|
353
|
+
if (viewletId === undefined) {
|
|
354
|
+
return promise;
|
|
355
|
+
}
|
|
356
|
+
this.showOnActivityBar(viewletId, options, promise);
|
|
357
|
+
return promise;
|
|
358
|
+
}
|
|
359
|
+
showOnActivityBar(viewletId, options, promise) {
|
|
360
|
+
let activityProgress;
|
|
361
|
+
let delayHandle = setTimeout(() => {
|
|
362
|
+
delayHandle = undefined;
|
|
363
|
+
const handle = this.activityService.showViewContainerActivity(viewletId, { badge: ( new ProgressBadge(() => '')), clazz: 'progress-badge', priority: 100 });
|
|
364
|
+
const startTimeVisible = Date.now();
|
|
365
|
+
const minTimeVisible = 300;
|
|
366
|
+
activityProgress = {
|
|
367
|
+
dispose() {
|
|
368
|
+
const d = Date.now() - startTimeVisible;
|
|
369
|
+
if (d < minTimeVisible) {
|
|
370
|
+
setTimeout(() => handle.dispose(), minTimeVisible - d);
|
|
371
|
+
}
|
|
372
|
+
else {
|
|
373
|
+
handle.dispose();
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
};
|
|
377
|
+
}, options.delay || 300);
|
|
378
|
+
promise.finally(() => {
|
|
379
|
+
clearTimeout(delayHandle);
|
|
380
|
+
dispose(activityProgress);
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
withCompositeProgress(progressIndicator, task, options) {
|
|
384
|
+
let discreteProgressRunner = undefined;
|
|
385
|
+
function updateProgress(stepOrTotal) {
|
|
386
|
+
let total = undefined;
|
|
387
|
+
let increment = undefined;
|
|
388
|
+
if (typeof stepOrTotal !== 'undefined') {
|
|
389
|
+
if (typeof stepOrTotal === 'number') {
|
|
390
|
+
total = stepOrTotal;
|
|
391
|
+
}
|
|
392
|
+
else if (typeof stepOrTotal.increment === 'number') {
|
|
393
|
+
total = stepOrTotal.total ?? 100;
|
|
394
|
+
increment = stepOrTotal.increment;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
if (typeof total === 'number') {
|
|
398
|
+
if (!discreteProgressRunner) {
|
|
399
|
+
discreteProgressRunner = progressIndicator.show(total, options.delay);
|
|
400
|
+
promise.catch(() => undefined ).finally(() => discreteProgressRunner?.done());
|
|
401
|
+
}
|
|
402
|
+
if (typeof increment === 'number') {
|
|
403
|
+
discreteProgressRunner.worked(increment);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
else {
|
|
407
|
+
discreteProgressRunner?.done();
|
|
408
|
+
progressIndicator.showWhile(promise, options.delay);
|
|
409
|
+
}
|
|
410
|
+
return discreteProgressRunner;
|
|
411
|
+
}
|
|
412
|
+
const promise = task({
|
|
413
|
+
report: progress => {
|
|
414
|
+
updateProgress(progress);
|
|
415
|
+
}
|
|
416
|
+
});
|
|
417
|
+
updateProgress(options.total);
|
|
418
|
+
return promise;
|
|
419
|
+
}
|
|
420
|
+
withDialogProgress(options, task, onDidCancel) {
|
|
421
|
+
const disposables = ( new DisposableStore());
|
|
422
|
+
const allowableCommands = [
|
|
423
|
+
'workbench.action.quit',
|
|
424
|
+
'workbench.action.reloadWindow',
|
|
425
|
+
'copy',
|
|
426
|
+
'cut',
|
|
427
|
+
'editor.action.clipboardCopyAction',
|
|
428
|
+
'editor.action.clipboardCutAction'
|
|
429
|
+
];
|
|
430
|
+
let dialog;
|
|
431
|
+
const createDialog = (message) => {
|
|
432
|
+
const buttons = options.buttons || [];
|
|
433
|
+
if (!options.sticky) {
|
|
434
|
+
buttons.push(options.cancellable ? ( localizeWithPath(
|
|
435
|
+
'vs/workbench/services/progress/browser/progressService',
|
|
436
|
+
'cancel',
|
|
437
|
+
"Cancel"
|
|
438
|
+
)) : ( localizeWithPath(
|
|
439
|
+
'vs/workbench/services/progress/browser/progressService',
|
|
440
|
+
'dismiss',
|
|
441
|
+
"Dismiss"
|
|
442
|
+
)));
|
|
443
|
+
}
|
|
444
|
+
dialog = ( new Dialog(this.layoutService.container, message, buttons, {
|
|
445
|
+
type: 'pending',
|
|
446
|
+
detail: options.detail,
|
|
447
|
+
cancelId: buttons.length - 1,
|
|
448
|
+
disableCloseAction: options.sticky,
|
|
449
|
+
disableDefaultAction: options.sticky,
|
|
450
|
+
keyEventProcessor: (event) => {
|
|
451
|
+
const resolved = this.keybindingService.softDispatch(event, this.layoutService.container);
|
|
452
|
+
if (resolved.kind === 2 && resolved.commandId) {
|
|
453
|
+
if (!allowableCommands.includes(resolved.commandId)) {
|
|
454
|
+
EventHelper.stop(event, true);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
},
|
|
458
|
+
buttonStyles: defaultButtonStyles,
|
|
459
|
+
checkboxStyles: defaultCheckboxStyles,
|
|
460
|
+
inputBoxStyles: defaultInputBoxStyles,
|
|
461
|
+
dialogStyles: defaultDialogStyles
|
|
462
|
+
}));
|
|
463
|
+
disposables.add(dialog);
|
|
464
|
+
dialog.show().then(dialogResult => {
|
|
465
|
+
onDidCancel?.(dialogResult.button);
|
|
466
|
+
dispose(dialog);
|
|
467
|
+
});
|
|
468
|
+
return dialog;
|
|
469
|
+
};
|
|
470
|
+
let delay = options.delay ?? 0;
|
|
471
|
+
let latestMessage = undefined;
|
|
472
|
+
const scheduler = disposables.add(( new RunOnceScheduler(() => {
|
|
473
|
+
delay = 0;
|
|
474
|
+
if (latestMessage && !dialog) {
|
|
475
|
+
dialog = createDialog(latestMessage);
|
|
476
|
+
}
|
|
477
|
+
else if (latestMessage) {
|
|
478
|
+
dialog.updateMessage(latestMessage);
|
|
479
|
+
}
|
|
480
|
+
}, 0)));
|
|
481
|
+
const updateDialog = function (message) {
|
|
482
|
+
latestMessage = message;
|
|
483
|
+
if (!scheduler.isScheduled()) {
|
|
484
|
+
scheduler.schedule(delay);
|
|
485
|
+
}
|
|
486
|
+
};
|
|
487
|
+
const promise = task({
|
|
488
|
+
report: progress => {
|
|
489
|
+
updateDialog(progress.message);
|
|
490
|
+
}
|
|
491
|
+
});
|
|
492
|
+
promise.finally(() => {
|
|
493
|
+
dispose(disposables);
|
|
494
|
+
});
|
|
495
|
+
if (options.title) {
|
|
496
|
+
updateDialog(options.title);
|
|
497
|
+
}
|
|
498
|
+
return promise;
|
|
499
|
+
}
|
|
500
|
+
};
|
|
501
|
+
ProgressService = ( __decorate([
|
|
502
|
+
( __param(0, IActivityService)),
|
|
503
|
+
( __param(1, IPaneCompositePartService)),
|
|
504
|
+
( __param(2, IViewDescriptorService)),
|
|
505
|
+
( __param(3, IViewsService)),
|
|
506
|
+
( __param(4, INotificationService)),
|
|
507
|
+
( __param(5, IStatusbarService)),
|
|
508
|
+
( __param(6, ILayoutService)),
|
|
509
|
+
( __param(7, IKeybindingService))
|
|
510
|
+
], ProgressService));
|
|
511
|
+
|
|
512
|
+
export { ProgressService };
|