@@ -258,6 +258,12 @@ export class SuggestAddon extends Disposable implements ITerminalAddon, ISuggest
258
258
await this . _handleCompletionProviders ( this . _terminal , token , explicitlyInvoked ) ;
259
259
}
260
260
261
+ private _wasLastInputArrowKey ( ) : boolean {
262
+ // Never request completions if the last key sequence was up or down as the user was likely
263
+ // navigating history
264
+ return ! ! this . _lastUserData ?. match ( / ^ \x1b [ \[ O ] ? [ A - D ] $ / ) ;
265
+ }
266
+
261
267
private _sync ( promptInputState : IPromptInputModelState ) : void {
262
268
const config = this . _configurationService . getValue < ITerminalSuggestConfiguration > ( terminalSuggestConfigSection ) ;
263
269
if ( ! this . _mostRecentPromptInputState || promptInputState . cursorIndex > this . _mostRecentPromptInputState . cursorIndex ) {
@@ -268,9 +274,7 @@ export class SuggestAddon extends Disposable implements ITerminalAddon, ISuggest
268
274
if ( ! this . _terminalSuggestWidgetVisibleContextKey . get ( ) ) {
269
275
if ( config . quickSuggestions ) {
270
276
if ( promptInputState . prefix . match ( / [ ^ \s ] $ / ) ) {
271
- // Never request completions if the last key sequence was up or down as the user was likely
272
- // navigating history
273
- if ( ! this . _lastUserData ?. match ( / ^ \x1b [ \[ O ] ? [ A - D ] $ / ) ) {
277
+ if ( ! this . _wasLastInputArrowKey ( ) ) {
274
278
this . requestCompletions ( ) ;
275
279
sent = true ;
276
280
}
@@ -289,8 +293,10 @@ export class SuggestAddon extends Disposable implements ITerminalAddon, ISuggest
289
293
// with git branches in particular
290
294
this . _isFilteringDirectories && prefix ?. match ( / [ \\ \/ ] $ / )
291
295
) {
292
- this . requestCompletions ( ) ;
293
- sent = true ;
296
+ if ( ! this . _wasLastInputArrowKey ( ) ) {
297
+ this . requestCompletions ( ) ;
298
+ sent = true ;
299
+ }
294
300
}
295
301
if ( ! sent ) {
296
302
for ( const provider of this . _terminalCompletionService . providers ) {
@@ -299,8 +305,10 @@ export class SuggestAddon extends Disposable implements ITerminalAddon, ISuggest
299
305
}
300
306
for ( const char of provider . triggerCharacters ) {
301
307
if ( prefix ?. endsWith ( char ) ) {
302
- this . requestCompletions ( ) ;
303
- sent = true ;
308
+ if ( ! this . _wasLastInputArrowKey ( ) ) {
309
+ this . requestCompletions ( ) ;
310
+ sent = true ;
311
+ }
304
312
break ;
305
313
}
306
314
}
0 commit comments