@@ -38,7 +38,7 @@ import { IKeybindingService } from '../../../../platform/keybinding/common/keybi
38
38
import { KeybindingWeight } from '../../../../platform/keybinding/common/keybindingsRegistry.js' ;
39
39
import { ILogService } from '../../../../platform/log/common/log.js' ;
40
40
import { bindContextKey , observableConfigValue } from '../../../../platform/observable/common/platformObservableUtils.js' ;
41
- import { IQuickInputService , QuickPickInput } from '../../../../platform/quickinput/common/quickInput.js' ;
41
+ import { IQuickInputButton , IQuickInputService , QuickPickInput } from '../../../../platform/quickinput/common/quickInput.js' ;
42
42
import { ActiveEditorContext } from '../../../common/contextkeys.js' ;
43
43
import { TEXT_FILE_EDITOR_ID } from '../../files/common/files.js' ;
44
44
import { getTestingConfiguration , TestingConfigKeys } from '../common/configuration.js' ;
@@ -791,6 +791,7 @@ registerAction2(class FilterCoverageToTestInEditor extends Action2 {
791
791
run ( accessor : ServicesAccessor , coverageOrUri ?: FileCoverage | URI , editor ?: ICodeEditor ) : void {
792
792
const testCoverageService = accessor . get ( ITestCoverageService ) ;
793
793
const quickInputService = accessor . get ( IQuickInputService ) ;
794
+ const commandService = accessor . get ( ICommandService ) ;
794
795
const activeEditor = isCodeEditor ( editor ) ? editor : accessor . get ( ICodeEditorService ) . getActiveCodeEditor ( ) ;
795
796
let coverage : FileCoverage | undefined ;
796
797
if ( coverageOrUri instanceof FileCoverage ) {
@@ -811,23 +812,30 @@ registerAction2(class FilterCoverageToTestInEditor extends Action2 {
811
812
const result = coverage . fromResult ;
812
813
const previousSelection = testCoverageService . filterToTest . get ( ) ;
813
814
814
- type TItem = { label : string ; testId : TestId | undefined } ;
815
+ type TItem = { label : string ; testId : TestId | undefined ; buttons ?: IQuickInputButton [ ] } ;
815
816
817
+ const buttons : IQuickInputButton [ ] = [ {
818
+ iconClass : 'codicon-go-to-file' ,
819
+ tooltip : 'Go to Test' ,
820
+ } ] ;
816
821
const items : QuickPickInput < TItem > [ ] = [
817
822
{ label : coverUtils . labels . allTests , testId : undefined } ,
818
823
{ type : 'separator' } ,
819
- ...tests . map ( id => ( { label : coverUtils . getLabelForItem ( result , id , commonPrefix ) , testId : id } ) ) ,
824
+ ...tests . map ( id => ( { label : coverUtils . getLabelForItem ( result , id , commonPrefix ) , testId : id , buttons } ) ) ,
820
825
] ;
821
826
822
827
// These handle the behavior that reveals the start of coverage when the
823
828
// user picks from the quickpick. Scroll position is restored if the user
824
- // exits without picking an item, or picks "all tets ".
829
+ // exits without picking an item, or picks "all tests ".
825
830
const scrollTop = activeEditor ?. getScrollTop ( ) || 0 ;
826
831
const revealScrollCts = new MutableDisposable < CancellationTokenSource > ( ) ;
827
832
828
833
quickInputService . pick ( items , {
829
834
activeItem : items . find ( ( item ) : item is TItem => 'item' in item && item . item === coverage ) ,
830
835
placeHolder : coverUtils . labels . pickShowCoverage ,
836
+ onDidTriggerItemButton : ( context ) => {
837
+ commandService . executeCommand ( 'vscode.revealTest' , context . item . testId ?. toString ( ) ) ;
838
+ } ,
831
839
onDidFocus : ( entry ) => {
832
840
if ( ! entry . testId ) {
833
841
revealScrollCts . clear ( ) ;
0 commit comments