Skip to content

Commit ca21ed1

Browse files
committed
Import testproj databases into workspace storage
If a folder that ends with `.testproj` is encountered, assume it is a database created by a codeql test. When the user wants to import this database, copy it into workspace storage. The database can be re-imported, which first removes the old version before importing it again.
1 parent 8063d6c commit ca21ed1

10 files changed

Lines changed: 322 additions & 28 deletions

File tree

extensions/ql-vscode/package-lock.json

Lines changed: 140 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

extensions/ql-vscode/package.json

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,10 @@
738738
"command": "codeQL.setCurrentDatabase",
739739
"title": "CodeQL: Set Current Database"
740740
},
741+
{
742+
"command": "codeQL.importTestDatabase",
743+
"title": "CodeQL: (Re-)Import Test Database"
744+
},
741745
{
742746
"command": "codeQL.getCurrentDatabase",
743747
"title": "CodeQL: Get Current Database"
@@ -1322,7 +1326,12 @@
13221326
{
13231327
"command": "codeQL.setCurrentDatabase",
13241328
"group": "9_qlCommands",
1325-
"when": "resourceScheme == codeql-zip-archive || explorerResourceIsFolder || resourceExtname == .zip"
1329+
"when": "resourceExtname != .testproj && (resourceScheme == codeql-zip-archive || explorerResourceIsFolder || resourceExtname == .zipz)"
1330+
},
1331+
{
1332+
"command": "codeQL.importTestDatabase",
1333+
"group": "9_qlCommands",
1334+
"when": "explorerResourceIsFolder && resourceExtname == .testproj"
13261335
},
13271336
{
13281337
"command": "codeQL.viewAstContextExplorer",
@@ -1476,6 +1485,10 @@
14761485
"command": "codeQL.setCurrentDatabase",
14771486
"when": "false"
14781487
},
1488+
{
1489+
"command": "codeQL.importTestDatabase",
1490+
"when": "false"
1491+
},
14791492
{
14801493
"command": "codeQL.getCurrentDatabase",
14811494
"when": "false"
@@ -2068,7 +2081,8 @@
20682081
"ts-loader": "^9.4.2",
20692082
"ts-node": "^10.7.0",
20702083
"ts-unused-exports": "^10.0.0",
2071-
"typescript": "^5.0.2"
2084+
"typescript": "^5.0.2",
2085+
"unzipper": "^0.10.14"
20722086
},
20732087
"lint-staged": {
20742088
"./**/*.{json,css,scss}": [

extensions/ql-vscode/src/common/commands.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ export type LocalDatabasesCommands = {
220220

221221
// Explorer context menu
222222
"codeQL.setCurrentDatabase": (uri: Uri) => Promise<void>;
223+
"codeQL.importTestDatabase": (uri: Uri) => Promise<void>;
223224

224225
// Database panel view title commands
225226
"codeQLDatabases.chooseDatabaseFolder": () => Promise<void>;

0 commit comments

Comments
 (0)