ayamir / nvimdots

A well configured and structured Neovim.
BSD 3-Clause "New" or "Revised" License
2.83k stars 451 forks source link

I have installed python-language-server, but why pylsp didn't work? #1121

Closed shaojunjie0912 closed 6 months ago

shaojunjie0912 commented 6 months ago

Version confirmation

Following prerequisites

Not a user config issue

Neovim version

NVIM v0.9.5

Operating system/version

WSL2-ArchLinux

Terminal name/version

Windows Terminal

$TERM environment variable

No response

Branch info

main (Default/Latest)

Fetch Preferences

SSH (use_ssh = true)

Affected language servers

pylsp

How to reproduce the issue

Just open a *.py for test.

Actual behavior

It couldn't give me any diagnosis.

no_diagnosis

But I have installed pylsp successfully.

pylsp_installed

Expected behavior

It should show diagnosis but not.

Support info

:LspInfo

lspinfo

:Mason

mason

Logs

[ERROR][2024-01-02 16:43:55] .../vim/lsp/rpc.lua:734    "rpc"   "/home/olioolii/.local/share/nvim/mason/bin/pylsp"      "stderr"        "2024-01-02 16:43:55,662 CST - WARNING - pylsp_jsonrpc.endpoint - Received cancel notification for unknown message id 151\n2024-01-02 16:43:55,663 CST - WARNING - pylsp_jsonrpc.endpoint - Received cancel notification for unknown message id 152\n"
[ERROR][2024-01-02 16:43:58] .../vim/lsp/rpc.lua:734    "rpc"   "/home/olioolii/.local/share/nvim/mason/bin/pylsp"      "stderr"        "2024-01-02 16:43:58,046 CST - WARNING - pylsp_jsonrpc.endpoint - Received cancel notification for unknown message id 159\n"
[ERROR][2024-01-02 16:44:00] .../vim/lsp/rpc.lua:734    "rpc"   "/home/olioolii/.local/share/nvim/mason/bin/pylsp"      "stderr"        "2024-01-02 16:44:00,235 CST - WARNING - pylsp_jsonrpc.endpoint - Received cancel notification for unknown message id 165\n2024-01-02 16:44:00,236 CST - WARNING - pylsp_jsonrpc.endpoint - Received cancel notification for unknown message id 166\n"
[ERROR][2024-01-02 16:44:01] .../vim/lsp/rpc.lua:734    "rpc"   "/home/olioolii/.local/share/nvim/mason/bin/pylsp"      "stderr"        "2024-01-02 16:44:01,200 CST - WARNING - pylsp_jsonrpc.endpoint - Received cancel notification for unknown message id 172\n"
[ERROR][2024-01-02 16:44:05] .../vim/lsp/rpc.lua:734    "rpc"   "/home/olioolii/.local/share/nvim/mason/bin/pylsp"      "stderr"        "2024-01-02 16:44:05,291 CST - WARNING - pylsp_jsonrpc.endpoint - Received cancel notification for unknown message id 176\n"
[ERROR][2024-01-02 16:44:20] .../vim/lsp/rpc.lua:734    "rpc"   "/home/olioolii/.local/share/nvim/mason/bin/pylsp"      "stderr"        "2024-01-02 16:44:20,119 CST - WARNING - pylsp_jsonrpc.endpoint - Received cancel notification for unknown message id 250\n"
[ERROR][2024-01-02 16:44:20] .../vim/lsp/rpc.lua:734    "rpc"   "/home/olioolii/.local/share/nvim/mason/bin/pylsp"      "stderr"        "2024-01-02 16:44:20,120 CST - WARNING - pylsp_jsonrpc.endpoint - Received cancel notification for unknown message id 251\n"
[ERROR][2024-01-02 16:44:21] .../vim/lsp/rpc.lua:734    "rpc"   "/home/olioolii/.local/share/nvim/mason/bin/pylsp"      "stderr"        "2024-01-02 16:44:21,095 CST - WARNING - pylsp_jsonrpc.endpoint - Received cancel notification for unknown message id 257\n"
[ERROR][2024-01-02 16:44:33] .../vim/lsp/rpc.lua:734    "rpc"   "/home/olioolii/.local/share/nvim/mason/bin/pylsp"      "stderr"        "2024-01-02 16:44:33,135 CST - WARNING - pylsp_jsonrpc.endpoint - Received cancel notification for unknown message id 313\n"
[ERROR][2024-01-02 16:46:32] .../vim/lsp/rpc.lua:734    "rpc"   "/home/olioolii/.local/share/nvim/mason/bin/pylsp"      "stderr"        "2024-01-02 16:46:32,983 CST - WARNING - pylsp_jsonrpc.endpoint - Received cancel notification for unknown message id 419\n2024-01-02 16:46:32,984 CST - WARNING - pylsp_jsonrpc.endpoint - Received cancel notification for unknown message id 420\n"
[ERROR][2024-01-02 16:47:23] .../vim/lsp/rpc.lua:734    "rpc"   "/home/olioolii/.local/share/nvim/mason/bin/pylsp"      "stderr"        "2024-01-02 16:47:23,304 CST - WARNING - pylsp_jsonrpc.endpoint - Received cancel notification for unknown message id 502\n"
[ERROR][2024-01-02 16:47:48] .../vim/lsp/rpc.lua:734    "rpc"   "/home/olioolii/.local/share/nvim/mason/bin/pylsp"      "stderr"        "2024-01-02 16:47:48,589 CST - WARNING - pylsp_jsonrpc.endpoint - Received cancel notification for unknown message id 507\n"
[ERROR][2024-01-02 16:50:07] .../vim/lsp/rpc.lua:734    "rpc"   "/home/olioolii/.local/share/nvim/mason/bin/pylsp"      "stderr"        "2024-01-02 16:50:07,104 CST - WARNING - pylsp_jsonrpc.endpoint - Received cancel notification for unknown message id 509\n"
[ERROR][2024-01-02 16:50:13] .../vim/lsp/rpc.lua:734    "rpc"   "/home/olioolii/.local/share/nvim/mason/bin/pylsp"      "stderr"        "2024-01-02 16:50:13,443 CST - WARNING - pylsp_jsonrpc.endpoint - Received cancel notification for unknown message id 514\n"

