Skip to content
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

Different behavior between servers for "fixAll" with syntax errors #11931

Closed
dhruvmanila opened this issue Jun 19, 2024 · 1 comment · Fixed by #12148
Closed

Different behavior between servers for "fixAll" with syntax errors #11931

dhruvmanila opened this issue Jun 19, 2024 · 1 comment · Fixed by #12148
Assignees
Labels
server Related to the LSP server

Comments

@dhruvmanila
Copy link
Member

The behavior between ruff server and ruff-lsp is different when a source action is applied in a file with syntax errors.

ruff server returns an error stating "A parsing error occurred during fix_all: ..." and does not apply any fixes.

ruff-lsp does not return any error and applies whatever fixes are available.

Use the following code snippet to test this out with source.fixAll code action:

foo;
y =

ruff-lsp will remove the semicolon after foo while ruff server will give an error.

For context, even if the source code contains syntax errors, Ruff can produce diagnostics for token-based rules and can generate fixes for some of them.

I'm not sure if we want to change this behavior but I don't think the new server should return an error if there's a syntax error. The diagnostics already point out the syntax error so this seems like a noise.

@dhruvmanila dhruvmanila added the server Related to the LSP server label Jun 19, 2024
@dhruvmanila
Copy link
Member Author

cc @snowsignal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
server Related to the LSP server
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants