File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -79,10 +79,13 @@ export class ExampleBrowser implements TreeDataProvider<any> {
79
79
return Object . values ( Examples )
80
80
. flatMap ( examples => examples . filter ( exampleWorksForOnOS ) )
81
81
. filter ( example => example . name . toUpperCase ( ) . includes ( upperFilter ) || example . content . some ( line => line . toUpperCase ( ) . includes ( upperFilter ) ) )
82
+ . sort ( sort )
82
83
. map ( example => new SQLExampleItem ( example ) ) ;
83
84
}
84
85
else {
85
- return Object . entries ( Examples ) . map ( ( [ name , examples ] ) => new ExampleGroupItem ( name , examples ) ) ;
86
+ return Object . entries ( Examples )
87
+ . sort ( ( [ name1 ] , [ name2 ] ) => sort ( name1 , name2 ) )
88
+ . map ( ( [ name , examples ] ) => new ExampleGroupItem ( name , examples ) ) ;
86
89
}
87
90
}
88
91
}
@@ -97,6 +100,7 @@ class ExampleGroupItem extends TreeItem {
97
100
getChildren ( ) : SQLExampleItem [ ] {
98
101
return this . group
99
102
. filter ( example => exampleWorksForOnOS ( example ) )
103
+ . sort ( sort )
100
104
. map ( example => new SQLExampleItem ( example ) ) ;
101
105
}
102
106
}
@@ -129,4 +133,10 @@ function exampleWorksForOnOS(example: SQLExample): boolean {
129
133
}
130
134
131
135
return true ;
136
+ }
137
+
138
+ function sort ( string1 : string | SQLExample , string2 : string | SQLExample ) {
139
+ string1 = typeof string1 === "string" ? string1 : string1 . name ;
140
+ string2 = typeof string2 === "string" ? string2 : string2 . name ;
141
+ return string1 . localeCompare ( string2 ) ;
132
142
}
You can’t perform that action at this time.
0 commit comments