Skip to content

Commit 987e4f9

Browse files
committed
argv: bring back deprecated ids (fixes microsoft#67937)
1 parent 65f4cd7 commit 987e4f9

1 file changed

Lines changed: 14 additions & 6 deletions

File tree

  • src/vs/platform/environment/node

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

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export interface Option {
2222
id: string;
2323
type: 'boolean' | 'string';
2424
alias?: string;
25+
deprecates?: string; // old deprecated id
2526
args?: string | string[];
2627
description?: string;
2728
cat?: keyof HelpCategories;
@@ -41,7 +42,7 @@ export const options: Option[] = [
4142
{ id: 'folder-uri', type: 'string', cat: 'o', args: 'uri', description: localize('folderUri', "Opens a window with given folder uri(s)") },
4243
{ id: 'file-uri', type: 'string', cat: 'o', args: 'uri', description: localize('fileUri', "Opens a window with given file uri(s)") },
4344

44-
{ id: 'extensions-dir', type: 'string', cat: 'e', args: 'dir', description: localize('extensionHomePath', "Set the root path for extensions.") },
45+
{ id: 'extensions-dir', type: 'string', deprecates: 'extensionHomePath', cat: 'e', args: 'dir', description: localize('extensionHomePath', "Set the root path for extensions.") },
4546
{ id: 'list-extensions', type: 'boolean', cat: 'e', description: localize('listExtensions', "List the installed extensions.") },
4647
{ id: 'show-versions', type: 'boolean', cat: 'e', description: localize('showVersions', "Show versions of installed extensions, when using --list-extension.") },
4748
{ id: 'install-extension', type: 'string', cat: 'e', args: 'extension-id', description: localize('installExtension', "Installs or updates the extension. Use `--force` argument to avoid prompts.") },
@@ -53,7 +54,7 @@ export const options: Option[] = [
5354
{ id: 'status', type: 'boolean', alias: 's', cat: 't', description: localize('status', "Print process usage and diagnostics information.") },
5455
{ id: 'prof-modules', type: 'boolean', alias: 'p', cat: 't', description: localize('prof-modules', "Capture performance markers while loading JS modules and print them with 'F1 > Developer: Startup Performance") },
5556
{ id: 'prof-startup', type: 'boolean', cat: 't', description: localize('prof-startup', "Run CPU profiler during startup") },
56-
{ id: 'disable-extensions', type: 'boolean', cat: 't', description: localize('disableExtensions', "Disable all installed extensions.") },
57+
{ id: 'disable-extensions', type: 'boolean', deprecates: 'disableExtensions', cat: 't', description: localize('disableExtensions', "Disable all installed extensions.") },
5758
{ id: 'disable-extension', type: 'string', cat: 't', args: 'extension-id', description: localize('disableExtension', "Disable an extension.") },
5859

5960
{ id: 'inspect-extensions', type: 'string', args: 'port', cat: 't', description: localize('inspect-extensions', "Allow debugging and profiling of extensions. Check the developer tools for the connection URI.") },
@@ -66,8 +67,8 @@ export const options: Option[] = [
6667
{ id: 'extensionDevelopmentPath', type: 'string' },
6768
{ id: 'extensionTestsPath', type: 'string' },
6869
{ id: 'debugId', type: 'string' },
69-
{ id: 'inspect-search', type: 'string' },
70-
{ id: 'inspect-brk-extensions', type: 'string' },
70+
{ id: 'inspect-search', type: 'string', deprecates: 'debugSearch' },
71+
{ id: 'inspect-brk-extensions', type: 'string', deprecates: 'debugBrkSearch' },
7172
{ id: 'export-default-configuration', type: 'string' },
7273
{ id: 'install-source', type: 'string' },
7374
{ id: 'driver', type: 'string' },
@@ -101,9 +102,12 @@ export function parseArgs(args: string[], isOptionSupported = (_: Option) => tru
101102
const string: string[] = [];
102103
const boolean: string[] = [];
103104
for (let o of options) {
104-
if (o.alias && isOptionSupported(o)) {
105-
alias[o.id] = o.alias;
105+
if (isOptionSupported(o)) {
106+
if (o.alias) {
107+
alias[o.id] = o.alias;
108+
}
106109
}
110+
107111
if (o.type === 'string') {
108112
string.push(o.id);
109113
} else if (o.type === 'boolean') {
@@ -116,6 +120,10 @@ export function parseArgs(args: string[], isOptionSupported = (_: Option) => tru
116120
if (o.alias) {
117121
delete parsedArgs[o.alias];
118122
}
123+
if (o.deprecates && parsedArgs[o.deprecates] && !parsedArgs[o.id]) {
124+
parsedArgs[o.id] = parsedArgs[o.deprecates];
125+
delete parsedArgs[o.deprecates];
126+
}
119127
}
120128
return parsedArgs;
121129
}

0 commit comments

Comments
 (0)