DoWhatIMeanSupport.st
changeset 5637 c37992ea83d4
parent 5633 f888f84e67f7
child 5658 22ffe8e819d6
--- a/DoWhatIMeanSupport.st	Sun Nov 12 13:57:54 2017 +0100
+++ b/DoWhatIMeanSupport.st	Sun Nov 19 15:03:33 2017 +0100
@@ -2938,7 +2938,7 @@
      allSelectors
      selectorsForIsXXXTests selectorsSentInClass selectorsImplementedInSuper 
      editAction editActionForArg argNames selectorsForVars
-     selectorTypedSoFar addIfNotYetImplemented alreadyOK processMenu|
+     selectorTypedSoFar selectorTypedSoFarLC addIfNotYetImplemented alreadyOK processMenu|
 
     allSelectors := Set new.
 
@@ -2948,6 +2948,8 @@
     crsrPos := codeView characterPositionOfCursor - 1.
 
     selectorTypedSoFar := node selector.
+    selectorTypedSoFarLC := selectorTypedSoFar asLowercase.
+    
     selectorTypedSoFar isUnarySelector ifTrue:[
         "/ user has just begun to edit a selector.
         "/ often, a good completion are the names of instVars for which no corresponding getter/setter exists
@@ -2959,7 +2961,8 @@
             
             addIfNotYetImplemented :=
                 [:list :sel |
-                    sel ~= selectorTypedSoFar ifTrue:[    
+                sel = 'max:' ifTrue:[self halt].
+                    (sel sameAs: selectorTypedSoFar) ifFalse:[    
                         (allSelectors includes:sel) ifFalse:[
                             (classOrNil implements:sel asSymbol) ifFalse:[ 
                                 list add:sel.
@@ -2980,7 +2983,7 @@
                     |nmSel|
 
                     nmSel := nm asLowercaseFirst.
-                    (nmSel startsWith:selectorTypedSoFar) ifTrue:[
+                    (nmSel startsWith:selectorTypedSoFarLC) ifTrue:[
                         addIfNotYetImplemented value:selectorsForVars value:nmSel.
                         addIfNotYetImplemented value:selectorsForVars value:(nmSel,':').
                     ]
@@ -3122,20 +3125,21 @@
     matchingSelectors remove:selectorTypedSoFar ifAbsent:[].
     
     selectors := Set new.
-    selectors addAll:matchingSelectors.
             
-    selectorsForVars notNil ifTrue:[ selectors addAll:selectorsForVars ].
+    selectorsForVars notNil ifTrue:[ 
+        selectors addAll:selectorsForVars 
+    ].
     selectorsSentInClass notNil ifTrue:[ selectors addAll:selectorsSentInClass ].
     selectorsImplementedInSuper notNil ifTrue:[ selectors addAll:selectorsImplementedInSuper ].
     selectorsForIsXXXTests notNil ifTrue:[ selectors addAll:selectorsForIsXXXTests ].
         
+    (selectors count:[:sel | sel asLowercase startsWith:selectorTypedSoFarLC]) == 0 ifTrue:[
+        selectors addAll:matchingSelectors.
+    ].    
+
     selectors := selectors asOrderedCollection.
     selectors sort:[:a :b | a size < b size].
-    selectorsForVars notEmptyOrNil ifTrue:[
-        selectors := self 
-                        splitSelectorList:selectors 
-                        by:[:sel | selectorsForVars includes:sel].
-    ].
+
     selectorsSentInClass notEmptyOrNil ifTrue:[
         selectors := self 
                         splitSelectorList:selectors 
@@ -3146,6 +3150,16 @@
                         splitSelectorList:selectors 
                         by:[:sel | selectorsImplementedInSuper includes:sel].
     ].
+
+    selectors := self 
+                    splitSelectorList:selectors 
+                    by:[:sel | sel asLowercase startsWith:selectorTypedSoFarLC].
+
+    selectorsForVars notEmptyOrNil ifTrue:[
+        selectors := self 
+                        splitSelectorList:selectors 
+                        by:[:sel | selectorsForVars includes:sel].
+    ].
     selectorsForIsXXXTests notEmptyOrNil ifTrue:[
         selectors := self 
                         splitSelectorList:selectors 
@@ -3238,7 +3252,7 @@
     "Modified: / 04-07-2006 / 18:48:26 / fm"
     "Created: / 10-11-2006 / 13:46:44 / cg"
     "Modified: / 16-02-2010 / 10:13:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 10-09-2017 / 14:51:26 / cg"
+    "Modified: / 19-11-2017 / 14:47:34 / cg"
 !
 
 codeCompletionForTempVariable:node into:actionBlock