Additional information

No response

CharlesChiuGit commented 6 months ago
  1. are u using the default settings?
  2. are all the pylsp plugin installed?
  3. why install extra LSPs like black manually?

image

image

shaojunjie0912 commented 6 months ago
  1. I removed the nvimdots and installed it again. It should be the default settings cause I didn't change anything.
  2. Sorry, but what do you mean that all the pylsp plugin? I think my mason plugins manager works well.
  3. Because I couldn't format my python code at first, so I installed balck.
shaojunjie0912 commented 6 months ago

Firstly, I created a virtual environment of python by python -m venv .env. Then, I sourced the activate. After that, I installed the pylsp by pip install python-lsp-server and pip install "python-lsp-server[all]" Eventually, I created a test.py like this:

a=1
c=b+a

I got no diagnosis and I couldn't format my code.

CharlesChiuGit commented 6 months ago

2. Sorry, but what do you mean that all the pylsp plugin? I think my mason plugins manager works well.

https://github.com/ayamir/nvimdots/blob/e977637732d78914054017a3609bed2cd72cea3e/lua/modules/configs/completion/mason.lua#L35C1-L59

CharlesChiuGit commented 6 months ago

After that, I installed the pylsp by pip install python-lsp-server and pip install "python-lsp-server[all]"

I'm not sure if pip-installed pylsp would work w/ mason-installed pylsp. 🤔

u can check all LSPs managed by mason at .local/share/nvim/mason/packages. (each LSP got it's own venv if it's written python.)

shaojunjie0912 commented 6 months ago

Hi, I went home just now and tested it again, it worked properly in my another computer (also WSL2-ArchLinux).

I created the virtualenv, then created the test.py directly, everything's OK!

Even if I pip install pylsp again, it didn't have any conflicts.

So, I didn't think it's the problem of nvimdots, maybe it's my mistake. I'm sorry.

Thanks a lot!

I love nvimdots!❤️