diff --git a/packages/core/scripts/test/launchTestUtilities.ts b/packages/core/scripts/test/launchTestUtilities.ts index 6f8b420fd8a..2afd135e367 100644 --- a/packages/core/scripts/test/launchTestUtilities.ts +++ b/packages/core/scripts/test/launchTestUtilities.ts @@ -86,7 +86,7 @@ async function getVSCodeCliArgs(params: { VSCODE_EXTENSION_ID.java, VSCODE_EXTENSION_ID.javadebug, VSCODE_EXTENSION_ID.git, - VSCODE_EXTENSION_ID.remotessh, + VSCODE_EXTENSION_ID.remotessh.id, ], }) disableWorkspaceTrustArg = [disableWorkspaceTrust] diff --git a/packages/core/src/shared/extensions.ts b/packages/core/src/shared/extensions.ts index cd14a9f5996..0ea09ac70d7 100644 --- a/packages/core/src/shared/extensions.ts +++ b/packages/core/src/shared/extensions.ts @@ -11,6 +11,14 @@ import { CredentialsStore } from '../auth/credentials/store' import { SamCliContext } from './sam/cli/samCliContext' import { UriHandler } from './vscode/uriHandler' +// Determine the remote SSH extension based on the editor +const getRemoteSshExtension = () => { + const isCursor = vscode.env.appName?.toLowerCase().includes('cursor') + return isCursor + ? { id: 'anysphere.remote-ssh', minVersion: '1.0.2' } + : { id: 'ms-vscode-remote.remote-ssh', minVersion: '0.74.0' } +} + // eslint-disable-next-line @typescript-eslint/naming-convention export const VSCODE_EXTENSION_ID = { awstoolkit: 'amazonwebservices.aws-toolkit-vscode', @@ -24,13 +32,9 @@ export const VSCODE_EXTENSION_ID = { javadebug: 'vscjava.vscode-java-debug', dotnet: 'ms-dotnettools.csdevkit', git: 'vscode.git', - remotessh: 'ms-vscode-remote.remote-ssh', + remotessh: getRemoteSshExtension(), } as const -export const vscodeExtensionMinVersion = { - remotessh: '0.74.0', -} - /** @deprecated Use `extensionGlobals.ts:globals` instead. */ export interface ExtContext { extensionContext: vscode.ExtensionContext diff --git a/packages/core/src/shared/remoteSession.ts b/packages/core/src/shared/remoteSession.ts index b45bdb3ca9c..cef1aaf00ac 100644 --- a/packages/core/src/shared/remoteSession.ts +++ b/packages/core/src/shared/remoteSession.ts @@ -11,7 +11,7 @@ import { Settings } from '../shared/settings' import { showConfirmationMessage, showMessageWithCancel } from './utilities/messages' import { CancellationError, Timeout } from './utilities/timeoutUtils' import { isExtensionInstalled, showInstallExtensionMsg } from './utilities/vsCodeUtils' -import { VSCODE_EXTENSION_ID, vscodeExtensionMinVersion } from './extensions' +import { VSCODE_EXTENSION_ID } from './extensions' import { Err, Result } from '../shared/utilities/result' import { ToolkitError, UnknownError } from './errors' import { getLogger } from './logger/logger' @@ -108,19 +108,19 @@ export async function ensureDependencies(): Promise { - if (!isExtensionInstalled(VSCODE_EXTENSION_ID.remotessh, vscodeExtensionMinVersion.remotessh)) { + if (!isExtensionInstalled(VSCODE_EXTENSION_ID.remotessh.id, VSCODE_EXTENSION_ID.remotessh.minVersion)) { showInstallExtensionMsg( - VSCODE_EXTENSION_ID.remotessh, + VSCODE_EXTENSION_ID.remotessh.id, 'Remote SSH', 'Connecting to Dev Environment', - vscodeExtensionMinVersion.remotessh + VSCODE_EXTENSION_ID.remotessh.minVersion ) - if (isExtensionInstalled(VSCODE_EXTENSION_ID.remotessh)) { + if (isExtensionInstalled(VSCODE_EXTENSION_ID.remotessh.id)) { throw new ToolkitError('Remote SSH extension version is too low', { cancelled: true, code: RemoteSessionError.ExtensionVersionTooLow, - details: { expected: vscodeExtensionMinVersion.remotessh }, + details: { expected: VSCODE_EXTENSION_ID.remotessh.minVersion }, }) } else { throw new ToolkitError('Remote SSH extension not installed', { diff --git a/packages/core/src/testE2E/codecatalyst/client.test.ts b/packages/core/src/testE2E/codecatalyst/client.test.ts index 84e9309120c..00f1d946d16 100644 --- a/packages/core/src/testE2E/codecatalyst/client.test.ts +++ b/packages/core/src/testE2E/codecatalyst/client.test.ts @@ -202,7 +202,7 @@ describe('Test how this codebase uses the CodeCatalyst API', function () { }) it('prompts to install the ssh extension if not available', async function () { - if (isExtensionInstalled(VSCODE_EXTENSION_ID.remotessh)) { + if (isExtensionInstalled(VSCODE_EXTENSION_ID.remotessh.id)) { skipTest(this, 'remote ssh already installed') }