@codingame/monaco-vscode-edit-sessions-service-override 25.1.2 → 26.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.
@@ -24,7 +24,7 @@ import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/fi
24
24
  import { basename } from '@codingame/monaco-vscode-api/vscode/vs/base/common/path';
25
25
  import { createCommandUri } from '@codingame/monaco-vscode-api/vscode/vs/base/common/htmlContent';
26
26
 
27
- const EDIT_SESSIONS_COUNT_KEY = 'editSessionsCount';
27
+ const EDIT_SESSIONS_COUNT_KEY = "editSessionsCount";
28
28
  const EDIT_SESSIONS_COUNT_CONTEXT_KEY = ( new RawContextKey(EDIT_SESSIONS_COUNT_KEY, 0));
29
29
  let EditSessionsDataViews = class EditSessionsDataViews extends Disposable {
30
30
  constructor(container, instantiationService) {
@@ -40,22 +40,22 @@ let EditSessionsDataViews = class EditSessionsDataViews extends Disposable {
40
40
  treeView.dataProvider = this.instantiationService.createInstance(EditSessionDataViewDataProvider);
41
41
  const viewsRegistry = ( Registry.as(Extensions.ViewsRegistry));
42
42
  viewsRegistry.registerViews([{
43
- id: viewId,
44
- name: EDIT_SESSIONS_TITLE,
45
- ctorDescriptor: ( new SyncDescriptor(TreeViewPane)),
46
- canToggleVisibility: true,
47
- canMoveView: false,
48
- treeView,
49
- collapsed: false,
50
- when: ( ContextKeyExpr.and(EDIT_SESSIONS_SHOW_VIEW)),
51
- order: 100,
52
- hideByDefault: true,
53
- }], container);
43
+ id: viewId,
44
+ name: EDIT_SESSIONS_TITLE,
45
+ ctorDescriptor: ( new SyncDescriptor(TreeViewPane)),
46
+ canToggleVisibility: true,
47
+ canMoveView: false,
48
+ treeView,
49
+ collapsed: false,
50
+ when: ( ContextKeyExpr.and(EDIT_SESSIONS_SHOW_VIEW)),
51
+ order: 100,
52
+ hideByDefault: true
53
+ }], container);
54
54
  viewsRegistry.registerViewWelcomeContent(viewId, {
55
55
  content: ( localize(
56
- 7244,
57
- 'You have no stored changes in the cloud to display.\n{0}',
58
- `[${( localize(7245, 'Store Working Changes'))}](${createCommandUri('workbench.editSessions.actions.store')})`
56
+ 7555,
57
+ "You have no stored changes in the cloud to display.\n{0}",
58
+ `[${( localize(7556, "Store Working Changes"))}](${createCommandUri("workbench.editSessions.actions.store")})`
59
59
  )),
60
60
  when: ( ContextKeyExpr.equals(EDIT_SESSIONS_COUNT_KEY, 0)),
61
61
  order: 1
@@ -63,47 +63,47 @@ let EditSessionsDataViews = class EditSessionsDataViews extends Disposable {
63
63
  this._register(registerAction2(class extends Action2 {
64
64
  constructor() {
65
65
  super({
66
- id: 'workbench.editSessions.actions.resume',
67
- title: ( localize(7246, "Resume Working Changes")),
66
+ id: "workbench.editSessions.actions.resume",
67
+ title: ( localize(7557, "Resume Working Changes")),
68
68
  icon: Codicon.desktopDownload,
69
69
  menu: {
70
70
  id: MenuId.ViewItemContext,
71
- when: ( ContextKeyExpr.and(( ContextKeyExpr.equals('view', viewId)), ( ContextKeyExpr.regex('viewItem', /edit-session/i)))),
72
- group: 'inline'
71
+ when: ( ContextKeyExpr.and(( ContextKeyExpr.equals("view", viewId)), ( ContextKeyExpr.regex("viewItem", /edit-session/i)))),
72
+ group: "inline"
73
73
  }
74
74
  });
75
75
  }
76
76
  async run(accessor, handle) {
77
77
  const editSessionId = ( URI.parse(handle.$treeItemHandle)).path.substring(1);
78
78
  const commandService = accessor.get(ICommandService);
79
- await commandService.executeCommand('workbench.editSessions.actions.resumeLatest', editSessionId, true);
79
+ await commandService.executeCommand("workbench.editSessions.actions.resumeLatest", editSessionId, true);
80
80
  await treeView.refresh();
81
81
  }
82
82
  }));
83
83
  this._register(registerAction2(class extends Action2 {
84
84
  constructor() {
85
85
  super({
86
- id: 'workbench.editSessions.actions.store',
87
- title: ( localize(7247, "Store Working Changes")),
88
- icon: Codicon.cloudUpload,
86
+ id: "workbench.editSessions.actions.store",
87
+ title: ( localize(7558, "Store Working Changes")),
88
+ icon: Codicon.cloudUpload
89
89
  });
90
90
  }
91
91
  async run(accessor, handle) {
92
92
  const commandService = accessor.get(ICommandService);
93
- await commandService.executeCommand('workbench.editSessions.actions.storeCurrent');
93
+ await commandService.executeCommand("workbench.editSessions.actions.storeCurrent");
94
94
  await treeView.refresh();
95
95
  }
96
96
  }));
97
97
  this._register(registerAction2(class extends Action2 {
98
98
  constructor() {
99
99
  super({
100
- id: 'workbench.editSessions.actions.delete',
101
- title: ( localize(7248, "Delete Working Changes")),
100
+ id: "workbench.editSessions.actions.delete",
101
+ title: ( localize(7559, "Delete Working Changes")),
102
102
  icon: Codicon.trash,
103
103
  menu: {
104
104
  id: MenuId.ViewItemContext,
105
- when: ( ContextKeyExpr.and(( ContextKeyExpr.equals('view', viewId)), ( ContextKeyExpr.regex('viewItem', /edit-session/i)))),
106
- group: 'inline'
105
+ when: ( ContextKeyExpr.and(( ContextKeyExpr.equals("view", viewId)), ( ContextKeyExpr.regex("viewItem", /edit-session/i)))),
106
+ group: "inline"
107
107
  }
108
108
  });
109
109
  }
@@ -113,16 +113,16 @@ let EditSessionsDataViews = class EditSessionsDataViews extends Disposable {
113
113
  const editSessionStorageService = accessor.get(IEditSessionsStorageService);
114
114
  const result = await dialogService.confirm({
115
115
  message: ( localize(
116
- 7249,
117
- 'Are you sure you want to permanently delete your working changes with ref {0}?',
116
+ 7560,
117
+ "Are you sure you want to permanently delete your working changes with ref {0}?",
118
118
  editSessionId
119
119
  )),
120
- detail: ( localize(7250, ' You cannot undo this action.')),
121
- type: 'warning',
120
+ detail: ( localize(7561, " You cannot undo this action.")),
121
+ type: "warning",
122
122
  title: EDIT_SESSIONS_TITLE.value
123
123
  });
124
124
  if (result.confirmed) {
125
- await editSessionStorageService.delete('editSessions', editSessionId);
125
+ await editSessionStorageService.delete("editSessions", editSessionId);
126
126
  await treeView.refresh();
127
127
  }
128
128
  }
@@ -130,12 +130,12 @@ let EditSessionsDataViews = class EditSessionsDataViews extends Disposable {
130
130
  this._register(registerAction2(class extends Action2 {
131
131
  constructor() {
132
132
  super({
133
- id: 'workbench.editSessions.actions.deleteAll',
134
- title: ( localize(7251, "Delete All Working Changes from Cloud")),
133
+ id: "workbench.editSessions.actions.deleteAll",
134
+ title: ( localize(7562, "Delete All Working Changes from Cloud")),
135
135
  icon: Codicon.trash,
136
136
  menu: {
137
137
  id: MenuId.ViewTitle,
138
- when: ( ContextKeyExpr.and(( ContextKeyExpr.equals('view', viewId)), ContextKeyExpr.greater(EDIT_SESSIONS_COUNT_KEY, 0))),
138
+ when: ( ContextKeyExpr.and(( ContextKeyExpr.equals("view", viewId)), ContextKeyExpr.greater(EDIT_SESSIONS_COUNT_KEY, 0)))
139
139
  }
140
140
  });
141
141
  }
@@ -144,26 +144,29 @@ let EditSessionsDataViews = class EditSessionsDataViews extends Disposable {
144
144
  const editSessionStorageService = accessor.get(IEditSessionsStorageService);
145
145
  const result = await dialogService.confirm({
146
146
  message: ( localize(
147
- 7252,
148
- 'Are you sure you want to permanently delete all stored changes from the cloud?'
147
+ 7563,
148
+ "Are you sure you want to permanently delete all stored changes from the cloud?"
149
149
  )),
150
- detail: ( localize(7253, ' You cannot undo this action.')),
151
- type: 'warning',
150
+ detail: ( localize(7564, " You cannot undo this action.")),
151
+ type: "warning",
152
152
  title: EDIT_SESSIONS_TITLE.value
153
153
  });
154
154
  if (result.confirmed) {
155
- await editSessionStorageService.delete('editSessions', null);
155
+ await editSessionStorageService.delete("editSessions", null);
156
156
  await treeView.refresh();
157
157
  }
158
158
  }
159
159
  }));
160
160
  }
161
161
  };
162
- EditSessionsDataViews = ( __decorate([
163
- ( __param(1, IInstantiationService))
164
- ], EditSessionsDataViews));
162
+ EditSessionsDataViews = ( __decorate([( __param(1, IInstantiationService))], EditSessionsDataViews));
165
163
  let EditSessionDataViewDataProvider = class EditSessionDataViewDataProvider {
166
- constructor(editSessionsStorageService, contextKeyService, workspaceContextService, fileService) {
164
+ constructor(
165
+ editSessionsStorageService,
166
+ contextKeyService,
167
+ workspaceContextService,
168
+ fileService
169
+ ) {
167
170
  this.editSessionsStorageService = editSessionsStorageService;
168
171
  this.contextKeyService = contextKeyService;
169
172
  this.workspaceContextService = workspaceContextService;
@@ -174,36 +177,39 @@ let EditSessionDataViewDataProvider = class EditSessionDataViewDataProvider {
174
177
  if (!element) {
175
178
  return this.getAllEditSessions();
176
179
  }
177
- const [ref, folderName, filePath] = ( URI.parse(element.handle)).path.substring(1).split('/');
180
+ const [ref, folderName, filePath] = ( URI.parse(element.handle)).path.substring(1).split("/");
178
181
  if (ref && !folderName) {
179
182
  return this.getEditSession(ref);
180
- }
181
- else if (ref && folderName && !filePath) {
183
+ } else if (ref && folderName && !filePath) {
182
184
  return this.getEditSessionFolderContents(ref, folderName);
183
185
  }
184
186
  return [];
185
187
  }
186
188
  async getAllEditSessions() {
187
- const allEditSessions = await this.editSessionsStorageService.list('editSessions');
189
+ const allEditSessions = await this.editSessionsStorageService.list("editSessions");
188
190
  this.editSessionsCount.set(allEditSessions.length);
189
191
  const editSessions = [];
190
192
  for (const session of allEditSessions) {
191
- const resource = ( URI.from(
192
- { scheme: EDIT_SESSIONS_SCHEME, authority: 'remote-session-content', path: `/${session.ref}` }
193
- ));
194
- const sessionData = await this.editSessionsStorageService.read('editSessions', session.ref);
193
+ const resource = ( URI.from({
194
+ scheme: EDIT_SESSIONS_SCHEME,
195
+ authority: "remote-session-content",
196
+ path: `/${session.ref}`
197
+ }));
198
+ const sessionData = await this.editSessionsStorageService.read("editSessions", session.ref);
195
199
  if (!sessionData) {
196
200
  continue;
197
201
  }
198
202
  const content = JSON.parse(sessionData.content);
199
- const label = ( content.folders.map((folder) => folder.name)).join(', ') ?? session.ref;
203
+ const label = ( content.folders.map(folder => folder.name)).join(", ") ?? session.ref;
200
204
  const machineId = content.machine;
201
205
  const machineName = machineId ? await this.editSessionsStorageService.getMachineById(machineId) : undefined;
202
206
  const description = machineName === undefined ? fromNow(session.created, true) : `${fromNow(session.created, true)}\u00a0\u00a0\u2022\u00a0\u00a0${machineName}`;
203
207
  editSessions.push({
204
208
  handle: ( resource.toString()),
205
209
  collapsibleState: TreeItemCollapsibleState.Collapsed,
206
- label: { label },
210
+ label: {
211
+ label
212
+ },
207
213
  description: description,
208
214
  themeIcon: Codicon.repo,
209
215
  contextValue: `edit-session`
@@ -212,7 +218,7 @@ let EditSessionDataViewDataProvider = class EditSessionDataViewDataProvider {
212
218
  return editSessions;
213
219
  }
214
220
  async getEditSession(ref) {
215
- const data = await this.editSessionsStorageService.read('editSessions', ref);
221
+ const data = await this.editSessionsStorageService.read("editSessions", ref);
216
222
  if (!data) {
217
223
  return [];
218
224
  }
@@ -221,33 +227,39 @@ let EditSessionDataViewDataProvider = class EditSessionDataViewDataProvider {
221
227
  const folder = content.folders[0];
222
228
  return this.getEditSessionFolderContents(ref, folder.name);
223
229
  }
224
- return ( content.folders.map((folder) => {
225
- const resource = ( URI.from(
226
- { scheme: EDIT_SESSIONS_SCHEME, authority: 'remote-session-content', path: `/${data.ref}/${folder.name}` }
227
- ));
230
+ return ( content.folders.map(folder => {
231
+ const resource = ( URI.from({
232
+ scheme: EDIT_SESSIONS_SCHEME,
233
+ authority: "remote-session-content",
234
+ path: `/${data.ref}/${folder.name}`
235
+ }));
228
236
  return {
229
237
  handle: ( resource.toString()),
230
238
  collapsibleState: TreeItemCollapsibleState.Collapsed,
231
- label: { label: folder.name },
239
+ label: {
240
+ label: folder.name
241
+ },
232
242
  themeIcon: Codicon.folder
233
243
  };
234
244
  }));
235
245
  }
236
246
  async getEditSessionFolderContents(ref, folderName) {
237
- const data = await this.editSessionsStorageService.read('editSessions', ref);
247
+ const data = await this.editSessionsStorageService.read("editSessions", ref);
238
248
  if (!data) {
239
249
  return [];
240
250
  }
241
251
  const content = JSON.parse(data.content);
242
- const currentWorkspaceFolder = this.workspaceContextService.getWorkspace().folders.find((folder) => folder.name === folderName);
243
- const editSessionFolder = content.folders.find((folder) => folder.name === folderName);
252
+ const currentWorkspaceFolder = this.workspaceContextService.getWorkspace().folders.find(folder => folder.name === folderName);
253
+ const editSessionFolder = content.folders.find(folder => folder.name === folderName);
244
254
  if (!editSessionFolder) {
245
255
  return [];
246
256
  }
247
- return Promise.all(( editSessionFolder.workingChanges.map(async (change) => {
248
- const cloudChangeUri = ( URI.from(
249
- { scheme: EDIT_SESSIONS_SCHEME, authority: 'remote-session-content', path: `/${data.ref}/${folderName}/${change.relativeFilePath}` }
250
- ));
257
+ return Promise.all(( editSessionFolder.workingChanges.map(async change => {
258
+ const cloudChangeUri = ( URI.from({
259
+ scheme: EDIT_SESSIONS_SCHEME,
260
+ authority: "remote-session-content",
261
+ path: `/${data.ref}/${folderName}/${change.relativeFilePath}`
262
+ }));
251
263
  if (currentWorkspaceFolder?.uri) {
252
264
  const localCopy = joinPath(currentWorkspaceFolder.uri, change.relativeFilePath);
253
265
  if (change.type === ChangeType.Addition && (await this.fileService.exists(localCopy))) {
@@ -255,15 +267,17 @@ let EditSessionDataViewDataProvider = class EditSessionDataViewDataProvider {
255
267
  handle: ( cloudChangeUri.toString()),
256
268
  resourceUri: cloudChangeUri,
257
269
  collapsibleState: TreeItemCollapsibleState.None,
258
- label: { label: change.relativeFilePath },
270
+ label: {
271
+ label: change.relativeFilePath
272
+ },
259
273
  themeIcon: Codicon.file,
260
274
  command: {
261
- id: 'vscode.diff',
262
- title: ( localize(7254, 'Compare Changes')),
275
+ id: "vscode.diff",
276
+ title: ( localize(7565, "Compare Changes")),
263
277
  arguments: [
264
278
  localCopy,
265
279
  cloudChangeUri,
266
- `${basename(change.relativeFilePath)} (${( localize(7255, 'Local Copy'))} \u2194 ${( localize(7256, 'Cloud Changes'))})`,
280
+ `${basename(change.relativeFilePath)} (${( localize(7566, "Local Copy"))} \u2194 ${( localize(7567, "Cloud Changes"))})`,
267
281
  undefined
268
282
  ]
269
283
  }
@@ -274,22 +288,19 @@ let EditSessionDataViewDataProvider = class EditSessionDataViewDataProvider {
274
288
  handle: ( cloudChangeUri.toString()),
275
289
  resourceUri: cloudChangeUri,
276
290
  collapsibleState: TreeItemCollapsibleState.None,
277
- label: { label: change.relativeFilePath },
291
+ label: {
292
+ label: change.relativeFilePath
293
+ },
278
294
  themeIcon: Codicon.file,
279
295
  command: {
280
296
  id: API_OPEN_EDITOR_COMMAND_ID,
281
- title: ( localize(7257, 'Open File')),
297
+ title: ( localize(7568, "Open File")),
282
298
  arguments: [cloudChangeUri, undefined, undefined]
283
299
  }
284
300
  };
285
301
  })));
286
302
  }
287
303
  };
288
- EditSessionDataViewDataProvider = ( __decorate([
289
- ( __param(0, IEditSessionsStorageService)),
290
- ( __param(1, IContextKeyService)),
291
- ( __param(2, IWorkspaceContextService)),
292
- ( __param(3, IFileService))
293
- ], EditSessionDataViewDataProvider));
304
+ EditSessionDataViewDataProvider = ( __decorate([( __param(0, IEditSessionsStorageService)), ( __param(1, IContextKeyService)), ( __param(2, IWorkspaceContextService)), ( __param(3, IFileService))], EditSessionDataViewDataProvider));
294
305
 
295
306
  export { EditSessionsDataViews };
@@ -6,35 +6,35 @@ import { RawContextKey } from '@codingame/monaco-vscode-api/vscode/vs/platform/c
6
6
  import { registerIcon } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/common/iconRegistry';
7
7
  import { StringSHA1 } from '@codingame/monaco-vscode-api/vscode/vs/base/common/hash';
8
8
 
9
- const EDIT_SESSION_SYNC_CATEGORY = ( localize2(7258, 'Cloud Changes'));
9
+ const EDIT_SESSION_SYNC_CATEGORY = ( localize2(7569, "Cloud Changes"));
10
10
  var ChangeType;
11
- (function (ChangeType) {
11
+ (function(ChangeType) {
12
12
  ChangeType[ChangeType["Addition"] = 1] = "Addition";
13
13
  ChangeType[ChangeType["Deletion"] = 2] = "Deletion";
14
14
  })(ChangeType || (ChangeType = {}));
15
15
  var FileType;
16
- (function (FileType) {
16
+ (function(FileType) {
17
17
  FileType[FileType["File"] = 1] = "File";
18
18
  })(FileType || (FileType = {}));
19
19
  const EditSessionSchemaVersion = 3;
20
- const EDIT_SESSIONS_SIGNED_IN_KEY = 'editSessionsSignedIn';
20
+ const EDIT_SESSIONS_SIGNED_IN_KEY = "editSessionsSignedIn";
21
21
  const EDIT_SESSIONS_SIGNED_IN = ( new RawContextKey(EDIT_SESSIONS_SIGNED_IN_KEY, false));
22
- const EDIT_SESSIONS_PENDING_KEY = 'editSessionsPending';
22
+ const EDIT_SESSIONS_PENDING_KEY = "editSessionsPending";
23
23
  const EDIT_SESSIONS_PENDING = ( new RawContextKey(EDIT_SESSIONS_PENDING_KEY, false));
24
- const EDIT_SESSIONS_CONTAINER_ID = 'workbench.view.editSessions';
25
- const EDIT_SESSIONS_DATA_VIEW_ID = 'workbench.views.editSessions.data';
26
- const EDIT_SESSIONS_TITLE = ( localize2(7258, 'Cloud Changes'));
27
- const EDIT_SESSIONS_VIEW_ICON = registerIcon('edit-sessions-view-icon', Codicon.cloudDownload, ( localize(7259, 'View icon of the cloud changes view.')));
28
- const EDIT_SESSIONS_SHOW_VIEW = ( new RawContextKey('editSessionsShowView', false));
29
- const EDIT_SESSIONS_SCHEME = 'vscode-edit-sessions';
24
+ const EDIT_SESSIONS_CONTAINER_ID = "workbench.view.editSessions";
25
+ const EDIT_SESSIONS_DATA_VIEW_ID = "workbench.views.editSessions.data";
26
+ const EDIT_SESSIONS_TITLE = ( localize2(7569, "Cloud Changes"));
27
+ const EDIT_SESSIONS_VIEW_ICON = registerIcon("edit-sessions-view-icon", Codicon.cloudDownload, ( localize(7570, "View icon of the cloud changes view.")));
28
+ const EDIT_SESSIONS_SHOW_VIEW = ( new RawContextKey("editSessionsShowView", false));
29
+ const EDIT_SESSIONS_SCHEME = "vscode-edit-sessions";
30
30
  function decodeEditSessionFileContent(version, content) {
31
31
  switch (version) {
32
- case 1:
33
- return VSBuffer.fromString(content);
34
- case 2:
35
- return decodeBase64(content);
36
- default:
37
- throw ( new Error('Upgrade to a newer version to decode this content.'));
32
+ case 1:
33
+ return VSBuffer.fromString(content);
34
+ case 2:
35
+ return decodeBase64(content);
36
+ default:
37
+ throw ( new Error("Upgrade to a newer version to decode this content."));
38
38
  }
39
39
  }
40
40
  function hashedEditSessionId(editSessionId) {
@@ -42,6 +42,6 @@ function hashedEditSessionId(editSessionId) {
42
42
  sha1.update(editSessionId);
43
43
  return sha1.digest();
44
44
  }
45
- const editSessionsLogId = 'editSessions';
45
+ const editSessionsLogId = "editSessions";
46
46
 
47
47
  export { ChangeType, EDIT_SESSIONS_CONTAINER_ID, EDIT_SESSIONS_DATA_VIEW_ID, EDIT_SESSIONS_PENDING, EDIT_SESSIONS_PENDING_KEY, EDIT_SESSIONS_SCHEME, EDIT_SESSIONS_SHOW_VIEW, EDIT_SESSIONS_SIGNED_IN, EDIT_SESSIONS_SIGNED_IN_KEY, EDIT_SESSIONS_TITLE, EDIT_SESSIONS_VIEW_ICON, EDIT_SESSION_SYNC_CATEGORY, EditSessionSchemaVersion, FileType, decodeEditSessionFileContent, editSessionsLogId, hashedEditSessionId };
@@ -11,7 +11,13 @@ import { editSessionsLogId } from './editSessions.js';
11
11
  let EditSessionsLogService = class EditSessionsLogService extends AbstractLogger {
12
12
  constructor(loggerService, environmentService) {
13
13
  super();
14
- this.logger = this._register(loggerService.createLogger(joinPath(environmentService.logsHome, `${editSessionsLogId}.log`), { id: editSessionsLogId, name: ( localize(7260, "Cloud Changes")), group: windowLogGroup }));
14
+ this.logger = this._register(
15
+ loggerService.createLogger(joinPath(environmentService.logsHome, `${editSessionsLogId}.log`), {
16
+ id: editSessionsLogId,
17
+ name: ( localize(7571, "Cloud Changes")),
18
+ group: windowLogGroup
19
+ })
20
+ );
15
21
  }
16
22
  trace(message, ...args) {
17
23
  this.logger.trace(message, ...args);
@@ -32,9 +38,6 @@ let EditSessionsLogService = class EditSessionsLogService extends AbstractLogger
32
38
  this.logger.flush();
33
39
  }
34
40
  };
35
- EditSessionsLogService = ( __decorate([
36
- ( __param(0, ILoggerService)),
37
- ( __param(1, IEnvironmentService))
38
- ], EditSessionsLogService));
41
+ EditSessionsLogService = ( __decorate([( __param(0, ILoggerService)), ( __param(1, IEnvironmentService))], EditSessionsLogService));
39
42
 
40
43
  export { EditSessionsLogService };
@@ -33,19 +33,45 @@ class NullEnablementService {
33
33
  this._onDidChangeResourceEnablement = ( new Emitter());
34
34
  this.onDidChangeResourceEnablement = this._onDidChangeResourceEnablement.event;
35
35
  }
36
- isEnabled() { return true; }
37
- canToggleEnablement() { return true; }
38
- setEnablement(_enabled) { }
39
- isResourceEnabled(_resource) { return true; }
40
- isResourceEnablementConfigured(_resource) { return false; }
41
- setResourceEnablement(_resource, _enabled) { }
42
- getResourceSyncStateVersion(_resource) { return undefined; }
36
+ isEnabled() {
37
+ return true;
38
+ }
39
+ canToggleEnablement() {
40
+ return true;
41
+ }
42
+ setEnablement(_enabled) {}
43
+ isResourceEnabled(_resource) {
44
+ return true;
45
+ }
46
+ isResourceEnablementConfigured(_resource) {
47
+ return false;
48
+ }
49
+ setResourceEnablement(_resource, _enabled) {}
50
+ getResourceSyncStateVersion(_resource) {
51
+ return undefined;
52
+ }
43
53
  }
44
54
  let WorkspaceStateSynchroniser = class WorkspaceStateSynchroniser extends AbstractSynchroniser {
45
- constructor(profile, collection, userDataSyncStoreService, logService, fileService, environmentService, telemetryService, configurationService, storageService, uriIdentityService, workspaceIdentityService, editSessionsStorageService) {
55
+ constructor(
56
+ profile,
57
+ collection,
58
+ userDataSyncStoreService,
59
+ logService,
60
+ fileService,
61
+ environmentService,
62
+ telemetryService,
63
+ configurationService,
64
+ storageService,
65
+ uriIdentityService,
66
+ workspaceIdentityService,
67
+ editSessionsStorageService
68
+ ) {
46
69
  const userDataSyncLocalStoreService = ( new NullBackupStoreService());
47
70
  const userDataSyncEnablementService = ( new NullEnablementService());
48
- super({ syncResource: SyncResource.WorkspaceState, profile }, collection, fileService, environmentService, storageService, userDataSyncStoreService, userDataSyncLocalStoreService, userDataSyncEnablementService, telemetryService, logService, configurationService, uriIdentityService);
71
+ super({
72
+ syncResource: SyncResource.WorkspaceState,
73
+ profile
74
+ }, collection, fileService, environmentService, storageService, userDataSyncStoreService, userDataSyncLocalStoreService, userDataSyncEnablementService, telemetryService, logService, configurationService, uriIdentityService);
49
75
  this.workspaceIdentityService = workspaceIdentityService;
50
76
  this.editSessionsStorageService = editSessionsStorageService;
51
77
  this.version = 1;
@@ -62,32 +88,40 @@ let WorkspaceStateSynchroniser = class WorkspaceStateSynchroniser extends Abstra
62
88
  return null;
63
89
  }
64
90
  const contributedData = {};
65
- keys.forEach((key) => {
91
+ keys.forEach(key => {
66
92
  const data = this.storageService.get(key, StorageScope.WORKSPACE);
67
93
  if (data) {
68
94
  contributedData[key] = data;
69
95
  }
70
96
  });
71
- const content = { folders, storage: contributedData, version: this.version };
72
- await this.editSessionsStorageService.write('workspaceState', stringify(content));
97
+ const content = {
98
+ folders,
99
+ storage: contributedData,
100
+ version: this.version
101
+ };
102
+ await this.editSessionsStorageService.write("workspaceState", stringify(content));
73
103
  return null;
74
104
  }
75
105
  async apply() {
76
- const payload = this.editSessionsStorageService.lastReadResources.get('editSessions')?.content;
106
+ const payload = this.editSessionsStorageService.lastReadResources.get("editSessions")?.content;
77
107
  const workspaceStateId = payload ? JSON.parse(payload).workspaceStateId : undefined;
78
- const resource = await this.editSessionsStorageService.read('workspaceState', workspaceStateId);
108
+ const resource = await this.editSessionsStorageService.read("workspaceState", workspaceStateId);
79
109
  if (!resource) {
80
110
  return null;
81
111
  }
82
112
  const remoteWorkspaceState = parse(resource.content);
83
113
  if (!remoteWorkspaceState) {
84
- this.logService.info('Skipping initializing workspace state because remote workspace state does not exist.');
114
+ this.logService.info(
115
+ "Skipping initializing workspace state because remote workspace state does not exist."
116
+ );
85
117
  return null;
86
118
  }
87
119
  const cancellationTokenSource = ( new CancellationTokenSource());
88
120
  const replaceUris = await this.workspaceIdentityService.matches(remoteWorkspaceState.folders, cancellationTokenSource.token);
89
121
  if (!replaceUris) {
90
- this.logService.info('Skipping initializing workspace state because remote workspace state does not match current workspace.');
122
+ this.logService.info(
123
+ "Skipping initializing workspace state because remote workspace state does not match current workspace."
124
+ );
91
125
  return null;
92
126
  }
93
127
  const storage = {};
@@ -100,28 +134,43 @@ let WorkspaceStateSynchroniser = class WorkspaceStateSynchroniser extends Abstra
100
134
  try {
101
135
  const value = parse(storage[key]);
102
136
  replaceUris(value);
103
- storageEntries.push({ key, value, scope: StorageScope.WORKSPACE, target: StorageTarget.USER });
104
- }
105
- catch {
106
- storageEntries.push({ key, value: storage[key], scope: StorageScope.WORKSPACE, target: StorageTarget.USER });
137
+ storageEntries.push({
138
+ key,
139
+ value,
140
+ scope: StorageScope.WORKSPACE,
141
+ target: StorageTarget.USER
142
+ });
143
+ } catch {
144
+ storageEntries.push({
145
+ key,
146
+ value: storage[key],
147
+ scope: StorageScope.WORKSPACE,
148
+ target: StorageTarget.USER
149
+ });
107
150
  }
108
151
  }
109
152
  this.storageService.storeAll(storageEntries, true);
110
153
  }
111
- this.editSessionsStorageService.delete('workspaceState', resource.ref);
154
+ this.editSessionsStorageService.delete("workspaceState", resource.ref);
112
155
  return null;
113
156
  }
114
157
  applyResult(remoteUserData, lastSyncUserData, result, force) {
115
- throw ( new Error('Method not implemented.'));
158
+ throw ( new Error("Method not implemented."));
116
159
  }
117
- async generateSyncPreview(remoteUserData, lastSyncUserData, isRemoteDataFromCurrentMachine, userDataSyncConfiguration, token) {
160
+ async generateSyncPreview(
161
+ remoteUserData,
162
+ lastSyncUserData,
163
+ isRemoteDataFromCurrentMachine,
164
+ userDataSyncConfiguration,
165
+ token
166
+ ) {
118
167
  return [];
119
168
  }
120
169
  getMergeResult(resourcePreview, token) {
121
- throw ( new Error('Method not implemented.'));
170
+ throw ( new Error("Method not implemented."));
122
171
  }
123
172
  getAcceptResult(resourcePreview, resource, content, token) {
124
- throw ( new Error('Method not implemented.'));
173
+ throw ( new Error("Method not implemented."));
125
174
  }
126
175
  async hasRemoteChanged(lastSyncUserData) {
127
176
  return true;
@@ -133,15 +182,6 @@ let WorkspaceStateSynchroniser = class WorkspaceStateSynchroniser extends Abstra
133
182
  return null;
134
183
  }
135
184
  };
136
- WorkspaceStateSynchroniser = ( __decorate([
137
- ( __param(4, IFileService)),
138
- ( __param(5, IEnvironmentService)),
139
- ( __param(6, ITelemetryService)),
140
- ( __param(7, IConfigurationService)),
141
- ( __param(8, IStorageService)),
142
- ( __param(9, IUriIdentityService)),
143
- ( __param(10, IWorkspaceIdentityService)),
144
- ( __param(11, IEditSessionsStorageService))
145
- ], WorkspaceStateSynchroniser));
185
+ WorkspaceStateSynchroniser = ( __decorate([( __param(4, IFileService)), ( __param(5, IEnvironmentService)), ( __param(6, ITelemetryService)), ( __param(7, IConfigurationService)), ( __param(8, IStorageService)), ( __param(9, IUriIdentityService)), ( __param(10, IWorkspaceIdentityService)), ( __param(11, IEditSessionsStorageService))], WorkspaceStateSynchroniser));
146
186
 
147
187
  export { WorkspaceStateSynchroniser };