@@ -153,11 +153,13 @@ export class SuggestWidget implements IDisposable {
153
153
this . _persistedSize = new PersistedWidgetSize ( _storageService , editor ) ;
154
154
155
155
let persistedSize : dom . Dimension | undefined ;
156
+ let currentSize : dom . Dimension | undefined ;
156
157
let persistHeight = false ;
157
158
let persistWidth = false ;
158
159
this . _disposables . add ( this . element . onDidWillResize ( ( ) => {
159
160
this . _contentWidget . lockPreference ( ) ;
160
161
persistedSize = this . _persistedSize . restore ( ) ;
162
+ currentSize = this . element . size ;
161
163
} ) ) ;
162
164
this . _disposables . add ( this . element . onDidResize ( e => {
163
165
@@ -166,14 +168,15 @@ export class SuggestWidget implements IDisposable {
166
168
persistHeight = persistHeight || ! ! e . north || ! ! e . south ;
167
169
persistWidth = persistWidth || ! ! e . east || ! ! e . west ;
168
170
if ( e . done ) {
169
-
170
- // only store width or height value that have changed
171
+ // only store width or height value that have changed and also
172
+ // only store changes that are above a certain threshold
173
+ const threshold = Math . floor ( this . getLayoutInfo ( ) . itemHeight / 3 ) ;
171
174
let { width, height } = this . element . size ;
172
- if ( persistedSize ) {
173
- if ( ! persistHeight ) {
175
+ if ( persistedSize && currentSize ) {
176
+ if ( ! persistHeight || Math . abs ( currentSize . height - height ) > threshold ) {
174
177
height = persistedSize . height ;
175
178
}
176
- if ( ! persistWidth ) {
179
+ if ( ! persistWidth || Math . abs ( currentSize . width - width ) > threshold ) {
177
180
width = persistedSize . width ;
178
181
}
179
182
}
@@ -182,6 +185,7 @@ export class SuggestWidget implements IDisposable {
182
185
// reset working state
183
186
this . _contentWidget . unlockPreference ( ) ;
184
187
persistedSize = undefined ;
188
+ currentSize = undefined ;
185
189
persistHeight = false ;
186
190
persistWidth = false ;
187
191
}
0 commit comments