markdown-language-features: enhance document link handling with improved URI parsing and selection#296821
Merged
mjbvz merged 4 commits intomicrosoft:mainfrom Mar 11, 2026
Merged
Conversation
…ved URI parsing and selection
Contributor
There was a problem hiding this comment.
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-L66from 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
extensions/markdown-language-features/src/util/openDocumentLink.ts
Outdated
Show resolved
Hide resolved
extensions/markdown-language-features/src/util/openDocumentLink.ts
Outdated
Show resolved
Hide resolved
extensions/markdown-language-features/src/util/openDocumentLink.ts
Outdated
Show resolved
Hide resolved
…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>
TylerLeonhardt
approved these changes
Mar 11, 2026
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.
markdown-language-features: enhance document link handling with improved URI parsing and selection. Fix #288317
Added support for
./src/main.ts#L100-L110style 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.