diff --git a/package.json b/package.json index ae8e1ea..7c2bfc1 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "displayName": "Gitpod", "description": "Gitpod Support", "publisher": "gitpod", - "version": "0.0.173", + "version": "0.0.174", "license": "MIT", "icon": "resources/gitpod.png", "repository": { @@ -271,19 +271,19 @@ "commandPalette": [ { "command": "gitpod.signIn", - "when": "!gitpod.inGpNextRemoteWindow" + "when": "!gitpod.inGitpodFlexRemoteWindow" }, { "command": "gitpod.exportLogs", - "when": "!gitpod.inGpNextRemoteWindow" + "when": "!gitpod.inGitpodFlexRemoteWindow" }, { "command": "gitpod.workspaces.refresh", - "when": "gitpod.authenticated == true && !gitpod.inGpNextRemoteWindow" + "when": "gitpod.authenticated == true && !gitpod.inGitpodFlexRemoteWindow" }, { "command": "gitpod.workspaces.connectInNewWindow", - "when": "gitpod.authenticated == true && !gitpod.inGpNextRemoteWindow" + "when": "gitpod.authenticated == true && !gitpod.inGitpodFlexRemoteWindow" }, { "command": "gitpod.workspaces.connectInNewWindow_context", @@ -291,7 +291,7 @@ }, { "command": "gitpod.workspaces.connectInCurrentWindow", - "when": "gitpod.authenticated == true && !gitpod.inGpNextRemoteWindow" + "when": "gitpod.authenticated == true && !gitpod.inGitpodFlexRemoteWindow" }, { "command": "gitpod.workspaces.connectInCurrentWindow_context", @@ -311,7 +311,7 @@ }, { "command": "gitpod.workspaces.stopWorkspace", - "when": "gitpod.authenticated == true && gitpod.inWorkspace != true && !gitpod.inGpNextRemoteWindow" + "when": "gitpod.authenticated == true && gitpod.inWorkspace != true && !gitpod.inGitpodFlexRemoteWindow" }, { "command": "gitpod.workspaces.stopWorkspace_context", @@ -339,7 +339,7 @@ }, { "command": "gitpod.workspaces.deleteWorkspace", - "when": "gitpod.authenticated == true && gitpod.inWorkspace != true && !gitpod.inGpNextRemoteWindow" + "when": "gitpod.authenticated == true && gitpod.inWorkspace != true && !gitpod.inGitpodFlexRemoteWindow" }, { "command": "gitpod.workspaces.deleteWorkspace_context", @@ -366,13 +366,13 @@ "id": "gitpod-login", "name": "Login", "icon": "$(squirrel)", - "when": "gitpod.authenticated != true && !gitpod.inGpNextRemoteWindow" + "when": "gitpod.authenticated != true && !gitpod.inGitpodFlexRemoteWindow" }, { "id": "gitpod-workspaces", "name": "Workspaces", "icon": "$(squirrel)", - "when": "gitpod.authenticated == true && !gitpod.inGpNextRemoteWindow" + "when": "gitpod.authenticated == true && !gitpod.inGitpodFlexRemoteWindow" }, { "id": "gitpod-workspace", @@ -385,7 +385,7 @@ "viewsWelcome": [ { "view": "gitpod-login", - "when": "gitpod.authenticated != true && !gitpod.inGpNextRemoteWindow", + "when": "gitpod.authenticated != true && !gitpod.inGitpodFlexRemoteWindow", "contents": "You have not yet signed in with Gitpod\n[Sign in](command:gitpod.signIn)" } ] diff --git a/src/extension.ts b/src/extension.ts index 24835fd..8ad021e 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -13,7 +13,7 @@ import { NotificationService } from './services/notificationService'; import { RemoteConnector } from './remoteConnector'; import { TelemetryService } from './services/telemetryService'; import { RemoteSession } from './remoteSession'; -import { SSHConnectionParams, getGitpodRemoteWindowConnectionInfo, isGitpodNextRemoteWindow } from './remote'; +import { SSHConnectionParams, getGitpodRemoteWindowConnectionInfo, isGitpodFlexRemoteWindow } from './remote'; import { HostService } from './services/hostService'; import { SessionService } from './services/sessionService'; import { CommandManager } from './commandManager'; @@ -45,8 +45,8 @@ export async function activate(context: vscode.ExtensionContext) { const extensionId = context.extension.id; const packageJSON = context.extension.packageJSON; - if (isGitpodNextRemoteWindow()) { - vscode.commands.executeCommand('setContext', 'gitpod.inGpNextRemoteWindow', true); + if (isGitpodFlexRemoteWindow()) { + vscode.commands.executeCommand('setContext', 'gitpod.inGitpodFlexRemoteWindow', true); return; } diff --git a/src/remote.ts b/src/remote.ts index f5db8aa..7a54efc 100644 --- a/src/remote.ts +++ b/src/remote.ts @@ -70,7 +70,7 @@ export function getGitpodRemoteWindowConnectionInfo(context: vscode.ExtensionCon return undefined; } -export function isGitpodNextRemoteWindow() { +export function isGitpodFlexRemoteWindow() { const remoteUri = vscode.workspace.workspaceFile?.scheme !== 'untitled' ? vscode.workspace.workspaceFile || vscode.workspace.workspaceFolders?.[0].uri : vscode.workspace.workspaceFolders?.[0].uri; @@ -96,6 +96,15 @@ export function isGitpodNextRemoteWindow() { return /gitpod\.(local|remote)$/.test(sshDest.hostname); } + if (vscode.env.remoteName === 'ssh-remote') { + const [, sshEncoded] = remoteUri.authority.split('+'); + if (!sshEncoded) { + return; + } + const sshDest = SSHDestination.fromRemoteSSHString(sshEncoded); + + return /gitpod\.(local|remote)$/.test(sshDest.hostname); + } return false; }