@@ -14,18 +14,53 @@ import type {
1414import { QLDebugConfiguration } from "../debugger/debug-configuration" ;
1515
1616// A command function matching the signature that VS Code calls when
17- // a command on a selection is invoked.
18- export type SelectionCommandFunction < Item > = (
17+ // a command is invoked from the title bar of a TreeView with
18+ // canSelectMany set to true.
19+ //
20+ // It is possible to get any combination of singleItem and multiSelect
21+ // to be undefined. This is because it is possible to click a title bar
22+ // option without interacting with any individual items first, or even
23+ // when there are no items present at all.
24+ // If both singleItem and multiSelect are defined, then singleItem will
25+ // be contained within multiSelect.
26+ export type TreeViewTitleMultiSelectionCommandFunction < Item > = (
27+ singleItem : Item | undefined ,
28+ multiSelect : Item [ ] | undefined ,
29+ ) => Promise < void > ;
30+
31+ // A command function matching the signature that VS Code calls when
32+ // a command is invoked from a context menu on a TreeView with
33+ // canSelectMany set to true.
34+ //
35+ // singleItem will always be defined and corresponds to the item that
36+ // was hovered or right-clicked. If precisely one item was selected then
37+ // multiSelect will be undefined. If more than one item is selected then
38+ // multiSelect will contain all selected items, including singleItem.
39+ export type TreeViewContextMultiSelectionCommandFunction < Item > = (
1940 singleItem : Item ,
20- multiSelect : Item [ ] ,
41+ multiSelect : Item [ ] | undefined ,
2142) => Promise < void > ;
2243
2344// A command function matching the signature that VS Code calls when
24- // a command on a selection is invoked when canSelectMany is false.
25- export type SingleSelectionCommandFunction < Item > = (
45+ // a command is invoked from a context menu on a TreeView with
46+ // canSelectMany set to false.
47+ //
48+ // It is guaranteed that precisely one item will be selected.
49+ export type TreeViewContextSingleSelectionCommandFunction < Item > = (
2650 singleItem : Item ,
2751) => Promise < void > ;
2852
53+ // A command function matching the signature that VS Code calls when
54+ // a command is invoked from a context menu on the file explorer.
55+ //
56+ // singleItem corresponds to the item that was right-clicked.
57+ // multiSelect will always been defined and non-empty and contains
58+ // all selected items, including singleItem.
59+ export type ExplorerSelectionCommandFunction < Item > = (
60+ singleItem : Item ,
61+ multiSelect : Item [ ] ,
62+ ) => Promise < void > ;
63+
2964/**
3065 * Contains type definitions for all commands used by the extension.
3166 *
@@ -104,13 +139,13 @@ export type LocalQueryCommands = {
104139 "codeQL.runQueryOnMultipleDatabasesContextEditor" : (
105140 uri ?: Uri ,
106141 ) => Promise < void > ;
107- "codeQL.runQueries" : SelectionCommandFunction < Uri > ;
142+ "codeQL.runQueries" : ExplorerSelectionCommandFunction < Uri > ;
108143 "codeQL.quickEval" : ( uri : Uri ) => Promise < void > ;
109144 "codeQL.quickEvalContextEditor" : ( uri : Uri ) => Promise < void > ;
110145 "codeQL.codeLensQuickEval" : ( uri : Uri , range : Range ) => Promise < void > ;
111146 "codeQL.quickQuery" : ( ) => Promise < void > ;
112147 "codeQL.getCurrentQuery" : ( ) => Promise < string > ;
113- "codeQL.createSkeletonQuery " : ( ) => Promise < void > ;
148+ "codeQL.createQuery " : ( ) => Promise < void > ;
114149} ;
115150
116151// Debugger commands
@@ -140,28 +175,28 @@ export type QueryHistoryCommands = {
140175 "codeQLQueryHistory.sortByCount" : ( ) => Promise < void > ;
141176
142177 // Commands in the context menu or in the hover menu
143- "codeQLQueryHistory.openQueryTitleMenu" : SelectionCommandFunction < QueryHistoryInfo > ;
144- "codeQLQueryHistory.openQueryContextMenu" : SelectionCommandFunction < QueryHistoryInfo > ;
145- "codeQLQueryHistory.removeHistoryItemTitleMenu" : SelectionCommandFunction < QueryHistoryInfo > ;
146- "codeQLQueryHistory.removeHistoryItemContextMenu" : SelectionCommandFunction < QueryHistoryInfo > ;
147- "codeQLQueryHistory.removeHistoryItemContextInline" : SelectionCommandFunction < QueryHistoryInfo > ;
148- "codeQLQueryHistory.renameItem" : SelectionCommandFunction < QueryHistoryInfo > ;
149- "codeQLQueryHistory.compareWith" : SelectionCommandFunction < QueryHistoryInfo > ;
150- "codeQLQueryHistory.showEvalLog" : SelectionCommandFunction < QueryHistoryInfo > ;
151- "codeQLQueryHistory.showEvalLogSummary" : SelectionCommandFunction < QueryHistoryInfo > ;
152- "codeQLQueryHistory.showEvalLogViewer" : SelectionCommandFunction < QueryHistoryInfo > ;
153- "codeQLQueryHistory.showQueryLog" : SelectionCommandFunction < QueryHistoryInfo > ;
154- "codeQLQueryHistory.showQueryText" : SelectionCommandFunction < QueryHistoryInfo > ;
155- "codeQLQueryHistory.openQueryDirectory" : SelectionCommandFunction < QueryHistoryInfo > ;
156- "codeQLQueryHistory.cancel" : SelectionCommandFunction < QueryHistoryInfo > ;
157- "codeQLQueryHistory.exportResults" : SelectionCommandFunction < QueryHistoryInfo > ;
158- "codeQLQueryHistory.viewCsvResults" : SelectionCommandFunction < QueryHistoryInfo > ;
159- "codeQLQueryHistory.viewCsvAlerts" : SelectionCommandFunction < QueryHistoryInfo > ;
160- "codeQLQueryHistory.viewSarifAlerts" : SelectionCommandFunction < QueryHistoryInfo > ;
161- "codeQLQueryHistory.viewDil" : SelectionCommandFunction < QueryHistoryInfo > ;
162- "codeQLQueryHistory.itemClicked" : SelectionCommandFunction < QueryHistoryInfo > ;
163- "codeQLQueryHistory.openOnGithub" : SelectionCommandFunction < QueryHistoryInfo > ;
164- "codeQLQueryHistory.copyRepoList" : SelectionCommandFunction < QueryHistoryInfo > ;
178+ "codeQLQueryHistory.openQueryTitleMenu" : TreeViewTitleMultiSelectionCommandFunction < QueryHistoryInfo > ;
179+ "codeQLQueryHistory.openQueryContextMenu" : TreeViewContextMultiSelectionCommandFunction < QueryHistoryInfo > ;
180+ "codeQLQueryHistory.removeHistoryItemTitleMenu" : TreeViewTitleMultiSelectionCommandFunction < QueryHistoryInfo > ;
181+ "codeQLQueryHistory.removeHistoryItemContextMenu" : TreeViewContextMultiSelectionCommandFunction < QueryHistoryInfo > ;
182+ "codeQLQueryHistory.removeHistoryItemContextInline" : TreeViewContextMultiSelectionCommandFunction < QueryHistoryInfo > ;
183+ "codeQLQueryHistory.renameItem" : TreeViewContextMultiSelectionCommandFunction < QueryHistoryInfo > ;
184+ "codeQLQueryHistory.compareWith" : TreeViewContextMultiSelectionCommandFunction < QueryHistoryInfo > ;
185+ "codeQLQueryHistory.showEvalLog" : TreeViewContextMultiSelectionCommandFunction < QueryHistoryInfo > ;
186+ "codeQLQueryHistory.showEvalLogSummary" : TreeViewContextMultiSelectionCommandFunction < QueryHistoryInfo > ;
187+ "codeQLQueryHistory.showEvalLogViewer" : TreeViewContextMultiSelectionCommandFunction < QueryHistoryInfo > ;
188+ "codeQLQueryHistory.showQueryLog" : TreeViewContextMultiSelectionCommandFunction < QueryHistoryInfo > ;
189+ "codeQLQueryHistory.showQueryText" : TreeViewContextMultiSelectionCommandFunction < QueryHistoryInfo > ;
190+ "codeQLQueryHistory.openQueryDirectory" : TreeViewContextMultiSelectionCommandFunction < QueryHistoryInfo > ;
191+ "codeQLQueryHistory.cancel" : TreeViewContextMultiSelectionCommandFunction < QueryHistoryInfo > ;
192+ "codeQLQueryHistory.exportResults" : TreeViewContextMultiSelectionCommandFunction < QueryHistoryInfo > ;
193+ "codeQLQueryHistory.viewCsvResults" : TreeViewContextMultiSelectionCommandFunction < QueryHistoryInfo > ;
194+ "codeQLQueryHistory.viewCsvAlerts" : TreeViewContextMultiSelectionCommandFunction < QueryHistoryInfo > ;
195+ "codeQLQueryHistory.viewSarifAlerts" : TreeViewContextMultiSelectionCommandFunction < QueryHistoryInfo > ;
196+ "codeQLQueryHistory.viewDil" : TreeViewContextMultiSelectionCommandFunction < QueryHistoryInfo > ;
197+ "codeQLQueryHistory.itemClicked" : TreeViewTitleMultiSelectionCommandFunction < QueryHistoryInfo > ;
198+ "codeQLQueryHistory.openOnGithub" : TreeViewContextMultiSelectionCommandFunction < QueryHistoryInfo > ;
199+ "codeQLQueryHistory.copyRepoList" : TreeViewContextMultiSelectionCommandFunction < QueryHistoryInfo > ;
165200
166201 // Commands in the command palette
167202 "codeQL.exportSelectedVariantAnalysisResults" : ( ) => Promise < void > ;
@@ -194,11 +229,11 @@ export type LocalDatabasesCommands = {
194229 ) => Promise < void > ;
195230
196231 // Database panel selection commands
197- "codeQLDatabases.removeDatabase" : SelectionCommandFunction < DatabaseItem > ;
198- "codeQLDatabases.upgradeDatabase" : SelectionCommandFunction < DatabaseItem > ;
199- "codeQLDatabases.renameDatabase" : SelectionCommandFunction < DatabaseItem > ;
200- "codeQLDatabases.openDatabaseFolder" : SelectionCommandFunction < DatabaseItem > ;
201- "codeQLDatabases.addDatabaseSource" : SelectionCommandFunction < DatabaseItem > ;
232+ "codeQLDatabases.removeDatabase" : TreeViewContextMultiSelectionCommandFunction < DatabaseItem > ;
233+ "codeQLDatabases.upgradeDatabase" : TreeViewContextMultiSelectionCommandFunction < DatabaseItem > ;
234+ "codeQLDatabases.renameDatabase" : TreeViewContextMultiSelectionCommandFunction < DatabaseItem > ;
235+ "codeQLDatabases.openDatabaseFolder" : TreeViewContextMultiSelectionCommandFunction < DatabaseItem > ;
236+ "codeQLDatabases.addDatabaseSource" : TreeViewContextMultiSelectionCommandFunction < DatabaseItem > ;
202237
203238 // Codespace template commands
204239 "codeQL.setDefaultTourDatabase" : ( ) => Promise < void > ;
@@ -244,11 +279,11 @@ export type DatabasePanelCommands = {
244279 "codeQLVariantAnalysisRepositories.addNewList" : ( ) => Promise < void > ;
245280 "codeQLVariantAnalysisRepositories.setupControllerRepository" : ( ) => Promise < void > ;
246281
247- "codeQLVariantAnalysisRepositories.setSelectedItem" : SingleSelectionCommandFunction < DbTreeViewItem > ;
248- "codeQLVariantAnalysisRepositories.setSelectedItemContextMenu" : SingleSelectionCommandFunction < DbTreeViewItem > ;
249- "codeQLVariantAnalysisRepositories.openOnGitHubContextMenu" : SingleSelectionCommandFunction < DbTreeViewItem > ;
250- "codeQLVariantAnalysisRepositories.renameItemContextMenu" : SingleSelectionCommandFunction < DbTreeViewItem > ;
251- "codeQLVariantAnalysisRepositories.removeItemContextMenu" : SingleSelectionCommandFunction < DbTreeViewItem > ;
282+ "codeQLVariantAnalysisRepositories.setSelectedItem" : TreeViewContextSingleSelectionCommandFunction < DbTreeViewItem > ;
283+ "codeQLVariantAnalysisRepositories.setSelectedItemContextMenu" : TreeViewContextSingleSelectionCommandFunction < DbTreeViewItem > ;
284+ "codeQLVariantAnalysisRepositories.openOnGitHubContextMenu" : TreeViewContextSingleSelectionCommandFunction < DbTreeViewItem > ;
285+ "codeQLVariantAnalysisRepositories.renameItemContextMenu" : TreeViewContextSingleSelectionCommandFunction < DbTreeViewItem > ;
286+ "codeQLVariantAnalysisRepositories.removeItemContextMenu" : TreeViewContextSingleSelectionCommandFunction < DbTreeViewItem > ;
252287} ;
253288
254289export type AstCfgCommands = {
0 commit comments