@@ -26,6 +26,7 @@ import { CreateDevEnvironmentRequest, UpdateDevEnvironmentRequest } from 'aws-sd
2626import { Auth } from '../auth/auth'
2727import { SsoConnection } from '../auth/connection'
2828import { showManageConnections } from '../auth/ui/vue/show'
29+ import { isInDevEnv } from '../shared/vscode/env'
2930
3031/** "List CodeCatalyst Commands" command. */
3132export async function listCommands ( ) : Promise < void > {
@@ -205,6 +206,14 @@ type Inject<T, U> = T extends (...args: infer P) => infer R
205206
206207type WithClient < T > = Parameters < Inject < T , CodeCatalystClient > >
207208
209+ class RemoteContextError extends ToolkitError {
210+ constructor ( ) {
211+ super ( 'Cannot connect from a remote context. Try again from a local VS Code instance.' , {
212+ code : 'ConnectedToRemote' ,
213+ } )
214+ }
215+ }
216+
208217export class CodeCatalystCommands {
209218 public readonly withClient : ClientInjector
210219 public readonly bindClient = createCommandDecorator ( this )
@@ -222,6 +231,9 @@ export class CodeCatalystCommands {
222231 }
223232
224233 public createDevEnv ( ) : Promise < void > {
234+ if ( vscode . env . remoteName === 'ssh-remote' && isInDevEnv ( ) ) {
235+ throw new RemoteContextError ( )
236+ }
225237 return this . withClient ( showCreateDevEnv , globals . context , CodeCatalystCommands . declared )
226238 }
227239
@@ -268,10 +280,8 @@ export class CodeCatalystCommands {
268280 targetPath ?: string ,
269281 connection ?: { startUrl : string ; region : string }
270282 ) : Promise < void > {
271- if ( vscode . env . remoteName === 'ssh-remote' ) {
272- throw new ToolkitError ( 'Cannot connect from a remote context. Try again from a local VS Code instance.' , {
273- code : 'ConnectedToRemote' ,
274- } )
283+ if ( vscode . env . remoteName === 'ssh-remote' && isInDevEnv ( ) ) {
284+ throw new RemoteContextError ( )
275285 }
276286
277287 const devenv = id ?? ( await this . selectDevEnv ( ) )
0 commit comments