pingdotgg / pingdotgg/t3code

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

Open
#5,885 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
23k
Forks
5.9k
Avg merge
11h 14m
Merged PRs (30d)
357

Description

Before submitting
  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.
Area

apps/server

Steps to reproduce
  1. Open checkout/worktree A of a repository in IntelliJ IDEA.
  2. In T3 Code, open a thread whose effective workspace is checkout/worktree B of the same repository, with B not already open in IntelliJ.
  3. Click a positioned file link from chat, a diff, a Git file action, or a terminal link, for example:
    /abs/worktree-b/src/File.java:168:4
  4. Observe which IntelliJ project owns the opened editor tab.

T3 currently launches the file without passing the thread's effective project/worktree root:

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

T3 should explicitly pass the effective project root it already knows, followed by the existing positioned file arguments:

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

IntelliJ should open or reuse worktree B as the project, then navigate to the requested line and column.

The project root should be carried explicitly in the editor-launch request rather than rediscovered from the file path, so this remains correct for non-Git projects and remote environments.

I expect this command structure should work for all JetBrains products, but I only verified with the ones I use, IntelliJ and C Lion

Actual behavior

Because only the file is passed, IntelliJ has to infer project ownership. With multiple related checkouts open, or when the intended worktree is not open yet, it can reuse the wrong project, open the file in LightEdit, or fail while trying to start another IDE instance.

The current launch contract contains the target path and editor ID, but not the T3 project/worktree root.

Impact

IntelliJ opens the file in the wrong project window. Sometimes you get an error from intellij.

Version or commit

main-compatible checkout @ 02f4ce566711

Environment

macOS, T3 Code web/desktop host, IntelliJ IDEA; especially visible with multiple Git worktrees

Logs or stack traces
# Current argument shape
idea --line 168 --column 4 /abs/worktree-b/src/File.java

# Desired argument shape
idea /abs/worktree-b --line 168 --column 4 /abs/worktree-b/src/File.java
Screenshots, recordings, or supporting files

No response

Workaround

A PATH wrapper around idea can infer the Git or .idea root from a single file target and insert that root before the existing arguments.

Additional context

T3 already parses :line:column targets for JetBrains editors and emits --column when a column is present. That behavior is not missing; it should be preserved and covered together with the project-root case.

Related but not duplicate:

  • #657 / #1673 added IntelliJ IDEA and --line / --column launch support.
  • #5090 proposes choosing a different default editor per project; this bug is about selecting the correct project inside the chosen JetBrains IDE.

JetBrains CLI reference: https://www.jetbrains.com/help/idea/opening-files-from-command-line.html

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the editor-launch request and the JetBrains positioned-file-link entry point in apps/server, then trace where the effective workspace root is available. Preserve the existing --line and --column handling while adding the root to the launch arguments. Done means IntelliJ opens the effective worktree as the project for chat, diff, Git, and terminal links, with coverage for the existing positioned-target behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.