Skip to content

Commit

Permalink
fix(code_actions): reverse order
Browse files Browse the repository at this point in the history
Reverse the order of code actions, so actions will be applied from back to front.
This will make sure following code actions won't be invalidated by their previous code actions.
  • Loading branch information
Sec-ant committed Mar 31, 2024
1 parent edacd6e commit 0bf3f09
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions crates/biome_lsp/src/handlers/analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ pub(crate) fn code_actions(
has_fixes |= action.diagnostics.is_some();
Some(CodeActionOrCommand::CodeAction(action))
})
.rev()
.chain(fix_all)
.collect();

Expand Down
7 changes: 5 additions & 2 deletions crates/biome_lsp/tests/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ async fn pull_quick_fixes() -> Result<()> {
data: None,
});

assert_eq!(res, vec![expected_code_action, expected_suppression_action]);
assert_eq!(res, vec![expected_suppression_action, expected_code_action]);

server.close_document().await?;

Expand Down Expand Up @@ -1265,7 +1265,10 @@ async fn pull_quick_fixes_include_unsafe() -> Result<()> {
data: None,
});

assert_eq!(res, vec![expected_code_action, expected_suppression_action]);
assert_eq!(
res,
vec![expected_suppression_action, expected_code_action,]
);

server.close_document().await?;

Expand Down

0 comments on commit 0bf3f09

Please sign in to comment.