@codingame/monaco-vscode-edit-sessions-service-override 4.5.0 → 4.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +1 -1
- package/package.json +2 -2
- package/vscode/src/vs/workbench/contrib/editSessions/browser/editSessions.contribution.js +156 -272
- package/vscode/src/vs/workbench/contrib/editSessions/browser/editSessionsFileSystemProvider.js +1 -1
- package/vscode/src/vs/workbench/contrib/editSessions/browser/editSessionsStorageService.js +77 -93
- package/vscode/src/vs/workbench/contrib/editSessions/browser/editSessionsViews.js +69 -101
- package/vscode/src/vs/workbench/contrib/editSessions/common/editSessions.js +13 -24
- package/vscode/src/vs/workbench/contrib/editSessions/common/editSessionsLogService.js +6 -9
- package/vscode/src/vs/workbench/contrib/editSessions/common/workspaceStateSync.js +3 -3
- package/vscode/src/vs/workbench/services/workspaces/common/editSessionIdentityService.js +1 -1
- package/editSessions.d.ts +0 -5
package/vscode/src/vs/workbench/contrib/editSessions/browser/editSessionsFileSystemProvider.js
CHANGED
|
@@ -48,7 +48,7 @@ let EditSessionsFileSystemProvider = class EditSessionsFileSystemProvider {
|
|
|
48
48
|
async rename(from, to, opts) { }
|
|
49
49
|
async delete(resource, opts) { }
|
|
50
50
|
async writeFile() {
|
|
51
|
-
throw new NotSupportedError();
|
|
51
|
+
throw ( new NotSupportedError());
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
54
|
EditSessionsFileSystemProvider = ( __decorate([
|
|
@@ -24,6 +24,7 @@ import { CancellationError } from 'vscode/vscode/vs/base/common/errors';
|
|
|
24
24
|
import { ISecretStorageService } from 'vscode/vscode/vs/platform/secrets/common/secrets.service';
|
|
25
25
|
|
|
26
26
|
var EditSessionsWorkbenchService_1;
|
|
27
|
+
const _moduleId = "vs/workbench/contrib/editSessions/browser/editSessionsStorageService";
|
|
27
28
|
let EditSessionsWorkbenchService = class EditSessionsWorkbenchService extends Disposable {
|
|
28
29
|
static { EditSessionsWorkbenchService_1 = this; }
|
|
29
30
|
static { this.CACHED_SESSION_STORAGE_KEY = 'editSessionAccountPreference'; }
|
|
@@ -58,12 +59,12 @@ let EditSessionsWorkbenchService = class EditSessionsWorkbenchService extends Di
|
|
|
58
59
|
this.SIZE_LIMIT = Math.floor(1024 * 1024 * 1.9);
|
|
59
60
|
this.serverConfiguration = this.productService['editSessions.store'];
|
|
60
61
|
this.initialized = false;
|
|
61
|
-
this._didSignIn = ( new Emitter());
|
|
62
|
-
this._didSignOut = ( new Emitter());
|
|
63
|
-
this._lastWrittenResources = ( new Map());
|
|
64
|
-
this._lastReadResources = ( new Map());
|
|
62
|
+
this._didSignIn = ( (new Emitter()));
|
|
63
|
+
this._didSignOut = ( (new Emitter()));
|
|
64
|
+
this._lastWrittenResources = ( (new Map()));
|
|
65
|
+
this._lastReadResources = ( (new Map()));
|
|
65
66
|
this._register(this.authenticationService.onDidChangeSessions((e) => this.onDidChangeSessions(e.event)));
|
|
66
|
-
this._register(this.storageService.onDidChangeValue(-1 , EditSessionsWorkbenchService_1.CACHED_SESSION_STORAGE_KEY, this._register(( new DisposableStore())))(() => this.onDidChangeStorage()));
|
|
67
|
+
this._register(this.storageService.onDidChangeValue(-1 , EditSessionsWorkbenchService_1.CACHED_SESSION_STORAGE_KEY, this._register(( (new DisposableStore()))))(() => this.onDidChangeStorage()));
|
|
67
68
|
this.registerSignInAction();
|
|
68
69
|
this.registerResetAuthenticationAction();
|
|
69
70
|
this.signedInContext = EDIT_SESSIONS_SIGNED_IN.bindTo(this.contextKeyService);
|
|
@@ -72,7 +73,7 @@ let EditSessionsWorkbenchService = class EditSessionsWorkbenchService extends Di
|
|
|
72
73
|
async write(resource, content) {
|
|
73
74
|
await this.initialize('write', false);
|
|
74
75
|
if (!this.initialized) {
|
|
75
|
-
throw new Error('Please sign in to store your edit session.');
|
|
76
|
+
throw ( (new Error('Please sign in to store your edit session.')));
|
|
76
77
|
}
|
|
77
78
|
if (typeof content !== 'string' && content.machine === undefined) {
|
|
78
79
|
content.machine = await this.getOrCreateCurrentMachineId();
|
|
@@ -85,7 +86,7 @@ let EditSessionsWorkbenchService = class EditSessionsWorkbenchService extends Di
|
|
|
85
86
|
async read(resource, ref) {
|
|
86
87
|
await this.initialize('read', false);
|
|
87
88
|
if (!this.initialized) {
|
|
88
|
-
throw new Error('Please sign in to apply your latest edit session.');
|
|
89
|
+
throw ( (new Error('Please sign in to apply your latest edit session.')));
|
|
89
90
|
}
|
|
90
91
|
let content;
|
|
91
92
|
const headers = createSyncHeaders(generateUuid());
|
|
@@ -111,7 +112,7 @@ let EditSessionsWorkbenchService = class EditSessionsWorkbenchService extends Di
|
|
|
111
112
|
async delete(resource, ref) {
|
|
112
113
|
await this.initialize('write', false);
|
|
113
114
|
if (!this.initialized) {
|
|
114
|
-
throw new Error(`Unable to delete edit session with ref ${ref}.`);
|
|
115
|
+
throw ( (new Error(`Unable to delete edit session with ref ${ref}.`)));
|
|
115
116
|
}
|
|
116
117
|
try {
|
|
117
118
|
await this.storeClient?.deleteResource(resource, ref);
|
|
@@ -123,7 +124,7 @@ let EditSessionsWorkbenchService = class EditSessionsWorkbenchService extends Di
|
|
|
123
124
|
async list(resource) {
|
|
124
125
|
await this.initialize('read', false);
|
|
125
126
|
if (!this.initialized) {
|
|
126
|
-
throw new Error(`Unable to list edit sessions.`);
|
|
127
|
+
throw ( (new Error(`Unable to list edit sessions.`)));
|
|
127
128
|
}
|
|
128
129
|
try {
|
|
129
130
|
return this.storeClient?.getAllResourceRefs(resource) ?? [];
|
|
@@ -147,7 +148,9 @@ let EditSessionsWorkbenchService = class EditSessionsWorkbenchService extends Di
|
|
|
147
148
|
async doInitialize(reason, silent) {
|
|
148
149
|
await this.extensionService.whenInstalledExtensionsRegistered();
|
|
149
150
|
if (!this.serverConfiguration?.url) {
|
|
150
|
-
throw new Error(
|
|
151
|
+
throw ( (new Error(
|
|
152
|
+
'Unable to initialize sessions sync as session sync preference is not configured in product.json.'
|
|
153
|
+
)));
|
|
151
154
|
}
|
|
152
155
|
if (this.storeClient === undefined) {
|
|
153
156
|
return false;
|
|
@@ -157,14 +160,14 @@ let EditSessionsWorkbenchService = class EditSessionsWorkbenchService extends Di
|
|
|
157
160
|
this.clearAuthenticationPreference();
|
|
158
161
|
}));
|
|
159
162
|
if (this.machineClient === undefined) {
|
|
160
|
-
this.machineClient = ( new UserDataSyncMachinesService(
|
|
163
|
+
this.machineClient = ( (new UserDataSyncMachinesService(
|
|
161
164
|
this.environmentService,
|
|
162
165
|
this.fileService,
|
|
163
166
|
this.storageService,
|
|
164
167
|
this.storeClient,
|
|
165
168
|
this.logService,
|
|
166
169
|
this.productService
|
|
167
|
-
));
|
|
170
|
+
)));
|
|
168
171
|
}
|
|
169
172
|
if (this.authenticationInfo !== undefined) {
|
|
170
173
|
return true;
|
|
@@ -180,7 +183,7 @@ let EditSessionsWorkbenchService = class EditSessionsWorkbenchService extends Di
|
|
|
180
183
|
await this.initialize('read', false);
|
|
181
184
|
if (!this.cachedMachines) {
|
|
182
185
|
const machines = await this.machineClient.getMachines();
|
|
183
|
-
this.cachedMachines = machines.reduce((map, machine) => map.set(machine.id, machine.name), ( new Map()));
|
|
186
|
+
this.cachedMachines = machines.reduce((map, machine) => map.set(machine.id, machine.name), ( (new Map())));
|
|
184
187
|
}
|
|
185
188
|
return this.cachedMachines.get(machineId);
|
|
186
189
|
}
|
|
@@ -230,61 +233,50 @@ let EditSessionsWorkbenchService = class EditSessionsWorkbenchService extends Di
|
|
|
230
233
|
const quickpick = this.quickInputService.createQuickPick();
|
|
231
234
|
quickpick.ok = false;
|
|
232
235
|
quickpick.placeholder = reason === 'read' ? ( localizeWithPath(
|
|
233
|
-
|
|
234
|
-
|
|
236
|
+
_moduleId,
|
|
237
|
+
0,
|
|
235
238
|
"Select an account to restore your working changes from the cloud"
|
|
236
239
|
)) : ( localizeWithPath(
|
|
237
|
-
|
|
238
|
-
|
|
240
|
+
_moduleId,
|
|
241
|
+
1,
|
|
239
242
|
"Select an account to store your working changes in the cloud"
|
|
240
243
|
));
|
|
241
244
|
quickpick.ignoreFocusOut = true;
|
|
242
245
|
quickpick.items = await this.createQuickpickItems();
|
|
243
|
-
return (
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
246
|
+
return (
|
|
247
|
+
(new Promise((resolve, reject) => {
|
|
248
|
+
quickpick.onDidHide((e) => {
|
|
249
|
+
reject(( (new CancellationError())));
|
|
250
|
+
quickpick.dispose();
|
|
251
|
+
});
|
|
252
|
+
quickpick.onDidAccept(async (e) => {
|
|
253
|
+
const selection = quickpick.selectedItems[0];
|
|
254
|
+
const session = 'provider' in selection ? { ...(await this.authenticationService.createSession(selection.provider.id, selection.provider.scopes)), providerId: selection.provider.id } : ('session' in selection ? selection.session : undefined);
|
|
255
|
+
resolve(session);
|
|
256
|
+
quickpick.hide();
|
|
257
|
+
});
|
|
258
|
+
quickpick.show();
|
|
259
|
+
}))
|
|
260
|
+
);
|
|
256
261
|
}
|
|
257
262
|
async createQuickpickItems() {
|
|
258
263
|
const options = [];
|
|
259
|
-
options.push({ type: 'separator', label: ( localizeWithPath(
|
|
260
|
-
'vs/workbench/contrib/editSessions/browser/editSessionsStorageService',
|
|
261
|
-
'signed in',
|
|
262
|
-
"Signed In"
|
|
263
|
-
)) });
|
|
264
|
+
options.push({ type: 'separator', label: ( localizeWithPath(_moduleId, 2, "Signed In")) });
|
|
264
265
|
const sessions = await this.getAllSessions();
|
|
265
266
|
options.push(...sessions);
|
|
266
|
-
options.push({ type: 'separator', label: ( localizeWithPath(
|
|
267
|
-
'vs/workbench/contrib/editSessions/browser/editSessionsStorageService',
|
|
268
|
-
'others',
|
|
269
|
-
"Others"
|
|
270
|
-
)) });
|
|
267
|
+
options.push({ type: 'separator', label: ( localizeWithPath(_moduleId, 3, "Others")) });
|
|
271
268
|
for (const authenticationProvider of (await this.getAuthenticationProviders())) {
|
|
272
|
-
const signedInForProvider = ( sessions.some(account => account.session.providerId === authenticationProvider.id));
|
|
269
|
+
const signedInForProvider = ( (sessions.some(account => account.session.providerId === authenticationProvider.id)));
|
|
273
270
|
if (!signedInForProvider || this.authenticationService.getProvider(authenticationProvider.id).supportsMultipleAccounts) {
|
|
274
271
|
const providerName = this.authenticationService.getProvider(authenticationProvider.id).label;
|
|
275
|
-
options.push({ label: ( localizeWithPath(
|
|
276
|
-
'vs/workbench/contrib/editSessions/browser/editSessionsStorageService',
|
|
277
|
-
'sign in using account',
|
|
278
|
-
"Sign in with {0}",
|
|
279
|
-
providerName
|
|
280
|
-
)), provider: authenticationProvider });
|
|
272
|
+
options.push({ label: ( localizeWithPath(_moduleId, 4, "Sign in with {0}", providerName)), provider: authenticationProvider });
|
|
281
273
|
}
|
|
282
274
|
}
|
|
283
275
|
return options;
|
|
284
276
|
}
|
|
285
277
|
async getAllSessions() {
|
|
286
278
|
const authenticationProviders = await this.getAuthenticationProviders();
|
|
287
|
-
const accounts = ( new Map());
|
|
279
|
+
const accounts = ( (new Map()));
|
|
288
280
|
let currentSession;
|
|
289
281
|
for (const provider of authenticationProviders) {
|
|
290
282
|
const sessions = await this.authenticationService.getSessions(provider.id, provider.scopes);
|
|
@@ -303,19 +295,21 @@ let EditSessionsWorkbenchService = class EditSessionsWorkbenchService extends Di
|
|
|
303
295
|
if (currentSession !== undefined) {
|
|
304
296
|
accounts.set(currentSession.session.account.id, currentSession);
|
|
305
297
|
}
|
|
306
|
-
return [...( accounts.values())].sort((a, b) => a.label.localeCompare(b.label));
|
|
298
|
+
return [...( (accounts.values()))].sort((a, b) => a.label.localeCompare(b.label));
|
|
307
299
|
}
|
|
308
300
|
async getAuthenticationProviders() {
|
|
309
301
|
if (!this.serverConfiguration) {
|
|
310
|
-
throw new Error(
|
|
302
|
+
throw ( (new Error(
|
|
303
|
+
'Unable to get configured authentication providers as session sync preference is not configured in product.json.'
|
|
304
|
+
)));
|
|
311
305
|
}
|
|
312
306
|
const authenticationProviders = this.serverConfiguration.authenticationProviders;
|
|
313
|
-
const configuredAuthenticationProviders = ( Object.keys(authenticationProviders)).reduce((result, id) => {
|
|
307
|
+
const configuredAuthenticationProviders = ( (Object.keys(authenticationProviders))).reduce((result, id) => {
|
|
314
308
|
result.push({ id, scopes: authenticationProviders[id].scopes });
|
|
315
309
|
return result;
|
|
316
310
|
}, []);
|
|
317
311
|
const availableAuthenticationProviders = this.authenticationService.declaredProviders;
|
|
318
|
-
return configuredAuthenticationProviders.filter(({ id }) => ( availableAuthenticationProviders.some(provider => provider.id === id)));
|
|
312
|
+
return configuredAuthenticationProviders.filter(({ id }) => ( (availableAuthenticationProviders.some(provider => provider.id === id))));
|
|
319
313
|
}
|
|
320
314
|
get existingSessionId() {
|
|
321
315
|
return this.storageService.get(EditSessionsWorkbenchService_1.CACHED_SESSION_STORAGE_KEY, -1 );
|
|
@@ -356,16 +350,15 @@ let EditSessionsWorkbenchService = class EditSessionsWorkbenchService extends Di
|
|
|
356
350
|
registerSignInAction() {
|
|
357
351
|
const that = this;
|
|
358
352
|
const id = 'workbench.editSessions.actions.signIn';
|
|
359
|
-
const when = ( ContextKeyExpr.and(
|
|
353
|
+
const when = ( (ContextKeyExpr.and(
|
|
354
|
+
(ContextKeyExpr.equals(EDIT_SESSIONS_PENDING_KEY, false)),
|
|
355
|
+
(ContextKeyExpr.equals(EDIT_SESSIONS_SIGNED_IN_KEY, false))
|
|
356
|
+
)));
|
|
360
357
|
this._register(registerAction2(class ResetEditSessionAuthenticationAction extends Action2 {
|
|
361
358
|
constructor() {
|
|
362
359
|
super({
|
|
363
360
|
id,
|
|
364
|
-
title: ( localizeWithPath(
|
|
365
|
-
'vs/workbench/contrib/editSessions/browser/editSessionsStorageService',
|
|
366
|
-
'sign in',
|
|
367
|
-
'Turn on Cloud Changes...'
|
|
368
|
-
)),
|
|
361
|
+
title: ( localizeWithPath(_moduleId, 5, 'Turn on Cloud Changes...')),
|
|
369
362
|
category: EDIT_SESSION_SYNC_CATEGORY,
|
|
370
363
|
precondition: when,
|
|
371
364
|
menu: [{
|
|
@@ -382,18 +375,17 @@ let EditSessionsWorkbenchService = class EditSessionsWorkbenchService extends Di
|
|
|
382
375
|
return await that.initialize('write', false);
|
|
383
376
|
}
|
|
384
377
|
}));
|
|
385
|
-
this._register(( MenuRegistry.appendMenuItem(MenuId.AccountsContext, {
|
|
378
|
+
this._register(( (MenuRegistry.appendMenuItem(MenuId.AccountsContext, {
|
|
386
379
|
group: '2_editSessions',
|
|
387
380
|
command: {
|
|
388
381
|
id,
|
|
389
|
-
title: ( localizeWithPath(
|
|
390
|
-
'vs/workbench/contrib/editSessions/browser/editSessionsStorageService',
|
|
391
|
-
'sign in badge',
|
|
392
|
-
'Turn on Cloud Changes... (1)'
|
|
393
|
-
)),
|
|
382
|
+
title: ( localizeWithPath(_moduleId, 6, 'Turn on Cloud Changes... (1)')),
|
|
394
383
|
},
|
|
395
|
-
when: ( ContextKeyExpr.and(
|
|
396
|
-
|
|
384
|
+
when: ( (ContextKeyExpr.and(
|
|
385
|
+
(ContextKeyExpr.equals(EDIT_SESSIONS_PENDING_KEY, true)),
|
|
386
|
+
(ContextKeyExpr.equals(EDIT_SESSIONS_SIGNED_IN_KEY, false))
|
|
387
|
+
)))
|
|
388
|
+
}))));
|
|
397
389
|
}
|
|
398
390
|
registerResetAuthenticationAction() {
|
|
399
391
|
const that = this;
|
|
@@ -401,35 +393,27 @@ let EditSessionsWorkbenchService = class EditSessionsWorkbenchService extends Di
|
|
|
401
393
|
constructor() {
|
|
402
394
|
super({
|
|
403
395
|
id: 'workbench.editSessions.actions.resetAuth',
|
|
404
|
-
title: ( localizeWithPath(
|
|
405
|
-
'vs/workbench/contrib/editSessions/browser/editSessionsStorageService',
|
|
406
|
-
'reset auth.v3',
|
|
407
|
-
'Turn off Cloud Changes...'
|
|
408
|
-
)),
|
|
396
|
+
title: ( localizeWithPath(_moduleId, 7, 'Turn off Cloud Changes...')),
|
|
409
397
|
category: EDIT_SESSION_SYNC_CATEGORY,
|
|
410
|
-
precondition: ( ContextKeyExpr.equals(EDIT_SESSIONS_SIGNED_IN_KEY, true)),
|
|
398
|
+
precondition: ( (ContextKeyExpr.equals(EDIT_SESSIONS_SIGNED_IN_KEY, true))),
|
|
411
399
|
menu: [{
|
|
412
400
|
id: MenuId.CommandPalette,
|
|
413
401
|
},
|
|
414
402
|
{
|
|
415
403
|
id: MenuId.AccountsContext,
|
|
416
404
|
group: '2_editSessions',
|
|
417
|
-
when: ( ContextKeyExpr.equals(EDIT_SESSIONS_SIGNED_IN_KEY, true)),
|
|
405
|
+
when: ( (ContextKeyExpr.equals(EDIT_SESSIONS_SIGNED_IN_KEY, true))),
|
|
418
406
|
}]
|
|
419
407
|
});
|
|
420
408
|
}
|
|
421
409
|
async run() {
|
|
422
410
|
const result = await that.dialogService.confirm({
|
|
423
411
|
message: ( localizeWithPath(
|
|
424
|
-
|
|
425
|
-
|
|
412
|
+
_moduleId,
|
|
413
|
+
8,
|
|
426
414
|
'Do you want to disable storing working changes in the cloud?'
|
|
427
415
|
)),
|
|
428
|
-
checkbox: { label: ( localizeWithPath(
|
|
429
|
-
'vs/workbench/contrib/editSessions/browser/editSessionsStorageService',
|
|
430
|
-
'delete all cloud changes',
|
|
431
|
-
'Delete all stored data from the cloud.'
|
|
432
|
-
)) }
|
|
416
|
+
checkbox: { label: ( localizeWithPath(_moduleId, 9, 'Delete all stored data from the cloud.')) }
|
|
433
417
|
});
|
|
434
418
|
if (result.confirmed) {
|
|
435
419
|
if (result.checkboxChecked) {
|
|
@@ -441,18 +425,18 @@ let EditSessionsWorkbenchService = class EditSessionsWorkbenchService extends Di
|
|
|
441
425
|
}));
|
|
442
426
|
}
|
|
443
427
|
};
|
|
444
|
-
EditSessionsWorkbenchService = EditSessionsWorkbenchService_1 = ( __decorate([
|
|
445
|
-
( __param(0, IFileService)),
|
|
446
|
-
( __param(1, IStorageService)),
|
|
447
|
-
( __param(2, IQuickInputService)),
|
|
448
|
-
( __param(3, IAuthenticationService)),
|
|
449
|
-
( __param(4, IExtensionService)),
|
|
450
|
-
( __param(5, IEnvironmentService)),
|
|
451
|
-
( __param(6, IEditSessionsLogService)),
|
|
452
|
-
( __param(7, IProductService)),
|
|
453
|
-
( __param(8, IContextKeyService)),
|
|
454
|
-
( __param(9, IDialogService)),
|
|
455
|
-
( __param(10, ISecretStorageService))
|
|
456
|
-
], EditSessionsWorkbenchService));
|
|
428
|
+
EditSessionsWorkbenchService = EditSessionsWorkbenchService_1 = ( (__decorate([
|
|
429
|
+
( (__param(0, IFileService))),
|
|
430
|
+
( (__param(1, IStorageService))),
|
|
431
|
+
( (__param(2, IQuickInputService))),
|
|
432
|
+
( (__param(3, IAuthenticationService))),
|
|
433
|
+
( (__param(4, IExtensionService))),
|
|
434
|
+
( (__param(5, IEnvironmentService))),
|
|
435
|
+
( (__param(6, IEditSessionsLogService))),
|
|
436
|
+
( (__param(7, IProductService))),
|
|
437
|
+
( (__param(8, IContextKeyService))),
|
|
438
|
+
( (__param(9, IDialogService))),
|
|
439
|
+
( (__param(10, ISecretStorageService)))
|
|
440
|
+
], EditSessionsWorkbenchService)));
|
|
457
441
|
|
|
458
442
|
export { EditSessionsWorkbenchService };
|