Skip to content

markdown-language-features: enhance document link handling with improved URI parsing and selection#296821

Merged
mjbvz merged 4 commits intomicrosoft:mainfrom
tamuratak:make_markdown_range_link_work
Mar 11, 2026
Merged

markdown-language-features: enhance document link handling with improved URI parsing and selection#296821
mjbvz merged 4 commits intomicrosoft:mainfrom
tamuratak:make_markdown_range_link_work

Conversation

@tamuratak
Copy link
Contributor

@tamuratak tamuratak commented Feb 22, 2026

markdown-language-features: enhance document link handling with improved URI parsing and selection. Fix #288317

Added support for ./src/main.ts#L100-L110 style links. Since LSP does not appear to support ranges, this needs to be handled on the VS Code side, not on vscode-markdown-languageservice.

This style links are now universal since we tell LLMs to write such links in markdown files.

Copilot AI review requested due to automatic review settings February 22, 2026 11:41
Copy link
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 pull request enhances markdown link handling to support line range fragments (e.g., #L100-L110) in file links. The issue occurred when the markdown language service couldn't parse line range information from link fragments, causing files to open at line 1 instead of the specified range. Since LSP doesn't support ranges, this functionality is implemented on the VS Code extension side.

Changes:

  • Added parsing logic to extract and handle line range fragments like #L61-L66 from markdown links
  • Implemented fallback mechanism to extract fragments from link text when the language service doesn't provide them
  • Enhanced URI handling to properly set fragment and selection ranges when opening files

tamuratak and others added 3 commits February 23, 2026 06:51
…k.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Collaborator

@mjbvz mjbvz left a comment

Choose a reason for hiding this comment

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

Thank you! Lgtm

@mjbvz mjbvz enabled auto-merge March 11, 2026 02:12
@mjbvz mjbvz merged commit a04eb67 into microsoft:main Mar 11, 2026
17 of 18 checks passed
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.

Some links in markdown sometimes lead to L1 instead of specified lines range in hashtag of url

4 participants