-
Notifications
You must be signed in to change notification settings - Fork 24
Description
I want to use python-lsp-server
and python-lsp-ruff
with neovim
, but I get the following error.
Other plugins such as python-lsp-black
work.
LspLog
[ERROR][2023-11-19 23:17:03] .../vim/lsp/rpc.lua:734 "rpc" "/home/Ttayu/.local/share/nvim/mason/bin/pylsp" "stderr" "2023-11-19 23:17:03,317 JST - ERROR - pylsp_jsonrpc.streams - Failed to write message to output file {'jsonrpc': '2.0', 'method': 'textDocument/publishDiagnostics', 'params': {'uri': 'file:///home/Ttayu/sample.py', 'diagnostics': [{'range': {'start': {'line': 1, 'character': 7}, 'end': {'line': 1, 'character': 13}}, 'message': 'shutil
imported but unused', 'severity': 1, 'code': 'F401', 'source': 'ruff', 'tags': [1], 'data': Fix(edits=[Edit(content='', location=Location(row=2, column=1), end_location=Location(row=3, column=1))], message='Remove unused import: shutil
', applicability='safe')}, {'range': {'start': {'line': 15, 'character': 0}, 'end': {'line': 15, 'character': 14}}, 'message': 'Module level import not at top of file', 'severity': 2, 'code': 'E402', 'source': 'ruff', 'tags': []}, {'range': {'start': {'line': 15, 'character': 7}, 'end': {'line': 15, 'character': 14}}, 'message': 'pathlib
imported but unused', 'severity': 1, 'code': 'F401', 'source': 'ruff', 'tags': [1], 'data': Fix(edits=[Edit(content='', location=Location(row=16, column=1), end_location=Location(row=17, column=1))], message='Remove unused import: pathlib
', applicability='safe')}, {'source': 'mypy', 'range': {'start': {'line': 9, 'character': 15}, 'end': {'line': 9, 'character': 38}}, 'message': '"filter[Any]" has no attribute "exists"', 'severity': 1, 'code': 'attr-defined'}]}}\nTraceback (most recent call last):\n File "/home/Ttayu/.local/share/nvim/mason/packages/python-lsp-server/venv/lib/python3.10/site-packages/pylsp_jsonrpc/streams.py", line 97, in write\n body = json.dumps(message, **self._json_dumps_args)\nTypeError: Fix(edits=[Edit(content='', location=Location(row=2, column=1), end_location=Location(row=3, column=1))], message='Remove unused import: shutil
', applicability='safe') is not JSON serializable\n"
import shutil
from pathlib import Path
import Path
Environment
python-lsp-ruff: 1.6.0
ruff: 0.1.6
OS:
- WSL-Ubuntu-22.04
Linux 5.15.133.1-microsoft-standard-WSL2
- Ubuntu-22.04.3 LTS
5.15.0-88-generic
NeoVim: NVIM v0.9.4, v0.10.0-dev-09a17f9
Build type: Release
LuaJIT 2.1.1692716794
pip list
/home/Ttayu/.local/share/nvim/mason/packages/python-lsp-server/venv/bin/pip list
Package Version
--------------------- --------
astroid 3.0.1
attrs 23.1.0
autopep8 2.0.4
cattrs 23.2.1
dill 0.3.7
docstring-to-markdown 0.13
flake8 6.1.0
importlib-metadata 6.8.0
isort 5.12.0
jedi 0.19.1
lsprotocol 2023.0.0
mccabe 0.7.0
packaging 23.2
parso 0.8.3
pip 23.2.1
platformdirs 4.0.0
pluggy 1.3.0
pycodestyle 2.11.1
pydocstyle 6.3.0
pyflakes 3.1.0
pylint 3.0.2
python-lsp-jsonrpc 1.1.2
python-lsp-ruff 1.6.0
python-lsp-server 1.9.0
pytoolconfig 1.2.6
rope 1.11.0
ruff 0.1.6
setuptools 65.5.0
snowballstemmer 2.2.0
tomli 2.0.1
tomlkit 0.12.3
ujson 5.8.0
whatthepatch 1.0.5
yapf 0.40.2
zipp 3.17.0