DoWhatIMeanSupport.st
changeset 6022 ccbc2453e82d
parent 6013 36f85fdcc2eb
child 6036 171e12f06b70
--- a/DoWhatIMeanSupport.st	Sat Mar 02 12:23:52 2019 +0100
+++ b/DoWhatIMeanSupport.st	Sun Mar 03 22:54:48 2019 +0100
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 2002 by eXept Software AG
 	      All Rights Reserved
@@ -258,7 +260,7 @@
 classCategoryCompletion:aPartialCategory inEnvironment:anEnvironment
     "given a partial class category name, return an array consisting of
      2 entries: 1st: the best (longest) match
-		2nd: collection consisting of matching categories"
+                2nd: collection consisting of matching categories"
 
     |matches best lcName|
 
@@ -266,31 +268,31 @@
 
     "/ search for exact match
     anEnvironment allClassesDo:[:aClass |
-	|category|
-
-	category := aClass category.
-	(category notNil and:[category startsWith:aPartialCategory]) ifTrue:[
-	    matches add:category
-	]
+        |category|
+
+        category := aClass category.
+        (category notNil and:[category startsWith:aPartialCategory]) ifTrue:[
+            matches add:category
+        ]
     ].
     matches isEmpty ifTrue:[
-	"/ search for case-ignoring match
-	lcName := aPartialCategory asLowercase.
-	anEnvironment allClassesDo:[:aClass |
-	    |category|
-
-	    category := aClass category.
-	    (category notNil and:[category asLowercase startsWith:lcName]) ifTrue:[
-		matches add:category
-	    ].
-	].
+        "/ search for case-ignoring match
+        lcName := aPartialCategory asLowercase.
+        anEnvironment allClassesDo:[:aClass |
+            |category|
+
+            category := aClass category.
+            (category notNil and:[category asLowercase startsWith:lcName]) ifTrue:[
+                matches add:category
+            ].
+        ].
     ].
 
     matches isEmpty ifTrue:[
-	^ Array with:aPartialCategory with:(Array with:aPartialCategory)
+        ^ Array with:aPartialCategory with:(Array with:aPartialCategory)
     ].
     matches size == 1 ifTrue:[
-	^ Array with:matches first with:(matches asArray)
+        ^ Array with:matches first with:(matches asArray)
     ].
     matches := matches asSortedCollection.
     best := matches longestCommonPrefix.
@@ -303,6 +305,7 @@
     "
 
     "Created: / 10-08-2006 / 13:06:45 / cg"
+    "Modified: / 03-03-2019 / 22:42:47 / Claus Gittinger"
 !
 
 classNameEntryCompletionBlock
@@ -633,7 +636,7 @@
 methodProtocolCompletion:aPartialProtocolName inEnvironment:anEnvironment
     "given a partial method protocol name, return an array consisting of
      2 entries: 1st: the best (longest) match
-		2nd: collection consisting of matching protocols"
+                2nd: collection consisting of matching protocols"
 
     |matches best lcName|
 
@@ -641,31 +644,31 @@
 
     "/ search for exact match
     anEnvironment allMethodsWithSelectorDo:[:eachMethod :eachSelector |
-	|protocol|
-
-	protocol := eachMethod category.
-	(protocol notNil and:[protocol startsWith:aPartialProtocolName]) ifTrue:[
-	    matches add:protocol
-	].
+        |protocol|
+
+        protocol := eachMethod category.
+        (protocol notNil and:[protocol startsWith:aPartialProtocolName]) ifTrue:[
+            matches add:protocol
+        ].
     ].
     matches isEmpty ifTrue:[
-	"/ search for case-ignoring match
-	lcName := aPartialProtocolName asLowercase.
-	anEnvironment allMethodsWithSelectorDo:[:eachMethod :eachSelector |
-	    |protocol|
-
-	    protocol := eachMethod category.
-	    (protocol notNil and:[protocol asLowercase startsWith:lcName]) ifTrue:[
-		matches add:protocol
-	    ].
-	].
+        "/ search for case-ignoring match
+        lcName := aPartialProtocolName asLowercase.
+        anEnvironment allMethodsWithSelectorDo:[:eachMethod :eachSelector |
+            |protocol|
+
+            protocol := eachMethod category.
+            (protocol notNil and:[protocol asLowercase startsWith:lcName]) ifTrue:[
+                matches add:protocol
+            ].
+        ].
     ].
 
     matches isEmpty ifTrue:[
-	^ Array with:aPartialProtocolName with:(Array with:aPartialProtocolName)
+        ^ Array with:aPartialProtocolName with:(Array with:aPartialProtocolName)
     ].
     matches size == 1 ifTrue:[
-	^ Array with:matches first with:(matches asArray)
+        ^ Array with:matches first with:(matches asArray)
     ].
     matches := matches asSortedCollection.
     best := matches longestCommonPrefix.
