From d1fedc39dd7da860982a4fdfcfcacba7750cf012 Mon Sep 17 00:00:00 2001 From: meganrogge Date: Wed, 26 Mar 2025 11:37:07 -0500 Subject: [PATCH 01/10] fix ##244594 --- .../src/completions/code-tunnel-insiders.ts | 4 +-- .../src/completions/code-tunnel.ts | 31 +++++++++++++++++-- .../terminal-suggest/src/completions/code.ts | 28 ++--------------- 3 files changed, 33 insertions(+), 30 deletions(-) diff --git a/extensions/terminal-suggest/src/completions/code-tunnel-insiders.ts b/extensions/terminal-suggest/src/completions/code-tunnel-insiders.ts index e1ca18bc10e6c..dc0582627022d 100644 --- a/extensions/terminal-suggest/src/completions/code-tunnel-insiders.ts +++ b/extensions/terminal-suggest/src/completions/code-tunnel-insiders.ts @@ -2,7 +2,7 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { commonOptions, extensionManagementOptions, troubleshootingOptions, tunnelOptions } from './code'; +import { commonOptions, extensionManagementOptions, troubleshootingOptions, globalTunnelOptions } from './code'; import codeTunnelCompletionSpec from './code-tunnel'; const codeTunnelInsidersCompletionSpec: Fig.Spec = { @@ -13,7 +13,7 @@ const codeTunnelInsidersCompletionSpec: Fig.Spec = { ...commonOptions, ...extensionManagementOptions('code-tunnel-insiders'), ...troubleshootingOptions('code-tunnel-insiders'), - ...tunnelOptions + ...globalTunnelOptions ] }; diff --git a/extensions/terminal-suggest/src/completions/code-tunnel.ts b/extensions/terminal-suggest/src/completions/code-tunnel.ts index d91e6bc9c4d77..4640bb7510223 100644 --- a/extensions/terminal-suggest/src/completions/code-tunnel.ts +++ b/extensions/terminal-suggest/src/completions/code-tunnel.ts @@ -2,18 +2,43 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import code, { codeTunnelSubcommands, commonOptions, extensionManagementOptions, troubleshootingOptions, tunnelOptions } from './code'; +import code, { codeTunnelSubcommands, commonOptions, extensionManagementOptions, troubleshootingOptions, globalTunnelOptions } from './code'; const codeTunnelCompletionSpec: Fig.Spec = { ...code, name: 'code-tunnel', description: 'Create a tunnel that\'s accessible on vscode.dev from anywhere.', - subcommands: codeTunnelSubcommands, + subcommands: [ + ...codeTunnelSubcommands, + { + name: 'ext', + description: 'Manage editor extensions', + subcommands: [ + { + name: 'list', + description: 'List installed extensions', + }, + { + name: 'install', + description: 'Install an extension', + }, + { + name: 'uninstall', + description: 'Uninstall an extension', + }, + { + name: 'update', + description: 'Update the installed extensions', + }, + ], + ...globalTunnelOptions + } + ], options: [ ...commonOptions, ...extensionManagementOptions('code-tunnel'), ...troubleshootingOptions('code-tunnel'), - ...tunnelOptions + ...globalTunnelOptions ] }; diff --git a/extensions/terminal-suggest/src/completions/code.ts b/extensions/terminal-suggest/src/completions/code.ts index 20bb2c13660f4..fd69d4662aa75 100644 --- a/extensions/terminal-suggest/src/completions/code.ts +++ b/extensions/terminal-suggest/src/completions/code.ts @@ -446,7 +446,7 @@ export const commonAuthOptions: Fig.Option[] = [ } ]; -export const tunnelOptions: Fig.Option[] = [ +export const globalTunnelOptions: Fig.Option[] = [ { name: '--cli-data-dir', description: 'Directory where CLI metadata should be stored', @@ -634,29 +634,7 @@ export const codeTunnelSubcommands = [ ], }, ], - options: tunnelOptions - }, - { - name: 'ext', - description: 'Manage editor extensions', - subcommands: [ - { - name: 'list', - description: 'List installed extensions', - }, - { - name: 'install', - description: 'Install an extension', - }, - { - name: 'uninstall', - description: 'Uninstall an extension', - }, - { - name: 'update', - description: 'Update the installed extensions', - }, - ], + options: globalTunnelOptions }, { name: 'status', @@ -665,7 +643,7 @@ export const codeTunnelSubcommands = [ { name: 'version', description: `Changes the version of the editor you're using`, - options: tunnelOptions + options: globalTunnelOptions }, { name: 'serve-web', From d1af7c36b9abb9051899df1cdf9a5105c8bac825 Mon Sep 17 00:00:00 2001 From: meganrogge Date: Wed, 26 Mar 2025 12:02:56 -0500 Subject: [PATCH 02/10] fix #244666 --- .../src/completions/code-tunnel-insiders.ts | 5 +- .../src/completions/code-tunnel.ts | 8 +- .../terminal-suggest/src/completions/code.ts | 105 +++++++++++++++++- 3 files changed, 111 insertions(+), 7 deletions(-) diff --git a/extensions/terminal-suggest/src/completions/code-tunnel-insiders.ts b/extensions/terminal-suggest/src/completions/code-tunnel-insiders.ts index dc0582627022d..14ab6965106f7 100644 --- a/extensions/terminal-suggest/src/completions/code-tunnel-insiders.ts +++ b/extensions/terminal-suggest/src/completions/code-tunnel-insiders.ts @@ -2,7 +2,7 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { commonOptions, extensionManagementOptions, troubleshootingOptions, globalTunnelOptions } from './code'; +import { commonOptions, extensionManagementOptions, troubleshootingOptions, globalTunnelOptions, codeTunnelOptions } from './code'; import codeTunnelCompletionSpec from './code-tunnel'; const codeTunnelInsidersCompletionSpec: Fig.Spec = { @@ -13,7 +13,8 @@ const codeTunnelInsidersCompletionSpec: Fig.Spec = { ...commonOptions, ...extensionManagementOptions('code-tunnel-insiders'), ...troubleshootingOptions('code-tunnel-insiders'), - ...globalTunnelOptions + ...globalTunnelOptions, + ...codeTunnelOptions ] }; diff --git a/extensions/terminal-suggest/src/completions/code-tunnel.ts b/extensions/terminal-suggest/src/completions/code-tunnel.ts index 4640bb7510223..e00ed04c78ee7 100644 --- a/extensions/terminal-suggest/src/completions/code-tunnel.ts +++ b/extensions/terminal-suggest/src/completions/code-tunnel.ts @@ -2,7 +2,7 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import code, { codeTunnelSubcommands, commonOptions, extensionManagementOptions, troubleshootingOptions, globalTunnelOptions } from './code'; +import code, { codeTunnelSubcommands, commonOptions, extensionManagementOptions, troubleshootingOptions, globalTunnelOptions, codeTunnelOptions } from './code'; const codeTunnelCompletionSpec: Fig.Spec = { ...code, @@ -31,14 +31,16 @@ const codeTunnelCompletionSpec: Fig.Spec = { description: 'Update the installed extensions', }, ], - ...globalTunnelOptions + ...globalTunnelOptions, + ...codeTunnelOptions } ], options: [ ...commonOptions, ...extensionManagementOptions('code-tunnel'), ...troubleshootingOptions('code-tunnel'), - ...globalTunnelOptions + ...globalTunnelOptions, + ...codeTunnelOptions ] }; diff --git a/extensions/terminal-suggest/src/completions/code.ts b/extensions/terminal-suggest/src/completions/code.ts index fd69d4662aa75..d55ec605ec64f 100644 --- a/extensions/terminal-suggest/src/completions/code.ts +++ b/extensions/terminal-suggest/src/completions/code.ts @@ -463,7 +463,6 @@ export const globalTunnelOptions: Fig.Option[] = [ template: 'filepaths', }, }, - { name: '--telemetry-level', description: 'Sets the initial telemetry level', @@ -480,6 +479,108 @@ export const globalTunnelOptions: Fig.Option[] = [ } ]; +export const codeTunnelOptions: Fig.Option[] = [ + { + name: '--install-extension', + description: 'Requests that extensions be preloaded and installed on connecting servers', + isRepeatable: true, + args: { + name: 'install_extension', + isOptional: true, + }, + }, + { + name: '--server-data-dir', + description: 'Specifies the directory that server data is kept in', + isRepeatable: true, + args: { + name: 'server_data_dir', + isOptional: true, + }, + }, + { + name: '--extensions-dir', + description: 'Set the root path for extensions', + isRepeatable: true, + args: { + name: 'extensions_dir', + isOptional: true, + }, + }, + { + name: '--user-data-dir', + description: 'Specifies the directory that user data is kept in. Can be used to open multiple distinct instances of the editor', + isRepeatable: true, + args: { + name: 'user_data_dir', + isOptional: true, + }, + }, + { + name: '--use-version', + description: 'Sets the editor version to use for this command. The preferred version can be persisted with `code version use `. Can be \'stable\', \'insiders\', a version number, or an absolute path to an existing install', + isRepeatable: true, + args: { + name: 'use_version', + isOptional: true, + }, + }, + { + name: '--random-name', + description: 'Randomly name machine for port forwarding service', + }, + { + name: '--no-sleep', + description: 'Prevents the machine going to sleep while this command runs', + }, + { + name: '--accept-server-license-terms', + description: 'If set, the user accepts the server license terms and the server will be started without a user prompt', + }, + { + name: '--name', + description: 'Sets the machine name for port forwarding service', + isRepeatable: true, + args: { + name: 'name', + isOptional: true, + }, + }, + { + name: ['-h', '--help'], + description: 'Print help', + }, + { + name: '--log', + description: 'Log level to use', + isRepeatable: true, + args: { + name: 'log', + isOptional: true, + suggestions: [ + 'trace', + 'debug', + 'info', + 'warn', + 'error', + 'critical', + 'off', + ], + }, + }, + { + name: '--verbose', + description: 'Print verbose output (implies --wait)', + }, + { + name: '--cli-data-dir', + description: 'Directory where CLI metadata should be stored', + args: { + name: 'cli_data_dir', + }, + }, +]; + export const codeTunnelSubcommands = [ { name: 'tunnel', @@ -634,7 +735,7 @@ export const codeTunnelSubcommands = [ ], }, ], - options: globalTunnelOptions + options: codeTunnelOptions, }, { name: 'status', From 50b230a329c090fc0ebca4b322f207861cf925af Mon Sep 17 00:00:00 2001 From: meganrogge Date: Wed, 26 Mar 2025 12:26:59 -0500 Subject: [PATCH 03/10] fix some subcommand options --- .../src/completions/code-tunnel.ts | 38 +++++++++++- .../terminal-suggest/src/completions/code.ts | 60 ++++++++++--------- 2 files changed, 69 insertions(+), 29 deletions(-) diff --git a/extensions/terminal-suggest/src/completions/code-tunnel.ts b/extensions/terminal-suggest/src/completions/code-tunnel.ts index e00ed04c78ee7..475a2d98a7255 100644 --- a/extensions/terminal-suggest/src/completions/code-tunnel.ts +++ b/extensions/terminal-suggest/src/completions/code-tunnel.ts @@ -2,7 +2,7 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import code, { codeTunnelSubcommands, commonOptions, extensionManagementOptions, troubleshootingOptions, globalTunnelOptions, codeTunnelOptions } from './code'; +import code, { codeTunnelSubcommands, commonOptions, extensionManagementOptions, troubleshootingOptions, globalTunnelOptions, codeTunnelOptions, commonCLIOptions } from './code'; const codeTunnelCompletionSpec: Fig.Spec = { ...code, @@ -17,23 +17,57 @@ const codeTunnelCompletionSpec: Fig.Spec = { { name: 'list', description: 'List installed extensions', + options: [ + ...commonCLIOptions, + { + name: '--category', + description: 'Filters installed extensions by provided category, when using --list-extensions', + isRepeatable: true, + args: { + name: 'category', + isOptional: true, + }, + } + ] }, { name: 'install', description: 'Install an extension', + options: [...commonCLIOptions, + { + name: '--pre-release', + description: 'Installs the pre-release version of the extension', + }, + { + name: '--donot-include-pack-and-dependencies', + description: `Don't include installing pack and dependencies of the extension`, + }, + { + name: '--force', + description: `Update to the latest version of the extension if it's already installed`, + }, + ], + args: { + name: 'ext-id | id', + isVariadic: true, + isOptional: true, + }, }, { name: 'uninstall', description: 'Uninstall an extension', + options: commonCLIOptions }, { name: 'update', description: 'Update the installed extensions', + options: commonCLIOptions }, ], ...globalTunnelOptions, ...codeTunnelOptions - } + }, + ], options: [ ...commonOptions, diff --git a/extensions/terminal-suggest/src/completions/code.ts b/extensions/terminal-suggest/src/completions/code.ts index d55ec605ec64f..4f2023b548237 100644 --- a/extensions/terminal-suggest/src/completions/code.ts +++ b/extensions/terminal-suggest/src/completions/code.ts @@ -446,6 +446,13 @@ export const commonAuthOptions: Fig.Option[] = [ } ]; +export const tunnelHelpOptions: Fig.Option[] = [ + { + name: ['-h', '--help'], + description: 'Print help', + }, +]; + export const globalTunnelOptions: Fig.Option[] = [ { name: '--cli-data-dir', @@ -455,28 +462,27 @@ export const globalTunnelOptions: Fig.Option[] = [ }, }, { - name: '--log-to-file', - description: 'Log to a file in addition to stdout. Used when running as a service', - hidden: true, - args: { - name: 'log_to_file', - template: 'filepaths', - }, + name: '--verbose', + description: 'Print verbose output (implies --wait)', }, { - name: '--telemetry-level', - description: 'Sets the initial telemetry level', - hidden: true, + name: '--log', + description: 'Log level to use', + isRepeatable: true, args: { - name: 'telemetry_level', + name: 'log', + isOptional: true, suggestions: [ - 'off', - 'crash', + 'trace', + 'debug', + 'info', + 'warn', 'error', - 'all', + 'critical', + 'off', ], }, - } + }, ]; export const codeTunnelOptions: Fig.Option[] = [ @@ -589,27 +595,27 @@ export const codeTunnelSubcommands = [ { name: 'prune', description: 'Delete all servers which are currently not running', - options: commonCLIOptions, + options: [...globalTunnelOptions, ...tunnelHelpOptions], }, { name: 'kill', description: 'Stops any running tunnel on the system', - options: commonCLIOptions, + options: [...globalTunnelOptions, ...tunnelHelpOptions], }, { name: 'restart', description: 'Restarts any running tunnel on the system', - options: commonCLIOptions, + options: [...globalTunnelOptions, ...tunnelHelpOptions], }, { name: 'status', description: 'Gets whether there is a tunnel running on the current machine', - options: commonCLIOptions, + options: [...globalTunnelOptions, ...tunnelHelpOptions], }, { name: 'rename', description: 'Rename the name of this machine associated with port forwarding service', - options: commonCLIOptions, + options: [...globalTunnelOptions, ...tunnelHelpOptions], args: { name: 'name', }, @@ -617,12 +623,12 @@ export const codeTunnelSubcommands = [ { name: 'status', description: 'Print process usage and diagnostics information', - options: commonCLIOptions, + options: [...globalTunnelOptions, ...tunnelHelpOptions], }, { name: 'unregister', description: 'Remove this machine\'s association with the port forwarding service', - options: commonCLIOptions, + options: [...globalTunnelOptions, ...tunnelHelpOptions], }, { name: 'user', @@ -630,17 +636,17 @@ export const codeTunnelSubcommands = [ { name: 'login', description: 'Log in to port forwarding service', - options: [...commonAuthOptions, ...commonCLIOptions], + options: [...globalTunnelOptions, ...tunnelHelpOptions, ...commonAuthOptions], }, { name: 'logout', description: 'Log out of port forwarding service', - options: commonCLIOptions, + options: [...globalTunnelOptions, ...tunnelHelpOptions], }, { name: 'show', description: 'Show the account that\'s logged into port forwarding service', - options: commonCLIOptions, + options: [...globalTunnelOptions, ...tunnelHelpOptions], }, { name: 'help', @@ -651,10 +657,8 @@ export const codeTunnelSubcommands = [ { name: 'show', description: 'Show the account that\'s logged into port forwarding service' }, { name: 'help', description: 'Print this message or the help of the given subcommand(s)' }, ], - options: commonCLIOptions, }, ], - options: commonCLIOptions, }, { name: 'service', @@ -907,10 +911,12 @@ export const codeTunnelSubcommands = [ { name: 'uninstall', description: 'Uninstall an extension', + options: commonCLIOptions }, { name: 'update', description: 'Update the installed extensions', + options: commonCLIOptions }, ], }, From be0c6c47e491aa1e66503dcbddcf83329f5fd6b9 Mon Sep 17 00:00:00 2001 From: meganrogge Date: Wed, 26 Mar 2025 12:35:00 -0500 Subject: [PATCH 04/10] update code-tunnel-insiders --- .../src/completions/code-tunnel-insiders.ts | 5 +- .../src/completions/code-tunnel.ts | 111 +++++++++--------- 2 files changed, 59 insertions(+), 57 deletions(-) diff --git a/extensions/terminal-suggest/src/completions/code-tunnel-insiders.ts b/extensions/terminal-suggest/src/completions/code-tunnel-insiders.ts index 14ab6965106f7..31eb32a1c3a71 100644 --- a/extensions/terminal-suggest/src/completions/code-tunnel-insiders.ts +++ b/extensions/terminal-suggest/src/completions/code-tunnel-insiders.ts @@ -2,13 +2,14 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { commonOptions, extensionManagementOptions, troubleshootingOptions, globalTunnelOptions, codeTunnelOptions } from './code'; -import codeTunnelCompletionSpec from './code-tunnel'; +import { commonOptions, extensionManagementOptions, troubleshootingOptions, globalTunnelOptions, codeTunnelOptions, codeTunnelSubcommands } from './code'; +import codeTunnelCompletionSpec, { extTunnelSubcommand } from './code-tunnel'; const codeTunnelInsidersCompletionSpec: Fig.Spec = { ...codeTunnelCompletionSpec, name: 'code-tunnel-insiders', description: 'Create a tunnel that\'s accessible on vscode.dev from anywhere, with insider features.', + subcommands: [...codeTunnelSubcommands, extTunnelSubcommand], options: [ ...commonOptions, ...extensionManagementOptions('code-tunnel-insiders'), diff --git a/extensions/terminal-suggest/src/completions/code-tunnel.ts b/extensions/terminal-suggest/src/completions/code-tunnel.ts index 475a2d98a7255..a150228248303 100644 --- a/extensions/terminal-suggest/src/completions/code-tunnel.ts +++ b/extensions/terminal-suggest/src/completions/code-tunnel.ts @@ -4,70 +4,71 @@ *--------------------------------------------------------------------------------------------*/ import code, { codeTunnelSubcommands, commonOptions, extensionManagementOptions, troubleshootingOptions, globalTunnelOptions, codeTunnelOptions, commonCLIOptions } from './code'; -const codeTunnelCompletionSpec: Fig.Spec = { - ...code, - name: 'code-tunnel', - description: 'Create a tunnel that\'s accessible on vscode.dev from anywhere.', +export const extTunnelSubcommand = { + name: 'ext', + description: 'Manage editor extensions', subcommands: [ - ...codeTunnelSubcommands, { - name: 'ext', - description: 'Manage editor extensions', - subcommands: [ - { - name: 'list', - description: 'List installed extensions', - options: [ - ...commonCLIOptions, - { - name: '--category', - description: 'Filters installed extensions by provided category, when using --list-extensions', - isRepeatable: true, - args: { - name: 'category', - isOptional: true, - }, - } - ] - }, + name: 'list', + description: 'List installed extensions', + options: [ + ...commonCLIOptions, { - name: 'install', - description: 'Install an extension', - options: [...commonCLIOptions, - { - name: '--pre-release', - description: 'Installs the pre-release version of the extension', - }, - { - name: '--donot-include-pack-and-dependencies', - description: `Don't include installing pack and dependencies of the extension`, - }, - { - name: '--force', - description: `Update to the latest version of the extension if it's already installed`, - }, - ], + name: '--category', + description: 'Filters installed extensions by provided category, when using --list-extensions', + isRepeatable: true, args: { - name: 'ext-id | id', - isVariadic: true, + name: 'category', isOptional: true, }, - }, - { - name: 'uninstall', - description: 'Uninstall an extension', - options: commonCLIOptions - }, - { - name: 'update', - description: 'Update the installed extensions', - options: commonCLIOptions - }, + } + ] + }, + { + name: 'install', + description: 'Install an extension', + options: [...commonCLIOptions, + { + name: '--pre-release', + description: 'Installs the pre-release version of the extension', + }, + { + name: '--donot-include-pack-and-dependencies', + description: `Don't include installing pack and dependencies of the extension`, + }, + { + name: '--force', + description: `Update to the latest version of the extension if it's already installed`, + }, ], - ...globalTunnelOptions, - ...codeTunnelOptions + args: { + name: 'ext-id | id', + isVariadic: true, + isOptional: true, + }, }, + { + name: 'uninstall', + description: 'Uninstall an extension', + options: commonCLIOptions + }, + { + name: 'update', + description: 'Update the installed extensions', + options: commonCLIOptions + }, + ], + ...globalTunnelOptions, + ...codeTunnelOptions +}; +const codeTunnelCompletionSpec: Fig.Spec = { + ...code, + name: 'code-tunnel', + description: 'Create a tunnel that\'s accessible on vscode.dev from anywhere.', + subcommands: [ + ...codeTunnelSubcommands, + extTunnelSubcommand ], options: [ ...commonOptions, From de487234115e7228564356e1aec21bcad9b102ac Mon Sep 17 00:00:00 2001 From: meganrogge Date: Wed, 26 Mar 2025 12:40:17 -0500 Subject: [PATCH 05/10] fix ext options --- .../src/completions/code-tunnel.ts | 38 +++++++++++-------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/extensions/terminal-suggest/src/completions/code-tunnel.ts b/extensions/terminal-suggest/src/completions/code-tunnel.ts index a150228248303..673132a253f0c 100644 --- a/extensions/terminal-suggest/src/completions/code-tunnel.ts +++ b/extensions/terminal-suggest/src/completions/code-tunnel.ts @@ -2,7 +2,7 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import code, { codeTunnelSubcommands, commonOptions, extensionManagementOptions, troubleshootingOptions, globalTunnelOptions, codeTunnelOptions, commonCLIOptions } from './code'; +import code, { codeTunnelSubcommands, commonOptions, extensionManagementOptions, troubleshootingOptions, globalTunnelOptions, codeTunnelOptions, commonCLIOptions, tunnelHelpOptions } from './code'; export const extTunnelSubcommand = { name: 'ext', @@ -11,23 +11,26 @@ export const extTunnelSubcommand = { { name: 'list', description: 'List installed extensions', - options: [ - ...commonCLIOptions, - { - name: '--category', - description: 'Filters installed extensions by provided category, when using --list-extensions', - isRepeatable: true, - args: { - name: 'category', - isOptional: true, - }, - } + options: [...globalTunnelOptions, ...tunnelHelpOptions, + { + name: '--category', + description: 'Filters installed extensions by provided category, when using --list-extensions', + isRepeatable: true, + args: { + name: 'category', + isOptional: true, + }, + }, + { + name: '--show-versions', + description: 'Show versions of installed extensions, when using --list-extensions', + }, ] }, { name: 'install', description: 'Install an extension', - options: [...commonCLIOptions, + options: [...globalTunnelOptions, ...tunnelHelpOptions, { name: '--pre-release', description: 'Installs the pre-release version of the extension', @@ -50,12 +53,17 @@ export const extTunnelSubcommand = { { name: 'uninstall', description: 'Uninstall an extension', - options: commonCLIOptions + options: [...globalTunnelOptions, ...tunnelHelpOptions], + args: { + name: 'ext-id | id', + isVariadic: true, + isOptional: true, + }, }, { name: 'update', description: 'Update the installed extensions', - options: commonCLIOptions + options: [...globalTunnelOptions, ...tunnelHelpOptions] }, ], ...globalTunnelOptions, From 00676f834e1fb63ebb4c1ee3f6bcb310961fbace Mon Sep 17 00:00:00 2001 From: meganrogge Date: Wed, 26 Mar 2025 12:40:37 -0500 Subject: [PATCH 06/10] rm unused --- extensions/terminal-suggest/src/completions/code-tunnel.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/terminal-suggest/src/completions/code-tunnel.ts b/extensions/terminal-suggest/src/completions/code-tunnel.ts index 673132a253f0c..523a433b41152 100644 --- a/extensions/terminal-suggest/src/completions/code-tunnel.ts +++ b/extensions/terminal-suggest/src/completions/code-tunnel.ts @@ -2,7 +2,7 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import code, { codeTunnelSubcommands, commonOptions, extensionManagementOptions, troubleshootingOptions, globalTunnelOptions, codeTunnelOptions, commonCLIOptions, tunnelHelpOptions } from './code'; +import code, { codeTunnelSubcommands, commonOptions, extensionManagementOptions, troubleshootingOptions, globalTunnelOptions, codeTunnelOptions, tunnelHelpOptions } from './code'; export const extTunnelSubcommand = { name: 'ext', From 1b1a7dedff3ad4878dc0def9c7a04e38d4f124ed Mon Sep 17 00:00:00 2001 From: meganrogge Date: Wed, 26 Mar 2025 12:44:09 -0500 Subject: [PATCH 07/10] fix more issues --- .../src/completions/code-tunnel-insiders.ts | 4 +-- .../src/completions/code-tunnel.ts | 32 ++++++++++++++++++- .../terminal-suggest/src/completions/code.ts | 2 +- 3 files changed, 34 insertions(+), 4 deletions(-) diff --git a/extensions/terminal-suggest/src/completions/code-tunnel-insiders.ts b/extensions/terminal-suggest/src/completions/code-tunnel-insiders.ts index 31eb32a1c3a71..d41f36325a45b 100644 --- a/extensions/terminal-suggest/src/completions/code-tunnel-insiders.ts +++ b/extensions/terminal-suggest/src/completions/code-tunnel-insiders.ts @@ -2,8 +2,8 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { commonOptions, extensionManagementOptions, troubleshootingOptions, globalTunnelOptions, codeTunnelOptions, codeTunnelSubcommands } from './code'; -import codeTunnelCompletionSpec, { extTunnelSubcommand } from './code-tunnel'; +import { commonOptions, extensionManagementOptions, troubleshootingOptions, globalTunnelOptions, codeTunnelSubcommands } from './code'; +import codeTunnelCompletionSpec, { codeTunnelOptions, extTunnelSubcommand } from './code-tunnel'; const codeTunnelInsidersCompletionSpec: Fig.Spec = { ...codeTunnelCompletionSpec, diff --git a/extensions/terminal-suggest/src/completions/code-tunnel.ts b/extensions/terminal-suggest/src/completions/code-tunnel.ts index 523a433b41152..7a189cf8cd32d 100644 --- a/extensions/terminal-suggest/src/completions/code-tunnel.ts +++ b/extensions/terminal-suggest/src/completions/code-tunnel.ts @@ -2,7 +2,37 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import code, { codeTunnelSubcommands, commonOptions, extensionManagementOptions, troubleshootingOptions, globalTunnelOptions, codeTunnelOptions, tunnelHelpOptions } from './code'; +import code, { codeTunnelSubcommands, commonOptions, extensionManagementOptions, troubleshootingOptions, globalTunnelOptions, tunnelHelpOptions } from './code'; + +export const codeTunnelOptions = [ + { + name: '--extensions-dir', + description: 'Set the root path for extensions', + isRepeatable: true, + args: { + name: 'extensions_dir', + isOptional: true, + }, + }, + { + name: '--user-data-dir', + description: 'Specifies the directory that user data is kept in. Can be used to open multiple distinct instances of the editor', + isRepeatable: true, + args: { + name: 'user_data_dir', + isOptional: true, + }, + }, + { + name: '--use-version', + description: 'Sets the editor version to use for this command. The preferred version can be persisted with `code version use `. Can be \'stable\', \'insiders\', a version number, or an absolute path to an existing install', + isRepeatable: true, + args: { + name: 'use_version', + isOptional: true, + }, + }, +]; export const extTunnelSubcommand = { name: 'ext', diff --git a/extensions/terminal-suggest/src/completions/code.ts b/extensions/terminal-suggest/src/completions/code.ts index 4f2023b548237..166705e7288ec 100644 --- a/extensions/terminal-suggest/src/completions/code.ts +++ b/extensions/terminal-suggest/src/completions/code.ts @@ -485,7 +485,7 @@ export const globalTunnelOptions: Fig.Option[] = [ }, ]; -export const codeTunnelOptions: Fig.Option[] = [ +const codeTunnelOptions: Fig.Option[] = [ { name: '--install-extension', description: 'Requests that extensions be preloaded and installed on connecting servers', From df9569b3f07442e7a4b84de675281eee84b85159 Mon Sep 17 00:00:00 2001 From: meganrogge Date: Wed, 26 Mar 2025 12:48:32 -0500 Subject: [PATCH 08/10] Rm export --- extensions/terminal-suggest/src/completions/code.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extensions/terminal-suggest/src/completions/code.ts b/extensions/terminal-suggest/src/completions/code.ts index 166705e7288ec..393ec2454ec94 100644 --- a/extensions/terminal-suggest/src/completions/code.ts +++ b/extensions/terminal-suggest/src/completions/code.ts @@ -154,7 +154,7 @@ export const commonOptions: Fig.Option[] = [ } ]; -export const commonCLIOptions: Fig.Option[] = [ +const commonCLIOptions: Fig.Option[] = [ { name: '--cli-data-dir', description: 'Directory where CLI metadata should be stored', From 3ddad647ecc0153d504014473d7e3f9a5d35bafd Mon Sep 17 00:00:00 2001 From: meganrogge Date: Wed, 26 Mar 2025 13:03:51 -0500 Subject: [PATCH 09/10] final batch of issues fixed --- .../src/completions/code-tunnel-insiders.ts | 7 +- .../src/completions/code-tunnel.ts | 126 +++---- .../terminal-suggest/src/completions/code.ts | 344 +++++++++--------- 3 files changed, 227 insertions(+), 250 deletions(-) diff --git a/extensions/terminal-suggest/src/completions/code-tunnel-insiders.ts b/extensions/terminal-suggest/src/completions/code-tunnel-insiders.ts index d41f36325a45b..dd54a2439ece3 100644 --- a/extensions/terminal-suggest/src/completions/code-tunnel-insiders.ts +++ b/extensions/terminal-suggest/src/completions/code-tunnel-insiders.ts @@ -2,8 +2,8 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { commonOptions, extensionManagementOptions, troubleshootingOptions, globalTunnelOptions, codeTunnelSubcommands } from './code'; -import codeTunnelCompletionSpec, { codeTunnelOptions, extTunnelSubcommand } from './code-tunnel'; +import { commonOptions, extensionManagementOptions, troubleshootingOptions, globalTunnelOptions, codeTunnelSubcommands, extTunnelSubcommand, codeTunnelOptions } from './code'; +import codeTunnelCompletionSpec, { codeTunnelSpecOptions } from './code-tunnel'; const codeTunnelInsidersCompletionSpec: Fig.Spec = { ...codeTunnelCompletionSpec, @@ -15,7 +15,8 @@ const codeTunnelInsidersCompletionSpec: Fig.Spec = { ...extensionManagementOptions('code-tunnel-insiders'), ...troubleshootingOptions('code-tunnel-insiders'), ...globalTunnelOptions, - ...codeTunnelOptions + ...codeTunnelOptions, + ...codeTunnelSpecOptions ] }; diff --git a/extensions/terminal-suggest/src/completions/code-tunnel.ts b/extensions/terminal-suggest/src/completions/code-tunnel.ts index 7a189cf8cd32d..a53edd52ef2bc 100644 --- a/extensions/terminal-suggest/src/completions/code-tunnel.ts +++ b/extensions/terminal-suggest/src/completions/code-tunnel.ts @@ -2,103 +2,77 @@ * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import code, { codeTunnelSubcommands, commonOptions, extensionManagementOptions, troubleshootingOptions, globalTunnelOptions, tunnelHelpOptions } from './code'; +import code, { codeTunnelSubcommands, commonOptions, extensionManagementOptions, troubleshootingOptions, globalTunnelOptions, extTunnelSubcommand, codeTunnelOptions } from './code'; -export const codeTunnelOptions = [ + +export const codeTunnelSpecOptions: Fig.Option[] = [ { - name: '--extensions-dir', - description: 'Set the root path for extensions', + name: '--cli-data-dir', + description: 'Directory where CLI metadata should be stored', isRepeatable: true, args: { - name: 'extensions_dir', + name: 'cli_data_dir', isOptional: true, }, }, { - name: '--user-data-dir', - description: 'Specifies the directory that user data is kept in. Can be used to open multiple distinct instances of the editor', + name: '--log-to-file', + description: 'Log to a file in addition to stdout. Used when running as a service', + hidden: true, isRepeatable: true, args: { - name: 'user_data_dir', + name: 'log_to_file', isOptional: true, + template: 'filepaths', }, }, { - name: '--use-version', - description: 'Sets the editor version to use for this command. The preferred version can be persisted with `code version use `. Can be \'stable\', \'insiders\', a version number, or an absolute path to an existing install', + name: '--log', + description: 'Log level to use', isRepeatable: true, args: { - name: 'use_version', + name: 'log', isOptional: true, + suggestions: [ + 'trace', + 'debug', + 'info', + 'warn', + 'error', + 'critical', + 'off', + ], }, }, -]; - -export const extTunnelSubcommand = { - name: 'ext', - description: 'Manage editor extensions', - subcommands: [ - { - name: 'list', - description: 'List installed extensions', - options: [...globalTunnelOptions, ...tunnelHelpOptions, - { - name: '--category', - description: 'Filters installed extensions by provided category, when using --list-extensions', - isRepeatable: true, - args: { - name: 'category', - isOptional: true, - }, - }, - { - name: '--show-versions', - description: 'Show versions of installed extensions, when using --list-extensions', - }, - ] - }, - { - name: 'install', - description: 'Install an extension', - options: [...globalTunnelOptions, ...tunnelHelpOptions, - { - name: '--pre-release', - description: 'Installs the pre-release version of the extension', - }, - { - name: '--donot-include-pack-and-dependencies', - description: `Don't include installing pack and dependencies of the extension`, - }, - { - name: '--force', - description: `Update to the latest version of the extension if it's already installed`, - }, + { + name: '--telemetry-level', + description: 'Sets the initial telemetry level', + hidden: true, + isRepeatable: true, + args: { + name: 'telemetry_level', + isOptional: true, + suggestions: [ + 'off', + 'crash', + 'error', + 'all', ], - args: { - name: 'ext-id | id', - isVariadic: true, - isOptional: true, - }, - }, - { - name: 'uninstall', - description: 'Uninstall an extension', - options: [...globalTunnelOptions, ...tunnelHelpOptions], - args: { - name: 'ext-id | id', - isVariadic: true, - isOptional: true, - }, }, - { - name: 'update', - description: 'Update the installed extensions', - options: [...globalTunnelOptions, ...tunnelHelpOptions] - }, - ], - ...globalTunnelOptions, - ...codeTunnelOptions -}; + }, + { + name: '--verbose', + description: 'Print verbose output (implies --wait)', + }, + { + name: '--disable-telemetry', + description: 'Disable telemetry for the current command, even if it was previously accepted as part of the license prompt or specified in \'--telemetry-level\'', + }, + { + name: ['-h', '--help'], + description: 'Print help', + }, +]; const codeTunnelCompletionSpec: Fig.Spec = { ...code, diff --git a/extensions/terminal-suggest/src/completions/code.ts b/extensions/terminal-suggest/src/completions/code.ts index 393ec2454ec94..1ae5957ac6126 100644 --- a/extensions/terminal-suggest/src/completions/code.ts +++ b/extensions/terminal-suggest/src/completions/code.ts @@ -154,76 +154,6 @@ export const commonOptions: Fig.Option[] = [ } ]; -const commonCLIOptions: Fig.Option[] = [ - { - name: '--cli-data-dir', - description: 'Directory where CLI metadata should be stored', - isRepeatable: true, - args: { - name: 'cli_data_dir', - isOptional: true, - }, - }, - { - name: '--log-to-file', - description: 'Log to a file in addition to stdout. Used when running as a service', - hidden: true, - isRepeatable: true, - args: { - name: 'log_to_file', - isOptional: true, - template: 'filepaths', - }, - }, - { - name: '--log', - description: 'Log level to use', - isRepeatable: true, - args: { - name: 'log', - isOptional: true, - suggestions: [ - 'trace', - 'debug', - 'info', - 'warn', - 'error', - 'critical', - 'off', - ], - }, - }, - { - name: '--telemetry-level', - description: 'Sets the initial telemetry level', - hidden: true, - isRepeatable: true, - args: { - name: 'telemetry_level', - isOptional: true, - suggestions: [ - 'off', - 'crash', - 'error', - 'all', - ], - }, - }, - { - name: '--verbose', - description: 'Print verbose output (implies --wait)', - }, - { - name: '--disable-telemetry', - description: 'Disable telemetry for the current command, even if it was previously accepted as part of the license prompt or specified in \'--telemetry-level\'', - }, - { - name: ['-h', '--help'], - description: 'Print help', - }, -]; - - export const extensionManagementOptions = (cliName: string): Fig.Option[] => [ { name: '--extensions-dir', @@ -485,25 +415,8 @@ export const globalTunnelOptions: Fig.Option[] = [ }, ]; -const codeTunnelOptions: Fig.Option[] = [ - { - name: '--install-extension', - description: 'Requests that extensions be preloaded and installed on connecting servers', - isRepeatable: true, - args: { - name: 'install_extension', - isOptional: true, - }, - }, - { - name: '--server-data-dir', - description: 'Specifies the directory that server data is kept in', - isRepeatable: true, - args: { - name: 'server_data_dir', - isOptional: true, - }, - }, + +export const codeTunnelOptions = [ { name: '--extensions-dir', description: 'Set the root path for extensions', @@ -531,61 +444,74 @@ const codeTunnelOptions: Fig.Option[] = [ isOptional: true, }, }, - { - name: '--random-name', - description: 'Randomly name machine for port forwarding service', - }, - { - name: '--no-sleep', - description: 'Prevents the machine going to sleep while this command runs', - }, - { - name: '--accept-server-license-terms', - description: 'If set, the user accepts the server license terms and the server will be started without a user prompt', - }, - { - name: '--name', - description: 'Sets the machine name for port forwarding service', - isRepeatable: true, - args: { - name: 'name', - isOptional: true, +]; + +export const extTunnelSubcommand = { + name: 'ext', + description: 'Manage editor extensions', + subcommands: [ + { + name: 'list', + description: 'List installed extensions', + options: [...globalTunnelOptions, ...tunnelHelpOptions, + { + name: '--category', + description: 'Filters installed extensions by provided category, when using --list-extensions', + isRepeatable: true, + args: { + name: 'category', + isOptional: true, + }, + }, + { + name: '--show-versions', + description: 'Show versions of installed extensions, when using --list-extensions', + }, + ] }, - }, - { - name: ['-h', '--help'], - description: 'Print help', - }, - { - name: '--log', - description: 'Log level to use', - isRepeatable: true, - args: { - name: 'log', - isOptional: true, - suggestions: [ - 'trace', - 'debug', - 'info', - 'warn', - 'error', - 'critical', - 'off', + { + name: 'install', + description: 'Install an extension', + options: [...globalTunnelOptions, ...tunnelHelpOptions, + { + name: '--pre-release', + description: 'Installs the pre-release version of the extension', + }, + { + name: '--donot-include-pack-and-dependencies', + description: `Don't include installing pack and dependencies of the extension`, + }, + { + name: '--force', + description: `Update to the latest version of the extension if it's already installed`, + }, ], + args: { + name: 'ext-id | id', + isVariadic: true, + isOptional: true, + }, }, - }, - { - name: '--verbose', - description: 'Print verbose output (implies --wait)', - }, - { - name: '--cli-data-dir', - description: 'Directory where CLI metadata should be stored', - args: { - name: 'cli_data_dir', + { + name: 'uninstall', + description: 'Uninstall an extension', + options: [...globalTunnelOptions, ...tunnelHelpOptions], + args: { + name: 'ext-id | id', + isVariadic: true, + isOptional: true, + }, }, - }, -]; + { + name: 'update', + description: 'Update the installed extensions', + options: [...globalTunnelOptions, ...tunnelHelpOptions] + }, + ], + ...globalTunnelOptions, + ...codeTunnelOptions +}; + export const codeTunnelSubcommands = [ { @@ -681,18 +607,18 @@ export const codeTunnelSubcommands = [ name: '--accept-server-license-terms', description: 'If set, the user accepts the server license terms and the server will be started without a user prompt', }, - ...commonCLIOptions, + ...globalTunnelOptions, ...tunnelHelpOptions ], }, { name: 'uninstall', description: 'Uninstalls and stops the tunnel service', - options: commonCLIOptions, + options: [...globalTunnelOptions, ...tunnelHelpOptions], }, { name: 'log', description: 'Shows logs for the running service', - options: commonCLIOptions, + options: [...globalTunnelOptions, ...tunnelHelpOptions], }, { name: 'help', @@ -703,10 +629,9 @@ export const codeTunnelSubcommands = [ { name: 'log', description: 'Shows logs for the running service' }, { name: 'help', description: 'Print this message or the help of the given subcommand(s)' }, ], - options: commonCLIOptions }, ], - options: commonCLIOptions, + options: [...globalTunnelOptions, ...tunnelHelpOptions], }, { name: 'help', @@ -739,7 +664,107 @@ export const codeTunnelSubcommands = [ ], }, ], - options: codeTunnelOptions, + options: [ + { + name: '--install-extension', + description: 'Requests that extensions be preloaded and installed on connecting servers', + isRepeatable: true, + args: { + name: 'install_extension', + isOptional: true, + }, + }, + { + name: '--server-data-dir', + description: 'Specifies the directory that server data is kept in', + isRepeatable: true, + args: { + name: 'server_data_dir', + isOptional: true, + }, + }, + { + name: '--extensions-dir', + description: 'Set the root path for extensions', + isRepeatable: true, + args: { + name: 'extensions_dir', + isOptional: true, + }, + }, + { + name: '--user-data-dir', + description: 'Specifies the directory that user data is kept in. Can be used to open multiple distinct instances of the editor', + isRepeatable: true, + args: { + name: 'user_data_dir', + isOptional: true, + }, + }, + { + name: '--use-version', + description: 'Sets the editor version to use for this command. The preferred version can be persisted with `code version use `. Can be \'stable\', \'insiders\', a version number, or an absolute path to an existing install', + isRepeatable: true, + args: { + name: 'use_version', + isOptional: true, + }, + }, + { + name: '--random-name', + description: 'Randomly name machine for port forwarding service', + }, + { + name: '--no-sleep', + description: 'Prevents the machine going to sleep while this command runs', + }, + { + name: '--accept-server-license-terms', + description: 'If set, the user accepts the server license terms and the server will be started without a user prompt', + }, + { + name: '--name', + description: 'Sets the machine name for port forwarding service', + isRepeatable: true, + args: { + name: 'name', + isOptional: true, + }, + }, + { + name: ['-h', '--help'], + description: 'Print help', + }, + { + name: '--log', + description: 'Log level to use', + isRepeatable: true, + args: { + name: 'log', + isOptional: true, + suggestions: [ + 'trace', + 'debug', + 'info', + 'warn', + 'error', + 'critical', + 'off', + ], + }, + }, + { + name: '--verbose', + description: 'Print verbose output (implies --wait)', + }, + { + name: '--cli-data-dir', + description: 'Directory where CLI metadata should be stored', + args: { + name: 'cli_data_dir', + }, + }, + ], }, { name: 'status', @@ -824,7 +849,7 @@ export const codeTunnelSubcommands = [ name: '--accept-server-license-terms', description: 'If set, the user accepts the server license terms and the server will be started without a user prompt', }, - ...commonCLIOptions, + ...globalTunnelOptions, ...tunnelHelpOptions, ] }, { @@ -896,30 +921,7 @@ export const codeTunnelSubcommands = [ } ], }, - { - name: 'ext', - description: 'Manage editor extensions', - subcommands: [ - { - name: 'list', - description: 'List installed extensions', - }, - { - name: 'install', - description: 'Install an extension', - }, - { - name: 'uninstall', - description: 'Uninstall an extension', - options: commonCLIOptions - }, - { - name: 'update', - description: 'Update the installed extensions', - options: commonCLIOptions - }, - ], - }, + extTunnelSubcommand, { name: 'status', description: 'Print process usage and diagnostics information', From f95436245a9d8cc1137e48e1108e8f7da9163f86 Mon Sep 17 00:00:00 2001 From: meganrogge Date: Wed, 26 Mar 2025 13:19:01 -0500 Subject: [PATCH 10/10] update test expectation --- extensions/terminal-suggest/src/test/completions/code.test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/extensions/terminal-suggest/src/test/completions/code.test.ts b/extensions/terminal-suggest/src/test/completions/code.test.ts index 3ca8ee8f837ab..b327e3e438e55 100644 --- a/extensions/terminal-suggest/src/test/completions/code.test.ts +++ b/extensions/terminal-suggest/src/test/completions/code.test.ts @@ -55,7 +55,6 @@ export const codeSpecOptionsAndSubcommands = [ '--wait', 'tunnel', 'serve-web', - 'ext', 'help', 'status', 'version'