Pārlūkot izejas kodu

HUE-4642 [editor] Ace autocomplete should honour the weights for partial matching

Johan Ahlen 9 gadi atpakaļ
vecāks
revīzija
b4578d3

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
desktop/core/src/desktop/static/desktop/js/ace/ext-language_tools.js


+ 1 - 0
desktop/core/src/desktop/static/desktop/js/sqlAutocompleter2.js

@@ -455,6 +455,7 @@
     var currentScore = 1000;
     completions.forEach(function (completion) {
       completion.score = currentScore;
+      completion.prioritizeScore = true;
       currentScore--;
     });
 

+ 7 - 0
tools/ace-editor/lib/ace/autocomplete.js

@@ -437,6 +437,13 @@ var FilteredList = function(array, filterText) {
         this.filterText = str;
         matches = this.filterCompletions(matches, this.filterText);
         matches = matches.sort(function (a, b) {
+          if (a.prioritizeScore && b.prioritzeScore) {
+            return b.score - a.score
+          } else if (a.prioritizeScore) {
+            return -1;
+          } else if (b.prioritizeScore) {
+            return 1;
+          }
           var alpha = 0;
           if (a.caption > b.caption) {
             alpha = 1;

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels