Skip to content

markdown: work around pasted link edit range mismatch - #332424

Draft
Dmitriy Vasyura (dmitrivMS) wants to merge 1 commit into
mainfrom
dev/dmitriv/fix-markdown-pasted-link-ranges
Draft

markdown: work around pasted link edit range mismatch#332424
Dmitriy Vasyura (dmitrivMS) wants to merge 1 commit into
mainfrom
dev/dmitriv/fix-markdown-pasted-link-ranges

Conversation

@dmitrivMS

Copy link
Copy Markdown
Collaborator

Fixes #323131

Potential upstream fix: microsoft/vscode-markdown-languageserver#25

Summary

  • serialize pasted-link edit ranges using the tuple wire format expected by the currently packaged Markdown language server
  • type the compatibility payload explicitly
  • add focused regression coverage for the serialized range shape

Details

vscode-markdown-languageserver 0.5.0 reads incoming edit ranges as [start, end], while the client currently sends the standard LSP { start, end } shape. This causes markdown/getUpdatePastedLinksEdit to fail while reading edit.range[0].line.

This is a compatibility workaround for the currently packaged server. It should be removed when VS Code adopts an upstream server version containing microsoft/vscode-markdown-languageserver#25, which fixes the server to accept standard LSP TextEdit ranges directly.

Validation

  • npm --prefix extensions\markdown-language-features run build-ext
  • .\scripts\test-integration.bat --suite markdown --grep "serializes text edits using the server range format"
  • manually copied a Markdown link between files in different directories, selected Paste and update pasted links, confirmed the relative path was rewritten correctly, and confirmed the original provider failure was absent from the fresh extension-host log

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings August 24, 2026 19:57
@dmitrivMS Dmitriy Vasyura (dmitrivMS) added bug Issue identified by VS Code Team member as probable bug markdown-ext The Markdown extension: language features and preview labels Aug 24, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a compatibility workaround for Markdown language server 0.5.0’s pasted-link range format.

Changes:

  • Serializes pasted-link edit ranges as tuples.
  • Explicitly types the compatibility payload.
  • Adds focused regression coverage.
Show a summary per file
File Description
src/client/client.ts Uses compatibility serialization for pasted-link edits.
src/client/protocol.ts Defines and serializes the server-specific wire format.
src/test/protocol.test.ts Verifies the serialized range shape.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Balanced

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

Labels

bug Issue identified by VS Code Team member as probable bug markdown-ext The Markdown extension: language features and preview

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Markdown Paste - Cannot read properties of undefined (reading 'line')

4 participants