Underline existing literal file paths without replacing syntax colors - #3996
Open
Matei02355 wants to merge 2 commits into
Open
Underline existing literal file paths without replacing syntax colors#3996Matei02355 wants to merge 2 commits into
Matei02355 wants to merge 2 commits into
Conversation
Matei02355
marked this pull request as ready for review
September 7, 2026 17:53
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.
Add --show-paths and PrettyPrinter::show_paths to underline recognizable literal paths that exist locally. This follows the issue author's proposed first iteration of checking existing paths only.
Resolve relative paths from each real input file's directory, or the working directory for stdin and custom readers. A display-only filename does not change that base. Recognize slash-separated paths, native Windows paths, leading ~/ and quoted filenames containing a dot; quoted paths may contain spaces. Ignore URLs and shell expressions, and leave missing or inaccessible paths unchanged.
Underline instead of replacing foreground colors, so existing escape/error colors and other font attributes remain visible. This checks literal path spellings, without decoding language escapes or claiming to validate configuration semantics. Cache checks separately for each input, retaining at most 4096 entries. Skip the filesystem work unless the option and colored output are enabled, and only inspect lines that will be displayed.
Validation: all 482 all-feature tests passed (7 ignored), including nine Linux regressions for per-file bases, display names, stdin, Unicode/space-containing paths, directories, missing paths, broken symlinks, URLs, unclosed quotes, home expansion, color suppression, library usage and preservation of existing styles. An additional Windows-only regression covers drive and backslash paths. All 8 default-feature help tests passed. All-target/all-feature Clippy with warnings denied, the minimal library build, formatting, whitespace checks and Bash/Zsh completion syntax passed. README, manual, help and all four completions are updated.
Fixes #2907.