@@ -818,7 +818,7 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
818
818
this . _linkManager . openRecentLink ( type ) ;
819
819
}
820
820
821
- async runRecent ( type : 'command' | 'cwd' ) : Promise < void > {
821
+ async runRecent ( type : 'command' | 'cwd' , filterMode ?: 'fuzzy' | 'contiguous' ) : Promise < void > {
822
822
if ( ! this . xterm ) {
823
823
return ;
824
824
}
@@ -968,25 +968,40 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
968
968
const originalItems = items ;
969
969
quickPick . items = [ ...originalItems ] ;
970
970
quickPick . sortByLabel = false ;
971
- quickPick . matchOnLabel = false ;
972
971
quickPick . placeholder = placeholder ;
973
972
quickPick . title = 'Run Recent Command' ;
974
- quickPick . onDidChangeValue ( value => {
975
- quickPick . items = originalItems . filter ( item => {
976
- if ( item . type === 'separator' ) {
977
- return true ;
978
- }
979
- item . highlights = undefined ;
980
- const matchIndex = item . label . indexOf ( value ) ;
981
- if ( matchIndex !== - 1 ) {
982
- item . highlights = {
983
- label : [ { start : matchIndex , end : matchIndex + value . length } ]
984
- } ;
985
- return true ;
986
- }
987
- return false ;
973
+ quickPick . customButton = true ;
974
+ quickPick . matchOnLabel = filterMode === 'fuzzy' ;
975
+ if ( filterMode === 'fuzzy' ) {
976
+ quickPick . customLabel = nls . localize ( 'terminal.contiguousSearch' , 'Use Contiguous Search' ) ;
977
+ quickPick . onDidCustom ( ( ) => {
978
+ quickPick . hide ( ) ;
979
+ this . runRecent ( type , 'contiguous' ) ;
988
980
} ) ;
989
- } ) ;
981
+ } else {
982
+ // contiguous is the default for command
983
+ quickPick . onDidChangeValue ( value => {
984
+ quickPick . items = originalItems . filter ( item => {
985
+ if ( item . type === 'separator' ) {
986
+ return true ;
987
+ }
988
+ item . highlights = undefined ;
989
+ const matchIndex = item . label . indexOf ( value ) ;
990
+ if ( matchIndex !== - 1 ) {
991
+ item . highlights = {
992
+ label : [ { start : matchIndex , end : matchIndex + value . length } ]
993
+ } ;
994
+ return true ;
995
+ }
996
+ return false ;
997
+ } ) ;
998
+ } ) ;
999
+ quickPick . customLabel = nls . localize ( 'terminal.fuzzySearch' , 'Use Fuzzy Search' ) ;
1000
+ quickPick . onDidCustom ( ( ) => {
1001
+ quickPick . hide ( ) ;
1002
+ this . runRecent ( type , 'fuzzy' ) ;
1003
+ } ) ;
1004
+ }
990
1005
quickPick . onDidTriggerItemButton ( async e => {
991
1006
if ( e . button === removeFromCommandHistoryButton ) {
992
1007
if ( type === 'command' ) {
0 commit comments