Skip to content

Error while debugging. #557

@STofone

Description

@STofone

version:2.0.0a4

2025-06-25 15:25:52.523 [info] config modified, restarting server...
2025-06-25 15:25:52.523 [info] cwd: 'e:\ProgSpace\pygls-main/examples/servers'
2025-06-25 15:25:52.523 [info] server: 'code_lens.py'
2025-06-25 15:25:52.523 [info] Looking for environment in which to execute: 'file:///e%3A/ProgSpace/pygls-main/examples/servers/code_lens.py'
2025-06-25 15:25:52.523 [info] Found environment: E:\PROGSPACE\PYGLS-MAIN\.VENV\SCRIPTS\PYTHON.EXE: e:\ProgSpace\pygls-main\.venv\Scripts\python.exe
2025-06-25 15:25:52.523 [info] client options: {
  "documentSelector": [
    {
      "scheme": "file",
      "language": "plaintext"
    }
  ],
  "outputChannel": {
    "name": "pygls",
    "logLevel": 3
  },
  "connectionOptions": {
    "maxRestartCount": 0
  }
}
2025-06-25 15:25:52.566 [info] e:\ProgSpace\pygls-main\.venv\Scripts\python.exe: can't find '__main__' module in 'e:\\ProgSpace\\pygls-main\\examples\\servers'

2025-06-25 15:25:52.571 [info] [Error - 3:25:52 PM] Server initialization failed.
2025-06-25 15:25:52.571 [info]   Message: Pending response rejected since connection got disposed
  Code: -32097 
2025-06-25 15:25:52.571 [info] [Error - 3:25:52 PM] The pygls server crashed 1 times in the last 3 minutes. The server will not be restarted. See the output for more information.
2025-06-25 15:25:52.571 [info] [Error - 3:25:52 PM] pygls client: couldn't create connection to server.
2025-06-25 15:25:52.571 [info]   Message: Pending response rejected since connection got disposed
  Code: -32097 

It works well without debug enable.

Here's my settings.json

{
    "[plaintext]": {
        // Uncomment to enable `textDocument/onTypeFormatting` requests
        // "editor.formatOnType": true
    },
    // Uncomment to override Python interpreter used.
    // "pygls.server.pythonPath": "/path/to/python",
    "pygls.server.debug": true, // This is relative to `pygls.server.cwd`
    "pygls.server.debugHost": "127.0.0.1",
    "pygls.server.cwd": "${workspaceFolder}/examples/servers",
    "pygls.trace.server": "off",
    "pygls.client.documentSelector": [
        {
            "scheme": "file",
            "language": "plaintext"
        }
    ],
    "python.testing.pytestArgs": [
        "."
    ],
    "python.testing.unittestEnabled": false,
    "python.testing.pytestEnabled": true,
    // "pygls.jsonServer.exampleConfiguration": "some value here",
    "pygls.server.launchScript": "code_lens.py",
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions