Skip to content

Commit 48fa5b2

Browse files
committed
1 parent db2f1d9 commit 48fa5b2

3 files changed

Lines changed: 12 additions & 0 deletions

File tree

src/vs/platform/environment/common/environment.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ export interface ParsedArgs {
7373
'disable-user-env-probe'?: boolean;
7474
'force'?: boolean;
7575
'force-user-env'?: boolean;
76+
'sync'?: 'on' | 'off';
7677

7778
// chromium command line args: https://electronjs.org/docs/all#supported-chrome-command-line-switches
7879
'no-proxy-server'?: boolean;

src/vs/platform/environment/node/argv.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export const OPTIONS: OptionDescriptions<Required<ParsedArgs>> = {
5252
'telemetry': { type: 'boolean', cat: 'o', description: localize('telemetry', "Shows all telemetry events which VS code collects.") },
5353
'folder-uri': { type: 'string[]', cat: 'o', args: 'uri', description: localize('folderUri', "Opens a window with given folder uri(s)") },
5454
'file-uri': { type: 'string[]', cat: 'o', args: 'uri', description: localize('fileUri', "Opens a window with given file uri(s)") },
55+
'sync': { type: 'string', cat: 'o', description: localize('turn sync', "Turn sync on or off"), args: ['on', 'off'] },
5556

5657
'extensions-dir': { type: 'string', deprecates: 'extensionHomePath', cat: 'e', args: 'dir', description: localize('extensionHomePath', "Set the root path for extensions.") },
5758
'builtin-extensions-dir': { type: 'string' },

src/vs/platform/userDataSync/common/userDataSyncEnablementService.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { Disposable } from 'vs/base/common/lifecycle';
88
import { Emitter, Event } from 'vs/base/common/event';
99
import { IStorageService, IWorkspaceStorageChangeEvent, StorageScope } from 'vs/platform/storage/common/storage';
1010
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
11+
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
1112

1213
type SyncEnablementClassification = {
1314
enabled?: { classification: 'SystemMetaData', purpose: 'FeatureInsight', isMeasurement: true };
@@ -29,8 +30,17 @@ export class UserDataSyncEnablementService extends Disposable implements IUserDa
2930
constructor(
3031
@IStorageService private readonly storageService: IStorageService,
3132
@ITelemetryService private readonly telemetryService: ITelemetryService,
33+
@IEnvironmentService environmentService: IEnvironmentService,
3234
) {
3335
super();
36+
switch (environmentService.args['sync']) {
37+
case 'on':
38+
this.setEnablement(true);
39+
break;
40+
case 'off':
41+
this.setEnablement(false);
42+
break;
43+
}
3444
this._register(storageService.onDidChangeStorage(e => this.onDidStorageChange(e)));
3545
}
3646

0 commit comments

Comments
 (0)