Closed Zeioth closed 1 month ago
also, my ruff-lsp version
Closing as duplicate of https://github.com/astral-sh/ruff-lsp/issues/486
Let's keep this open as the notification is coming from the native server.
Can you try removing ruff_lsp
and only running the native server? It's not recommended to use both at the same time.
Can you also check the logs via :LspLog
and check if there's any error message present there? I think you'll need to turn on the server tracing like so:
require('lspconfig').ruff.setup({
trace = 'messages',
init_options = {
settings = {
logLevel = 'debug',
},
},
})
Sorry, I didn't notice the logs that you've provided. That doesn't contain anything relevant, you'll need to turn on server tracing via the config that I've provided in my previous comment.
The issue is on ruff itself, so the workaround on my end has been using ruff-lsp
+ pywright
.
@Zeioth please stop opening and closing this issue unnecessarily because it triggers a notification for everyone observing the repository.
To get this resolved, please provide us with the log that @dhruvmanila asked you for. It's very difficult to help you without it.
@MichaReiser @dhruvmanila Here is the log generated by
:lua require('lspconfig').ruff.setup({ trace = 'messages', init_options = { settings = { logLevel = 'debug' } } })
[START][2024-09-21 12:42:58] LSP logging initiated
[ERROR][2024-09-21 12:42:58] .../vim/lsp/rpc.lua:770 "rpc" "/home/zeioth/.local/share/nvim/mason/bin/ruff" "stderr" " 0.000011050s WARN main ruff_server::server: No workspace(s) were provided during initialization. Using the current working directory as a default workspace...\n"
[ERROR][2024-09-21 12:42:59] .../vim/lsp/rpc.lua:770 "rpc" "/home/zeioth/.local/share/nvim/mason/bin/ruff" "stderr" " 0.012430178s WARN ruff:main ruff_server::server: LSP client does not support dynamic capability registration - automatic configuration reloading will not be available.\n"
[ERROR][2024-09-21 12:43:01] .../vim/lsp/rpc.lua:770 "rpc" "/home/zeioth/.local/share/nvim/mason/bin/ruff-lsp" "stderr" 'Cancel notification for unknown message id "2"\n'
[ERROR][2024-09-21 12:43:01] .../vim/lsp/rpc.lua:770 "rpc" "/home/zeioth/.local/share/nvim/mason/bin/ruff-lsp" "stderr" 'Cancel notification for unknown message id "3"\n'
[ERROR][2024-09-21 12:43:57] .../vim/lsp/rpc.lua:770 "rpc" "/home/zeioth/.local/share/nvim/mason/bin/ruff-lsp" "stderr" 'Cancel notification for unknown message id "27"\n'
[ERROR][2024-09-21 12:53:47] .../vim/lsp/rpc.lua:770 "rpc" "/home/zeioth/.local/share/nvim/mason/bin/ruff" "stderr" " 424.907668433s DEBUG ruff:worker:5 ruff_server::resolve: Included path via `include`: /home/zeioth/raven-app/src/utils/controller.py\n"
[ERROR][2024-09-21 12:53:47] .../vim/lsp/rpc.lua:770 "rpc" "/home/zeioth/.local/share/nvim/mason/bin/ruff-lsp" "stderr" 'Cancel notification for unknown message id "103"\n'
[ERROR][2024-09-21 12:53:47] .../vim/lsp/rpc.lua:770 "rpc" "/home/zeioth/.local/share/nvim/mason/bin/ruff" "stderr" " 425.022634237s ERROR ruff:worker:8 ruff_server::server::api: An error occurred with result ID 73: failed to deserialize diagnostic data: invalid length 0, expected struct AssociatedDiagnosticData with 4 elements\n"
[ERROR][2024-09-21 12:53:47] .../vim/lsp/rpc.lua:770 "rpc" "/home/zeioth/.local/share/nvim/mason/bin/ruff-lsp" "stderr" "Exception occurred for message \"104\": AttributeError: 'NoneType' object has no attribute 'get'\nTraceback (most recent call last):\n File \"/home/zeioth/.local/share/nvim/mason/packages/ruff-lsp/venv/lib/python3.12/site-packages/pygls/protocol/json_rpc.py\", line 194, in _execute_request_callback\n self._send_response(msg_id, result=future.result())\n ^^^^^^^^^^^^^^^\n File \"/home/zeioth/.local/share/nvim/mason/packages/ruff-lsp/venv/lib/python3.12/site-packages/ruff_lsp/server.py\", line 992, in code_action\n fix = cast(DiagnosticData, diagnostic.data).get(\"fix\")\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nAttributeError: 'NoneType' object has no attribute 'get'\n"
[ERROR][2024-09-21 12:53:47] .../vim/lsp/rpc.lua:770 "rpc" "/home/zeioth/.local/share/nvim/mason/bin/ruff" "stderr" " 425.084355442s DEBUG ruff:worker:4 ruff_server::resolve: Included path via `include`: /home/zeioth/raven-app/src/utils/controller.py\n"
[ERROR][2024-09-21 12:53:47] .../vim/lsp/rpc.lua:770 "rpc" "/home/zeioth/.local/share/nvim/mason/bin/ruff" "stderr" " 425.092566072s DEBUG ruff:worker:9 ruff_server::resolve: Included path via `include`: /home/zeioth/raven-app/src/utils/controller.py\n"
[ERROR][2024-09-21 12:53:47] .../vim/lsp/rpc.lua:770 "rpc" "/home/zeioth/.local/share/nvim/mason/bin/ruff" "stderr" " 425.277145226s DEBUG ruff:worker:10 ruff_server::resolve: Included path via `include`: /home/zeioth/raven-app/src/utils/controller.py\n"
[ERROR][2024-09-21 12:53:47] .../vim/lsp/rpc.lua:770 "rpc" "/home/zeioth/.local/share/nvim/mason/bin/ruff" "stderr" " 425.707603056s DEBUG ruff:worker:11 ruff_server::resolve: Included path via `include`: /home/zeioth/raven-app/src/utils/controller.py\n"
[ERROR][2024-09-21 12:53:50] .../vim/lsp/rpc.lua:770 "rpc" "/home/zeioth/.local/share/nvim/mason/bin/ruff-lsp" "stderr" 'Cancel notification for unknown message id "105"\n'
[ERROR][2024-09-21 12:53:52] .../vim/lsp/rpc.lua:770 "rpc" "/home/zeioth/.local/share/nvim/mason/bin/ruff-lsp" "stderr" 'Cancel notification for unknown message id "106"\n'
Might be a problem in the package itself?
Thanks for sharing the logs. From the logs, it seems you're running both ruff-lsp
and ruff
(server) at the same time. This is not a supported setup and shouldn't be needed. Can you try to remove ruff-lsp
and only use ruff
server?
[ERROR][2024-09-21 12:53:47] .../vim/lsp/rpc.lua:770 "rpc" "/home/zeioth/.local/share/nvim/mason/bin/ruff" "stderr" " 425.022634237s ERROR ruff:worker:8 ruff_server::server::api: An error occurred with result ID 73: failed to deserialize diagnostic data: invalid length 0, expected struct AssociatedDiagnosticData with 4 elements\n"
[ERROR][2024-09-21 12:53:47] .../vim/lsp/rpc.lua:770 "rpc" "/home/zeioth/.local/share/nvim/mason/bin/ruff-lsp" "stderr"
@MichaReiser I've tried with ruff
alone. Now I only get this error when I trigger lsp autocomplete (which doesn't work). Linting work as expected.
[ERROR][2024-09-22 15:19:50] .../vim/lsp/rpc.lua:770 "rpc" "/home/zeioth/.local/share/nvim/mason/bin/ruff" "stderr" " 59.355577387s DEBUG ruff:worker:16 ruff_server::resolve: Included path via `include`: /home/zeioth/raven-app/src/main.py\n"
Because you say using both ruffs at the same time is not supported, I understand ruff-lsp
is already included inside ruff
, and lsp autocompletion should be working fine?
What you're seeing there isn't an error. It's only a debug message. I think you can turn it of again by removing the logInfo
setting
ruff, and lsp autocompletion should be working fine
Ruff's LSP doesn't provide any auto completion. It only provides formatting and linting capabilities.
Got it. Thank you. I think we can close this for now then.
Description
Ruff displays errors on neovim (installed using)
Screenshot
LSP Log