Skip to content
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

Sort databases by name if their languages are the same #3055

Merged
merged 1 commit into from
Nov 6, 2023
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]

- The "Sort by Language" action in the databases view now sorts by name within each language. [#3055](https://github.com/github/vscode-codeql/pull/3055)

## 1.9.4 - 6 November 2023

No user facing changes.
Expand Down
12 changes: 10 additions & 2 deletions extensions/ql-vscode/src/databases/local-databases-ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,17 @@ class DatabaseTreeDataProvider
case SortOrder.NameDesc:
return db2.name.localeCompare(db1.name, env.language);
case SortOrder.LanguageAsc:
return db1.language.localeCompare(db2.language, env.language);
return (
db1.language.localeCompare(db2.language, env.language) ||
// If the languages are the same, sort by name
db1.name.localeCompare(db2.name, env.language)
);
case SortOrder.LanguageDesc:
return db2.language.localeCompare(db1.language, env.language);
return (
db2.language.localeCompare(db1.language, env.language) ||
// If the languages are the same, sort by name
db2.name.localeCompare(db1.name, env.language)
);
case SortOrder.DateAddedAsc:
return (db1.dateAdded || 0) - (db2.dateAdded || 0);
case SortOrder.DateAddedDesc:
Expand Down
Loading