Check for local files from within surrounding parens#44733
Merged
KyleBarton merged 2 commits intomainfrom Dec 15, 2025
Merged
Conversation
CherryWorm
pushed a commit
to CherryWorm/zed
that referenced
this pull request
Dec 16, 2025
…44733) Closes zed-industries#18228 We parse local clickable links by looking for start/end based on whitespace. However, this means that we don't catch links which are embedded in parenthesis, such as in markdown syntax: `[here's my link text](./path/to/file.txt)` Parsing strictly against parenthesis can be problematic, because strictly-speaking, files can have parenthesis. This is a valid file name in at least MacOS: `thisfilehas)parens.txt` Therefore, this change adds a small regex layer on top of the filename finding logic, which parses out text within parenthesis. If any are found, they are checked for being a valid filepath. The original filename string is also checked in order to preserve behavior. Before: https://github.com/user-attachments/assets/37f60335-e947-4879-9ca2-88a33f5781f5 After: https://github.com/user-attachments/assets/bd10649e-ad74-43da-80f4-3e7fd56abd86 Release Notes: - Improved link parsing for cases when a link is embedded in parenthesis, e.g. markdown
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #18228
We parse local clickable links by looking for start/end based on whitespace. However, this means that we don't catch links which are embedded in parenthesis, such as in markdown syntax:
[here's my link text](./path/to/file.txt)Parsing strictly against parenthesis can be problematic, because strictly-speaking, files can have parenthesis. This is a valid file name in at least MacOS:
thisfilehas)parens.txtTherefore, this change adds a small regex layer on top of the filename finding logic, which parses out text within parenthesis. If any are found, they are checked for being a valid filepath. The original filename string is also checked in order to preserve behavior.
Before:
Screen.Recording.2025-12-12.at.12.21.34.PM.mov
After:
Screen.Recording.2025-12-12.at.12.22.37.PM.mov
Release Notes: