-
Notifications
You must be signed in to change notification settings - Fork 921
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[QA] Should Ruff be able to fix indentation errors (E999) ? #11846
Comments
Hey, thanks for such a detailed issue, really appreciate you taking the time to write that up.
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).
Can you say a bit more about this? What do you mean when you say that the server gets disconnected? Is it that the
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.
I just start to get 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. I do get another error logged via :LspLog
Not sure if it's related. I haven't been able to look into this yet. |
Hmm, this shouldn't be happening. I'm trying to reproduce this but unable to do so with the following steps:
I'm using ruff version
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.
The text was updated successfully, but these errors were encountered: