# agent_ui: Truncate file path in context completions \(\#42682\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/518ea716eeef2fd639f6349e84aad94b0e71dafb)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 518ea716eeef2fd639f6349e84aad94b0e71dafb

Requested commit: 518ea716eeef2fd639f6349e84aad94b0e71dafb

Commit: 518ea716eeef2fd639f6349e84aad94b0e71dafb

Tree: d557ba4fee59084dfcef37330481aa98dc6e6977

Author: Scott Churchley

Committer: GitHub

## Message

```
agent_ui: Truncate file path in context completions (#42682)

Closes https://github.com/zed-industries/zed/issues/38753

Followed some prior art here: [a similar calculation
](https://github.com/zed-industries/zed/blob/e80b490ac00bfb5c206d3eb3f5c2dec10e742678/crates/file_finder/src/file_finder.rs#L1105)
in `file_finder.rs`

Release Notes:

- improved visibility of long path names in context completions by
truncating on the left when space is insufficient to render the full
path

Before:
<img width="544" height="251" alt="Screenshot of overflowing file paths"
src="https://github.com/user-attachments/assets/8440710d-3f59-4273-92bb-3db85022b57c"
/>

After: 
<img width="544" height="251" alt="Screenshot of truncated file paths"
src="https://github.com/user-attachments/assets/e268ba87-7979-4bc3-8d08-9198b4baea02"
/>
```

## Parents

- [20b584398e6151f0950f18a2579b4ee0b4012c96](https://git.cafe/gitcafe/zed/commit/20b584398e6151f0950f18a2579b4ee0b4012c96?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/518ea716eeef2fd639f6349e84aad94b0e71dafb?format=markdown)
