Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(devbox): support trae and windsurf #5356

Merged
merged 6 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading