@@ -124,6 +124,8 @@ export class queryHistory implements TreeDataProvider<any> {
124
124
let pastWeekQueries : PastQueryNode [ ] = [ ] ;
125
125
let pastMonthQueries : PastQueryNode [ ] = [ ] ;
126
126
let olderQueries : PastQueryNode [ ] = [ ] ;
127
+ const starredQueries = currentList . filter ( queryItem => queryItem . starred ) ;
128
+ const hasStarredQueries = starredQueries . length > 0 ;
127
129
128
130
currentList . forEach ( queryItem => {
129
131
// The smaller the unix value, the older it is
@@ -140,8 +142,11 @@ export class queryHistory implements TreeDataProvider<any> {
140
142
141
143
let nodes : TimePeriodNode [ ] = [ ] ;
142
144
145
+ if ( hasStarredQueries ) {
146
+ nodes . push ( new TimePeriodNode ( `Starred` , starredQueries . map ( q => new PastQueryNode ( q ) ) , { expanded : true , stars : true } ) ) ;
147
+ }
143
148
if ( pastDayQueries . length > 0 ) {
144
- nodes . push ( new TimePeriodNode ( `Past day` , pastDayQueries , true ) ) ;
149
+ nodes . push ( new TimePeriodNode ( `Past day` , pastDayQueries , { expanded : ! hasStarredQueries } ) ) ;
145
150
}
146
151
if ( pastWeekQueries . length > 0 ) {
147
152
nodes . push ( new TimePeriodNode ( `Past week` , pastWeekQueries ) ) ;
@@ -163,11 +168,11 @@ export class queryHistory implements TreeDataProvider<any> {
163
168
}
164
169
165
170
class TimePeriodNode extends TreeItem {
166
- constructor ( public period : string , private nodes : PastQueryNode [ ] , expanded = false ) {
167
- super ( period , expanded ? TreeItemCollapsibleState . Expanded : TreeItemCollapsibleState . Collapsed ) ;
171
+ constructor ( title : string , private nodes : PastQueryNode [ ] , opts : { expanded ?: boolean , stars ?: boolean } = { } ) {
172
+ super ( title , opts . expanded ? TreeItemCollapsibleState . Expanded : TreeItemCollapsibleState . Collapsed ) ;
168
173
this . contextValue = `timePeriod` ;
169
174
170
- this . iconPath = new ThemeIcon ( `calendar` ) ;
175
+ this . iconPath = new ThemeIcon ( opts . stars ? `star-full` : `calendar` ) ;
171
176
}
172
177
173
178
getChildren ( ) {
0 commit comments