@@ -2634,11 +2634,19 @@ fn schema(fields: &[SchemaField]) -> serde_json::Value {
2634
2634
. iter ( )
2635
2635
. map ( |( field, ty, doc, default) | {
2636
2636
let name = field. replace ( '_' , "." ) ;
2637
+ let catagory = name. find ( '.' ) . map ( |end| {
2638
+ String :: from ( & name[ ..end] )
2639
+ } ) . unwrap_or ( "general" . into ( ) ) ;
2637
2640
let name = format ! ( "rust-analyzer.{name}" ) ;
2638
2641
let props = field_props ( field, ty, doc, default) ;
2639
- ( name, props)
2642
+ serde_json:: json!( {
2643
+ "title" : catagory,
2644
+ "properties" : {
2645
+ name: props
2646
+ }
2647
+ } )
2640
2648
} )
2641
- . collect :: < serde_json :: Map < _ , _ > > ( ) ;
2649
+ . collect :: < Vec < _ > > ( ) ;
2642
2650
map. into ( )
2643
2651
}
2644
2652
@@ -3037,8 +3045,8 @@ mod tests {
3037
3045
let s = Config :: json_schema ( ) ;
3038
3046
let schema = format ! ( "{s:#}" ) ;
3039
3047
let mut schema = schema
3040
- . trim_start_matches ( '{ ' )
3041
- . trim_end_matches ( '} ' )
3048
+ . trim_start_matches ( '[ ' )
3049
+ . trim_end_matches ( '] ' )
3042
3050
. replace ( " " , " " )
3043
3051
. replace ( '\n' , "\n " )
3044
3052
. trim_start_matches ( '\n' )
@@ -3072,8 +3080,8 @@ mod tests {
3072
3080
let package_json_path = project_root ( ) . join ( "editors/code/package.json" ) ;
3073
3081
let mut package_json = fs:: read_to_string ( & package_json_path) . unwrap ( ) ;
3074
3082
3075
- let start_marker = " \" $generated-start\" : { },\n " ;
3076
- let end_marker = " \" $generated-end\" : { }\n " ;
3083
+ let start_marker = " { \" title \" : \" $generated-start\" },\n " ;
3084
+ let end_marker = " { \" title \" : \" $generated-end\" }\n " ;
3077
3085
3078
3086
let start = package_json. find ( start_marker) . unwrap ( ) + start_marker. len ( ) ;
3079
3087
let end = package_json. find ( end_marker) . unwrap ( ) ;
0 commit comments