@@ -368,9 +368,19 @@ 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 : 'logFile' ,
375
+ schema : {
376
+ markdownDescription : nls . localize ( 'logFile' , "The id of the log file to open, for example `\"window\"`. Currently the best way to get this is to get the ID by checking the `workbench.action.output.show.<id>` commands" ) ,
377
+ type : 'string'
378
+ }
379
+ } ]
380
+ } ,
371
381
} ) ;
372
382
}
373
- async run ( accessor : ServicesAccessor ) : Promise < void > {
383
+ async run ( accessor : ServicesAccessor , args ?: unknown ) : Promise < void > {
374
384
const outputService = accessor . get ( IOutputService ) ;
375
385
const quickInputService = accessor . get ( IQuickInputService ) ;
376
386
const instantiationService = accessor . get ( IInstantiationService ) ;
@@ -379,7 +389,14 @@ class OutputContribution extends Disposable implements IWorkbenchContribution {
379
389
const entries : IOutputChannelQuickPickItem [ ] = outputService . getChannelDescriptors ( ) . filter ( c => c . file && c . log )
380
390
. map ( channel => ( < IOutputChannelQuickPickItem > { id : channel . id , label : channel . label , channel } ) ) ;
381
391
382
- const entry = await quickInputService . pick ( entries , { placeHolder : nls . localize ( 'selectlogFile' , "Select Log file" ) } ) ;
392
+ const argName = args && typeof args === 'string' ? args : undefined ;
393
+ let entry : IOutputChannelQuickPickItem | undefined ;
394
+ if ( argName ) {
395
+ entry = entries . find ( e => e . id === argName ) ;
396
+ }
397
+ if ( ! entry ) {
398
+ entry = await quickInputService . pick ( entries , { placeHolder : nls . localize ( 'selectlogFile' , "Select Log File" ) } ) ;
399
+ }
383
400
if ( entry ) {
384
401
assertIsDefined ( entry . channel . file ) ;
385
402
await editorService . openEditor ( instantiationService . createInstance ( LogViewerInput , ( entry . channel as IFileOutputChannelDescriptor ) ) , { pinned : true } ) ;
0 commit comments