From 646ecfd40546a50b4af41af033c9e2a5b82c12c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Kr=C3=B6g?= Date: Sat, 15 Feb 2020 22:12:06 +0100 Subject: [PATCH] Weight function prefer classes over modules --- config/jsdoc/api/template/static/scripts/main.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/config/jsdoc/api/template/static/scripts/main.js b/config/jsdoc/api/template/static/scripts/main.js index 3bd79e9e1b..2d32f6e9de 100644 --- a/config/jsdoc/api/template/static/scripts/main.js +++ b/config/jsdoc/api/template/static/scripts/main.js @@ -32,23 +32,20 @@ $(function () { if (beginOnly) { return re.baseName.test(name) ? 10000 : 0; } - let weight = 0; + // If everything else is equal, prefer shorter names, and prefer classes over modules + let weight = matchedItem.data('longname').length - name.length * 100; if (name.match(re.begin)) { - weight += 10000; + weight += 100000; if (re.baseName.test(name)) { - weight += 1000000; + weight += 10000000; if (re.fullName.test(name)) { - // Full match of the last part of the path is weighted even higher - weight += 10000000; + weight += 100000000; if (re.completeName.test(name)) { - // Complete match is weighted highest. - weight += 100000000; + weight += 1000000000; } } } } - // If everything else is equal, prefer shorter names. - weight -= name.length; return weight; } }