@@ -8,7 +8,7 @@ use biome_analyze::{
88 SUPPRESSION_TOP_LEVEL_ACTION_CATEGORY , SourceActionKind ,
99} ;
1010use biome_configuration:: analyzer:: RuleSelector ;
11- use biome_diagnostics:: { Applicability , Error } ;
11+ use biome_diagnostics:: Error ;
1212use biome_fs:: BiomePath ;
1313use biome_lsp_converters:: from_proto;
1414use biome_lsp_converters:: line_index:: LineIndex ;
@@ -96,16 +96,12 @@ pub(crate) fn code_actions(
9696 }
9797
9898 let mut has_fix_all = false ;
99- let mut has_quick_fix = false ;
10099 let mut filters = Vec :: new ( ) ;
101100 if let Some ( filter) = & params. context . only {
102101 for kind in filter {
103102 let kind = kind. as_str ( ) ;
104103 if FIX_ALL_CATEGORY . matches ( kind) {
105104 has_fix_all = true ;
106- } else if ActionCategory :: QuickFix ( Cow :: Borrowed ( "" ) ) . to_str ( ) == kind {
107- // The action is a on-save quick-fixes
108- has_quick_fix = true ;
109105 }
110106 filters. push ( kind) ;
111107 }
@@ -190,39 +186,31 @@ pub(crate) fn code_actions(
190186 . actions
191187 . into_iter ( )
192188 . filter_map ( |action| {
193- debug ! ( "Action: {:?}" , & action. category) ;
194- // Don't apply unsafe fixes when the code action is on-save quick-fixes
195- if has_quick_fix && action. suggestion . applicability == Applicability :: MaybeIncorrect {
196- return None ;
197- }
189+ debug ! (
190+ "Action: {:?}, and applicability {:?}" ,
191+ & action. category, & action. suggestion. applicability
192+ ) ;
198193 // Filter out source.organizeImports.biome action when assist is not supported.
199194 if action. category . matches ( "source.organizeImports.biome" )
200195 && !file_features. supports_assist ( )
201196 {
202197 return None ;
203198 }
204- // Filter out quickfix.biome action when lint is not supported.
205- if action. category . matches ( "quickfix.biome" ) && !file_features. supports_lint ( ) {
199+ // Filter out quickfix.biome action when lint and assist aren't
200+ if action. category . matches ( "quickfix.biome" )
201+ && !file_features. supports_lint ( )
202+ && !file_features. supports_assist ( )
203+ {
206204 return None ;
207205 }
208206
209- // Filter out suppressions if the linter isn 't supported
207+ // Filter out suppressions if the linter and assist aren 't supported
210208 if ( action. category . matches ( SUPPRESSION_INLINE_ACTION_CATEGORY )
211209 || action
212210 . category
213211 . matches ( SUPPRESSION_TOP_LEVEL_ACTION_CATEGORY ) )
214212 && !file_features. supports_lint ( )
215- {
216- return None ;
217- }
218-
219- // Filter out the suppressions if the client is requesting a fix all signal.
220- // Fix all should apply only the safe changes.
221- if has_fix_all
222- && ( action. category . matches ( SUPPRESSION_INLINE_ACTION_CATEGORY )
223- || action
224- . category
225- . matches ( SUPPRESSION_TOP_LEVEL_ACTION_CATEGORY ) )
213+ && !file_features. supports_assist ( )
226214 {
227215 return None ;
228216 }
@@ -280,7 +268,7 @@ pub(crate) fn code_actions(
280268 Ok ( Some ( actions) )
281269}
282270
283- /// Generate a "fix all" code action for the given document
271+ /// Generate the code action `source.fixAll.biome` for the current document
284272#[ tracing:: instrument( level = "debug" , skip( session, url) ) ]
285273fn fix_all (
286274 session : & Session ,
@@ -293,7 +281,7 @@ fn fix_all(
293281 let Some ( doc) = session. document ( url) else {
294282 return Ok ( None ) ;
295283 } ;
296- let features = FeaturesBuilder :: new ( ) . with_linter ( ) . with_assist ( ) . build ( ) ;
284+ let analyzer_features = FeaturesBuilder :: new ( ) . with_linter ( ) . with_assist ( ) . build ( ) ;
297285
298286 if !session. workspace . file_exists ( path. clone ( ) . into ( ) ) ? {
299287 return Ok ( None ) ;
@@ -302,7 +290,7 @@ fn fix_all(
302290 if session. workspace . is_path_ignored ( IsPathIgnoredParams {
303291 path : path. clone ( ) ,
304292 project_key : doc. project_key ,
305- features,
293+ features : analyzer_features ,
306294 } ) ? {
307295 return Ok ( None ) ;
308296 }
@@ -318,11 +306,10 @@ fn fix_all(
318306 } ) ?;
319307 let should_format = file_features. supports_format ( ) ;
320308
321- let features = FeaturesBuilder :: new ( ) . with_linter ( ) . with_assist ( ) . build ( ) ;
322309 if session. workspace . is_path_ignored ( IsPathIgnoredParams {
323310 path : path. clone ( ) ,
324311 project_key : doc. project_key ,
325- features,
312+ features : analyzer_features ,
326313 } ) ? {
327314 return Ok ( None ) ;
328315 }
@@ -424,7 +411,7 @@ fn fix_all(
424411 } ;
425412
426413 Ok ( Some ( CodeActionOrCommand :: CodeAction ( lsp:: CodeAction {
427- title : String :: from ( "Fix all auto-fixable issues " ) ,
414+ title : String :: from ( "Apply all safe fixes (Biome) " ) ,
428415 kind : Some ( fix_all_kind ( ) ) ,
429416 diagnostics : Some ( diagnostics) ,
430417 edit : Some ( edit) ,
0 commit comments