Skip to content

Commit

Permalink
lsp: Avoid apear fixAll, when there is no diagnostics.
Browse files Browse the repository at this point in the history
  • Loading branch information
huacnlee committed Oct 17, 2024
1 parent 68feb3b commit 4689889
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion autocorrect-lsp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,8 @@ impl LanguageServer for Backend {
map
});

let has_fix_all = all_changes.is_some() && !all_changes.as_ref().unwrap().is_empty();

// self.client
// .log_message(
// MessageType::LOG,
Expand Down Expand Up @@ -402,7 +404,9 @@ impl LanguageServer for Backend {
..Default::default()
};
response.push(CodeActionOrCommand::CodeAction(action));
response.push(CodeActionOrCommand::CodeAction(fix_all_action.clone()))
if has_fix_all {
response.push(CodeActionOrCommand::CodeAction(fix_all_action.clone()))
}
}
return Ok(Some(response));
}
Expand Down

0 comments on commit 4689889

Please sign in to comment.