Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/core/scripts/test/launchTestUtilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
14 changes: 9 additions & 5 deletions packages/core/src/shared/extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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
Expand Down
12 changes: 6 additions & 6 deletions packages/core/src/shared/remoteSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -108,19 +108,19 @@ export async function ensureDependencies(): Promise<Result<DependencyPaths, Canc
}

export async function ensureRemoteSshInstalled(): Promise<void> {
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', {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/testE2E/codecatalyst/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
}

Expand Down
Loading