extensions.st
changeset 289 5c2cffd3c13c
parent 279 1dcaf8e06968
child 291 ad653f664e59
child 359 c9f69a8e441c
--- a/extensions.st	Sat May 10 11:31:11 2014 +0100
+++ b/extensions.st	Tue Oct 07 15:22:01 2014 +0100
@@ -56,49 +56,49 @@
 
 !DoWhatIMeanSupport methodsFor:'code completion - smallsense'!
 
-smallSenseCodeCompletionForClass: classOrNilArg context: contextOrNil codeView: codeViewArg 
+stx_goodies_smallsense_codeCompletionForClass:classOrNilArg context:contextOrNil codeView:codeViewArg
     <swizzle: #codeCompletionForClass:context:codeView:>
     "SmallSense version of #codeCompletionForClass:context:codeView:.
 
      When SmallSense is loaded, this method is swizzled as #codeCompletionForClass:context:codeView:.
      into DoWhatIMeanSupport."
-    
+
     | p  node  text  items  mode |
 
     codeView := codeViewArg.
-    
+
     "/ The respondsTo: hack is because CVS CodeView2 has no #mode method.
-    
-    mode := (codeView respondsTo: #mode) ifTrue: [
+
+    mode := (codeView respondsTo:#mode) ifTrue:[
             codeView mode
-        ] ifFalse: [ #method ].
-    contextOrNil notNil ifTrue: [
+        ] ifFalse:[ #method ].
+    contextOrNil notNil ifTrue:[
         mode := #method.
     ].
-    items := SmallSense::SmalltalkCompletion 
-            resultSetFor: mode
-            source: codeView contents
-            class: classOrNilArg
-            line: codeView cursorLine
-            column: codeView cursorCol.
-    items notEmptyOrNil ifTrue: [
-        (p := items position) notNil ifTrue: [
+    items := SmallSense::SmalltalkCompletion
+            resultSetFor:mode
+            source:codeView contents
+            class:classOrNilArg
+            line:codeView cursorLine
+            column:codeView cursorCol.
+    items notEmptyOrNil ifTrue:[
+        (p := items position) notNil ifTrue:[
             node := p node.
-            node notNil ifTrue: [
-                (node isVariable and: [ p isInNode ]) ifTrue: [
+            node notNil ifTrue:[
+                (node isVariable and:[ p isInNode ]) ifTrue:[
                     text := node name
-                ] ifFalse: [
-                    node isMessage ifTrue: [
+                ] ifFalse:[
+                    node isMessage ifTrue:[
                         text := node selector
                     ]
                 ].
             ].
         ].
     ].
-    SmallSense::CompletionWindow 
-        openForView: codeView
-        text: text
-        items: items.
+    SmallSense::CompletionWindow
+        openForView:codeView
+        text:text
+        items:items.
 
     "Created: / 19-08-2013 / 15:01:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
     "Modified: / 02-09-2013 / 12:52:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -323,9 +323,9 @@
     [ stmt notNil ] whileTrue:[
         | expr |
 
-        stmt isReturnNode ifTrue:[ 
+        stmt isReturnNode ifTrue:[
             expr := stmt.
-        ] ifFalse:[ 
+        ] ifFalse:[
             expr := stmt expression.
         ].
         aBlock value: ('statement[%1]' bindWith: index) value: expr.
@@ -356,21 +356,17 @@
 
 !Tools::CodeCompletionService class methodsFor:'testing'!
 
-smallSenseIsUsefulFor:aCodeView
-    "No old completion once there's SmallSense :-)"
+stx_goodies_smallsense_isUsefulFor: arg1
+    <swizzle: #isUsefulFor:>
 
-    <swizzle: #isUsefulFor:>     
-
-    ^ false.
-
-    "Created: / 02-09-2013 / 12:58:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    ^ false
 ! !
 
 !Tools::CodeHighlightingService class methodsFor:'instance creation'!
 
 new
     "return an initialized instance"
-    
+
     ^ (SmallSense::CodeHighlightingService ? self) basicNew initialize.
 
     "Created: / 27-07-2013 / 22:47:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -381,7 +377,7 @@
 
 new
     "return an initialized instance"
-    
+
     ^ (SmallSense::CodeNavigationService ? self) basicNew initialize.
 
     "Created: / 27-07-2013 / 22:47:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -390,18 +386,17 @@
 
 !Tools::NavigationState methodsFor:'aspects - SmallSense'!
 
-smallSenseSelectedClasses
-
-    <swizzle: #selectedClasses>     
-
+stx_goodies_smallsense_selectedClasses
+    <swizzle: #selectedClasses>
     selectedClasses isNil ifTrue:[
-        selectedClasses := "SpecialValueHolder with:nil." nil asValue.
+        selectedClasses := nil asValue.
         (ConfigurableFeatures includesFeature:'SmallSenseEnabled') ifTrue:[
-            selectedClasses onChangeEvaluate:[
-                selectedClasses value ? #() do:[:cls|
-                    (Smalltalk at:#SmallSense::Manager) instance updateInfoForClass: cls.
-                ].
-            ]
+            selectedClasses
+                onChangeEvaluate:[
+                    selectedClasses value ? #() do:[:cls |
+                        (Smalltalk at:#'SmallSense::Manager') instance updateInfoForClass:cls.
+                    ].
+                ]
         ]
     ].
     ^ selectedClasses
@@ -414,7 +409,7 @@
 searchCompletionBlock_SmallSense
     "This returns a class/selector name completion block that uses
      standard DoWhatIMeanSupport"
-    
+
     ^ [:patternString | self smallSenseSearchCompletion:patternString ]
 
     "Created: / 25-11-2013 / 12:27:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -422,9 +417,9 @@
 
 !Tools::NewSystemBrowser methodsFor:'private-searching-smallsense'!
 
-smallSenseSearchCompletion:patternString 
+smallSenseSearchCompletion:patternString
     "/sorry, no method search yet"
-    
+
     ^ self smallSenseSearchCompletionNewForClass:patternString
 
     "Modified: / 04-08-2011 / 19:05:28 / cg"
@@ -436,7 +431,7 @@
 smallSenseSearchCompletionBlock
     "This returns a class/selector name completion block that uses
      standard DoWhatIMeanSupport"
-    
+
     ^ [:patternString | self smallSenseSearchCompletion:patternString ]
 
     "Modified: / 04-08-2011 / 19:05:28 / cg"
@@ -445,7 +440,7 @@
 
 !Tools::NewSystemBrowser methodsFor:'private-searching-smallsense'!
 
-smallSenseSearchCompletionEntryForClass:aClass showPrefix:showPrefix 
+smallSenseSearchCompletionEntryForClass:aClass showPrefix:showPrefix
     ^ (SmallSense::ClassPO new)
         klass:aClass;
         showPrefix:showPrefix.
@@ -456,7 +451,7 @@
 
 !Tools::NewSystemBrowser methodsFor:'private-searching-smallsense'!
 
-smallSenseSearchCompletionNewForClass:patternString 
+smallSenseSearchCompletionNewForClass:patternString
     | env  pattern  matcher  matches  relax  withPrefix |
 
     patternString isEmptyOrNil ifTrue:[
@@ -479,15 +474,15 @@
         matches isEmptyOrNil and:[ relax <= 3 ]
     ] whileTrue:[
         matches := OrderedCollection new.
-        env 
-            keysDo:[:nm | 
+        env
+            keysDo:[:nm |
                 | cls |
 
                 cls := env at:nm.
-                (cls notNil and:[ cls isBehavior and:[ (matches includesIdentical:cls) not ] ]) 
+                (cls notNil and:[ cls isBehavior and:[ (matches includesIdentical:cls) not ] ])
                         ifTrue:[
-                            "cls isJavaClass"false ifTrue:[ 
-                                cls isAnonymous ifFalse:[ 
+                            "cls isJavaClass"false ifTrue:[
+                                cls isAnonymous ifFalse:[
                                     (matcher value:cls) ifTrue:[
                                         matches add:cls
                                     ].
@@ -504,8 +499,8 @@
     matches isEmpty ifTrue:[
         ^ #( nil #() )
     ] ifFalse:[
-        matches := matches 
-                collect:[:cls | 
+        matches := matches
+                collect:[:cls |
                     self smallSenseSearchCompletionEntryForClass:cls showPrefix:withPrefix
                 ].
         ^ {
@@ -683,9 +678,8 @@
 
 !Workspace class methodsFor:'defaults - smallsense'!
 
-smallSenseCodeCompletionServiceClass
+stx_goodies_smallsense_codeCompletionServiceClass
     <swizzle: #codeCompletionServiceClass>
-
     ^ SmallSense::CodeCompletionService
 
     "Created: / 24-09-2013 / 00:29:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"