fix: allow parentheses in terminal link paths#304992
Open
yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
Open
fix: allow parentheses in terminal link paths#304992yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
yogeshwaran-c wants to merge 1 commit intomicrosoft:mainfrom
Conversation
File paths containing parentheses like `./src/(hello)/[world]/file.tsx` (common in Next.js route groups) are not recognized as clickable links in the terminal because `()` characters are excluded from the path character regex. Remove `()` from ExcludedPathCharactersClause and WinExcludedPathCharactersClause so parentheses are allowed in the middle of paths. They remain excluded from start positions via the ExcludedStartPathCharactersClause variants, preventing false positives from parenthesized expressions at the start of potential links. The suffix-based link detection (which handles patterns like `file(339,12)`) is unaffected since it uses its own regex that works backwards from the suffix. Closes microsoft#212109
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.
What kind of change does this PR introduce?
Bug fix
What is the current behavior?
File paths containing parentheses like
./src/(hello)/[world]/file.tsx(common in Next.js route groups) are not properly recognized as clickable links in the terminal. The path gets split at(and)characters because they are excluded from theExcludedPathCharactersClauseregex.For example,
echo "./src/(hello)/[world]/file.tsx"in the terminal produces segmented links instead of one clickable path:Closes #212109
What is the new behavior?
Parentheses
()are now allowed in the middle of terminal link paths. They remain excluded from start positions viaExcludedStartPathCharactersClause, preventing false positives.The suffix-based link detection (which handles patterns like
file(339,12)) is unaffected since it uses its own dedicated regex that works backwards from detected suffixes.Additional context
The fix removes
()fromExcludedPathCharactersClauseandWinExcludedPathCharactersClause(2 lines changed). TheExcludedStartPathCharactersClausevariants still exclude()[]from the first character of a path.Code pointer from @Tyriar: #212109 (comment)