#UI_ENHANCEMENT by cg
authorClaus Gittinger <cg@exept.de>
Thu, 28 Apr 2016 15:42:57 +0200
changeset 5033 743f882894d9
parent 5031 ea94aa3cb834
child 5034 13a4d949449a
child 5035 5afe663f6f8d
#UI_ENHANCEMENT by cg class: DoWhatIMeanSupport changed: #codeCompletionForVariable:into: include global names in variable suggestion
DoWhatIMeanSupport.st
--- a/DoWhatIMeanSupport.st	Wed Apr 27 15:01:40 2016 +0200
+++ b/DoWhatIMeanSupport.st	Thu Apr 28 15:42:57 2016 +0200
@@ -3285,27 +3285,37 @@
     nameIsOK ifTrue:[
         "/ if the name already exists, only allow longer names, if there are
         longerNames := allTheBest select:[:assoc | assoc key startsWith:nm].
+        longerNames size < 30 ifTrue:[
+            longerNames := allTheBest select:[:assoc | assoc key includesString:nm caseSensitive:false].
+        ].
         longerNames notEmpty ifTrue:[
             allTheBest := longerNames.
         ].
     ].
-    allTheBest size > 15 ifTrue:[
-        "/ remove all those which are below some threshold or are a prefix
-        0.4 to:0.9 by:0.1 do:[:delta |
-            "/ if still too many, remove more and more
-            allTheBest size > 15 ifTrue:[
-                allTheBest := allDistances select:[:entry | (entry key startsWith:nm) or:[ entry value >= (bestAssoc value * delta) ]].
-            ]
-        ].
-        allTheBest size > 15 ifTrue:[
-            "/ remove all those which are below some threshold
-            0.4 to:0.9 by:0.1 do:[:delta |
-                "/ if still too many, remove more and more
-                allTheBest size > 15 ifTrue:[
-                    allTheBest := allDistances select:[:entry | entry value >= (bestAssoc value * delta) ].
-                ]
-            ].
-        ].
+    allTheBest size > 20 ifTrue:[
+        allTheBest := allTheBest copyTo:20.
+"/        "/ remove all those which are below some threshold or are a prefix
+"/        0.2 to:0.9 by:0.1 do:[:delta |
+"/            |bestValue n|
+"/            
+"/            "/ if still too many, remove more and more
+"/            allTheBest size > 50 ifTrue:[
+"/                bestValue := bestAssoc value * delta.
+"/                n := allTheBest select:[:entry | (entry key startsWith:nm) or:[ entry value >= bestValue ]].
+"/                n size >= 15 ifTrue:[ allTheBest := n ].
+"/            ]
+"/        ].
+"/        allTheBest size > 20 ifTrue:[
+"/            "/ remove all those which are below some threshold
+"/            0.2 to:0.9 by:0.1 do:[:delta |
+"/                |bestValue n|
+"/                "/ if still too many, remove more and more
+"/                allTheBest size > 20 ifTrue:[
+"/                    bestValue := bestAssoc value * delta.
+"/                    allTheBest := allTheBest select:[:entry | entry value >= bestValue ].
+"/                ]
+"/            ].
+"/        ].
     ].
     suggestions := allTheBest collect:[:assoc | assoc key].