Skip to content

Terminate URL detection at CJK full-width ! and ?#314618

Open
yogeshwaran-c wants to merge 1 commit into
microsoft:mainfrom
yogeshwaran-c:fix/terminal-link-cjk-punctuation-303101
Open

Terminate URL detection at CJK full-width ! and ?#314618
yogeshwaran-c wants to merge 1 commit into
microsoft:mainfrom
yogeshwaran-c:fix/terminal-link-cjk-punctuation-303101

Conversation

@yogeshwaran-c
Copy link
Copy Markdown
Contributor

Summary

In CJK contexts, when a URL was followed by a full-width exclamation mark (, U+FF01) or full-width question mark (, U+FF1F), the punctuation was incorrectly absorbed into the detected link, producing a broken URL.

The link computer's FORCE_TERMINATION_CHARACTERS already includes the full-width period (), comma (), and other CJK sentence-enders, but omitted these two. Adding them as force-termination characters fixes the issue while preserving existing CJK URL behavior (e.g. Wikipedia URLs that legitimately contain 【】, 《》, "").

Fixes #303101

Test plan

The link computer's FORCE_TERMINATION_CHARACTERS already includes CJK
sentence-enders such as the full-width period (。) and comma (,), but
omitted the full-width exclamation mark (!, U+FF01) and question mark
(?, U+FF1F). When a URL was followed by either of these in CJK text,
the punctuation was incorrectly absorbed into the detected link.

Fixes microsoft#303101
Copilot AI review requested due to automatic review settings May 6, 2026 01:48
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts VS Code’s link detection (used by both the editor link computer and terminal URL link detection) so that CJK full-width exclamation (, U+FF01) and question (, U+FF1F) characters forcibly terminate a detected URL, preventing trailing punctuation from being incorrectly included in the clickable link.

Changes:

  • Add and to FORCE_TERMINATION_CHARACTERS in the link computer classifier.
  • Add editor unit tests to verify URLs terminate before / in CJK text.
  • Add terminal URL detector unit test cases mirroring the reported reproduction.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/vs/workbench/contrib/terminalContrib/links/test/browser/terminalUriLinkDetector.test.ts Adds terminal link detection test cases ensuring / are excluded from detected URLs.
src/vs/editor/test/common/modes/linkComputer.test.ts Adds editor link computer tests validating URL termination at full-width and .
src/vs/editor/common/languages/linkComputer.ts Extends the force-termination character set to include full-width and .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Terminal link detection includes Chinese period (。) as part of URL

3 participants