Skip to content

Update to Pygls 2#367

Merged
edvilme merged 7 commits intomicrosoft:mainfrom
edvilme:pygls-2
Feb 11, 2026
Merged

Update to Pygls 2#367
edvilme merged 7 commits intomicrosoft:mainfrom
edvilme:pygls-2

Conversation

@edvilme
Copy link
Contributor

@edvilme edvilme commented Feb 11, 2026

This pull request updates the Flake8 VS Code extension to use Flake8 version 7.3.0 and refactors the LSP server implementation to use the new pygls API, improving compatibility and maintainability. The changes include migrating from the deprecated workspace.Document to pygls.workspace.TextDocument, updating diagnostic and logging methods, and modernizing code action and quick fix handling.

Dependency update:

  • Updated the bundled Flake8 version in the extension from 7.1.1 to 7.3.0 in README.md.

Migration to new pygls API:

  • Replaced all usage of workspace.Document with pygls.workspace.TextDocument throughout lsp_server.py, including function signatures and type annotations. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11]

  • Updated document access methods from get_document to get_text_document in all LSP event handlers. [1] [2]

Diagnostic and logging improvements:

  • Replaced deprecated diagnostic publishing (publish_diagnostics) with the new text_document_publish_diagnostics method and updated the way diagnostics are sent.

  • Refactored all logging and user notification calls to use the new window_log_message and window_show_message APIs, improving message handling and compatibility. [1] [2]

@edvilme edvilme added the debt label Feb 11, 2026
@edvilme edvilme marked this pull request as ready for review February 11, 2026 21:04
@edvilme edvilme merged commit e13eb36 into microsoft:main Feb 11, 2026
23 checks passed
Copy link

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 updates the Flake8 VS Code extension to use pygls 2.0.1 (from 1.3.1) and Flake8 7.3.0 (from 7.1.1), performing a comprehensive migration to the new pygls API. The changes ensure compatibility with the latest version of the LSP library while maintaining all existing functionality.

Changes:

  • Updated all dependencies including pygls, flake8, lsprotocol, and related packages
  • Migrated all pygls API calls from the deprecated 1.x API to the new 2.0 API
  • Updated imports, type annotations, and method calls throughout the LSP server implementation

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

File Description
requirements.txt Updated all dependencies to their latest versions, including pygls 2.0.1 and flake8 7.3.0
bundled/tool/lsp_server.py Migrated from pygls 1.x to 2.0 API: updated imports, replaced workspace.Document with TextDocument, changed get_document to get_text_document, updated diagnostic publishing and logging methods
README.md Updated the bundled flake8 version number from 7.1.1 to 7.3.0

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -1,6 +1,6 @@
# Flake8 extension for Visual Studio Code
# Flake8 extension for Visual Studio Code
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

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

There is a trailing space at the end of this line that should be removed.

Suggested change
# Flake8 extension for Visual Studio Code
# Flake8 extension for Visual Studio Code

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants