Skip to content

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

Closed
maslinedwin wants to merge 1 commit into
pingdotgg:mainfrom
maslinedwin:fix/jetbrains-project-root
Closed

maslinedwin wants to merge 1 commit into
pingdotgg:mainfrom
maslinedwin:fix/jetbrains-project-root

Conversation

@maslinedwin

@maslinedwin maslinedwin commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

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:

idea /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 5325a42. 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.

JetBrains CLIs were started as `idea --line 168 --column 4 /file`, so
IntelliJ could reuse the wrong project window. Carry the thread's known
workspace root on the launch request and emit
`idea /project --line 168 --column 4 /file` when that root is present.

Made with Grok (T3 Code).
@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

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.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Aug 16, 2026
@macroscopeapp

macroscopeapp Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

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.

@shivamhwp

Copy link
Copy Markdown
Collaborator

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.

Copy link
Copy Markdown
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: JetBrains file links can open in the wrong project

3 participants