Skip to content

fix: show full file path in edit tool view#1599

Merged
charlesvien merged 9 commits into
PostHog:mainfrom
reverb256:fix/1194-show-edited-file-path
Apr 23, 2026
Merged

fix: show full file path in edit tool view#1599
charlesvien merged 9 commits into
PostHog:mainfrom
reverb256:fix/1194-show-edited-file-path

Conversation

@reverb256
Copy link
Copy Markdown
Contributor

Problem

When the agent edits a file, the edit tool view only shows the filename (e.g. ActionSelector.tsx), not the full path. When working across many files with the same name in different directories, this makes it hard to know which file was changed.

Fixes #1194

Solution

Updated FileMentionChip to show the relative directory path before the filename:

  • Before: 📄 ActionSelector.tsx
  • After: 📄 src/renderer/components/action-selector/ActionSelector.tsx

The directory portion uses text-gray-9 (muted) for visual hierarchy, keeping the filename prominent. Uses the existing toRelativePath utility already in the same file.

Files Changed

  • apps/code/src/renderer/features/sessions/components/session-update/FileMentionChip.tsx — 9 lines added

FileMentionChip now displays the relative directory path (muted)
before the filename, so users can see which file was edited
at a glance without expanding the diff.

Before: 📄 ActionSelector.tsx
After:  📄 src/renderer/components/action-selector/ActionSelector.tsx

The directory portion uses text-gray-9 for visual hierarchy,
keeping the filename prominent.

Fixes PostHog#1194
>
<Text size="1">
<FileIcon filename={filename} size={12} />
{directory && (
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tiny nitpick: there is a bit of a gap between the two spans now, can we tighten that up a bit please?Screenshot 2026-04-09 at 1.40.20 PM.png

Copy link
Copy Markdown
Contributor

@adboio adboio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left a small comment, otherwise looks great :)

Wrap directory and filename in a single span to eliminate
whitespace gap between them.
@reverb256
Copy link
Copy Markdown
Contributor Author

Good catch! Tightened the spacing by wrapping directory and filename in a single span. Pushed the fix 👍

Use inline-flex on the wrapper span to collapse whitespace text
nodes between directory and filename, eliminating the visible gap.
@reverb256
Copy link
Copy Markdown
Contributor Author

Visual Evidence

Before → After: Full file path shown in edit tool view

PR #1599 visual evidence

The directory portion is shown in muted gray (text-gray-9) for visual hierarchy, keeping the filename prominent.

@reverb256
Copy link
Copy Markdown
Contributor Author

Good catch — tightened the gap between the icon and filename (gap="0" instead of gap="1").

@reverb256
Copy link
Copy Markdown
Contributor Author

@adboio thanks for catching that! Tightened up the gap by putting the spans on one line and adding gap-0 to the inline-flex container. Also removed all unrelated changes — the PR now only touches FileMentionChip.tsx.

Copy link
Copy Markdown
Contributor

@adboio adboio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for fixing!! can you please just remove the .github/evidence from the commit? i'll get this merged asap :)

Reorders FileMentionChip so the bold filename renders before the gray
directory path, matching the diff panel header style. Directory
truncates with an ellipsis on overflow while the filename stays
visible in full.

Nudges the whole chip down 1px and uses inline-flex with baseline
alignment so it sits cleanly inline with surrounding text.

Also restores .gitignore entries and removes the PR evidence image
that leaked onto the branch.

Generated-By: PostHog Code
Task-Id: 97371512-63be-4a27-be52-b007a53795a4
Adds flex sizing and overflow containment so the chip shrinks to its
parent's width and the directory path clips with an ellipsis when
there isn't enough room, instead of pushing layout.

Generated-By: PostHog Code
Task-Id: 97371512-63be-4a27-be52-b007a53795a4
@jonathanlab
Copy link
Copy Markdown
Contributor

CleanShot 2026-04-20 at 17 10 31@2x

I've put the file name in front since it's more readable this way.

@charlesvien charlesvien enabled auto-merge (squash) April 23, 2026 23:11
@charlesvien charlesvien merged commit 09c791f into PostHog:main Apr 23, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clearly show the edited file's path

4 participants