Open andrewcrook opened 2 weeks ago
Hey, thanks for such a detailed issue, really appreciate you taking the time to write that up.
However, if there is an indentation issue E999 in the code ruff cannot format or fix until all E999's have been manually fixed.
Currently, Ruff doesn't support linting or formatting a source code with syntax errors. Or, more precisely it only supports certain subset of rules (very few). But, this is something which we want to add support for (linting source code with syntax errors).
Sometimes, it will also cause the LSP to disconnect and no longer be available for python file types when called unfortunately this doesn’t show under LspLog.
Can you say a bit more about this? What do you mean when you say that the server gets disconnected? Is it that the ruff
process itself quits while Neovim is still open?
Seems to work fine for code spacing issues such as
print (x) -> print(x)
This works because whitespaces are generally ignored except for when it's used for indentation. So, this is valid Python code. While, a mismatch in indentation isn't valid because Python uses indentation to group statements which act as a single block. For example, in JavaScript curly braces are used to define a block of code.
@dhruvmanila many thanks for the explanation I thought this might be the case.
Can you say a bit more about this? What do you mean when you say that the server gets disconnected? Is it that the ruff process itself quits while Neovim is still open?
I just start to get [LSP] Format request failed, no matching language servers.
until I restart neovim.
So the failure seems to be detaching it from neovims LSP configuration for that buffer I would guess
I haven't been able to get enough information regarding this because it isn't being logged. If I can get information or a better idea about the issue I will raise a new issue.
I do get another error logged via :LspLog
[ERROR][2024-06-12 12:06:35] .../vim/lsp/rpc.lua:770 "rpc" "/Users/XXXX/.local/share/nvim/mason/bin/ruff" "stderr" " 0.095206s WARN ruff_server::server LSP client does not support dynamic capability registration - automatic configuration reloading will not be available.\n"
Not sure if it's related. I haven't been able to look into this yet.
I just start to get
[LSP] Format request failed, no matching language servers.
until I restart neovim.So the failure seems to be detaching it from neovims LSP configuration for that buffer I would guess
Hmm, this shouldn't be happening. I'm trying to reproduce this but unable to do so with the following steps:
vim.lsp.buf.format
, check the logs and verify the error is loggedI'm using ruff version v0.4.8
and Neovim version v0.10.0
. Can you try these steps or provide a similar steps for me to reproduce i?
I do get another error logged via :LspLog
[ERROR][2024-06-12 12:06:35] .../vim/lsp/rpc.lua:770 "rpc" "/Users/XXXX/.local/share/nvim/mason/bin/ruff" "stderr" " 0.095206s WARN ruff_server::server LSP client does not support dynamic capability registration - automatic configuration reloading will not be available.\n"
Not sure if it's related. I haven't been able to look into this yet.
You don't need to worry about this.
I have ruff setup in neovim as a LSP using
ruff server --preview
. However, if there is an indentation issue E999 in the code ruff cannot format or fix until all E999's have been manually fixed. Sometimes, it will also cause the LSP to disconnect and no longer be available for python file types when called unfortunately this doesn’t show under LspLog.Seems to work fine for code spacing issues such as
print (x) -> print(x)
Heres some trash code I have been using to test ruffs capabilities and to get some information regarding this issue.
Version info
Under Neovim - Cmdline
Fix all
format
under Shell
check
check fix
format
default settings when check is running under shell
I did come across some mentions of this issue but couldn’t find a solution or a definitive answer.