@@ -679,6 +682,7 @@
 
     "Created: / 10-08-2006 / 13:05:27 / cg"
     "Modified: / 16-03-2011 / 12:30:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 03-03-2019 / 22:43:07 / Claus Gittinger"
 !
 
 nameSpaceCompletion:aPartialClassName inEnvironment:anEnvironment
@@ -2529,7 +2533,7 @@
 "/
 "/    info := best storeString.
 "/    implClass notNil ifTrue:[
-"/        info := implClass name , ' » ' , info.
+"/        info := implClass name , ' » ' , info.
 "/    ].
 "/    self information:info.
 "/].
@@ -2792,10 +2796,12 @@
     knownClass isMeta ifTrue:[
         selectorsImplementedInClass := 
             selectorsImplementedInClass reject:[:sel |
-                |mthd|
+                |mthd cat|
 
                 mthd := knownClass lookupMethodFor:sel.
-                mthd notNil and:[mthd category startsWith: 'documentation']
+                mthd notNil 
+                  and:[(cat := mthd category) notNil 
+                  and:[(cat startsWith: 'documentation')]]
             ].
 
         knownClass theNonMetaclass isAbstract ifTrue:[
@@ -2804,10 +2810,12 @@
                           ]
         ] ifFalse:[
             mostUseful := selectorsImplementedInClass select:[:sel |
-                                |mthd|
+                                |mthd cat|
 
                                 mthd := knownClass lookupMethodFor:sel.
-                                mthd notNil and:[mthd category startsWith: 'instance']
+                                mthd notNil 
+                                  and:[(cat := mthd category) notNil 
+                                  and:[cat startsWith: 'instance']]
                           ].
         ]
     ] ifFalse:[
@@ -2841,6 +2849,7 @@
 
     "Created: / 01-05-2016 / 17:01:21 / cg"
     "Modified: / 10-10-2017 / 16:57:21 / cg"
+    "Modified: / 03-03-2019 / 22:41:42 / Claus Gittinger"
 !
 
 codeCompletionForMethodSpec:node
@@ -3352,8 +3361,8 @@
                     withAllSuperclassesDo:[:cls |
                         cls methodDictionary keysAndValuesDo:[:sel :mthd |
                             |cat|
-                            cat := mthd category asLowercase.
-                            cat = 'instance creation' ifTrue:[
+                            cat := mthd category.
+                            (cat notNil and:[cat sameAs: 'instance creation']) ifTrue:[
                                 selectors1 add:sel
                             ] ifFalse:[
                                 "/ other category: look if it sends new, new: etc.
@@ -3898,7 +3907,7 @@
     "Modified: / 16-02-2010 / 10:13:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified (comment): / 12-06-2017 / 12:34:46 / mawalch"
     "Modified: / 22-06-2017 / 06:56:42 / cg"
-    "Modified: / 01-03-2019 / 14:53:13 / Claus Gittinger"
+    "Modified: / 03-03-2019 / 22:51:33 / Claus Gittinger"
 !
 
 editActionToInsert:aString
@@ -5261,7 +5270,7 @@
 "/
 "/    info := best storeString.
 "/    implClass notNil ifTrue:[
-"/        info := implClass name , ' » ' , info.
+"/        info := implClass name , ' » ' , info.
 "/    ].
 "/    self information:info.
 
@@ -5416,9 +5425,11 @@
             |methods menu exitKey idx|
 
             methods := nodeVal class methodDictionary values
-                            select:[:m | |cat|
-                                cat := m category asLowercase.
-                                cat = 'instance creation'
+                            select:[:m | 
+                                |cat|
+                                cat := m category.
+                                cat notNil
+                                and:[cat sameAs:'instance creation']
                             ].
 
             menu := PopUpMenu labels:(methods collect:[:each | each selector]).
@@ -5483,7 +5494,9 @@
         ].
 
     addWithFactorBlock :=
-        [:eachNames :factor | |namesToAdd|
+        [:eachNames :factor | 
+            |namesToAdd|
+
             namesToAdd := eachNames select:[:nameToAdd | nameToAdd ~= nm ].
             namesToAdd := namesToAdd reject:[:each | allVariables includes:each ].
             allVariables addAll:namesToAdd.
@@ -5729,7 +5742,7 @@
     "Modified: / 16-02-2010 / 10:13:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 28-08-2013 / 15:37:28 / cg"
     "Modified (format): / 12-06-2017 / 12:37:31 / mawalch"
-    "Modified: / 01-03-2019 / 14:52:51 / Claus Gittinger"
+    "Modified (format): / 03-03-2019 / 22:53:58 / Claus Gittinger"
 ! !
 
 !DoWhatIMeanSupport methodsFor:'helpers-naive type inference'!