[issues/310] Fix navigation for links wrapped in backticks, quotes, and angle brackets#314
[issues/310] Fix navigation for links wrapped in backticks, quotes, and angle brackets#314
Conversation
Links wrapped in backticks, quotes, or angle brackets failed navigation because the wrapper character was captured as part of the path. The detection regex used \S (non-whitespace) which matches all of these, resulting in paths like "`file.ts" or "'file.ts" that can't be resolved. Replaces \S with a PATH_CHAR class [^\s\x60\x27\x22<>] that excludes common wrapper characters (backtick, single quote, double quote, angle brackets) from path matching. These are never/practically never in real file paths and are the same tradeoff as the existing URL character exclusion. Parentheses and brackets are intentionally NOT excluded — they appear in real paths.
Verifies the PATH_CHAR fix from the previous commit works correctly across all wrapper characters (backtick, single quote, double quote, angle brackets) and all wrapping scenarios users encounter in markdown, prose, and scratchpads. Also documents that parentheses and brackets are intentionally NOT excluded since they appear in real directory/file names.
… fix Documents the broader fix covering all wrapper characters (backtick, single quote, double quote, angle brackets) under the [Unreleased] Fixed section.
WalkthroughThis PR fixes navigation failures when RangeLinks are wrapped in markdown delimiter characters (backticks, quotes, angle brackets). It introduces a new Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Links wrapped in common text wrapper characters (backticks, single quotes, double quotes, angle brackets) failed navigation because the wrapper character was captured as part of the file path. The link detection regex used
\S(non-whitespace) for path matching, which matches all of these characters. This PR replaces\Swith aPATH_CHARclass that excludes wrapper characters from path matching, fixing navigation across all wrapping scenarios users encounter in markdown, prose, and AI scratchpads.Changes
PATH_CHARconstant[^\s\x60\x27\x22<>]that excludes backtick, single quote, double quote, and angle brackets from path character matching\SwithPATH_CHARin both single-char and multi-char hash delimiter path patternsDesign Decision
The excluded characters (
`,',",<,>) are:",<,>) or cause shell issues (`,')Parentheses
()and brackets[]are intentionally kept as valid path characters because they appear in real directory names (e.g., "My Documents (backup)", "[archived]").Test Plan
Documentation
Related
Summary by CodeRabbit
Bug Fixes
Tests