#BUGFIX by cg
authorClaus Gittinger <cg@exept.de>
Sat, 08 Apr 2017 16:41:54 +0200
changeset 5528 c514dd6f6e3b
parent 5527 43de5aae90dc
child 5529 4eee15e7acbe
#BUGFIX by cg class: DoWhatIMeanSupport comment/format in: #tryCodeCompletionWithSource:nodeInterval:at:mustBeExpression:into: changed: #codeCompletionForMessage:into: #codeCompletionForSmalltalkMethod:orClass:context:codeView:into:
DoWhatIMeanSupport.st
--- a/DoWhatIMeanSupport.st	Fri Apr 07 03:47:40 2017 +0000
+++ b/DoWhatIMeanSupport.st	Sat Apr 08 16:41:54 2017 +0200
@@ -1694,6 +1694,14 @@
         ].
     ].
     
+    true "suggestions isNil" ifTrue:[
+        "/ try parsing the partial source (from beginning up to the cursor)
+        self
+            tryCodeCompletionWithSource:partialSource nodeInterval:interval
+            at:crsrPos mustBeExpression:(classOrNilArg isNil and:[methodOrNilArg isNil])
+            into:suggestionCollector.
+    ].
+
     true "suggestions isEmptyOrNil" ifTrue:[
         "/ try parsing the whole source
         self
@@ -1702,14 +1710,6 @@
             into:suggestionCollector
     ].
     
-    true "suggestions isNil" ifTrue:[
-        "/ try parsing the partial source (from beginning up to the cursor)
-        self
-            tryCodeCompletionWithSource:partialSource nodeInterval:interval
-            at:crsrPos mustBeExpression:(classOrNilArg isNil and:[methodOrNilArg isNil])
-            into:suggestionCollector.
-    ].
-    
     suggestions isEmptyOrNil ifTrue:[
         "/ nothing found
         ^ self
@@ -1717,8 +1717,7 @@
     actionBlock value:suggestions value:actions value:title.
 
     "Created: / 18-09-2013 / 15:25:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 01-03-2017 / 15:40:06 / cg"
-    "Modified (format): / 22-03-2017 / 12:28:35 / cg"
+    "Modified: / 08-04-2017 / 16:31:11 / cg"
 ! !
 
 !DoWhatIMeanSupport methodsFor:'code completion - obsolete'!
@@ -2163,6 +2162,7 @@
                 offerParenthisationAroundNode := parentNode.
                 "/ Transcript show:'2:'; showCR:parentNode.
             ].
+            parentSelector := newParentSelector.
         ] ifFalse:[
             |kwSels|
  
@@ -2430,6 +2430,10 @@
         ]
     ].    
     selectorsImplementedInClass notNil ifTrue:[
+        (parentSelector notNil and:[parentSelector includes:$:]) ifTrue:[
+            selectorsImplementedInClass := selectorsImplementedInClass reject:[:sel | sel isKeywordSelector].
+        ].
+        
         "/ the one's implemented in the class itself are moved to the top of the list.
         allBest := self 
                     splitSelectorList:allBest 
@@ -2444,6 +2448,12 @@
                     by:[:sel | otherMessagesToReceiver "selectorsSentInCode" includes:sel].
     ].
  
+    (parentSelector notNil and:[parentSelector includes:$:]) ifTrue:[
+        allBest := self 
+                    splitSelectorList:allBest 
+                    by:[:sel | sel startsWith:parentSelector].
+    ].
+    
 "/ this makes it very slow
 "/false ifTrue:[
 "/    srchClass notNil ifTrue:[
@@ -2464,10 +2474,12 @@
 "/    self information:info.
 "/].
  
-    "/ the one's which are a prefix are moved towards the top of the list
-    allBest := self splitSelectorList:allBest 
-                    by:[:sel | sel notNil and:[sel asLowercase startsWith:lcSelector]].
- 
+    (parentSelector notNil and:[parentSelector includes:$:]) ifTrue:[
+        "/ the one's which are a prefix are moved towards the top of the list
+        allBest := self splitSelectorList:allBest 
+                        by:[:sel | sel notNil and:[sel asLowercase startsWith:lcSelector]].
+    ].
+    
     "/ heuristic hack:
     "/ 'i' and 'w' generate lists in which ifXXX / whileXXX are not at the top of the list.
     "/ we know, that those are most often wanted!!
@@ -2481,6 +2493,15 @@
 
     self sortUsefulSelectorsIn:allBest. "/cosmetics
 
+    (parentSelector notNil and:[parentSelector includes:$:]) ifTrue:[
+        allBest := (allBest 
+                        select:[:sel | sel startsWith:parentSelector]
+                        thenCollect:[:sel | sel copyFrom:(parentSelector lastIndexOf:$:)+1])
+                    ,
+                    (allBest 
+                        reject:[:sel | sel startsWith:parentSelector]).
+    ].
+    
     "/ parenthesizers always at the end.
     bestWithParenthesis notEmptyOrNil ifTrue:[ 
         allBest := allBest , bestWithParenthesis.
@@ -2674,12 +2695,11 @@
                     info:'Completion'.
             ].
         ].
- 
     actionBlock value:allBest value:editAction value:nil.
 
     "Created: / 10-11-2006 / 13:18:27 / cg"
     "Modified: / 16-02-2010 / 10:33:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 19-02-2017 / 12:42:23 / cg"
+    "Modified: / 08-04-2017 / 16:29:29 / cg"
 !
 
 codeCompletionForMessageTo:node into:actionBlock
@@ -4623,7 +4643,7 @@
                     ].
                 ].    
             ].    
-        ].    
+        ].
     ].
 
     (node isVariable or:[node isBlock and:[node stop notNil]]) ifTrue:[
@@ -4676,7 +4696,7 @@
     self information:'Node is neither variable nor message.'.
 
     "Modified: / 04-07-2006 / 18:48:26 / fm"
-    "Modified: / 22-03-2017 / 12:33:31 / cg"
+    "Modified: / 08-04-2017 / 16:01:14 / cg"
 !
 
 withoutSelectorsUnlikelyFor:aClass from:selectorsArg forPartial:partialSelector