Merge pull request #2384 from github/robertbrignull/makeSelected
Fix not setting database as selected if it already exists
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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> {
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -112,6 +112,7 @@ export class TestRunner extends DisposableObject {
|
||||
},
|
||||
token,
|
||||
uri,
|
||||
false,
|
||||
);
|
||||
await this.databaseManager.renameDatabaseItem(
|
||||
reopenedDatabase,
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -172,6 +172,7 @@ describe("test-runner", () => {
|
||||
expect.anything(),
|
||||
expect.anything(),
|
||||
preTestDatabaseItem.databaseUri,
|
||||
false,
|
||||
);
|
||||
|
||||
expect(renameDatabaseItemSpy).toBeCalledTimes(1);
|
||||
|
||||
Reference in New Issue
Block a user