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

Avoid syntax error notification for source code actions #12148

Merged
merged 1 commit into from
Jul 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions crates/ruff_server/src/fix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ pub(crate) fn fix_all(
let FixerResult {
transformed,
result: LinterResult {
has_syntax_error: has_error,
..
has_syntax_error, ..
},
..
} = ruff_linter::linter::lint_fix(
Expand All @@ -83,9 +82,9 @@ pub(crate) fn fix_all(
source_type,
)?;

if has_error {
// abort early if a parsing error occurred
return Err(anyhow::anyhow!("A parsing error occurred during `fix_all`"));
if has_syntax_error {
// If there's a syntax error, then there won't be any fixes to apply.
return Ok(Fixes::default());
}

// fast path: if `transformed` is still borrowed, no changes were made and we can return early
Expand Down
Loading