@@ -35,7 +35,7 @@ const testFilterDescriptions: { [K in TestFilterTerm]: string } = {
35
35
export class TestingExplorerFilter extends BaseActionViewItem {
36
36
private input ! : SuggestEnabledInputWithHistory ;
37
37
private wrapper ! : HTMLDivElement ;
38
- private readonly history : StoredValue < string [ ] > = this . instantiationService . createInstance ( StoredValue , {
38
+ private readonly history : StoredValue < { values : string [ ] ; lastValue : string } | string [ ] > = this . instantiationService . createInstance ( StoredValue , {
39
39
key : 'testing.filterHistory2' ,
40
40
scope : StorageScope . WORKSPACE ,
41
41
target : StorageTarget . USER
@@ -65,9 +65,12 @@ export class TestingExplorerFilter extends BaseActionViewItem {
65
65
const wrapper = this . wrapper = dom . $ ( '.testing-filter-wrapper' ) ;
66
66
container . appendChild ( wrapper ) ;
67
67
68
- const history = this . history . get ( [ ] ) ;
69
- if ( history . length ) {
70
- this . state . setText ( history [ history . length - 1 ] ) ;
68
+ let history = this . history . get ( { lastValue : '' , values : [ ] } ) ;
69
+ if ( history instanceof Array ) {
70
+ history = { lastValue : '' , values : history } ;
71
+ }
72
+ if ( history . lastValue ) {
73
+ this . state . setText ( history . lastValue ) ;
71
74
}
72
75
73
76
const input = this . input = this . _register ( this . instantiationService . createInstance ( ContextScopedSuggestEnabledInputWithHistory , {
@@ -94,7 +97,7 @@ export class TestingExplorerFilter extends BaseActionViewItem {
94
97
value : this . state . text . value ,
95
98
placeholderText : localize ( 'testExplorerFilter' , "Filter (e.g. text, !exclude, @tag)" ) ,
96
99
} ,
97
- history
100
+ history : history . values
98
101
} ) ) ;
99
102
this . _register ( attachSuggestEnabledInputBoxStyler ( input , this . themeService ) ) ;
100
103
@@ -145,12 +148,7 @@ export class TestingExplorerFilter extends BaseActionViewItem {
145
148
* Persists changes to the input history.
146
149
*/
147
150
public saveState ( ) {
148
- const history = this . input . getHistory ( ) ;
149
- if ( history . length ) {
150
- this . history . store ( history ) ;
151
- } else {
152
- this . history . delete ( ) ;
153
- }
151
+ this . history . store ( { lastValue : this . input . getValue ( ) , values : this . input . getHistory ( ) } ) ;
154
152
}
155
153
156
154
/**
0 commit comments