Skip to content

Commit ed9c95e

Browse files
committed
Add better log messages
1 parent f84f792 commit ed9c95e

3 files changed

Lines changed: 15 additions & 4 deletions

File tree

extensions/ql-vscode/src/databases/database-fetcher.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,9 @@ export async function importLocalDatabase(
318318
await commandManager.execute("codeQLDatabases.focus");
319319
void showAndLogInformationMessage(
320320
extLogger,
321-
"Database unzipped and imported successfully.",
321+
origin.type === "testproj"
322+
? "Test database imported successfully."
323+
: "Database unzipped and imported successfully.",
322324
);
323325
}
324326
return item;

extensions/ql-vscode/src/databases/local-databases-ui.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ import {
6161
tryGetQueryLanguage,
6262
} from "../common/query-language";
6363
import type { LanguageContextStore } from "../language-context-store";
64+
import { extLogger } from "../common/logging/vscode";
6465

6566
enum SortOrder {
6667
NameAsc = "NameAsc",
@@ -755,13 +756,12 @@ export class DatabaseUI extends DisposableObject {
755756
// Check if the database is already in the workspace. If
756757
// so, delete it first before importing the new one.
757758
const existingItem = this.databaseManager.findTestDatabase(uri);
759+
const baseName = basename(uri.fsPath);
758760
if (existingItem !== undefined) {
759761
progress({
760762
maxStep: 9,
761763
step: 1,
762-
message: `Removing existing test database ${basename(
763-
uri.fsPath,
764-
)}`,
764+
message: `Removing existing test database ${baseName}`,
765765
});
766766
await this.databaseManager.removeDatabaseItem(existingItem);
767767
}
@@ -774,6 +774,14 @@ export class DatabaseUI extends DisposableObject {
774774
progress,
775775
this.queryServer.cliServer,
776776
);
777+
778+
if (existingItem !== undefined) {
779+
progress({
780+
maxStep: 9,
781+
step: 9,
782+
message: `Successfully re-imported ${baseName}`,
783+
});
784+
}
777785
} catch (e) {
778786
// rethrow and let this be handled by default error handling.
779787
throw new Error(

extensions/ql-vscode/src/databases/local-databases/database-manager.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ export class DatabaseManager extends DisposableObject {
256256
dateAdded: Date.now(),
257257
language: dbItem.language,
258258
origin: dbItem.origin,
259+
extensionManagedLocation: dbItem.extensionManagedLocation,
259260
});
260261
await this.addDatabaseItem(newDbItem);
261262
await this.setCurrentDatabaseItem(newDbItem);

0 commit comments

Comments
 (0)