Skip to content

Commit

Permalink
Fix and rename inGitpodFlexRemoteWindow context key (#110)
Browse files Browse the repository at this point in the history
* Fix and rename inGitpodFlexRemoteWindow context key

* 🆙 bump version
  • Loading branch information
jeanp413 authored Sep 19, 2024
1 parent 4b58838 commit 79e4915
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 15 deletions.
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -271,27 +271,27 @@
"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",
"when": "false"
},
{
"command": "gitpod.workspaces.connectInCurrentWindow",
"when": "gitpod.authenticated == true && !gitpod.inGpNextRemoteWindow"
"when": "gitpod.authenticated == true && !gitpod.inGitpodFlexRemoteWindow"
},
{
"command": "gitpod.workspaces.connectInCurrentWindow_context",
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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)"
}
]
Expand Down
6 changes: 3 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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;
}

Expand Down
11 changes: 10 additions & 1 deletion src/remote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}

Expand Down

0 comments on commit 79e4915

Please sign in to comment.