[PR #4220] File linking on paste #10900

Closed
opened 2026-02-16 18:15:39 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/4220

State: closed
Merged: No


1.0.0 removed the feature of auto-file linking when pasting a file path on the input (#3624). I think this PR complies with the CONTRIBUTING.md guidelines, but feel free to close it if it doesn't (or tell me how to improve it, I will gladly contribute what I can to this project)

The code runs after the image and long text bits and checks if the pasted text is a file/symbolic link/directory. If it isn't, it pastes the plain text as normal and continues, but if it is, it inserts the reference. I had to start with a preventDefault because of the async stat call, so I manually had to insert the raw text when it didn't match a file.

I didn't find any tests for near code, so I didn't write any, but if you need I can move some stuff around and make it so what I added is easier to test. I also think most of this code is similar to the autocomplete bits in some ways, I just opted to duplicate it to make it less code to review

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/4220 **State:** closed **Merged:** No --- 1.0.0 removed the feature of auto-file linking when pasting a file path on the input (#3624). I **think** this PR complies with the `CONTRIBUTING.md` guidelines, but feel free to close it if it doesn't (or tell me how to improve it, I will gladly contribute what I can to this project) The code runs after the image and long text bits and checks if the pasted text is a file/symbolic link/directory. If it isn't, it pastes the plain text as normal and continues, but if it is, it inserts the reference. I had to start with a `preventDefault` because of the async `stat` call, so I manually had to insert the raw text when it didn't match a file. I didn't find any tests for near code, so I didn't write any, but if you need I can move some stuff around and make it so what I added is easier to test. I also think most of this code is similar to the autocomplete bits in some ways, I just opted to duplicate it to make it less code to review
yindo added the pull-request label 2026-02-16 18:15:39 -05:00
yindo closed this issue 2026-02-16 18:15:39 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#10900