@@ -965,42 +965,61 @@ export class TerminalInstance extends Disposable implements ITerminalInstance {
965
965
}
966
966
const outputProvider = this . _instantiationService . createInstance ( TerminalOutputProvider ) ;
967
967
const quickPick = this . _quickInputService . createQuickPick ( ) ;
968
- quickPick . items = items ;
968
+ const originalItems = items ;
969
+ quickPick . items = [ ...originalItems ] ;
969
970
quickPick . sortByLabel = false ;
971
+ quickPick . matchOnLabel = false ;
970
972
quickPick . placeholder = placeholder ;
971
- return new Promise < void > ( r => {
972
- quickPick . onDidTriggerItemButton ( async e => {
973
- if ( e . button === removeFromCommandHistoryButton ) {
974
- if ( type === 'command' ) {
975
- this . _instantiationService . invokeFunction ( getCommandHistory ) ?. remove ( e . item . label ) ;
976
- } else {
977
- this . _instantiationService . invokeFunction ( getDirectoryHistory ) ?. remove ( e . item . label ) ;
978
- }
973
+ 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 ;
988
+ } ) ;
989
+ } ) ;
990
+ quickPick . onDidTriggerItemButton ( async e => {
991
+ if ( e . button === removeFromCommandHistoryButton ) {
992
+ if ( type === 'command' ) {
993
+ this . _instantiationService . invokeFunction ( getCommandHistory ) ?. remove ( e . item . label ) ;
979
994
} else {
980
- const selectedCommand = ( e . item as Item ) . command ;
981
- const output = selectedCommand ?. getOutput ( ) ;
982
- if ( output && selectedCommand ?. command ) {
983
- const textContent = await outputProvider . provideTextContent ( URI . from (
984
- {
985
- scheme : TerminalOutputProvider . scheme ,
986
- path : `${ selectedCommand . command } ... ${ fromNow ( selectedCommand . timestamp , true ) } ` ,
987
- fragment : output ,
988
- query : `terminal-output-${ selectedCommand . timestamp } -${ this . instanceId } `
989
- } ) ) ;
990
- if ( textContent ) {
991
- await this . _editorService . openEditor ( {
992
- resource : textContent . uri
993
- } ) ;
994
- }
995
+ this . _instantiationService . invokeFunction ( getDirectoryHistory ) ?. remove ( e . item . label ) ;
996
+ }
997
+ } else {
998
+ const selectedCommand = ( e . item as Item ) . command ;
999
+ const output = selectedCommand ?. getOutput ( ) ;
1000
+ if ( output && selectedCommand ?. command ) {
1001
+ const textContent = await outputProvider . provideTextContent ( URI . from (
1002
+ {
1003
+ scheme : TerminalOutputProvider . scheme ,
1004
+ path : `${ selectedCommand . command } ... ${ fromNow ( selectedCommand . timestamp , true ) } ` ,
1005
+ fragment : output ,
1006
+ query : `terminal-output-${ selectedCommand . timestamp } -${ this . instanceId } `
1007
+ } ) ) ;
1008
+ if ( textContent ) {
1009
+ await this . _editorService . openEditor ( {
1010
+ resource : textContent . uri
1011
+ } ) ;
995
1012
}
996
1013
}
997
- quickPick . hide ( ) ;
998
- } ) ;
999
- quickPick . onDidAccept ( ( ) => {
1000
- const result = quickPick . activeItems [ 0 ] ;
1001
- this . sendText ( type === 'cwd' ? `cd ${ result . label } ` : result . label , ! quickPick . keyMods . alt ) ;
1002
- quickPick . hide ( ) ;
1003
- } ) ;
1014
+ }
1015
+ quickPick . hide ( ) ;
1016
+ } ) ;
1017
+ quickPick . onDidAccept ( ( ) => {
1018
+ const result = quickPick . activeItems [ 0 ] ;
1019
+ this . sendText ( type === 'cwd' ? `cd ${ result . label } ` : result . label , ! quickPick . keyMods . alt ) ;
1020
+ quickPick . hide ( ) ;
1021
+ } ) ;
1022
+ return new Promise < void > ( r => {
1004
1023
quickPick . show ( ) ;
1005
1024
quickPick . onDidHide ( ( ) => r ( ) ) ;
1006
1025
} ) ;
0 commit comments