Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions extensions/ql-vscode/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## [UNRELEASED]

- Fix bug where the "CodeQL: Set Current Database" command didn't always select the database. [#2384](https://github.com/github/vscode-codeql/pull/2384)

## 1.8.3 - 26 April 2023

- Added ability to filter repositories for a variant analysis to only those that have results [#2343](https://github.com/github/vscode-codeql/pull/2343)
Expand Down
7 changes: 5 additions & 2 deletions extensions/ql-vscode/src/databases/local-databases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ export class DatabaseManager extends DisposableObject {
progress: ProgressCallback,
token: vscode.CancellationToken,
uri: vscode.Uri,
makeSelected = false,
makeSelected = true,
displayName?: string,
isTutorialDatabase?: boolean,
): Promise<DatabaseItem> {
Expand All @@ -645,12 +645,15 @@ export class DatabaseManager extends DisposableObject {
public async addExistingDatabaseItem(
databaseItem: DatabaseItem,
progress: ProgressCallback,
makeSelected = true,
makeSelected: boolean,
token: vscode.CancellationToken,
isTutorialDatabase?: boolean,
): Promise<DatabaseItem> {
const existingItem = this.findDatabaseItem(databaseItem.databaseUri);
if (existingItem !== undefined) {
if (makeSelected) {
await this.setCurrentDatabaseItem(existingItem);
}
return existingItem;
}

Expand Down
1 change: 1 addition & 0 deletions extensions/ql-vscode/src/test-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export class TestRunner extends DisposableObject {
},
token,
uri,
false,
);
await this.databaseManager.renameDatabaseItem(
reopenedDatabase,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -749,17 +749,14 @@ describe("local databases", () => {
mockDbItem.databaseUri,
);

expect(resolveDatabaseContentsSpy).toBeCalledTimes(1);
expect(resolveDatabaseContentsSpy).toBeCalledTimes(2);
});

it("should set the database as the currently selected one", async () => {
const makeSelected = true;

await databaseManager.openDatabase(
{} as ProgressCallback,
{} as CancellationToken,
mockDbItem.databaseUri,
makeSelected,
);

expect(setCurrentDatabaseItemSpy).toBeCalledTimes(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ describe("test-runner", () => {
expect.anything(),
expect.anything(),
preTestDatabaseItem.databaseUri,
false,
);

expect(renameDatabaseItemSpy).toBeCalledTimes(1);
Expand Down