|
1 | 1 | import type { CommandManager } from "../packages/commands"; |
2 | | -import type { Uri } from "vscode"; |
| 2 | +import type { Uri, Range } from "vscode"; |
3 | 3 | import type { DbTreeViewItem } from "../databases/ui/db-tree-view-item"; |
4 | 4 | import type { DatabaseItem } from "../local-databases"; |
5 | 5 | import type { QueryHistoryInfo } from "../query-history/query-history-info"; |
@@ -27,6 +27,23 @@ export type SingleSelectionCommandFunction<Item> = ( |
27 | 27 | // Base commands not tied directly to a module like e.g. variant analysis. |
28 | 28 | export type BaseCommands = { |
29 | 29 | "codeQL.openDocumentation": () => Promise<void>; |
| 30 | + |
| 31 | + "codeQL.restartQueryServer": () => Promise<void>; |
| 32 | +}; |
| 33 | + |
| 34 | +// Commands used for running local queries |
| 35 | +export type LocalQueryCommands = { |
| 36 | + "codeQL.runQuery": (uri?: Uri) => Promise<void>; |
| 37 | + "codeQL.runQueryContextEditor": (uri?: Uri) => Promise<void>; |
| 38 | + "codeQL.runQueryOnMultipleDatabases": (uri?: Uri) => Promise<void>; |
| 39 | + "codeQL.runQueryOnMultipleDatabasesContextEditor": ( |
| 40 | + uri?: Uri, |
| 41 | + ) => Promise<void>; |
| 42 | + "codeQL.runQueries": SelectionCommandFunction<Uri>; |
| 43 | + "codeQL.quickEval": (uri: Uri) => Promise<void>; |
| 44 | + "codeQL.quickEvalContextEditor": (uri: Uri) => Promise<void>; |
| 45 | + "codeQL.codeLensQuickEval": (uri: Uri, range: Range) => Promise<void>; |
| 46 | + "codeQL.quickQuery": () => Promise<void>; |
30 | 47 | }; |
31 | 48 |
|
32 | 49 | // Commands used for the query history panel |
@@ -63,27 +80,42 @@ export type QueryHistoryCommands = { |
63 | 80 |
|
64 | 81 | // Commands used for the local databases panel |
65 | 82 | export type LocalDatabasesCommands = { |
66 | | - "codeQL.setCurrentDatabase": (uri: Uri) => Promise<void>; |
67 | | - "codeQL.setDefaultTourDatabase": () => Promise<void>; |
| 83 | + // Command palette commands |
| 84 | + "codeQL.chooseDatabaseFolder": () => Promise<void>; |
| 85 | + "codeQL.chooseDatabaseArchive": () => Promise<void>; |
| 86 | + "codeQL.chooseDatabaseInternet": () => Promise<void>; |
| 87 | + "codeQL.chooseDatabaseGithub": () => Promise<void>; |
68 | 88 | "codeQL.upgradeCurrentDatabase": () => Promise<void>; |
69 | 89 | "codeQL.clearCache": () => Promise<void>; |
70 | 90 |
|
| 91 | + // Explorer context menu |
| 92 | + "codeQL.setCurrentDatabase": (uri: Uri) => Promise<void>; |
| 93 | + |
| 94 | + // Database panel view title commands |
71 | 95 | "codeQLDatabases.chooseDatabaseFolder": () => Promise<void>; |
72 | 96 | "codeQLDatabases.chooseDatabaseArchive": () => Promise<void>; |
73 | 97 | "codeQLDatabases.chooseDatabaseInternet": () => Promise<void>; |
74 | 98 | "codeQLDatabases.chooseDatabaseGithub": () => Promise<void>; |
| 99 | + "codeQLDatabases.sortByName": () => Promise<void>; |
| 100 | + "codeQLDatabases.sortByDateAdded": () => Promise<void>; |
| 101 | + |
| 102 | + // Database panel context menu |
75 | 103 | "codeQLDatabases.setCurrentDatabase": ( |
76 | 104 | databaseItem: DatabaseItem, |
77 | 105 | ) => Promise<void>; |
78 | | - "codeQLDatabases.sortByName": () => Promise<void>; |
79 | | - "codeQLDatabases.sortByDateAdded": () => Promise<void>; |
80 | | - "codeQLDatabases.removeOrphanedDatabases": () => Promise<void>; |
81 | 106 |
|
| 107 | + // Database panel selection commands |
82 | 108 | "codeQLDatabases.removeDatabase": SelectionCommandFunction<DatabaseItem>; |
83 | 109 | "codeQLDatabases.upgradeDatabase": SelectionCommandFunction<DatabaseItem>; |
84 | 110 | "codeQLDatabases.renameDatabase": SelectionCommandFunction<DatabaseItem>; |
85 | 111 | "codeQLDatabases.openDatabaseFolder": SelectionCommandFunction<DatabaseItem>; |
86 | 112 | "codeQLDatabases.addDatabaseSource": SelectionCommandFunction<DatabaseItem>; |
| 113 | + |
| 114 | + // Codespace template commands |
| 115 | + "codeQL.setDefaultTourDatabase": () => Promise<void>; |
| 116 | + |
| 117 | + // Internal commands |
| 118 | + "codeQLDatabases.removeOrphanedDatabases": () => Promise<void>; |
87 | 119 | }; |
88 | 120 |
|
89 | 121 | // Commands tied to variant analysis |
@@ -113,11 +145,20 @@ export type PackagingCommands = { |
113 | 145 | "codeQL.downloadPacks": () => Promise<void>; |
114 | 146 | }; |
115 | 147 |
|
| 148 | +export type EvalLogViewerCommands = { |
| 149 | + "codeQLEvalLogViewer.clear": () => Promise<void>; |
| 150 | +}; |
| 151 | + |
116 | 152 | export type AllCommands = BaseCommands & |
117 | 153 | QueryHistoryCommands & |
118 | 154 | LocalDatabasesCommands & |
119 | 155 | VariantAnalysisCommands & |
120 | 156 | DatabasePanelCommands & |
121 | | - PackagingCommands; |
| 157 | + PackagingCommands & |
| 158 | + EvalLogViewerCommands; |
122 | 159 |
|
123 | 160 | export type AppCommandManager = CommandManager<AllCommands>; |
| 161 | + |
| 162 | +// Separate command manager because it uses a different logger |
| 163 | +export type QueryServerCommands = LocalQueryCommands; |
| 164 | +export type QueryServerCommandManager = CommandManager<QueryServerCommands>; |
0 commit comments