@codingame/monaco-vscode-configuration-service-override 9.0.3 → 10.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/configuration.js +7 -4
- package/package.json +3 -3
- package/tools.js +4 -2
- package/vscode/src/vs/editor/common/services/textResourceConfigurationService.js +10 -11
- package/vscode/src/vs/workbench/api/common/configurationExtensionPoint.js +48 -48
- package/vscode/src/vs/workbench/contrib/workspaces/browser/workspaces.contribution.js +13 -15
- package/vscode/src/vs/workbench/services/configuration/browser/configuration.js +18 -16
- package/vscode/src/vs/workbench/services/configuration/browser/configurationService.js +85 -86
- package/vscode/src/vs/workbench/services/configuration/common/configurationCache.js +1 -2
- package/vscode/src/vs/workbench/services/configuration/common/configurationEditing.js +112 -138
- package/vscode/src/vs/workbench/services/configurationResolver/browser/baseConfigurationResolverService.js +12 -15
- package/vscode/src/vs/workbench/services/configurationResolver/browser/configurationResolverService.js +0 -1
- package/vscode/src/vs/workbench/services/textresourceProperties/common/textResourcePropertiesService.js +4 -6
- package/vscode/src/vs/workbench/services/workspaces/browser/abstractWorkspaceEditingService.js +17 -19
- package/vscode/src/vs/workbench/services/workspaces/browser/workspacesService.js +8 -11
|
@@ -4,9 +4,6 @@ import { Schemas } from 'vscode/vscode/vs/base/common/network';
|
|
|
4
4
|
import { isUndefinedOrNull, isString } from 'vscode/vscode/vs/base/common/types';
|
|
5
5
|
import { isCodeEditor, isDiffEditor } from 'vscode/vscode/vs/editor/browser/editorBrowser';
|
|
6
6
|
import { localize } from 'vscode/vscode/vs/nls';
|
|
7
|
-
import { ConfigurationTarget } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
8
|
-
import { StorageScope, StorageTarget } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
9
|
-
import { WorkbenchState } from 'vscode/vscode/vs/platform/workspace/common/workspace';
|
|
10
7
|
import { EditorResourceAccessor, SideBySideEditor } from 'vscode/vscode/vs/workbench/common/editor';
|
|
11
8
|
import { AbstractVariableResolverService } from 'vscode/vscode/vs/workbench/services/configurationResolver/common/variableResolver';
|
|
12
9
|
|
|
@@ -137,15 +134,15 @@ class BaseConfigurationResolverService extends AbstractVariableResolverService {
|
|
|
137
134
|
return Promise.resolve(undefined);
|
|
138
135
|
}
|
|
139
136
|
let inputs = [];
|
|
140
|
-
if (this.workspaceContextService.getWorkbenchState() !==
|
|
137
|
+
if (this.workspaceContextService.getWorkbenchState() !== 1 && section) {
|
|
141
138
|
const overrides = folder ? { resource: folder.uri } : {};
|
|
142
139
|
const result = this.configurationService.inspect(section, overrides);
|
|
143
140
|
if (result && (result.userValue || result.workspaceValue || result.workspaceFolderValue)) {
|
|
144
141
|
switch (target) {
|
|
145
|
-
case
|
|
142
|
+
case 2 :
|
|
146
143
|
inputs = result.userValue?.inputs;
|
|
147
144
|
break;
|
|
148
|
-
case
|
|
145
|
+
case 5 :
|
|
149
146
|
inputs = result.workspaceValue?.inputs;
|
|
150
147
|
break;
|
|
151
148
|
default: inputs = result.workspaceFolderValue?.inputs;
|
|
@@ -173,7 +170,7 @@ class BaseConfigurationResolverService extends AbstractVariableResolverService {
|
|
|
173
170
|
result = await this.commandService.executeCommand(commandId, configuration);
|
|
174
171
|
if (typeof result !== 'string' && !isUndefinedOrNull(result)) {
|
|
175
172
|
throw ( (new Error(localize(
|
|
176
|
-
|
|
173
|
+
8899,
|
|
177
174
|
"Cannot substitute command variable '{0}' because command did not return a result of type string.",
|
|
178
175
|
commandId
|
|
179
176
|
))));
|
|
@@ -225,7 +222,7 @@ class BaseConfigurationResolverService extends AbstractVariableResolverService {
|
|
|
225
222
|
showUserInput(section, variable, inputInfos) {
|
|
226
223
|
if (!inputInfos) {
|
|
227
224
|
return Promise.reject(( (new Error(( localize(
|
|
228
|
-
|
|
225
|
+
8900,
|
|
229
226
|
"Variable '{0}' must be defined in an '{1}' section of the debug or task configuration.",
|
|
230
227
|
variable,
|
|
231
228
|
'inputs'
|
|
@@ -235,7 +232,7 @@ class BaseConfigurationResolverService extends AbstractVariableResolverService {
|
|
|
235
232
|
if (info) {
|
|
236
233
|
const missingAttribute = (attrName) => {
|
|
237
234
|
throw ( (new Error(localize(
|
|
238
|
-
|
|
235
|
+
8901,
|
|
239
236
|
"Input variable '{0}' is of type '{1}' and must include '{2}'.",
|
|
240
237
|
variable,
|
|
241
238
|
info.type,
|
|
@@ -287,7 +284,7 @@ class BaseConfigurationResolverService extends AbstractVariableResolverService {
|
|
|
287
284
|
value: value
|
|
288
285
|
};
|
|
289
286
|
if (value === info.default) {
|
|
290
|
-
item.description = ( localize(
|
|
287
|
+
item.description = ( localize(8902, "(Default)"));
|
|
291
288
|
picks.unshift(item);
|
|
292
289
|
}
|
|
293
290
|
else if (!info.default && value === previousPickedValue) {
|
|
@@ -316,7 +313,7 @@ class BaseConfigurationResolverService extends AbstractVariableResolverService {
|
|
|
316
313
|
return result;
|
|
317
314
|
}
|
|
318
315
|
throw ( (new Error(localize(
|
|
319
|
-
|
|
316
|
+
8903,
|
|
320
317
|
"Cannot substitute input variable '{0}' because command '{1}' did not return a result of type string.",
|
|
321
318
|
variable,
|
|
322
319
|
info.command
|
|
@@ -325,23 +322,23 @@ class BaseConfigurationResolverService extends AbstractVariableResolverService {
|
|
|
325
322
|
}
|
|
326
323
|
default:
|
|
327
324
|
throw ( (new Error(localize(
|
|
328
|
-
|
|
325
|
+
8904,
|
|
329
326
|
"Input variable '{0}' can only be of type 'promptString', 'pickString', or 'command'.",
|
|
330
327
|
variable
|
|
331
328
|
))));
|
|
332
329
|
}
|
|
333
330
|
}
|
|
334
331
|
return Promise.reject(( (new Error(( localize(
|
|
335
|
-
|
|
332
|
+
8905,
|
|
336
333
|
"Undefined input variable '{0}' encountered. Remove or define '{0}' to continue.",
|
|
337
334
|
variable
|
|
338
335
|
))))));
|
|
339
336
|
}
|
|
340
337
|
storeInputLru(lru) {
|
|
341
|
-
this.storageService.store(LAST_INPUT_STORAGE_KEY, JSON.stringify(lru.toJSON()),
|
|
338
|
+
this.storageService.store(LAST_INPUT_STORAGE_KEY, JSON.stringify(lru.toJSON()), 1 , 1 );
|
|
342
339
|
}
|
|
343
340
|
readInputLru() {
|
|
344
|
-
const contents = this.storageService.get(LAST_INPUT_STORAGE_KEY,
|
|
341
|
+
const contents = this.storageService.get(LAST_INPUT_STORAGE_KEY, 1 );
|
|
345
342
|
const lru = ( (new LRUCache(LAST_INPUT_CACHE_SIZE)));
|
|
346
343
|
try {
|
|
347
344
|
if (contents) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
2
|
import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands.service';
|
|
3
3
|
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
|
|
4
|
-
import 'vscode/vscode/vs/platform/instantiation/common/extensions';
|
|
5
4
|
import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label.service';
|
|
6
5
|
import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput.service';
|
|
7
6
|
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
2
|
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
|
|
3
3
|
import 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
4
|
-
import {
|
|
4
|
+
import { OS } from 'vscode/vscode/vs/base/common/platform';
|
|
5
5
|
import { Schemas } from 'vscode/vscode/vs/base/common/network';
|
|
6
|
-
import { StorageScope, StorageTarget } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
7
6
|
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
8
7
|
import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService.service';
|
|
9
|
-
import 'vscode/vscode/vs/platform/instantiation/common/extensions';
|
|
10
8
|
import { IRemoteAgentService } from 'vscode/vscode/vs/workbench/services/remote/common/remoteAgentService.service';
|
|
11
9
|
|
|
12
10
|
let TextResourcePropertiesService = class TextResourcePropertiesService {
|
|
@@ -23,7 +21,7 @@ let TextResourcePropertiesService = class TextResourcePropertiesService {
|
|
|
23
21
|
return eol;
|
|
24
22
|
}
|
|
25
23
|
const os = this.getOS(resource);
|
|
26
|
-
return os ===
|
|
24
|
+
return os === 3 || os === 2 ? '\n' : '\r\n';
|
|
27
25
|
}
|
|
28
26
|
getOS(resource) {
|
|
29
27
|
let os = OS;
|
|
@@ -31,8 +29,8 @@ let TextResourcePropertiesService = class TextResourcePropertiesService {
|
|
|
31
29
|
if (remoteAuthority) {
|
|
32
30
|
if (resource && resource.scheme !== Schemas.file) {
|
|
33
31
|
const osCacheKey = `resource.authority.os.${remoteAuthority}`;
|
|
34
|
-
os = this.remoteEnvironment ? this.remoteEnvironment.os : this.storageService.getNumber(osCacheKey,
|
|
35
|
-
this.storageService.store(osCacheKey, os,
|
|
32
|
+
os = this.remoteEnvironment ? this.remoteEnvironment.os : this.storageService.getNumber(osCacheKey, 1 , OS);
|
|
33
|
+
this.storageService.store(osCacheKey, os, 1 , 1 );
|
|
36
34
|
}
|
|
37
35
|
}
|
|
38
36
|
return os;
|
package/vscode/src/vs/workbench/services/workspaces/browser/abstractWorkspaceEditingService.js
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
2
|
import { localize } from 'vscode/vscode/vs/nls';
|
|
3
|
-
import { WORKSPACE_FILTER, hasWorkspaceFileExtension, WORKSPACE_EXTENSION, isSavedWorkspace,
|
|
3
|
+
import { WORKSPACE_FILTER, hasWorkspaceFileExtension, WORKSPACE_EXTENSION, isSavedWorkspace, isUntitledWorkspace, toWorkspaceIdentifier, isWorkspaceIdentifier } from 'vscode/vscode/vs/platform/workspace/common/workspace';
|
|
4
4
|
import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace.service';
|
|
5
|
-
import { JSONEditingErrorCode } from '@codingame/monaco-vscode-base-service-override/vscode/vs/workbench/services/configuration/common/jsonEditing';
|
|
6
5
|
import { IJSONEditingService } from 'vscode/vscode/vs/workbench/services/configuration/common/jsonEditing.service';
|
|
7
6
|
import { rewriteWorkspaceFileForNewLocation } from 'vscode/vscode/vs/platform/workspaces/common/workspaces';
|
|
8
7
|
import { IWorkspacesService } from 'vscode/vscode/vs/platform/workspaces/common/workspaces.service';
|
|
9
|
-
import {
|
|
8
|
+
import { Extensions } from 'vscode/vscode/vs/platform/configuration/common/configurationRegistry';
|
|
10
9
|
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
11
10
|
import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands.service';
|
|
12
|
-
import {
|
|
11
|
+
import { distinct } from 'vscode/vscode/vs/base/common/arrays';
|
|
13
12
|
import { joinPath, basename, removeTrailingPathSeparator, isEqual } from 'vscode/vscode/vs/base/common/resources';
|
|
14
13
|
import 'vscode/vscode/vs/platform/notification/common/notification';
|
|
15
14
|
import { INotificationService } from 'vscode/vscode/vs/platform/notification/common/notification.service';
|
|
@@ -20,7 +19,6 @@ import { mnemonicButtonLabel } from 'vscode/vscode/vs/base/common/labels';
|
|
|
20
19
|
import { ITextFileService } from 'vscode/vscode/vs/workbench/services/textfile/common/textfiles.service';
|
|
21
20
|
import { IHostService } from 'vscode/vscode/vs/workbench/services/host/browser/host.service';
|
|
22
21
|
import { Schemas } from 'vscode/vscode/vs/base/common/network';
|
|
23
|
-
import { SaveReason } from 'vscode/vscode/vs/workbench/common/editor';
|
|
24
22
|
import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
|
|
25
23
|
import { IWorkspaceTrustManagementService } from 'vscode/vscode/vs/platform/workspace/common/workspaceTrust.service';
|
|
26
24
|
import { IWorkbenchConfigurationService } from 'vscode/vscode/vs/workbench/services/configuration/common/configuration.service';
|
|
@@ -55,8 +53,8 @@ let AbstractWorkspaceEditingService = class AbstractWorkspaceEditingService exte
|
|
|
55
53
|
availableFileSystems.unshift(Schemas.vscodeRemote);
|
|
56
54
|
}
|
|
57
55
|
let workspacePath = await this.fileDialogService.showSaveDialog({
|
|
58
|
-
saveLabel: mnemonicButtonLabel(( localize(
|
|
59
|
-
title: ( localize(
|
|
56
|
+
saveLabel: mnemonicButtonLabel(( localize(3683, "Save"))),
|
|
57
|
+
title: ( localize(3684, "Save Workspace")),
|
|
60
58
|
filters: WORKSPACE_FILTER,
|
|
61
59
|
defaultUri: joinPath(await this.fileDialogService.defaultWorkspacePath(), this.getNewWorkspaceName()),
|
|
62
60
|
availableFileSystems
|
|
@@ -74,7 +72,7 @@ let AbstractWorkspaceEditingService = class AbstractWorkspaceEditingService exte
|
|
|
74
72
|
if (configPathURI && isSavedWorkspace(configPathURI, this.environmentService)) {
|
|
75
73
|
return basename(configPathURI);
|
|
76
74
|
}
|
|
77
|
-
const folder =
|
|
75
|
+
const folder = this.contextService.getWorkspace().folders.at(0);
|
|
78
76
|
if (folder) {
|
|
79
77
|
return `${basename(folder.uri)}.${WORKSPACE_EXTENSION}`;
|
|
80
78
|
}
|
|
@@ -107,7 +105,7 @@ let AbstractWorkspaceEditingService = class AbstractWorkspaceEditingService exte
|
|
|
107
105
|
if (this.includesSingleFolderWorkspace(foldersToDelete)) {
|
|
108
106
|
return this.createAndEnterWorkspace(foldersToAdd);
|
|
109
107
|
}
|
|
110
|
-
if (this.contextService.getWorkbenchState() !==
|
|
108
|
+
if (this.contextService.getWorkbenchState() !== 3 ) {
|
|
111
109
|
return this.doAddFolders(foldersToAdd, index, donotNotifyError);
|
|
112
110
|
}
|
|
113
111
|
return this.doUpdateFolders(foldersToAdd, foldersToDelete, index, donotNotifyError);
|
|
@@ -132,11 +130,11 @@ let AbstractWorkspaceEditingService = class AbstractWorkspaceEditingService exte
|
|
|
132
130
|
}
|
|
133
131
|
async doAddFolders(foldersToAdd, index, donotNotifyError = false) {
|
|
134
132
|
const state = this.contextService.getWorkbenchState();
|
|
135
|
-
if (state !==
|
|
133
|
+
if (state !== 3 ) {
|
|
136
134
|
let newWorkspaceFolders = ( (this.contextService.getWorkspace().folders.map(folder => ({ uri: folder.uri }))));
|
|
137
135
|
newWorkspaceFolders.splice(typeof index === 'number' ? index : newWorkspaceFolders.length, 0, ...foldersToAdd);
|
|
138
136
|
newWorkspaceFolders = distinct(newWorkspaceFolders, folder => this.uriIdentityService.extUri.getComparisonKey(folder.uri));
|
|
139
|
-
if (state ===
|
|
137
|
+
if (state === 1 && newWorkspaceFolders.length === 0 || state === 2 && newWorkspaceFolders.length === 1) {
|
|
140
138
|
return;
|
|
141
139
|
}
|
|
142
140
|
return this.createAndEnterWorkspace(newWorkspaceFolders);
|
|
@@ -166,7 +164,7 @@ let AbstractWorkspaceEditingService = class AbstractWorkspaceEditingService exte
|
|
|
166
164
|
}
|
|
167
165
|
}
|
|
168
166
|
includesSingleFolderWorkspace(folders) {
|
|
169
|
-
if (this.contextService.getWorkbenchState() ===
|
|
167
|
+
if (this.contextService.getWorkbenchState() === 2 ) {
|
|
170
168
|
const workspaceFolder = this.contextService.getWorkspace().folders[0];
|
|
171
169
|
return (
|
|
172
170
|
(folders.some(
|
|
@@ -235,7 +233,7 @@ let AbstractWorkspaceEditingService = class AbstractWorkspaceEditingService exte
|
|
|
235
233
|
const configPathURI = workspace.configPath;
|
|
236
234
|
const existingModel = this.textFileService.files.get(configPathURI);
|
|
237
235
|
if (existingModel) {
|
|
238
|
-
await existingModel.save({ force: true, reason:
|
|
236
|
+
await existingModel.save({ force: true, reason: 1 });
|
|
239
237
|
return;
|
|
240
238
|
}
|
|
241
239
|
const workspaceFileExists = await this.fileService.exists(configPathURI);
|
|
@@ -248,7 +246,7 @@ let AbstractWorkspaceEditingService = class AbstractWorkspaceEditingService exte
|
|
|
248
246
|
}
|
|
249
247
|
handleWorkspaceConfigurationEditingError(error) {
|
|
250
248
|
switch (error.code) {
|
|
251
|
-
case
|
|
249
|
+
case 0 :
|
|
252
250
|
this.onInvalidWorkspaceConfigurationFileError();
|
|
253
251
|
break;
|
|
254
252
|
default:
|
|
@@ -257,14 +255,14 @@ let AbstractWorkspaceEditingService = class AbstractWorkspaceEditingService exte
|
|
|
257
255
|
}
|
|
258
256
|
onInvalidWorkspaceConfigurationFileError() {
|
|
259
257
|
const message = ( localize(
|
|
260
|
-
|
|
258
|
+
3685,
|
|
261
259
|
"Unable to write into workspace configuration file. Please open the file to correct errors/warnings in it and try again."
|
|
262
260
|
));
|
|
263
261
|
this.askToOpenWorkspaceConfigurationFile(message);
|
|
264
262
|
}
|
|
265
263
|
askToOpenWorkspaceConfigurationFile(message) {
|
|
266
264
|
this.notificationService.prompt(Severity$1.Error, message, [{
|
|
267
|
-
label: ( localize(
|
|
265
|
+
label: ( localize(3686, "Open Workspace Configuration")),
|
|
268
266
|
run: () => this.commandService.executeCommand('workbench.action.openWorkspaceConfigFile')
|
|
269
267
|
}]);
|
|
270
268
|
}
|
|
@@ -273,14 +271,14 @@ let AbstractWorkspaceEditingService = class AbstractWorkspaceEditingService exte
|
|
|
273
271
|
throw ( (new Error('Entering a new workspace is not possible in tests.')));
|
|
274
272
|
}
|
|
275
273
|
const workspace = await this.workspacesService.getWorkspaceIdentifier(workspaceUri);
|
|
276
|
-
if (this.contextService.getWorkbenchState() ===
|
|
274
|
+
if (this.contextService.getWorkbenchState() === 2 ) {
|
|
277
275
|
await this.migrateWorkspaceSettings(workspace);
|
|
278
276
|
}
|
|
279
277
|
await this.configurationService.initialize(workspace);
|
|
280
278
|
return this.workspacesService.enterWorkspace(workspaceUri);
|
|
281
279
|
}
|
|
282
280
|
migrateWorkspaceSettings(toWorkspace) {
|
|
283
|
-
return this.doCopyWorkspaceSettings(toWorkspace, setting => setting.scope ===
|
|
281
|
+
return this.doCopyWorkspaceSettings(toWorkspace, setting => setting.scope === 3 );
|
|
284
282
|
}
|
|
285
283
|
copyWorkspaceSettings(toWorkspace) {
|
|
286
284
|
return this.doCopyWorkspaceSettings(toWorkspace);
|
|
@@ -299,7 +297,7 @@ let AbstractWorkspaceEditingService = class AbstractWorkspaceEditingService exte
|
|
|
299
297
|
return this.jsonEditingService.write(toWorkspace.configPath, [{ path: ['settings'], value: targetWorkspaceConfiguration }], true);
|
|
300
298
|
}
|
|
301
299
|
async trustWorkspaceConfiguration(configPathURI) {
|
|
302
|
-
if (this.contextService.getWorkbenchState() !==
|
|
300
|
+
if (this.contextService.getWorkbenchState() !== 1 && this.workspaceTrustManagementService.isWorkspaceTrusted()) {
|
|
303
301
|
await this.workspaceTrustManagementService.setUrisTrust([configPathURI], true);
|
|
304
302
|
}
|
|
305
303
|
}
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
-
import 'vscode/vscode/vs/platform/instantiation/common/extensions';
|
|
3
2
|
import { restoreRecentlyOpened, isRecentFolder, isRecentWorkspace, isRecentFile, toStoreData, getStoredWorkspaceFolder } from 'vscode/vscode/vs/platform/workspaces/common/workspaces';
|
|
4
3
|
import 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
5
4
|
import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
6
|
-
import { StorageScope, StorageTarget } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
7
5
|
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
|
|
8
|
-
import { isTemporaryWorkspace,
|
|
6
|
+
import { isTemporaryWorkspace, WORKSPACE_EXTENSION } from 'vscode/vscode/vs/platform/workspace/common/workspace';
|
|
9
7
|
import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace.service';
|
|
10
8
|
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
11
9
|
import { Disposable, DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
12
10
|
import { getWorkspaceIdentifier } from 'vscode/vscode/vs/workbench/services/workspaces/browser/workspaces';
|
|
13
|
-
import { FileOperationResult } from 'vscode/vscode/vs/platform/files/common/files';
|
|
14
11
|
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
|
|
15
12
|
import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService.service';
|
|
16
13
|
import { joinPath } from 'vscode/vscode/vs/base/common/resources';
|
|
@@ -36,7 +33,7 @@ let BrowserWorkspacesService = class BrowserWorkspacesService extends Disposable
|
|
|
36
33
|
this.registerListeners();
|
|
37
34
|
}
|
|
38
35
|
registerListeners() {
|
|
39
|
-
this._register(this.storageService.onDidChangeValue(
|
|
36
|
+
this._register(this.storageService.onDidChangeValue(-1 , BrowserWorkspacesService_1.RECENTLY_OPENED_KEY, this._register(( new DisposableStore())))(() => this._onRecentlyOpenedChange.fire()));
|
|
40
37
|
this._register(this.contextService.onDidChangeWorkspaceFolders(e => this.onDidChangeWorkspaceFolders(e)));
|
|
41
38
|
}
|
|
42
39
|
onDidChangeWorkspaceFolders(e) {
|
|
@@ -51,16 +48,16 @@ let BrowserWorkspacesService = class BrowserWorkspacesService extends Disposable
|
|
|
51
48
|
const workspace = this.contextService.getWorkspace();
|
|
52
49
|
const remoteAuthority = this.environmentService.remoteAuthority;
|
|
53
50
|
switch (this.contextService.getWorkbenchState()) {
|
|
54
|
-
case
|
|
51
|
+
case 2 :
|
|
55
52
|
this.addRecentlyOpened([{ folderUri: workspace.folders[0].uri, remoteAuthority }]);
|
|
56
53
|
break;
|
|
57
|
-
case
|
|
54
|
+
case 3 :
|
|
58
55
|
this.addRecentlyOpened([{ workspace: { id: workspace.id, configPath: workspace.configuration }, remoteAuthority }]);
|
|
59
56
|
break;
|
|
60
57
|
}
|
|
61
58
|
}
|
|
62
59
|
async getRecentlyOpened() {
|
|
63
|
-
const recentlyOpenedRaw = this.storageService.get(BrowserWorkspacesService_1.RECENTLY_OPENED_KEY,
|
|
60
|
+
const recentlyOpenedRaw = this.storageService.get(BrowserWorkspacesService_1.RECENTLY_OPENED_KEY, -1 );
|
|
64
61
|
if (recentlyOpenedRaw) {
|
|
65
62
|
const recentlyOpened = restoreRecentlyOpened(JSON.parse(recentlyOpenedRaw), this.logService);
|
|
66
63
|
recentlyOpened.workspaces = recentlyOpened.workspaces.filter(recent => {
|
|
@@ -108,10 +105,10 @@ let BrowserWorkspacesService = class BrowserWorkspacesService extends Disposable
|
|
|
108
105
|
});
|
|
109
106
|
}
|
|
110
107
|
async saveRecentlyOpened(data) {
|
|
111
|
-
return this.storageService.store(BrowserWorkspacesService_1.RECENTLY_OPENED_KEY, JSON.stringify(toStoreData(data)),
|
|
108
|
+
return this.storageService.store(BrowserWorkspacesService_1.RECENTLY_OPENED_KEY, JSON.stringify(toStoreData(data)), -1 , 0 );
|
|
112
109
|
}
|
|
113
110
|
async clearRecentlyOpened() {
|
|
114
|
-
this.storageService.remove(BrowserWorkspacesService_1.RECENTLY_OPENED_KEY,
|
|
111
|
+
this.storageService.remove(BrowserWorkspacesService_1.RECENTLY_OPENED_KEY, -1 );
|
|
115
112
|
}
|
|
116
113
|
async enterWorkspace(workspaceUri) {
|
|
117
114
|
return { workspace: await this.getWorkspaceIdentifier(workspaceUri) };
|
|
@@ -134,7 +131,7 @@ let BrowserWorkspacesService = class BrowserWorkspacesService extends Disposable
|
|
|
134
131
|
await this.fileService.del(workspace.configPath);
|
|
135
132
|
}
|
|
136
133
|
catch (error) {
|
|
137
|
-
if (error.fileOperationResult !==
|
|
134
|
+
if (error.fileOperationResult !== 1 ) {
|
|
138
135
|
throw error;
|
|
139
136
|
}
|
|
140
137
|
}
|