Skip to content

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

@dhruvmanila

Description

@dhruvmanila

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.

Metadata

Metadata

Assignees

Labels

serverRelated to the LSP server

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions