@@ -18,7 +18,7 @@ const HOVER_BASE_CONFIG: HoverConfig = HoverConfig {
18
18
format : HoverDocFormat :: Markdown ,
19
19
keywords : true ,
20
20
max_trait_assoc_items_count : None ,
21
- max_struct_or_union_fields_count : Some ( 5 ) ,
21
+ max_fields_count : Some ( 5 ) ,
22
22
max_enum_variants_count : Some ( 5 ) ,
23
23
} ;
24
24
@@ -52,7 +52,7 @@ fn check(ra_fixture: &str, expect: Expect) {
52
52
}
53
53
54
54
#[ track_caller]
55
- fn check_hover_struct_or_union_fields_limit (
55
+ fn check_hover_fields_limit (
56
56
fields_count : impl Into < Option < usize > > ,
57
57
ra_fixture : & str ,
58
58
expect : Expect ,
@@ -62,7 +62,7 @@ fn check_hover_struct_or_union_fields_limit(
62
62
. hover (
63
63
& HoverConfig {
64
64
links_in_hover : true ,
65
- max_struct_or_union_fields_count : fields_count. into ( ) ,
65
+ max_fields_count : fields_count. into ( ) ,
66
66
..HOVER_BASE_CONFIG
67
67
} ,
68
68
FileRange { file_id : position. file_id , range : TextRange :: empty ( position. offset ) } ,
@@ -939,7 +939,7 @@ struct Foo$0 where u32: Copy { field: u32 }
939
939
940
940
#[ test]
941
941
fn hover_record_struct_limit ( ) {
942
- check_hover_struct_or_union_fields_limit (
942
+ check_hover_fields_limit (
943
943
3 ,
944
944
r#"
945
945
struct Foo$0 { a: u32, b: i32, c: i32 }
@@ -961,7 +961,7 @@ fn hover_record_struct_limit() {
961
961
```
962
962
"# ] ] ,
963
963
) ;
964
- check_hover_struct_or_union_fields_limit (
964
+ check_hover_fields_limit (
965
965
3 ,
966
966
r#"
967
967
struct Foo$0 { a: u32 }
@@ -981,7 +981,7 @@ fn hover_record_struct_limit() {
981
981
```
982
982
"# ] ] ,
983
983
) ;
984
- check_hover_struct_or_union_fields_limit (
984
+ check_hover_fields_limit (
985
985
3 ,
986
986
r#"
987
987
struct Foo$0 { a: u32, b: i32, c: i32, d: u32 }
@@ -1004,7 +1004,7 @@ fn hover_record_struct_limit() {
1004
1004
```
1005
1005
"# ] ] ,
1006
1006
) ;
1007
- check_hover_struct_or_union_fields_limit (
1007
+ check_hover_fields_limit (
1008
1008
None ,
1009
1009
r#"
1010
1010
struct Foo$0 { a: u32, b: i32, c: i32 }
@@ -1022,7 +1022,7 @@ fn hover_record_struct_limit() {
1022
1022
```
1023
1023
"# ] ] ,
1024
1024
) ;
1025
- check_hover_struct_or_union_fields_limit (
1025
+ check_hover_fields_limit (
1026
1026
0 ,
1027
1027
r#"
1028
1028
struct Foo$0 { a: u32, b: i32, c: i32 }
@@ -1042,6 +1042,100 @@ fn hover_record_struct_limit() {
1042
1042
)
1043
1043
}
1044
1044
1045
+ #[ test]
1046
+ fn hover_record_variant_limit ( ) {
1047
+ check_hover_fields_limit (
1048
+ 3 ,
1049
+ r#"
1050
+ enum Foo { A$0 { a: u32, b: i32, c: i32 } }
1051
+ "# ,
1052
+ expect ! [ [ r#"
1053
+ *A*
1054
+
1055
+ ```rust
1056
+ test::Foo
1057
+ ```
1058
+
1059
+ ```rust
1060
+ // size = 12 (0xC), align = 4
1061
+ A { a: u32, b: i32, c: i32, }
1062
+ ```
1063
+ "# ] ] ,
1064
+ ) ;
1065
+ check_hover_fields_limit (
1066
+ 3 ,
1067
+ r#"
1068
+ enum Foo { A$0 { a: u32 } }
1069
+ "# ,
1070
+ expect ! [ [ r#"
1071
+ *A*
1072
+
1073
+ ```rust
1074
+ test::Foo
1075
+ ```
1076
+
1077
+ ```rust
1078
+ // size = 4, align = 4
1079
+ A { a: u32, }
1080
+ ```
1081
+ "# ] ] ,
1082
+ ) ;
1083
+ check_hover_fields_limit (
1084
+ 3 ,
1085
+ r#"
1086
+ enum Foo { A$0 { a: u32, b: i32, c: i32, d: u32 } }
1087
+ "# ,
1088
+ expect ! [ [ r#"
1089
+ *A*
1090
+
1091
+ ```rust
1092
+ test::Foo
1093
+ ```
1094
+
1095
+ ```rust
1096
+ // size = 16 (0x10), align = 4
1097
+ A { a: u32, b: i32, c: i32, /* … */ }
1098
+ ```
1099
+ "# ] ] ,
1100
+ ) ;
1101
+ check_hover_fields_limit (
1102
+ None ,
1103
+ r#"
1104
+ enum Foo { A$0 { a: u32, b: i32, c: i32 } }
1105
+ "# ,
1106
+ expect ! [ [ r#"
1107
+ *A*
1108
+
1109
+ ```rust
1110
+ test::Foo
1111
+ ```
1112
+
1113
+ ```rust
1114
+ // size = 12 (0xC), align = 4
1115
+ A
1116
+ ```
1117
+ "# ] ] ,
1118
+ ) ;
1119
+ check_hover_fields_limit (
1120
+ 0 ,
1121
+ r#"
1122
+ enum Foo { A$0 { a: u32, b: i32, c: i32 } }
1123
+ "# ,
1124
+ expect ! [ [ r#"
1125
+ *A*
1126
+
1127
+ ```rust
1128
+ test::Foo
1129
+ ```
1130
+
1131
+ ```rust
1132
+ // size = 12 (0xC), align = 4
1133
+ A { /* … */ }
1134
+ ```
1135
+ "# ] ] ,
1136
+ ) ;
1137
+ }
1138
+
1045
1139
#[ test]
1046
1140
fn hover_enum_limit ( ) {
1047
1141
check_hover_enum_variants_limit (
@@ -1152,7 +1246,7 @@ fn hover_enum_limit() {
1152
1246
1153
1247
#[ test]
1154
1248
fn hover_union_limit ( ) {
1155
- check_hover_struct_or_union_fields_limit (
1249
+ check_hover_fields_limit (
1156
1250
5 ,
1157
1251
r#"union Foo$0 { a: u32, b: i32 }"# ,
1158
1252
expect ! [ [ r#"
@@ -1171,7 +1265,7 @@ fn hover_union_limit() {
1171
1265
```
1172
1266
"# ] ] ,
1173
1267
) ;
1174
- check_hover_struct_or_union_fields_limit (
1268
+ check_hover_fields_limit (
1175
1269
1 ,
1176
1270
r#"union Foo$0 { a: u32, b: i32 }"# ,
1177
1271
expect ! [ [ r#"
@@ -1190,7 +1284,7 @@ fn hover_union_limit() {
1190
1284
```
1191
1285
"# ] ] ,
1192
1286
) ;
1193
- check_hover_struct_or_union_fields_limit (
1287
+ check_hover_fields_limit (
1194
1288
0 ,
1195
1289
r#"union Foo$0 { a: u32, b: i32 }"# ,
1196
1290
expect ! [ [ r#"
@@ -1206,7 +1300,7 @@ fn hover_union_limit() {
1206
1300
```
1207
1301
"# ] ] ,
1208
1302
) ;
1209
- check_hover_struct_or_union_fields_limit (
1303
+ check_hover_fields_limit (
1210
1304
None ,
1211
1305
r#"union Foo$0 { a: u32, b: i32 }"# ,
1212
1306
expect ! [ [ r#"
@@ -1691,7 +1785,7 @@ impl Thing {
1691
1785
```
1692
1786
"# ] ] ,
1693
1787
) ;
1694
- check_hover_struct_or_union_fields_limit (
1788
+ check_hover_fields_limit (
1695
1789
None ,
1696
1790
r#"
1697
1791
struct Thing { x: u32 }
@@ -6832,7 +6926,7 @@ enum Enum {
6832
6926
6833
6927
```rust
6834
6928
// size = 4, align = 4
6835
- RecordV { field: u32 }
6929
+ RecordV { field: u32, }
6836
6930
```
6837
6931
"# ] ] ,
6838
6932
) ;
0 commit comments