DoWhatIMeanSupport.st
changeset 3731 eb92d54a47ac
parent 3720 f37c0d1757e3
child 3734 0e36383745e0
--- a/DoWhatIMeanSupport.st	Fri Aug 07 18:53:19 2009 +0200
+++ b/DoWhatIMeanSupport.st	Wed Aug 12 20:27:22 2009 +0200
@@ -69,19 +69,20 @@
         ^ self.
     ].
 
+    crsrPos := codeView characterPositionOfCursor-1.
+    char := codeView characterAtCharacterPosition:crsrPos.
+    [crsrPos > 1 and:[char isSeparator or:['.' includes:char]]] whileTrue:[
+        crsrPos := crsrPos - 1.
+        char := codeView characterAtCharacterPosition:crsrPos.
+    ].
+
     interval := codeView selectedInterval.
     interval isEmpty ifTrue:[
-        crsrPos := codeView characterPositionOfCursor-1.
-        char := codeView characterAtCharacterPosition:crsrPos.
-
-        [crsrPos > 1 and:[char isSeparator or:['.' includes:char]]] whileTrue:[
-            crsrPos := crsrPos - 1.
-            char := codeView characterAtCharacterPosition:crsrPos.
-        ].
         interval := crsrPos to:crsrPos.
     ].
 
     source := codeView contentsAsString string.
+    source := source copyTo:crsrPos.
 
     "/ this is too naive and stupid; if there is a syntactic error,
     "/ we will not find a node for a long time (stepping back more and more,
@@ -248,22 +249,17 @@
         srchClass := self lookupClassForMessage:node inClass:cls.
 
         srchClass notNil ifTrue:[
-            bestSelectors := Parser findBestSelectorsFor:selector in:srchClass.
+            bestSelectors := Parser findBest:30 selectorsFor:selector in:srchClass forCompletion:true.
         ] ifFalse:[
             codeView topView withCursor:(Cursor questionMark) do:[
-                bestSelectors := Parser findBestSelectorsFor:selector.
+                bestSelectors := Parser findBest:30 selectorsFor:selector in:nil forCompletion:true.
             ].
         ].
 
         (bestSelectors includes:selector) ifTrue:[
             bestSelectors := bestSelectors select:[:sel | sel size > selector size].
         ].
-        bestPrefixes := bestSelectors select:[:sel | sel asLowercase startsWith:selector asLowercase].
-        bestPrefixes size > 0 ifTrue:[
-            bestPrefixes
-        ] ifFalse:[
-            bestSelectors
-        ]
+        bestSelectors
     ].
 
     selector := node selector.
@@ -1804,5 +1800,5 @@
 !DoWhatIMeanSupport class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/DoWhatIMeanSupport.st,v 1.56 2009-07-14 13:22:30 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/DoWhatIMeanSupport.st,v 1.57 2009-08-12 18:27:22 cg Exp $'
 ! !