python-lsp / python-lsp-server

Fork of the python-language-server project, maintained by the Spyder IDE team and the community
MIT License
1.75k stars 187 forks source link

pylsp_jsonrpc.endpoint - Failed to handle request 32 #548

Open baloe opened 2 months ago

baloe commented 2 months ago

I am struggling to get the thing running in Manjaro.

The one functionality that I really really want to use is to be able to search and go to function definitions, just like it used to be possible in Atom without the burden of installing any lsp-server at all.

Anyway, so I installed the lsp-server via sudo pacman -S python-lsp-server and am using Kate as my code editor to edit python files.

However, when opening a python file in kate, it outputs the following lines:

[11:16:37  LSP Client Log] Started server python@/home/baloe: /usr/bin/pylsp --check-parent-process
[11:16:42  LSP Server Log] python@/home/baloe
2024-04-06 11:16:42,181 CEST - WARNING - pylsp.workspace - There was an error while trying to initialize progress reporting.Likely progress reporting was used in a synchronous LSP handler, which is not supported by progress reporting yet. To prevent waiting for the timeout you can set `skip_token_initialization=True`. Not every editor will show progress then, but many will.
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/pylsp/workspace.py", line 267, in _progress_begin
    ).result(timeout=1.0)
      ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/concurrent/futures/_base.py", line 458, in result
    raise TimeoutError()
TimeoutError
[11:16:42  LSP Server Info] lint: pycodestyle [100%]
[11:16:43  LSP Server Log] python@/home/baloe
2024-04-06 11:16:43,619 CEST - WARNING - pylsp.workspace - There was an error while trying to initialize progress reporting.Likely progress reporting was used in a synchronous LSP handler, which is not supported by progress reporting yet. To prevent waiting for the timeout you can set `skip_token_initialization=True`. Not every editor will show progress then, but many will.
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/pylsp/workspace.py", line 267, in _progress_begin
    ).result(timeout=1.0)
      ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/concurrent/futures/_base.py", line 458, in result
    raise TimeoutError()
TimeoutError
[11:16:44  LSP Server Info] lint: mccabe [100%]

Where am I supposed to set skip_token_initialization=True? It is not documented in https://github.com/python-lsp/python-lsp-server/blob/develop/CONFIGURATION.md

When trying to search for a symbol I then get this output:

[10:57:16  LSP Server Log] python@/home/baloe
2024-04-06 10:57:16,144 CEST - ERROR - pylsp_jsonrpc.endpoint - Failed to handle request 32
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/pylsp_jsonrpc/endpoint.py", line 193, in _handle_request
    handler = self._dispatcher[method]
              ~~~~~~~~~~~~~~~~^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pylsp/python_lsp.py", line 230, in __getitem__
    raise KeyError()
KeyError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/pylsp_jsonrpc/endpoint.py", line 117, in consume
    self._handle_request(message['id'], message['method'], message.get('params'))
  File "/usr/lib/python3.11/site-packages/pylsp_jsonrpc/endpoint.py", line 195, in _handle_request
    raise JsonRpcMethodNotFound.of(method) from e
pylsp_jsonrpc.exceptions.JsonRpcMethodNotFound: Method Not Found: workspace/symbol