Skip to content

Commit 6b57993

Browse files
authored
Merge pull request #976 from marcnjaramillo/selected-database-view
Fix issue where 'Set current database' shows on selected database in …
2 parents b8618aa + 34ac30e commit 6b57993

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

extensions/ql-vscode/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@
604604
{
605605
"command": "codeQLDatabases.setCurrentDatabase",
606606
"group": "inline",
607-
"when": "view == codeQLDatabases"
607+
"when": "view == codeQLDatabases && viewItem != currentDatabase"
608608
},
609609
{
610610
"command": "codeQLDatabases.removeDatabase",

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

+1
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ class DatabaseTreeDataProvider extends DisposableObject
135135
this.extensionPath,
136136
SELECTED_DATABASE_ICON
137137
);
138+
item.contextValue = 'currentDatabase';
138139
} else if (element.error !== undefined) {
139140
item.iconPath = joinThemableIconPath(
140141
this.extensionPath,

extensions/ql-vscode/src/databases.ts

+2
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,8 @@ export class DatabaseManager extends DisposableObject {
731731
this._currentDatabaseItem = item;
732732
this.updatePersistedCurrentDatabaseItem();
733733

734+
await vscode.commands.executeCommand('setContext', 'codeQL.currentDatabaseItem', item?.name);
735+
734736
this._onDidChangeCurrentDatabaseItem.fire({
735737
item,
736738
kind: DatabaseEventKind.Change

0 commit comments

Comments
 (0)