1- import { CommandManager } from "../packages/commands" ;
1+ import type { CommandManager } from "../packages/commands" ;
22import type { Uri } from "vscode" ;
3+ import type { DbTreeViewItem } from "../databases/ui/db-tree-view-item" ;
4+ import type { QueryHistoryInfo } from "../query-history/query-history-info" ;
5+
6+ // A command function matching the signature that VS Code calls when
7+ // a command on a selection is invoked.
8+ export type SelectionCommandFunction < Item > = (
9+ singleItem : Item ,
10+ multiSelect : Item [ ] ,
11+ ) => Promise < void > ;
12+
13+ // A command function matching the signature that VS Code calls when
14+ // a command on a selection is invoked when canSelectMany is false.
15+ export type SingleSelectionCommandFunction < Item > = (
16+ singleItem : Item ,
17+ ) => Promise < void > ;
318
419/**
520 * Contains type definitions for all commands used by the extension.
@@ -13,6 +28,38 @@ export type BaseCommands = {
1328 "codeQL.openDocumentation" : ( ) => Promise < void > ;
1429} ;
1530
31+ // Commands used for the query history panel
32+ export type QueryHistoryCommands = {
33+ // Commands in the "navigation" group
34+ "codeQLQueryHistory.sortByName" : ( ) => Promise < void > ;
35+ "codeQLQueryHistory.sortByDate" : ( ) => Promise < void > ;
36+ "codeQLQueryHistory.sortByCount" : ( ) => Promise < void > ;
37+
38+ // Commands in the context menu or in the hover menu
39+ "codeQLQueryHistory.openQueryTitleMenu" : SelectionCommandFunction < QueryHistoryInfo > ;
40+ "codeQLQueryHistory.openQueryContextMenu" : SelectionCommandFunction < QueryHistoryInfo > ;
41+ "codeQLQueryHistory.removeHistoryItemTitleMenu" : SelectionCommandFunction < QueryHistoryInfo > ;
42+ "codeQLQueryHistory.removeHistoryItemContextMenu" : SelectionCommandFunction < QueryHistoryInfo > ;
43+ "codeQLQueryHistory.removeHistoryItemContextInline" : SelectionCommandFunction < QueryHistoryInfo > ;
44+ "codeQLQueryHistory.renameItem" : SelectionCommandFunction < QueryHistoryInfo > ;
45+ "codeQLQueryHistory.compareWith" : SelectionCommandFunction < QueryHistoryInfo > ;
46+ "codeQLQueryHistory.showEvalLog" : SelectionCommandFunction < QueryHistoryInfo > ;
47+ "codeQLQueryHistory.showEvalLogSummary" : SelectionCommandFunction < QueryHistoryInfo > ;
48+ "codeQLQueryHistory.showEvalLogViewer" : SelectionCommandFunction < QueryHistoryInfo > ;
49+ "codeQLQueryHistory.showQueryLog" : SelectionCommandFunction < QueryHistoryInfo > ;
50+ "codeQLQueryHistory.showQueryText" : SelectionCommandFunction < QueryHistoryInfo > ;
51+ "codeQLQueryHistory.openQueryDirectory" : SelectionCommandFunction < QueryHistoryInfo > ;
52+ "codeQLQueryHistory.cancel" : SelectionCommandFunction < QueryHistoryInfo > ;
53+ "codeQLQueryHistory.exportResults" : SelectionCommandFunction < QueryHistoryInfo > ;
54+ "codeQLQueryHistory.viewCsvResults" : SelectionCommandFunction < QueryHistoryInfo > ;
55+ "codeQLQueryHistory.viewCsvAlerts" : SelectionCommandFunction < QueryHistoryInfo > ;
56+ "codeQLQueryHistory.viewSarifAlerts" : SelectionCommandFunction < QueryHistoryInfo > ;
57+ "codeQLQueryHistory.viewDil" : SelectionCommandFunction < QueryHistoryInfo > ;
58+ "codeQLQueryHistory.itemClicked" : SelectionCommandFunction < QueryHistoryInfo > ;
59+ "codeQLQueryHistory.openOnGithub" : SelectionCommandFunction < QueryHistoryInfo > ;
60+ "codeQLQueryHistory.copyRepoList" : SelectionCommandFunction < QueryHistoryInfo > ;
61+ } ;
62+
1663// Commands tied to variant analysis
1764export type VariantAnalysisCommands = {
1865 "codeQL.openVariantAnalysisLogs" : (
@@ -22,6 +69,22 @@ export type VariantAnalysisCommands = {
2269 "codeQL.runVariantAnalysisContextEditor" : ( uri ?: Uri ) => Promise < void > ;
2370} ;
2471
25- export type AllCommands = BaseCommands & VariantAnalysisCommands ;
72+ export type DatabasePanelCommands = {
73+ "codeQLVariantAnalysisRepositories.openConfigFile" : ( ) => Promise < void > ;
74+ "codeQLVariantAnalysisRepositories.addNewDatabase" : ( ) => Promise < void > ;
75+ "codeQLVariantAnalysisRepositories.addNewList" : ( ) => Promise < void > ;
76+ "codeQLVariantAnalysisRepositories.setupControllerRepository" : ( ) => Promise < void > ;
77+
78+ "codeQLVariantAnalysisRepositories.setSelectedItem" : SingleSelectionCommandFunction < DbTreeViewItem > ;
79+ "codeQLVariantAnalysisRepositories.setSelectedItemContextMenu" : SingleSelectionCommandFunction < DbTreeViewItem > ;
80+ "codeQLVariantAnalysisRepositories.openOnGitHubContextMenu" : SingleSelectionCommandFunction < DbTreeViewItem > ;
81+ "codeQLVariantAnalysisRepositories.renameItemContextMenu" : SingleSelectionCommandFunction < DbTreeViewItem > ;
82+ "codeQLVariantAnalysisRepositories.removeItemContextMenu" : SingleSelectionCommandFunction < DbTreeViewItem > ;
83+ } ;
84+
85+ export type AllCommands = BaseCommands &
86+ QueryHistoryCommands &
87+ VariantAnalysisCommands &
88+ DatabasePanelCommands ;
2689
2790export type AppCommandManager = CommandManager < AllCommands > ;
0 commit comments