Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
30 changes: 30 additions & 0 deletions apps/server/src/process/externalLauncher.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,36 @@ for (const cwd of ["/workspace with spaces/", "/workspace with spaces/file.ts:12
);
}

it.effect.skipIf(windowsHost)("prefers zeditor over the ZFS zed on Linux PATH", () =>
Effect.gen(function* () {
const fs = yield* FileSystem.FileSystem;
const path = yield* Path.Path;
const binDir = yield* fs.makeTempDirectoryScoped({ prefix: "t3-zed-linux-" });
for (const name of ["zed", "zeditor"]) {
yield* fs.writeFileString(path.join(binDir, name), "#!/bin/sh\n");
yield* fs.chmod(path.join(binDir, name), 0o755);
}

let spawned: ChildProcess.StandardCommand | undefined;
yield* Effect.gen(function* () {
const launcher = yield* ExternalLauncher.ExternalLauncher;
yield* launcher.launchEditor({ editor: "zed", cwd: "/workspace" });
}).pipe(
Effect.provide(
layerTest({
platform: "linux",
env: { HOME: binDir, PATH: binDir },
onSpawn: (command) => {
spawned = command;
},
}),
),
);
assert.ok(spawned);
assert.equal(spawned.command, "zeditor");
}).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),
);

it.effect.each([
{ editor: "webstorm", installPath: "Applications/WebStorm 2026.2.app/Contents/MacOS/webstorm" },
{ editor: "idea", installPath: "Applications/IntelliJ IDEA 2026.1.4.app/Contents/MacOS/idea" },
Expand Down
7 changes: 5 additions & 2 deletions packages/shared/src/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,11 @@ export const resolveEditorCommand = Effect.fn("editor.resolveEditorCommand")(fun
// OpenZFS also installs a `zed` executable. Prefer the macOS editor bundle
// so a PATH entry for the ZFS Event Daemon cannot take over editor opens.
const preferBundle = platform === "darwin" && editor.id === "zed";
// On Linux distro packages ship the editor as `zeditor` precisely because `zed` belongs to ZFS.
const commands =
platform === "linux" && editor.id === "zed" ? ["zeditor", "zed"] : editor.commands;
if (!preferBundle) {
for (const command of editor.commands) {
for (const command of commands) {
Comment thread
maria-rcks marked this conversation as resolved.
Resolved
if (yield* isCommandAvailable(command, { env })) return Option.some({ command, baseArgs });
}
}
Expand Down Expand Up @@ -135,7 +138,7 @@ export const resolveEditorCommand = Effect.fn("editor.resolveEditorCommand")(fun
if (dataHome) dirs.push(path.join(dataHome, "JetBrains/Toolbox/scripts"));
}
for (const dir of dirs) {
for (const name of editor.commands) candidates.push(path.join(dir, name));
for (const name of commands) candidates.push(path.join(dir, name));
}
}

Expand Down
Loading