From 6f020d4b332b5ea2d78785bf25506be30cc7a8ae Mon Sep 17 00:00:00 2001 From: Koen Vlaswinkel Date: Fri, 8 Sep 2023 14:41:19 +0200 Subject: [PATCH] Sort methods alphabetically --- extensions/ql-vscode/src/model-editor/shared/sorting.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/extensions/ql-vscode/src/model-editor/shared/sorting.ts b/extensions/ql-vscode/src/model-editor/shared/sorting.ts index a7c26963682..6009e7ec46e 100644 --- a/extensions/ql-vscode/src/model-editor/shared/sorting.ts +++ b/extensions/ql-vscode/src/model-editor/shared/sorting.ts @@ -76,6 +76,13 @@ function compareMethod(a: Method, b: Method): number { if (!a.supported && b.supported) { return -1; } + // Then sort by number of usages descending - return b.usages.length - a.usages.length; + const usageDifference = b.usages.length - a.usages.length; + if (usageDifference !== 0) { + return usageDifference; + } + + // Then sort by method signature ascending + return a.signature.localeCompare(b.signature); }