@@ -34,6 +34,26 @@ pub(crate) const TEST_CONFIG: AssistConfig = AssistConfig {
34
34
assist_emit_must_use : false ,
35
35
term_search_fuel : 400 ,
36
36
term_search_borrowck : true ,
37
+ code_action_grouping : true ,
38
+ } ;
39
+
40
+ pub ( crate ) const TEST_CONFIG_NO_GROUPING : AssistConfig = AssistConfig {
41
+ snippet_cap : SnippetCap :: new ( true ) ,
42
+ allowed : None ,
43
+ insert_use : InsertUseConfig {
44
+ granularity : ImportGranularity :: Crate ,
45
+ prefix_kind : hir:: PrefixKind :: Plain ,
46
+ enforce_granularity : true ,
47
+ group : true ,
48
+ skip_glob_imports : true ,
49
+ } ,
50
+ prefer_no_std : false ,
51
+ prefer_prelude : true ,
52
+ prefer_absolute : false ,
53
+ assist_emit_must_use : false ,
54
+ term_search_fuel : 400 ,
55
+ term_search_borrowck : true ,
56
+ code_action_grouping : false ,
37
57
} ;
38
58
39
59
pub ( crate ) const TEST_CONFIG_NO_SNIPPET_CAP : AssistConfig = AssistConfig {
@@ -52,6 +72,7 @@ pub(crate) const TEST_CONFIG_NO_SNIPPET_CAP: AssistConfig = AssistConfig {
52
72
assist_emit_must_use : false ,
53
73
term_search_fuel : 400 ,
54
74
term_search_borrowck : true ,
75
+ code_action_grouping : true ,
55
76
} ;
56
77
57
78
pub ( crate ) const TEST_CONFIG_IMPORT_ONE : AssistConfig = AssistConfig {
@@ -70,6 +91,7 @@ pub(crate) const TEST_CONFIG_IMPORT_ONE: AssistConfig = AssistConfig {
70
91
assist_emit_must_use : false ,
71
92
term_search_fuel : 400 ,
72
93
term_search_borrowck : true ,
94
+ code_action_grouping : true ,
73
95
} ;
74
96
75
97
pub ( crate ) fn with_single_file ( text : & str ) -> ( RootDatabase , EditionedFileId ) {
@@ -346,6 +368,41 @@ fn labels(assists: &[Assist]) -> String {
346
368
labels. into_iter ( ) . collect :: < String > ( )
347
369
}
348
370
371
+ #[ test]
372
+ fn long_groups_are_skipped_under_skip_resolve_strategy ( ) {
373
+ let before = r#"
374
+ trait SomeTrait {
375
+ type T;
376
+ fn fn_(arg: u32) -> u32;
377
+ fn method_(&mut self) -> bool;
378
+ }
379
+ struct A;
380
+ impl SomeTrait for A {
381
+ type T = u32;
382
+
383
+ fn fn_(arg: u32) -> u32 {
384
+ 42
385
+ }
386
+
387
+ fn method_(&mut self) -> bool {
388
+ false
389
+ }
390
+ }
391
+ struct B {
392
+ a$0 : A,
393
+ }
394
+ "# ;
395
+ let ( before_cursor_pos, before) = extract_offset ( before) ;
396
+ let ( db, file_id) = with_single_file ( & before) ;
397
+ let frange = FileRange { file_id, range : TextRange :: empty ( before_cursor_pos) } ;
398
+ let res = assists ( & db, & TEST_CONFIG , AssistResolveStrategy :: None , frange. into ( ) ) ;
399
+ assert ! ( res. iter( ) . map( |a| & a. id) . any( |a| { a. 0 == "generate_delegate_trait" } ) ) ;
400
+
401
+ let limited =
402
+ assists ( & db, & TEST_CONFIG_NO_GROUPING , AssistResolveStrategy :: None , frange. into ( ) ) ;
403
+ assert ! ( !limited. iter( ) . map( |a| & a. id) . any( |a| { a. 0 == "generate_delegate_trait" } ) ) ;
404
+ }
405
+
349
406
#[ test]
350
407
fn assist_order_field_struct ( ) {
351
408
let before = "struct Foo { $0bar: u32 }" ;
0 commit comments