Skip to content

Commit

Permalink
feat(devbox): support trae and windsurf (#5356)
Browse files Browse the repository at this point in the history
* feat: feat

* fix: trae bug

* chore: adjust some text

* feat: web support trae

* chore: some chore
  • Loading branch information
mlhiter authored Jan 27, 2025
1 parent c070c58 commit e1e7c94
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 30 deletions.
6 changes: 6 additions & 0 deletions extensions/ide/vscode/devbox/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how

## [Unreleased]

## [1.3.1] - 2025-01-21

### Added

- Support Windsurf and Trae.

## [1.3.0] - 2024-12-24

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion 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.3.0",
"version": "1.3.3",
"keywords": [
"devbox",
"remote development",
Expand Down
23 changes: 13 additions & 10 deletions extensions/ide/vscode/devbox/src/commands/remoteConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,13 +256,19 @@ export class RemoteSSHConnector extends Disposable {
vscode.env.uriScheme === 'vscode' ||
vscode.env.uriScheme === 'vscode-insiders' ||
vscode.env.uriScheme === 'cursor'
if (!isOfficialVscode) {
const isTrae = vscode.env.uriScheme === 'trae'

// windsurf has remote-ssh inside already
if (!isOfficialVscode && !isTrae) {
return true
}

const msVscodeRemoteExt = vscode.extensions.getExtension(
'ms-vscode-remote.remote-ssh'
)
const remoteSSHId = isOfficialVscode
? 'ms-vscode-remote.remote-ssh'
: 'labring.open-remote-ssh-for-trae'

const msVscodeRemoteExt = vscode.extensions.getExtension(remoteSSHId)

if (msVscodeRemoteExt) {
return true
}
Expand All @@ -281,16 +287,13 @@ export class RemoteSSHConnector extends Disposable {
return false
}

await vscode.commands.executeCommand(
'extension.open',
'ms-vscode-remote.remote-ssh'
)
await vscode.commands.executeCommand('extension.open', remoteSSHId)
await vscode.commands.executeCommand(
'workbench.extensions.installExtension',
'ms-vscode-remote.remote-ssh'
remoteSSHId
)

Logger.info('"ms-vscode-remote.remote-ssh" extension is installed')
Logger.info(`"${remoteSSHId}" extension is installed`)

return true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ export class DBViewProvider
await this.refreshDatabases()
}
private async openWebTerminal(dbInfo: Database) {
console.log('dbInfo', dbInfo)
const commandMap = {
postgresql: `psql '${dbInfo.connection}'`,
mongodb: `mongosh '${dbInfo.connection}'`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,30 +237,33 @@ class ProjectTreeDataProvider
}

try {
const appName = vscode.env.appName

// 1. remove global state
GlobalStateManager.remove(deletedHost)

// 2. remove remote-ssh config
const existingSSHHostPlatforms = vscode.workspace
.getConfiguration('remote.SSH')
.get<{ [host: string]: string }>('remotePlatform', {})
const newSSHHostPlatforms = Object.keys(existingSSHHostPlatforms).reduce(
(acc: { [host: string]: string }, host: string) => {
// 2. remove remote-ssh config if app is not windsurf or Trae
if (appName !== 'Windsurf' && appName !== 'Trae') {
const existingSSHHostPlatforms = vscode.workspace
.getConfiguration('remote.SSH')
.get<{ [host: string]: string }>('remotePlatform', {})
const newSSHHostPlatforms = Object.keys(
existingSSHHostPlatforms
).reduce((acc: { [host: string]: string }, host: string) => {
if (host.startsWith(deletedHost)) {
return acc
}
acc[host] = existingSSHHostPlatforms[host]
return acc
},
{}
)
await vscode.workspace
.getConfiguration('remote.SSH')
.update(
'remotePlatform',
newSSHHostPlatforms,
vscode.ConfigurationTarget.Global
)
}, {})
await vscode.workspace
.getConfiguration('remote.SSH')
.update(
'remotePlatform',
newSSHHostPlatforms,
vscode.ConfigurationTarget.Global
)
}

// 3. remove ssh config
const content = await fs.promises.readFile(
Expand Down
3 changes: 2 additions & 1 deletion extensions/ide/vscode/devbox/src/utils/handleUri.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ export class UriHandler {
uri.scheme !== 'vscode' &&
uri.scheme !== 'cursor' &&
uri.scheme !== 'vscode-insiders' &&
uri.scheme !== 'windsurf'
uri.scheme !== 'windsurf' &&
uri.scheme !== 'trae'
) {
return
}
Expand Down
8 changes: 8 additions & 0 deletions frontend/providers/devbox/components/IDEButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,14 @@ export const ideObj = {
value: 'windsurf',
sortId: 3
},
trae: {
label: 'Trae',
menuLabel: 'Trae',
icon: 'trae',
prefix: 'trae://',
value: 'trae',
sortId: 4
},
jetbrains: {
label: 'JetBrains',
icon: 'jetbrains',
Expand Down
1 change: 1 addition & 0 deletions frontend/providers/devbox/components/Icon/icons/trae.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion frontend/providers/devbox/components/Icon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ const map = {
rustover: require('./icons/jetbrains/rustover.svg').default,
webstorm: require('./icons/jetbrains/webstorm.svg').default,
gift: require('./icons/gift.svg').default,
fileConfig: require('./icons/fileConfig.svg').default
fileConfig: require('./icons/fileConfig.svg').default,
trae: require('./icons/trae.svg').default
};

const MyIcon = ({
Expand Down

0 comments on commit e1e7c94

Please sign in to comment.