Skip to content

Commit

Permalink
fix: install remote-ssh manually to unify windsurf and cursor (#5264)
Browse files Browse the repository at this point in the history
* fix: install remote-ssh

* fix: i18n bug

* chore: text perf

* chore: update version info
  • Loading branch information
mlhiter authored Dec 10, 2024
1 parent c9bef4d commit 7b94860
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 17 deletions.
4 changes: 4 additions & 0 deletions extensions/ide/vscode/devbox/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how

## [Unreleased]

### Changed

- Adjust `Remote-SSH` to install by code.

## [1.2.1] - 2024-12-4

### Fixed
Expand Down
10 changes: 7 additions & 3 deletions extensions/ide/vscode/devbox/l10n/bundle.l10n.zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"Copy Password": "复制密码",
"Copy Connection String": "复制连接串",
"Connection string copied to clipboard!": "连接串已复制到剪贴板!",
"Please select a region,RegionList are added by your each connection.": "请选择一个可用区,可用区来自于您的每个连接。",
"Please select a region,every region are from your each connection.": "请选择一个可用区,可用区来自于您的每个连接。",
"Only Devbox can be opened.": "只能打开 Devbox。",
"Are you sure to delete?": "确定删除Devbox?",
"This action will only delete the devbox ssh config in the local environment.": "此操作只会删除本地环境中的 Devbox SSH 配置。",
Expand All @@ -19,7 +19,11 @@
"Open in Browser": "在浏览器中打开",
"Preview in Editor": "在编辑器中预览",
"Open Database Web Terminal": "打开数据库 Web 终端",
"Cursor's Devbox is often not the latest. If there are any issues, please manually install the [plugin](https://marketplace.visualstudio.com/items?itemName=labring.devbox-aio&ssr=false#overview) referenced this [URI](https://www.cursor.com/how-to-install-extension).": "Cursor 的 Devbox 通常不是最新的。如果有任何问题,请手动安装 [插件](https://marketplace.visualstudio.com/items?itemName=labring.devbox-aio&ssr=false#overview) 参考此 [URI](https://www.cursor.com/how-to-install-extension).",
"The Devbox of Cursor is usually not the latest. If there are any issues, please manually install the [plugin](https://marketplace.visualstudio.com/items?itemName=labring.devbox-aio&ssr=false#overview) referring to this [URI](https://www.cursor.com/how-to-install-extension).": "Cursor 的 Devbox 通常不是最新的。如果有任何问题,请手动安装 [插件](https://marketplace.visualstudio.com/items?itemName=labring.devbox-aio&ssr=false#overview) 参考此 [URI](https://www.cursor.com/how-to-install-extension).",
"SSH Port is not correct,maybe your devbox's nodeport is over the limit": "SSH 端口不正确,可能您的 Devbox 的 nodeport 超过了限制",
"This Devbox has been deleted in the cloud.Now it cannot be opened. Do you want to delete its local ssh configuration?": "该 Devbox 已在云端删除,现在无法打开。请问是否删除本地 SSH 配置?"
"Failed to write SSH configuration": "写入 SSH 配置失败",
"Failed to write SSH private key": "写入 SSH 私钥失败",
"Please install \"Remote - SSH\" extension to connect to a devbox workspace.": "请安装 \"Remote - SSH\" 扩展以连接到 Devbox 工作区。",
"Install": "安装",
"Cancel": "取消"
}
5 changes: 1 addition & 4 deletions extensions/ide/vscode/devbox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "devbox-aio",
"displayName": "%displayName%",
"description": "%description%",
"version": "1.2.1",
"version": "1.3.2024120601",
"keywords": [
"devbox",
"remote development",
Expand Down Expand Up @@ -206,9 +206,6 @@
]
}
},
"extensionDependencies": [
"ms-vscode-remote.remote-ssh"
],
"scripts": {
"vscode:prepublish": "npm run package",
"compile": "webpack",
Expand Down
26 changes: 16 additions & 10 deletions extensions/ide/vscode/devbox/src/commands/remoteConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ import { GlobalStateManager } from '../utils/globalStateManager'
import { ensureFileAccessPermission, ensureFileExists } from '../utils/file'
import { modifiedRemoteSSHConfig } from '../utils/remoteSSHConfig'

const message = {
FailedToWriteSSHConfig: vscode.l10n.t('Failed to write SSH configuration'),
FailedToWriteSSHPrivateKey: vscode.l10n.t('Failed to write SSH private key'),
PleaseInstallRemoteSSH: vscode.l10n.t(
'Please install "Remote - SSH" extension to connect to a devbox workspace.'
),
Install: vscode.l10n.t('Install'),
Cancel: vscode.l10n.t('Cancel'),
}

export class RemoteSSHConnector extends Disposable {
constructor(context: vscode.ExtensionContext) {
super()
Expand Down Expand Up @@ -126,7 +136,7 @@ export class RemoteSSHConnector extends Disposable {
}) {
Logger.info(`Connecting to remote SSH: ${args.sshHostLabel}`)

this.ensureRemoteSSHExtInstalled()
await this.ensureRemoteSSHExtInstalled()

const { sshDomain, sshPort, base64PrivateKey, sshHostLabel, workingDir } =
args
Expand Down Expand Up @@ -203,7 +213,7 @@ export class RemoteSSHConnector extends Disposable {
} catch (error) {
Logger.error(`Failed to write SSH configuration: ${error}`)
vscode.window.showErrorMessage(
`Failed to write SSH configuration: ${error}`
`${message.FailedToWriteSSHConfig}: ${error}`
)
}

Expand All @@ -217,7 +227,7 @@ export class RemoteSSHConnector extends Disposable {
} catch (error) {
Logger.error(`Failed to write SSH private key: ${error}`)
vscode.window.showErrorMessage(
`Failed to write SSH private key: ${error}`
`${message.FailedToWriteSSHPrivateKey}: ${error}`
)
}

Expand Down Expand Up @@ -257,11 +267,11 @@ export class RemoteSSHConnector extends Disposable {
return true
}

const install = 'Install'
const cancel = 'Cancel'
const install = message.Install
const cancel = message.Cancel

const action = await vscode.window.showInformationMessage(
'Please install "Remote - SSH" extension to connect to a Gitpod workspace.',
message.PleaseInstallRemoteSSH,
{ modal: true },
install,
cancel
Expand All @@ -271,10 +281,6 @@ export class RemoteSSHConnector extends Disposable {
return false
}

vscode.window.showInformationMessage(
'Installing "ms-vscode-remote.remote-ssh" extension'
)

await vscode.commands.executeCommand(
'extension.open',
'ms-vscode-remote.remote-ssh'
Expand Down

0 comments on commit 7b94860

Please sign in to comment.