@@ -25,7 +25,6 @@ import {
2525import { extLogger } from "../common" ;
2626import { URLSearchParams } from "url" ;
2727import { DisposableObject } from "../pure/disposable-object" ;
28- import { commandRunner } from "../commandRunner" ;
2928import { ONE_HOUR_IN_MS , TWO_HOURS_IN_MS } from "../pure/time" ;
3029import {
3130 asError ,
@@ -66,6 +65,7 @@ import { getTotalResultCount } from "../variant-analysis/shared/variant-analysis
6665import { HistoryTreeDataProvider } from "./history-tree-data-provider" ;
6766import { redactableError } from "../pure/errors" ;
6867import { QueryHistoryDirs } from "./query-history-dirs" ;
68+ import { QueryHistoryCommands } from "../common/commands" ;
6969
7070/**
7171 * query-history-manager.ts
@@ -201,159 +201,6 @@ export class QueryHistoryManager extends DisposableObject {
201201 } ) ,
202202 ) ;
203203
204- void extLogger . log ( "Registering query history panel commands." ) ;
205- this . push (
206- commandRunner (
207- "codeQLQueryHistory.openQueryTitleMenu" ,
208- this . handleOpenQuery . bind ( this ) ,
209- ) ,
210- ) ;
211- this . push (
212- commandRunner (
213- "codeQLQueryHistory.openQueryContextMenu" ,
214- this . handleOpenQuery . bind ( this ) ,
215- ) ,
216- ) ;
217- this . push (
218- commandRunner (
219- "codeQLQueryHistory.removeHistoryItemTitleMenu" ,
220- this . handleRemoveHistoryItem . bind ( this ) ,
221- ) ,
222- ) ;
223- this . push (
224- commandRunner (
225- "codeQLQueryHistory.removeHistoryItemContextMenu" ,
226- this . handleRemoveHistoryItem . bind ( this ) ,
227- ) ,
228- ) ;
229- this . push (
230- commandRunner (
231- "codeQLQueryHistory.removeHistoryItemContextInline" ,
232- this . handleRemoveHistoryItem . bind ( this ) ,
233- ) ,
234- ) ;
235- this . push (
236- commandRunner (
237- "codeQLQueryHistory.sortByName" ,
238- this . handleSortByName . bind ( this ) ,
239- ) ,
240- ) ;
241- this . push (
242- commandRunner (
243- "codeQLQueryHistory.sortByDate" ,
244- this . handleSortByDate . bind ( this ) ,
245- ) ,
246- ) ;
247- this . push (
248- commandRunner (
249- "codeQLQueryHistory.sortByCount" ,
250- this . handleSortByCount . bind ( this ) ,
251- ) ,
252- ) ;
253- this . push (
254- commandRunner (
255- "codeQLQueryHistory.renameItem" ,
256- this . handleRenameItem . bind ( this ) ,
257- ) ,
258- ) ;
259- this . push (
260- commandRunner (
261- "codeQLQueryHistory.compareWith" ,
262- this . handleCompareWith . bind ( this ) ,
263- ) ,
264- ) ;
265- this . push (
266- commandRunner (
267- "codeQLQueryHistory.showQueryLog" ,
268- this . handleShowQueryLog . bind ( this ) ,
269- ) ,
270- ) ;
271- this . push (
272- commandRunner (
273- "codeQLQueryHistory.openQueryDirectory" ,
274- this . handleOpenQueryDirectory . bind ( this ) ,
275- ) ,
276- ) ;
277- this . push (
278- commandRunner (
279- "codeQLQueryHistory.showEvalLog" ,
280- this . handleShowEvalLog . bind ( this ) ,
281- ) ,
282- ) ;
283- this . push (
284- commandRunner (
285- "codeQLQueryHistory.showEvalLogSummary" ,
286- this . handleShowEvalLogSummary . bind ( this ) ,
287- ) ,
288- ) ;
289- this . push (
290- commandRunner (
291- "codeQLQueryHistory.showEvalLogViewer" ,
292- this . handleShowEvalLogViewer . bind ( this ) ,
293- ) ,
294- ) ;
295- this . push (
296- commandRunner ( "codeQLQueryHistory.cancel" , this . handleCancel . bind ( this ) ) ,
297- ) ;
298- this . push (
299- commandRunner (
300- "codeQLQueryHistory.showQueryText" ,
301- this . handleShowQueryText . bind ( this ) ,
302- ) ,
303- ) ;
304- this . push (
305- commandRunner (
306- "codeQLQueryHistory.exportResults" ,
307- this . handleExportResults . bind ( this ) ,
308- ) ,
309- ) ;
310- this . push (
311- commandRunner (
312- "codeQLQueryHistory.viewCsvResults" ,
313- this . handleViewCsvResults . bind ( this ) ,
314- ) ,
315- ) ;
316- this . push (
317- commandRunner (
318- "codeQLQueryHistory.viewCsvAlerts" ,
319- this . handleViewCsvAlerts . bind ( this ) ,
320- ) ,
321- ) ;
322- this . push (
323- commandRunner (
324- "codeQLQueryHistory.viewSarifAlerts" ,
325- this . handleViewSarifAlerts . bind ( this ) ,
326- ) ,
327- ) ;
328- this . push (
329- commandRunner (
330- "codeQLQueryHistory.viewDil" ,
331- this . handleViewDil . bind ( this ) ,
332- ) ,
333- ) ;
334- this . push (
335- commandRunner (
336- "codeQLQueryHistory.itemClicked" ,
337- async ( item : LocalQueryInfo ) => {
338- return this . handleItemClicked ( item , [ item ] ) ;
339- } ,
340- ) ,
341- ) ;
342- this . push (
343- commandRunner (
344- "codeQLQueryHistory.openOnGithub" ,
345- async ( item : LocalQueryInfo ) => {
346- return this . handleOpenOnGithub ( item , [ item ] ) ;
347- } ,
348- ) ,
349- ) ;
350- this . push (
351- commandRunner (
352- "codeQLQueryHistory.copyRepoList" ,
353- this . handleCopyRepoList . bind ( this ) ,
354- ) ,
355- ) ;
356-
357204 // There are two configuration items that affect the query history:
358205 // 1. The ttl for query history items.
359206 // 2. The default label for query history items.
@@ -388,6 +235,45 @@ export class QueryHistoryManager extends DisposableObject {
388235 this . registerToVariantAnalysisEvents ( ) ;
389236 }
390237
238+ public getCommands ( ) : QueryHistoryCommands {
239+ return {
240+ "codeQLQueryHistory.sortByName" : this . handleSortByName . bind ( this ) ,
241+ "codeQLQueryHistory.sortByDate" : this . handleSortByDate . bind ( this ) ,
242+ "codeQLQueryHistory.sortByCount" : this . handleSortByCount . bind ( this ) ,
243+
244+ "codeQLQueryHistory.openQueryTitleMenu" : this . handleOpenQuery . bind ( this ) ,
245+ "codeQLQueryHistory.openQueryContextMenu" :
246+ this . handleOpenQuery . bind ( this ) ,
247+ "codeQLQueryHistory.removeHistoryItemTitleMenu" :
248+ this . handleRemoveHistoryItem . bind ( this ) ,
249+ "codeQLQueryHistory.removeHistoryItemContextMenu" :
250+ this . handleRemoveHistoryItem . bind ( this ) ,
251+ "codeQLQueryHistory.removeHistoryItemContextInline" :
252+ this . handleRemoveHistoryItem . bind ( this ) ,
253+ "codeQLQueryHistory.renameItem" : this . handleRenameItem . bind ( this ) ,
254+ "codeQLQueryHistory.compareWith" : this . handleCompareWith . bind ( this ) ,
255+ "codeQLQueryHistory.showEvalLog" : this . handleShowEvalLog . bind ( this ) ,
256+ "codeQLQueryHistory.showEvalLogSummary" :
257+ this . handleShowEvalLogSummary . bind ( this ) ,
258+ "codeQLQueryHistory.showEvalLogViewer" :
259+ this . handleShowEvalLogViewer . bind ( this ) ,
260+ "codeQLQueryHistory.showQueryLog" : this . handleShowQueryLog . bind ( this ) ,
261+ "codeQLQueryHistory.showQueryText" : this . handleShowQueryText . bind ( this ) ,
262+ "codeQLQueryHistory.openQueryDirectory" :
263+ this . handleOpenQueryDirectory . bind ( this ) ,
264+ "codeQLQueryHistory.cancel" : this . handleCancel . bind ( this ) ,
265+ "codeQLQueryHistory.exportResults" : this . handleExportResults . bind ( this ) ,
266+ "codeQLQueryHistory.viewCsvResults" : this . handleViewCsvResults . bind ( this ) ,
267+ "codeQLQueryHistory.viewCsvAlerts" : this . handleViewCsvAlerts . bind ( this ) ,
268+ "codeQLQueryHistory.viewSarifAlerts" :
269+ this . handleViewSarifAlerts . bind ( this ) ,
270+ "codeQLQueryHistory.viewDil" : this . handleViewDil . bind ( this ) ,
271+ "codeQLQueryHistory.itemClicked" : this . handleItemClicked . bind ( this ) ,
272+ "codeQLQueryHistory.openOnGithub" : this . handleOpenOnGithub . bind ( this ) ,
273+ "codeQLQueryHistory.copyRepoList" : this . handleCopyRepoList . bind ( this ) ,
274+ } ;
275+ }
276+
391277 public completeQuery ( info : LocalQueryInfo , results : QueryWithResults ) : void {
392278 info . completeThisQuery ( results ) ;
393279 this . _onDidCompleteQuery . fire ( info ) ;
0 commit comments