Skip to content

Update to pygls 2#400

Merged
edvilme merged 7 commits into
microsoft:mainfrom
edvilme:pygls-2
Feb 12, 2026
Merged

Update to pygls 2#400
edvilme merged 7 commits into
microsoft:mainfrom
edvilme:pygls-2

Conversation

@edvilme

@edvilme edvilme commented Feb 11, 2026

Copy link
Copy Markdown
Contributor

This pull request updates the LSP server implementation in bundled/tool/lsp_server.py to be compatible with pygls version 2 and refactors diagnostic and messaging APIs to use the new methods and types. The changes modernize the codebase, improve clarity, and ensure compatibility with the latest pygls release.

Migration to pygls v2 and API refactoring:

  • Updated requirements.in to require pygls>=2, ensuring compatibility with the latest version.
  • Replaced imports and usages of server.LanguageServer, workspace.Document, and associated methods with their pygls v2 equivalents (LanguageServer, TextDocument, etc.).
  • Refactored diagnostic publishing methods to use text_document_publish_diagnostics and lsp.PublishDiagnosticsParams instead of the deprecated publish_diagnostics. [1] [2] [3]
  • Updated messaging functions to use window_log_message and window_show_message with the new parameter objects, replacing the old show_message_log and show_message methods.

Type and method updates for workspace/document handling:

  • Changed function signatures and internal logic to use TextDocument instead of workspace.Document, updating all relevant helper and utility functions. [1] [2] [3] [4] [5]

These updates are essential for maintaining compatibility and leveraging improvements in pygls v2.

@edvilme

edvilme commented Feb 11, 2026

Copy link
Copy Markdown
Contributor Author

Tests fixed to match changes from python/mypy#19115

@edvilme edvilme added the debt Technical debt or repo cleanup label Feb 11, 2026
@edvilme edvilme marked this pull request as ready for review February 11, 2026 20:35
Comment thread bundled/tool/lsp_server.py
rchiodo
rchiodo previously approved these changes Feb 11, 2026
@edvilme edvilme enabled auto-merge (squash) February 12, 2026 00:04
@edvilme edvilme merged commit ab468d9 into microsoft:main Feb 12, 2026
13 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

debt Technical debt or repo cleanup

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants