@codingame/monaco-vscode-notifications-service-override 5.3.0 → 6.0.0
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-notifications-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -26,6 +26,6 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"vscode": "npm:@codingame/monaco-vscode-api@
|
|
29
|
+
"vscode": "npm:@codingame/monaco-vscode-api@6.0.0"
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -2,10 +2,12 @@ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
|
2
2
|
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
3
3
|
import { isNotificationSource, NotificationsFilter, NoOpNotification, NeverShowAgainScope } from 'vscode/vscode/vs/platform/notification/common/notification';
|
|
4
4
|
import 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
5
|
-
import { NotificationsModel, ChoiceAction } from 'vscode/vscode/vs/workbench/common/notifications';
|
|
5
|
+
import { NotificationsModel, NotificationChangeType, ChoiceAction } from 'vscode/vscode/vs/workbench/common/notifications';
|
|
6
6
|
import { Disposable, DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
7
7
|
import { Emitter, Event } from 'vscode/vscode/vs/base/common/event';
|
|
8
|
+
import 'vscode/vscode/vs/platform/instantiation/common/extensions';
|
|
8
9
|
import { Action } from 'vscode/vscode/vs/base/common/actions';
|
|
10
|
+
import { StorageScope, StorageTarget } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
9
11
|
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
10
12
|
import Severity$1 from 'vscode/vscode/vs/base/common/severity';
|
|
11
13
|
|
|
@@ -23,10 +25,10 @@ let NotificationService = class NotificationService extends Disposable {
|
|
|
23
25
|
this.onDidRemoveNotification = this._onDidRemoveNotification.event;
|
|
24
26
|
this._onDidChangeFilter = this._register(( (new Emitter())));
|
|
25
27
|
this.onDidChangeFilter = this._onDidChangeFilter.event;
|
|
26
|
-
this.globalFilterEnabled = this.storageService.getBoolean(NotificationService_1.GLOBAL_FILTER_SETTINGS_KEY,
|
|
28
|
+
this.globalFilterEnabled = this.storageService.getBoolean(NotificationService_1.GLOBAL_FILTER_SETTINGS_KEY, StorageScope.APPLICATION, false);
|
|
27
29
|
this.mapSourceToFilter = (() => {
|
|
28
30
|
const map = ( (new Map()));
|
|
29
|
-
for (const sourceFilter of this.storageService.getObject(NotificationService_1.PER_SOURCE_FILTER_SETTINGS_KEY,
|
|
31
|
+
for (const sourceFilter of this.storageService.getObject(NotificationService_1.PER_SOURCE_FILTER_SETTINGS_KEY, StorageScope.APPLICATION, [])) {
|
|
30
32
|
map.set(sourceFilter.id, sourceFilter);
|
|
31
33
|
}
|
|
32
34
|
return map;
|
|
@@ -37,8 +39,8 @@ let NotificationService = class NotificationService extends Disposable {
|
|
|
37
39
|
registerListeners() {
|
|
38
40
|
this._register(this.model.onDidChangeNotification(e => {
|
|
39
41
|
switch (e.kind) {
|
|
40
|
-
case
|
|
41
|
-
case
|
|
42
|
+
case NotificationChangeType.ADD:
|
|
43
|
+
case NotificationChangeType.REMOVE: {
|
|
42
44
|
const source = typeof e.item.sourceId === 'string' && typeof e.item.source === 'string' ? { id: e.item.sourceId, label: e.item.source } : e.item.source;
|
|
43
45
|
const notification = {
|
|
44
46
|
message: e.item.message.original,
|
|
@@ -46,7 +48,7 @@ let NotificationService = class NotificationService extends Disposable {
|
|
|
46
48
|
source,
|
|
47
49
|
priority: e.item.priority
|
|
48
50
|
};
|
|
49
|
-
if (e.kind ===
|
|
51
|
+
if (e.kind === NotificationChangeType.ADD) {
|
|
50
52
|
if (isNotificationSource(source)) {
|
|
51
53
|
if (!( (this.mapSourceToFilter.has(source.id)))) {
|
|
52
54
|
this.setFilter({ ...source, filter: NotificationsFilter.OFF });
|
|
@@ -57,7 +59,7 @@ let NotificationService = class NotificationService extends Disposable {
|
|
|
57
59
|
}
|
|
58
60
|
this._onDidAddNotification.fire(notification);
|
|
59
61
|
}
|
|
60
|
-
if (e.kind ===
|
|
62
|
+
if (e.kind === NotificationChangeType.REMOVE) {
|
|
61
63
|
this._onDidRemoveNotification.fire(notification);
|
|
62
64
|
}
|
|
63
65
|
break;
|
|
@@ -73,7 +75,7 @@ let NotificationService = class NotificationService extends Disposable {
|
|
|
73
75
|
return;
|
|
74
76
|
}
|
|
75
77
|
this.globalFilterEnabled = filter === NotificationsFilter.ERROR;
|
|
76
|
-
this.storageService.store(NotificationService_1.GLOBAL_FILTER_SETTINGS_KEY, this.globalFilterEnabled,
|
|
78
|
+
this.storageService.store(NotificationService_1.GLOBAL_FILTER_SETTINGS_KEY, this.globalFilterEnabled, StorageScope.APPLICATION, StorageTarget.MACHINE);
|
|
77
79
|
this.updateFilters();
|
|
78
80
|
this._onDidChangeFilter.fire();
|
|
79
81
|
}
|
|
@@ -104,7 +106,7 @@ let NotificationService = class NotificationService extends Disposable {
|
|
|
104
106
|
}
|
|
105
107
|
}
|
|
106
108
|
saveSourceFilters() {
|
|
107
|
-
this.storageService.store(NotificationService_1.PER_SOURCE_FILTER_SETTINGS_KEY, JSON.stringify([...( (this.mapSourceToFilter.values()))]),
|
|
109
|
+
this.storageService.store(NotificationService_1.PER_SOURCE_FILTER_SETTINGS_KEY, JSON.stringify([...( (this.mapSourceToFilter.values()))]), StorageScope.APPLICATION, StorageTarget.MACHINE);
|
|
108
110
|
}
|
|
109
111
|
getFilters() {
|
|
110
112
|
return [...( (this.mapSourceToFilter.values()))];
|
|
@@ -162,7 +164,7 @@ let NotificationService = class NotificationService extends Disposable {
|
|
|
162
164
|
}
|
|
163
165
|
const neverShowAgainAction = toDispose.add(( (new Action('workbench.notification.neverShowAgain', ( localizeWithPath(_moduleId, 0, "Don't Show Again")), undefined, true, async () => {
|
|
164
166
|
handle.close();
|
|
165
|
-
this.storageService.store(id, true, scope,
|
|
167
|
+
this.storageService.store(id, true, scope, StorageTarget.USER);
|
|
166
168
|
}))));
|
|
167
169
|
const actions = {
|
|
168
170
|
primary: notification.actions?.primary || [],
|
|
@@ -183,13 +185,13 @@ let NotificationService = class NotificationService extends Disposable {
|
|
|
183
185
|
toStorageScope(options) {
|
|
184
186
|
switch (options.scope) {
|
|
185
187
|
case NeverShowAgainScope.APPLICATION:
|
|
186
|
-
return
|
|
188
|
+
return StorageScope.APPLICATION;
|
|
187
189
|
case NeverShowAgainScope.PROFILE:
|
|
188
|
-
return
|
|
190
|
+
return StorageScope.PROFILE;
|
|
189
191
|
case NeverShowAgainScope.WORKSPACE:
|
|
190
|
-
return
|
|
192
|
+
return StorageScope.WORKSPACE;
|
|
191
193
|
default:
|
|
192
|
-
return
|
|
194
|
+
return StorageScope.APPLICATION;
|
|
193
195
|
}
|
|
194
196
|
}
|
|
195
197
|
prompt(severity, message, choices, options) {
|
|
@@ -204,7 +206,7 @@ let NotificationService = class NotificationService extends Disposable {
|
|
|
204
206
|
}
|
|
205
207
|
const neverShowAgainChoice = {
|
|
206
208
|
label: ( localizeWithPath(_moduleId, 0, "Don't Show Again")),
|
|
207
|
-
run: () => this.storageService.store(id, true, scope,
|
|
209
|
+
run: () => this.storageService.store(id, true, scope, StorageTarget.USER),
|
|
208
210
|
isSecondary: options.neverShowAgain.isSecondary
|
|
209
211
|
};
|
|
210
212
|
if (!options.neverShowAgain.isSecondary) {
|