@@ -13,18 +13,53 @@ import type {
1313} from "../variant-analysis/shared/variant-analysis" ;
1414
1515// A command function matching the signature that VS Code calls when
16- // a command on a selection is invoked.
17- export type SelectionCommandFunction < Item > = (
16+ // a command is invoked from the title bar of a TreeView with
17+ // canSelectMany set to true.
18+ //
19+ // It is possible to get any combination of singleItem and multiSelect
20+ // to be undefined. This is because it is possible to click a title bar
21+ // option without interacting with any individual items first, or even
22+ // when there are no items present at all.
23+ // If both singleItem and multiSelect are defined, then singleItem will
24+ // be contained within multiSelect.
25+ export type TreeViewTitleMultiSelectionCommandFunction < Item > = (
26+ singleItem : Item | undefined ,
27+ multiSelect : Item [ ] | undefined ,
28+ ) => Promise < void > ;
29+
30+ // A command function matching the signature that VS Code calls when
31+ // a command is invoked from a context menu on a TreeView with
32+ // canSelectMany set to true.
33+ //
34+ // singleItem will always be defined and corresponds to the item that
35+ // was hovered or right-clicked. If precisely one item was selected then
36+ // multiSelect will be undefined. If more than one item is selected then
37+ // multiSelect will contain all selected items, including singleItem.
38+ export type TreeViewContextMultiSelectionCommandFunction < Item > = (
1839 singleItem : Item ,
19- multiSelect : Item [ ] ,
40+ multiSelect : Item [ ] | undefined ,
2041) => Promise < void > ;
2142
2243// A command function matching the signature that VS Code calls when
23- // a command on a selection is invoked when canSelectMany is false.
24- export type SingleSelectionCommandFunction < Item > = (
44+ // a command is invoked from a context menu on a TreeView with
45+ // canSelectMany set to false.
46+ //
47+ // It is guaranteed that precisely one item will be selected.
48+ export type TreeViewContextSingleSelectionCommandFunction < Item > = (
2549 singleItem : Item ,
2650) => Promise < void > ;
2751
52+ // A command function matching the signature that VS Code calls when
53+ // a command is invoked from a context menu on the file explorer.
54+ //
55+ // singleItem corresponds to the item that was right-clicked.
56+ // multiSelect will always been defined and non-empty and contains
57+ // all selected items, including singleItem.
58+ export type ExplorerSelectionCommandFunction < Item > = (
59+ singleItem : Item ,
60+ multiSelect : Item [ ] ,
61+ ) => Promise < void > ;
62+
2863/**
2964 * Contains type definitions for all commands used by the extension.
3065 *
@@ -94,12 +129,12 @@ export type LocalQueryCommands = {
94129 "codeQL.runQueryOnMultipleDatabasesContextEditor" : (
95130 uri ?: Uri ,
96131 ) => Promise < void > ;
97- "codeQL.runQueries" : SelectionCommandFunction < Uri > ;
132+ "codeQL.runQueries" : ExplorerSelectionCommandFunction < Uri > ;
98133 "codeQL.quickEval" : ( uri : Uri ) => Promise < void > ;
99134 "codeQL.quickEvalContextEditor" : ( uri : Uri ) => Promise < void > ;
100135 "codeQL.codeLensQuickEval" : ( uri : Uri , range : Range ) => Promise < void > ;
101136 "codeQL.quickQuery" : ( ) => Promise < void > ;
102- "codeQL.createSkeletonQuery " : ( ) => Promise < void > ;
137+ "codeQL.createQuery " : ( ) => Promise < void > ;
103138} ;
104139
105140export type ResultsViewCommands = {
@@ -119,28 +154,28 @@ export type QueryHistoryCommands = {
119154 "codeQLQueryHistory.sortByCount" : ( ) => Promise < void > ;
120155
121156 // Commands in the context menu or in the hover menu
122- "codeQLQueryHistory.openQueryTitleMenu" : SelectionCommandFunction < QueryHistoryInfo > ;
123- "codeQLQueryHistory.openQueryContextMenu" : SelectionCommandFunction < QueryHistoryInfo > ;
124- "codeQLQueryHistory.removeHistoryItemTitleMenu" : SelectionCommandFunction < QueryHistoryInfo > ;
125- "codeQLQueryHistory.removeHistoryItemContextMenu" : SelectionCommandFunction < QueryHistoryInfo > ;
126- "codeQLQueryHistory.removeHistoryItemContextInline" : SelectionCommandFunction < QueryHistoryInfo > ;
127- "codeQLQueryHistory.renameItem" : SelectionCommandFunction < QueryHistoryInfo > ;
128- "codeQLQueryHistory.compareWith" : SelectionCommandFunction < QueryHistoryInfo > ;
129- "codeQLQueryHistory.showEvalLog" : SelectionCommandFunction < QueryHistoryInfo > ;
130- "codeQLQueryHistory.showEvalLogSummary" : SelectionCommandFunction < QueryHistoryInfo > ;
131- "codeQLQueryHistory.showEvalLogViewer" : SelectionCommandFunction < QueryHistoryInfo > ;
132- "codeQLQueryHistory.showQueryLog" : SelectionCommandFunction < QueryHistoryInfo > ;
133- "codeQLQueryHistory.showQueryText" : SelectionCommandFunction < QueryHistoryInfo > ;
134- "codeQLQueryHistory.openQueryDirectory" : SelectionCommandFunction < QueryHistoryInfo > ;
135- "codeQLQueryHistory.cancel" : SelectionCommandFunction < QueryHistoryInfo > ;
136- "codeQLQueryHistory.exportResults" : SelectionCommandFunction < QueryHistoryInfo > ;
137- "codeQLQueryHistory.viewCsvResults" : SelectionCommandFunction < QueryHistoryInfo > ;
138- "codeQLQueryHistory.viewCsvAlerts" : SelectionCommandFunction < QueryHistoryInfo > ;
139- "codeQLQueryHistory.viewSarifAlerts" : SelectionCommandFunction < QueryHistoryInfo > ;
140- "codeQLQueryHistory.viewDil" : SelectionCommandFunction < QueryHistoryInfo > ;
141- "codeQLQueryHistory.itemClicked" : SelectionCommandFunction < QueryHistoryInfo > ;
142- "codeQLQueryHistory.openOnGithub" : SelectionCommandFunction < QueryHistoryInfo > ;
143- "codeQLQueryHistory.copyRepoList" : SelectionCommandFunction < QueryHistoryInfo > ;
157+ "codeQLQueryHistory.openQueryTitleMenu" : TreeViewTitleMultiSelectionCommandFunction < QueryHistoryInfo > ;
158+ "codeQLQueryHistory.openQueryContextMenu" : TreeViewContextMultiSelectionCommandFunction < QueryHistoryInfo > ;
159+ "codeQLQueryHistory.removeHistoryItemTitleMenu" : TreeViewTitleMultiSelectionCommandFunction < QueryHistoryInfo > ;
160+ "codeQLQueryHistory.removeHistoryItemContextMenu" : TreeViewContextMultiSelectionCommandFunction < QueryHistoryInfo > ;
161+ "codeQLQueryHistory.removeHistoryItemContextInline" : TreeViewContextMultiSelectionCommandFunction < QueryHistoryInfo > ;
162+ "codeQLQueryHistory.renameItem" : TreeViewContextMultiSelectionCommandFunction < QueryHistoryInfo > ;
163+ "codeQLQueryHistory.compareWith" : TreeViewContextMultiSelectionCommandFunction < QueryHistoryInfo > ;
164+ "codeQLQueryHistory.showEvalLog" : TreeViewContextMultiSelectionCommandFunction < QueryHistoryInfo > ;
165+ "codeQLQueryHistory.showEvalLogSummary" : TreeViewContextMultiSelectionCommandFunction < QueryHistoryInfo > ;
166+ "codeQLQueryHistory.showEvalLogViewer" : TreeViewContextMultiSelectionCommandFunction < QueryHistoryInfo > ;
167+ "codeQLQueryHistory.showQueryLog" : TreeViewContextMultiSelectionCommandFunction < QueryHistoryInfo > ;
168+ "codeQLQueryHistory.showQueryText" : TreeViewContextMultiSelectionCommandFunction < QueryHistoryInfo > ;
169+ "codeQLQueryHistory.openQueryDirectory" : TreeViewContextMultiSelectionCommandFunction < QueryHistoryInfo > ;
170+ "codeQLQueryHistory.cancel" : TreeViewContextMultiSelectionCommandFunction < QueryHistoryInfo > ;
171+ "codeQLQueryHistory.exportResults" : TreeViewContextMultiSelectionCommandFunction < QueryHistoryInfo > ;
172+ "codeQLQueryHistory.viewCsvResults" : TreeViewContextMultiSelectionCommandFunction < QueryHistoryInfo > ;
173+ "codeQLQueryHistory.viewCsvAlerts" : TreeViewContextMultiSelectionCommandFunction < QueryHistoryInfo > ;
174+ "codeQLQueryHistory.viewSarifAlerts" : TreeViewContextMultiSelectionCommandFunction < QueryHistoryInfo > ;
175+ "codeQLQueryHistory.viewDil" : TreeViewContextMultiSelectionCommandFunction < QueryHistoryInfo > ;
176+ "codeQLQueryHistory.itemClicked" : TreeViewTitleMultiSelectionCommandFunction < QueryHistoryInfo > ;
177+ "codeQLQueryHistory.openOnGithub" : TreeViewContextMultiSelectionCommandFunction < QueryHistoryInfo > ;
178+ "codeQLQueryHistory.copyRepoList" : TreeViewContextMultiSelectionCommandFunction < QueryHistoryInfo > ;
144179
145180 // Commands in the command palette
146181 "codeQL.exportSelectedVariantAnalysisResults" : ( ) => Promise < void > ;
@@ -173,11 +208,11 @@ export type LocalDatabasesCommands = {
173208 ) => Promise < void > ;
174209
175210 // Database panel selection commands
176- "codeQLDatabases.removeDatabase" : SelectionCommandFunction < DatabaseItem > ;
177- "codeQLDatabases.upgradeDatabase" : SelectionCommandFunction < DatabaseItem > ;
178- "codeQLDatabases.renameDatabase" : SelectionCommandFunction < DatabaseItem > ;
179- "codeQLDatabases.openDatabaseFolder" : SelectionCommandFunction < DatabaseItem > ;
180- "codeQLDatabases.addDatabaseSource" : SelectionCommandFunction < DatabaseItem > ;
211+ "codeQLDatabases.removeDatabase" : TreeViewContextMultiSelectionCommandFunction < DatabaseItem > ;
212+ "codeQLDatabases.upgradeDatabase" : TreeViewContextMultiSelectionCommandFunction < DatabaseItem > ;
213+ "codeQLDatabases.renameDatabase" : TreeViewContextMultiSelectionCommandFunction < DatabaseItem > ;
214+ "codeQLDatabases.openDatabaseFolder" : TreeViewContextMultiSelectionCommandFunction < DatabaseItem > ;
215+ "codeQLDatabases.addDatabaseSource" : TreeViewContextMultiSelectionCommandFunction < DatabaseItem > ;
181216
182217 // Codespace template commands
183218 "codeQL.setDefaultTourDatabase" : ( ) => Promise < void > ;
@@ -222,11 +257,11 @@ export type DatabasePanelCommands = {
222257 "codeQLVariantAnalysisRepositories.addNewList" : ( ) => Promise < void > ;
223258 "codeQLVariantAnalysisRepositories.setupControllerRepository" : ( ) => Promise < void > ;
224259
225- "codeQLVariantAnalysisRepositories.setSelectedItem" : SingleSelectionCommandFunction < DbTreeViewItem > ;
226- "codeQLVariantAnalysisRepositories.setSelectedItemContextMenu" : SingleSelectionCommandFunction < DbTreeViewItem > ;
227- "codeQLVariantAnalysisRepositories.openOnGitHubContextMenu" : SingleSelectionCommandFunction < DbTreeViewItem > ;
228- "codeQLVariantAnalysisRepositories.renameItemContextMenu" : SingleSelectionCommandFunction < DbTreeViewItem > ;
229- "codeQLVariantAnalysisRepositories.removeItemContextMenu" : SingleSelectionCommandFunction < DbTreeViewItem > ;
260+ "codeQLVariantAnalysisRepositories.setSelectedItem" : TreeViewContextSingleSelectionCommandFunction < DbTreeViewItem > ;
261+ "codeQLVariantAnalysisRepositories.setSelectedItemContextMenu" : TreeViewContextSingleSelectionCommandFunction < DbTreeViewItem > ;
262+ "codeQLVariantAnalysisRepositories.openOnGitHubContextMenu" : TreeViewContextSingleSelectionCommandFunction < DbTreeViewItem > ;
263+ "codeQLVariantAnalysisRepositories.renameItemContextMenu" : TreeViewContextSingleSelectionCommandFunction < DbTreeViewItem > ;
264+ "codeQLVariantAnalysisRepositories.removeItemContextMenu" : TreeViewContextSingleSelectionCommandFunction < DbTreeViewItem > ;
230265} ;
231266
232267export type AstCfgCommands = {
0 commit comments