Skip to content

Commit f48176b

Browse files
committed
Re-sort databases list after db rename
1 parent 83f64fb commit f48176b

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

extensions/ql-vscode/CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- Alter structure of the _Test Explorer_ tree. It now follows the structure of the filesystem instead of the QL Packs. [#624](https://github.com/github/vscode-codeql/pull/624)
99
- Add more structured output for tests. [#626](https://github.com/github/vscode-codeql/pull/626)
1010
- Whenever the extension restarts, orphaned databases will be cleaned up. These are databases whose files are located inside of the extension's storage area, but are not imported into the workspace.
11+
- After renaming a database, the database list is re-sorted. [#685](https://github.com/github/vscode-codeql/pull/685)
1112

1213
## 1.3.6 - 4 November 2020
1314

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import {
3737
promptImportInternetDatabase,
3838
promptImportLgtmDatabase,
3939
} from './databaseFetcher';
40-
import { CancellationToken } from 'vscode-jsonrpc';
40+
import { CancellationToken } from 'vscode';
4141
import { asyncFilter } from './pure/helpers-pure';
4242

4343
type ThemableIconPath = { light: string; dark: string } | string;

extensions/ql-vscode/src/databases.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,8 @@ export class DatabaseManager extends DisposableObject {
667667
item.name = newName;
668668
this.updatePersistedDatabaseList();
669669
this._onDidChangeDatabaseItem.fire({
670-
item,
670+
// pass undefined so that the entire tree is rebuilt in order to re-sort
671+
item: undefined,
671672
kind: DatabaseEventKind.Rename
672673
});
673674
}

extensions/ql-vscode/src/vscode-tests/no-workspace/databases.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ describe('databases', () => {
8383
expect(mockDbItem.name).to.eq('new name');
8484
expect(updateSpy).to.have.been.calledWith('databaseList', ['new name']);
8585
expect(spy).to.have.been.calledWith({
86-
item: mockDbItem,
86+
item: undefined,
8787
kind: DatabaseEventKind.Rename
8888
});
8989
});

0 commit comments

Comments
 (0)