Skip to content

crash when pygls>=2.0.0 is installed and importStrategy is "fromEnvironment" #626

@DetachHead

Description

@DetachHead

Diagnostic Data

  • Python version (& distribution if applicable, e.g., Anaconda): 3.14
  • Type of virtual environment used (e.g., conda, venv, virtualenv, etc.): uv
  • Operating system (and version): linux mint 22.2
  • Version of tool extension you are using: 2025.2.0

Behaviour

Expected Behavior

no crash

Actual Behavior

Image

looks like it's because this LanguageServer class has been moved/deleted/renamed in pygls 2.0

AttributeError: module 'pygls.server' has no attribute 'LanguageServer'

Reproduction Steps:

  1. set "pylint.importStrategy": "fromEnvironment" in .vscode/settings.json
  2. install pygls 2.0 into the current venv (uv add --dev pygls==2.0.0)
  3. restart vscode and open a python file

Logs:

Click here for detailed logs
2025-11-15 16:17:08.058 [info]   Message: Pending response rejected since connection got disposed
  Code: -32097 
2025-11-15 16:17:08.616 [info] Traceback (most recent call last):

2025-11-15 16:17:08.617 [info]   File "/home/me/.vscode-oss/extensions/ms-python.pylint-2025.2.0-universal/bundled/tool/lsp_server.py", line 73, in <module>
    LSP_SERVER = server.LanguageServer(
                 ^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'pygls.server' has no attribute 'LanguageServer'

2025-11-15 16:17:08.729 [info] [Error - 16:17:08] Server initialization failed.

Outcome When Attempting Debugging Steps:

Did running it from the command line work? yes

Extra Details

my project depends on pygls so i don't want to have to downgrade it. this extension should probably use its own bundled version of pygls even when pylint.importStrategy is set to "fromEnvironment"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue identified by VS Code Team member as probable bugtriage-neededIssue is not triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions