Repository navigation
Support mnemonic prefixes in git diff parsing for terminal links - #298490
Conversation
|
@microsoft-github-policy-service agree |
There was a problem hiding this comment.
Pull request overview
Updates VS Code’s integrated terminal local-file link parsing so filenames in git diff output are correctly detected when diff.mnemonicPrefix is enabled (eg. i/ and w/ instead of a/ and b/), preventing links from including the mnemonic prefix as part of the path.
Changes:
- Generalize git-diff prefix stripping to support mnemonic prefixes via small regex helpers.
- Expand existing git-diff parsing tests to cover the additional mnemonic prefixes.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/vs/workbench/contrib/terminalContrib/links/browser/terminalLinkParsing.ts | Adds regex-based detection of git diff prefixes (a/, b/, c/, i/, o/, w/) so link ranges exclude the prefix consistently. |
| src/vs/workbench/contrib/terminalContrib/links/test/browser/terminalLinkParsing.test.ts | Parameterizes git-diff link parsing tests to validate mnemonic-prefix handling. |
|
Megan Rogge (@meganrogge) Daniel Imms (@Tyriar) Ladislau Szomoru (@lszomoru) is there a way to get a review on this small bugfix? This has been sitting idle with assignees for a few weeks. |
|
Just wanted to bump this Megan Rogge (@meganrogge) Daniel Imms (@Tyriar) Ladislau Szomoru (@lszomoru) - this is a small bugfix in an existing feature with tests updated and passing. Can I please get a review? |
|
Lee Murray (@mrleemurray) Ulugbek Abdullaev (@ulugbekna) can I please get a review on this PR, or someone to explicitly acknowledge that it's not going to be accepted? How does one get any response from a maintainer in this project? |
|
Clint Harrison (@clintharrison) Apologies for the delay, and thanks much for the PR. PR looks generally good, |
Git supports a config option
diff.mnemonicPrefixthat sometimes uses characters other thana/andb/in diffs to distinguish where they came from. This PR updates the link parsing in the integrated terminal, so file paths are still detected when this option is enabled.I updated the existing tests for this functionality.
Manual testing
Make some change in a git repo (e.g.
echo "hello world" >>README.md).Enable this config option and run git diff:
git -c diff.mnemonicPrefix=true diffin the terminal will now be comparing theindex and theworking copy files:With this change,
README.mdin each location should be underlined on hover and possible to open with ⌘/ctrl+click.Notably, cmd-click will open
README.md, and not attempt to find a file namedw/README.mdFixes #302823