@@ -368,9 +368,24 @@ class OutputContribution extends Disposable implements IWorkbenchContribution {
368
368
menu : {
369
369
id : MenuId . CommandPalette ,
370
370
} ,
371
+ description : {
372
+ description : 'workbench.action.openLogFile' ,
373
+ args : [ {
374
+ name : 'args' ,
375
+ schema : {
376
+ type : 'object' ,
377
+ properties : {
378
+ logFile : {
379
+ description : nls . localize ( 'logFile' , "The name of the log file to open, for example \"Extension Host\"" ) ,
380
+ type : 'string'
381
+ }
382
+ }
383
+ }
384
+ } ]
385
+ } ,
371
386
} ) ;
372
387
}
373
- async run ( accessor : ServicesAccessor ) : Promise < void > {
388
+ async run ( accessor : ServicesAccessor , args ?: unknown ) : Promise < void > {
374
389
const outputService = accessor . get ( IOutputService ) ;
375
390
const quickInputService = accessor . get ( IQuickInputService ) ;
376
391
const instantiationService = accessor . get ( IInstantiationService ) ;
@@ -379,7 +394,14 @@ class OutputContribution extends Disposable implements IWorkbenchContribution {
379
394
const entries : IOutputChannelQuickPickItem [ ] = outputService . getChannelDescriptors ( ) . filter ( c => c . file && c . log )
380
395
. map ( channel => ( < IOutputChannelQuickPickItem > { id : channel . id , label : channel . label , channel } ) ) ;
381
396
382
- const entry = await quickInputService . pick ( entries , { placeHolder : nls . localize ( 'selectlogFile' , "Select Log file" ) } ) ;
397
+ const argName = args && typeof args === 'object' && 'logFile' in args && typeof args . logFile === 'string' ? args . logFile : undefined ;
398
+ let entry : IOutputChannelQuickPickItem | undefined ;
399
+ if ( argName ) {
400
+ entry = entries . find ( e => e . label === argName ) ;
401
+ }
402
+ if ( ! entry ) {
403
+ entry = await quickInputService . pick ( entries , { placeHolder : nls . localize ( 'selectlogFile' , "Select Log File" ) } ) ;
404
+ }
383
405
if ( entry ) {
384
406
assertIsDefined ( entry . channel . file ) ;
385
407
await editorService . openEditor ( instantiationService . createInstance ( LogViewerInput , ( entry . channel as IFileOutputChannelDescriptor ) ) , { pinned : true } ) ;
0 commit comments