fix(server): pass project root to JetBrains editor launches#7194

closed1
main
GitHub fork: fix/jetbrains-project-root
openedAug 16, 2026byMmaslinedwin
View on GitHubTwo-way sync enabledPR last imported 21d ago

JetBrains CLIs were launched as idea --line 168 --column 4 /abs/worktree-b/src/File.java. Without the project/worktree root, IntelliJ can reuse the wrong window, open LightEdit, or fail when another checkout of the same repo is already open.

LaunchEditorInput now carries an optional projectRoot from the thread's known workspace cwd (chat links, diffs, git file actions, terminal links, file preview). Line-column launches become:

1idea /abs/worktree-b --line 168 --column 4 /abs/worktree-b/src/File.java

If the root is missing, the previous arg shape is unchanged. --column is still omitted when no column is present. VS Code --goto and Zed direct-path launches are unchanged. The root is never inferred from the file path.

Fixes #5885

Made with Grok (T3 Code).


Note

Low Risk Scoped to optional editor launch args and UI plumbing; backward-compatible when projectRoot is omitted, with regression tests for JetBrains CLI shapes.

Overview Fixes JetBrains line-column launches opening the wrong project window when multiple checkouts exist by threading an optional projectRoot through LaunchEditorInput and the web “open in editor” paths.

When projectRoot is set, externalLauncher prepends it before --line / --column and the file path (e.g. idea /abs/worktree-b --line 168 --column 4 …). Without it, JetBrains args stay the old shape. VS Code (--goto) and Zed direct-path launches are unchanged.

The UI passes the thread/workspace cwd as projectRoot from chat markdown links, diff panel, git file actions, terminal links, file preview, and OpenInPicker / useOpenInPreferredEditor. New server tests lock in the arg shapes.

Reviewed by Cursor Bugbot for commit 5325a42281886674b25c2e95140adf0e00335d46. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Pass project root to JetBrains editor launches

  • Adds an optional projectRoot field to LaunchEditorInput in editor.ts and threads it through resolveCommandEditorArgs in externalLauncher.ts
  • For line-column launch style (e.g. JetBrains CLIs), projectRoot is prepended to the args before --line when a file position is present
  • All web components that trigger editor opens (ChatMarkdown, DiffPanel, GitActionsControl, OpenInPicker, etc.) now pass their local cwd or equivalent as projectRoot

Macroscope summarized 5325a42.

Checks

1 failing · 11 successful · 5 skipped
Some checks failed

Failing1

5325a42

Added 1 commit

  • fix(server): pass project root to JetBrains editor launches5325a42
Synced from GitHub

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 6d3c7acb-34e4-4030-a872-197a0354c954

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Synced from GitHub

Approvability

Verdict: Approved 5325a42

Straightforward bug fix that adds an optional projectRoot parameter to JetBrains editor launches. The change is additive, well-scoped to editor launching behavior, and includes comprehensive test coverage for the new argument construction logic.

You can customize Macroscope's approvability policy. Learn more.

Note: GPT-6 on behalf of shivam (@shivamhwp).

Please rebase this onto current main. The ChatMarkdown hook now uses availableEditors directly, and LaunchEditorInput includes the newer reveal option. Preserve that option while adding projectRoot, and carry cwd into the current hook call. The PR currently conflicts at both locations.

Note

This comment is posted by Julius' dot

Closing for missing verification results. The PR adds launcher regression tests but reports no executed checks or results for this branch. The command examples in #5885 establish the intended arguments, but do not verify that the changed entry points pass the correct worktree root. Run the focused launcher tests, report their results, and document a positioned file launch into worktree B while worktree A is already open before requesting reconsideration.