The best way to control Claude Code, Codex and more from any computer or phone
fix(editors): JetBrains IDEs open file links in the thread's project (#33558)
Co-authored-by: Julius Marminge <julius0216@outlook.com>
Victor committed
Nov 12, 2026 at 17:07 UTC
9ccc0f8a60ef0332e418e2938a37e58287323504
6 files changed
+19
-3
apps/server/src/process/externalLauncher.test.ts
+6
-1
@@ -687,7 +687,11 @@ it.effect.each([
687
yield* Effect.gen(function* () {
688
const launcher = yield* ExternalLauncher.ExternalLauncher;
689
assert.include(yield* launcher.resolveAvailableEditors(), editor);
690
- yield* launcher.launchEditor({ editor, cwd: "/workspace with spaces/file.ts:12:4" });
690
+ yield* launcher.launchEditor({
691
+ editor,
692
+ cwd: "/workspace with spaces/file.ts:12:4",
693
+ projectRoot: "/workspace with spaces",
694
+ });
695
}).pipe(
696
Effect.provide(
697
layerTest({
@@ -703,6 +707,7 @@ it.effect.each([
707
assert.ok(spawned);
708
assert.equal(spawned.command, executable);
709
assert.deepEqual(spawned.args, [
710
+ "/workspace with spaces",
711
"--line",
712
"12",
713
"--column",
apps/server/src/process/externalLauncher.ts
+7
-1
@@ -140,6 +140,7 @@ function resolveCommandEditorArgs(
140
editor: (typeof EDITORS)[number],
141
target: string,
142
isDirectory: boolean,
143
+ projectRoot: string | undefined,
144
): ReadonlyArray<string> {
145
const parsedTarget = parseTargetPathAndPosition(target);
146
@@ -154,6 +155,8 @@ function resolveCommandEditorArgs(
155
return Option.match(parsedTarget, {
156
onNone: () => [target],
157
onSome: ({ path, line, column }) => [
158
+ // Only positioned targets get the root: a folder target would open as a second project.
159
+ ...(projectRoot === undefined ? [] : [projectRoot]),
160
"--line",
161
line,
162
// JetBrains IDEs count `--column` from 0; targets count columns from 1.
@@ -498,7 +501,10 @@ const resolveEditorLaunch = Effect.fn("resolveEditorLaunch")(function* (
501
editor: editorDef.id,
502
target: input.cwd,
503
command,
501
- args: [...baseArgs, ...resolveCommandEditorArgs(editorDef, input.cwd, isDirectory)],
504
+ args: [
505
+ ...baseArgs,
506
+ ...resolveCommandEditorArgs(editorDef, input.cwd, isDirectory, input.projectRoot),
507
+ ],
508
};
509
}
510
apps/web/src/components/ChatMarkdown.tsx
+1
-1
@@ -647,7 +647,7 @@ function useChatMarkdownState({
647
const projects = useProjects();
648
const [preferredEditor] = usePreferredEditor(availableEditors);
649
const preferredEditorMenuLabel = openInEditorMenuLabel(preferredEditor);
650
- const openInPreferredEditor = useOpenInPreferredEditor(environmentId, availableEditors);
650
+ const openInPreferredEditor = useOpenInPreferredEditor(environmentId, availableEditors, cwd);
651
const openInEditor = useAtomCommand(shellEnvironment.openInEditor, {
652
reportFailure: false,
653
});
apps/web/src/components/ThreadTerminalDrawer.tsx
+1
@@ -560,6 +560,7 @@ function TerminalSessionViewport({
560
const openInPreferredEditor = useOpenInPreferredEditor(
561
environmentId,
562
serverConfig?.availableEditors ?? [],
563
+ worktreePath ?? cwd,
564
);
565
const openTerminalPath = useEffectEvent((target: string) => openInPreferredEditor(target));
566
const openPreview = useAtomCommand(previewEnvironment.open, {
apps/web/src/editorPreferences.ts
+2
@@ -67,6 +67,7 @@ function resolveAndPersistPreferredEditor(availableEditors: readonly EditorId[])
67
export function useOpenInPreferredEditor(
68
environmentId: EnvironmentId | null,
69
availableEditors: readonly EditorId[],
70
+ projectRoot?: string,
71
) {
72
const openInEditor = useAtomCommand(shellEnvironment.openInEditor, {
73
reportFailure: false,
@@ -120,6 +121,7 @@ export function useOpenInPreferredEditor(
121
input: {
122
cwd: targetPath,
123
editor,
124
+ ...(projectRoot ? { projectRoot } : {}),
125
},
126
});
127
return mapAtomCommandResult(result, () => editor);
packages/contracts/src/editor.ts
+2
@@ -157,6 +157,8 @@ export type FileManagerRevealKind = typeof FileManagerRevealKind.Type;
157
export const LaunchEditorInput = Schema.Struct({
158
cwd: TrimmedNonEmptyString,
159
editor: EditorId,
160
+ /** Workspace the target belongs to; JetBrains IDEs open positioned files in this project. */
161
+ projectRoot: Schema.optional(TrimmedNonEmptyString),
162
/** Only for file-manager; requires the server's shellRevealInFileManager capability. */
163
reveal: Schema.optional(Schema.Boolean),
164
});