@@ -4,6 +4,7 @@ import { ExtensionContext, window as Window } from 'vscode';
44import { CompletedQuery } from './query-results' ;
55import { QueryHistoryConfig } from './config' ;
66import { QueryWithResults } from './run-queries' ;
7+ import * as helpers from './helpers' ;
78
89/**
910 * query-history.ts
@@ -187,6 +188,20 @@ export class QueryHistoryManager {
187188 }
188189 }
189190
191+ async handleShowQueryLog ( queryHistoryItem : CompletedQuery ) {
192+ if ( queryHistoryItem . logFileLocation ) {
193+ try {
194+ await vscode . window . showTextDocument ( vscode . Uri . parse ( queryHistoryItem . logFileLocation ) , {
195+ viewColumn : vscode . ViewColumn . Beside
196+ } ) ;
197+ } catch ( e ) {
198+ helpers . showAndLogErrorMessage ( `Could not open log file ${ queryHistoryItem . logFileLocation } ` ) ;
199+ }
200+ } else {
201+ helpers . showAndLogWarningMessage ( 'No log file available' ) ;
202+ }
203+ }
204+
190205 constructor (
191206 ctx : ExtensionContext ,
192207 private queryHistoryConfigListener : QueryHistoryConfig ,
@@ -208,6 +223,7 @@ export class QueryHistoryManager {
208223 ctx . subscriptions . push ( vscode . commands . registerCommand ( 'codeQLQueryHistory.openQuery' , this . handleOpenQuery ) ) ;
209224 ctx . subscriptions . push ( vscode . commands . registerCommand ( 'codeQLQueryHistory.removeHistoryItem' , this . handleRemoveHistoryItem . bind ( this ) ) ) ;
210225 ctx . subscriptions . push ( vscode . commands . registerCommand ( 'codeQLQueryHistory.setLabel' , this . handleSetLabel . bind ( this ) ) ) ;
226+ ctx . subscriptions . push ( vscode . commands . registerCommand ( 'codeQLQueryHistory.showQueryLog' , this . handleShowQueryLog . bind ( this ) ) ) ;
211227 ctx . subscriptions . push ( vscode . commands . registerCommand ( 'codeQLQueryHistory.itemClicked' , async ( item ) => {
212228 return this . handleItemClicked ( item ) ;
213229 } ) ) ;
0 commit comments