Skip to content
Open
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
5 changes: 3 additions & 2 deletions src/main/core/app/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ class AppService implements IInitializable, IDisposable {

const { host, username, port } = connection;

if (appId === 'vscode' || appId === 'vscodium' || appId === 'cursor') {
if (appId === 'vscode' || appId === 'vscodium' || appId === 'cursor' || appId === 'zed') {
await shell.openExternal(buildRemoteEditorUrl(appId, host, username, target));
return;
}
Expand Down Expand Up @@ -351,7 +351,8 @@ class AppService implements IInitializable, IDisposable {
);
}

const quoted = (p: string) => `'${p.replace(/'/g, "'\\''")}'`;
const quoted = (p: string) =>
process.platform !== 'win32' ? `'${p.replace(/'/g, "'\\''")}'` : `"${p.replace(/"/g, '""')}"`;
const commands: string[] = platformConfig?.openCommands ?? [];
const command = commands
.map((cmd) => cmd.replace('{{path}}', quoted(target)).replace('{{path_raw}}', target))
Expand Down
4 changes: 3 additions & 1 deletion src/main/core/app/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,9 @@ export const resolveAppVersion = async (): Promise<string> => {

export const checkCommand = (cmd: string): Promise<boolean> =>
new Promise((resolve) => {
exec(`command -v ${cmd} >/dev/null 2>&1`, { env: buildExternalToolEnv() }, (error) => {
const check =
process.platform !== 'win32' ? `command -v ${cmd} >/dev/null 2>&1` : `where ${cmd}`;
exec(check, { env: buildExternalToolEnv() }, (error) => {
resolve(!error);
});
});
Comment thread
anglox marked this conversation as resolved.
Expand Down
10 changes: 8 additions & 2 deletions src/main/utils/remoteOpenIn.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { quoteShellArg } from './shellEscape';

type RemoteEditorScheme = 'vscode' | 'vscodium' | 'cursor';
type RemoteEditorScheme = 'vscode' | 'vscodium' | 'cursor' | 'zed';

export function buildRemoteSshAuthority(host: string, username: string): string {
const normalizedHost = host.trim();
Expand All @@ -24,7 +24,13 @@ export function buildRemoteEditorUrl(
const authority = buildRemoteSshAuthority(host, username);
const encodedAuthority = encodeURIComponent(authority);
const normalizedTargetPath = targetPath.startsWith('/') ? targetPath : `/${targetPath}`;
return `${scheme}://vscode-remote/ssh-remote+${encodedAuthority}${normalizedTargetPath}`;

switch (scheme) {
case 'zed':
return `zed://ssh/${encodedAuthority}${normalizedTargetPath}`;
default:
return `${scheme}://vscode-remote/ssh-remote+${encodedAuthority}${normalizedTargetPath}`;
}
}

type RemoteTerminalExecInput = {
Expand Down
21 changes: 13 additions & 8 deletions src/shared/openInApps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const _OPEN_IN_APPS = {
appNames: ['Cursor'],
},
win32: {
openCommands: ['start "" cursor {{path}}'],
openCommands: ['cursor {{path}}'],
checkCommands: ['cursor'],
},
linux: {
Expand All @@ -116,7 +116,7 @@ const _OPEN_IN_APPS = {
appNames: ['Visual Studio Code'],
},
win32: {
openCommands: ['start "" code {{path}}', 'start "" code-insiders {{path}}'],
openCommands: ['code {{path}}', 'code-insiders {{path}}'],
checkCommands: ['code', 'code-insiders'],
},
linux: {
Expand All @@ -143,7 +143,7 @@ const _OPEN_IN_APPS = {
appNames: ['VSCodium'],
},
win32: {
openCommands: ['start "" codium {{path}}'],
openCommands: ['codium {{path}}'],
checkCommands: ['codium'],
},
linux: {
Expand All @@ -169,7 +169,7 @@ const _OPEN_IN_APPS = {
appNames: ['Windsurf'],
},
win32: {
openCommands: ['start "" windsurf {{path}}'],
openCommands: ['windsurf {{path}}'],
checkCommands: ['windsurf'],
},
linux: {
Expand Down Expand Up @@ -289,6 +289,7 @@ const _OPEN_IN_APPS = {
label: 'Zed',
iconPath: ICON_PATHS.zed,
autoInstall: true,
supportsRemote: true,
platforms: {
darwin: {
openCommands: ['command -v zed >/dev/null 2>&1 && zed {{path}}', 'open -a "Zed" {{path}}'],
Expand All @@ -299,6 +300,10 @@ const _OPEN_IN_APPS = {
openCommands: ['zed {{path}}', 'xdg-open {{path}}'],
checkCommands: ['zed'],
},
win32: {
openCommands: ['zed {{path}}'],
checkCommands: ['zed'],
},
},
},
kiro: {
Expand All @@ -317,7 +322,7 @@ const _OPEN_IN_APPS = {
appNames: ['Kiro'],
},
win32: {
openCommands: ['start "" kiro {{path}}'],
openCommands: ['kiro {{path}}'],
checkCommands: ['kiro'],
},
linux: {
Expand All @@ -341,7 +346,7 @@ const _OPEN_IN_APPS = {
appNames: ['Antigravity'],
},
win32: {
openCommands: ['start "" antigravity {{path}}'],
openCommands: ['antigravity {{path}}'],
checkCommands: ['antigravity'],
},
linux: {
Expand All @@ -365,7 +370,7 @@ const _OPEN_IN_APPS = {
appNames: ['Trae'],
},
win32: {
openCommands: ['start "" trae "{{path_raw}}"'],
openCommands: ['trae "{{path_raw}}"'],
checkCommands: ['trae'],
},
linux: {
Expand All @@ -389,7 +394,7 @@ const _OPEN_IN_APPS = {
appNames: ['Trae Solo'],
},
win32: {
openCommands: ['start "" trae-solo "{{path_raw}}"'],
openCommands: ['trae-solo "{{path_raw}}"'],
checkCommands: ['trae-solo'],
},
linux: {
Expand Down
Loading