Skip to content

Fix issue where 'Set current database' shows on selected database in … #976

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 19, 2021
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: 1 addition & 1 deletion extensions/ql-vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@
{
"command": "codeQLDatabases.setCurrentDatabase",
"group": "inline",
"when": "view == codeQLDatabases"
"when": "view == codeQLDatabases && viewItem != currentDatabase"
},
{
"command": "codeQLDatabases.removeDatabase",
Expand Down
1 change: 1 addition & 0 deletions extensions/ql-vscode/src/databases-ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ class DatabaseTreeDataProvider extends DisposableObject
this.extensionPath,
SELECTED_DATABASE_ICON
);
item.contextValue = 'currentDatabase';
} else if (element.error !== undefined) {
item.iconPath = joinThemableIconPath(
this.extensionPath,
Expand Down
2 changes: 2 additions & 0 deletions extensions/ql-vscode/src/databases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,8 @@ export class DatabaseManager extends DisposableObject {
this._currentDatabaseItem = item;
this.updatePersistedCurrentDatabaseItem();

await vscode.commands.executeCommand('setContext', 'codeQL.currentDatabaseItem', item?.name);

this._onDidChangeCurrentDatabaseItem.fire({
item,
kind: DatabaseEventKind.Change
Expand Down