Initial support for completing selector parts.
authorJan Vrany <jan.vrany@fit.cvut.cz>
Tue, 08 Apr 2014 21:46:51 +0200
changeset 192 f27ce6dac101
parent 191 49c0c66eb21a
child 193 c0c4605b3791
Initial support for completing selector parts. When user types map at: 1 ifA then the completer also offers to complete `ifAbsent:`, `ifAbsentPut:` ... in addition to SmallInteger methods.
Make.proto
Make.spec
SmallSense__CompletionController.st
SmallSense__CompletionEngine.st
SmallSense__JavaCompletionEngineSimple.st
SmallSense__MethodKeywordRestPO.st
SmallSense__MethodPO.st
SmallSense__SmalltalkCompletionEngine.st
SmallSense__SmalltalkInferencerParameters.st
abbrev.stc
bc.mak
jv_smallsense.st
libInit.cc
smallsense.rc
--- a/Make.proto	Tue Apr 08 15:03:38 2014 +0200
+++ b/Make.proto	Tue Apr 08 21:46:51 2014 +0200
@@ -34,7 +34,7 @@
 # add the path(es) here:,
 # ********** OPTIONAL: MODIFY the next lines ***
 # LOCALINCLUDES=-Ifoo -Ibar
-LOCALINCLUDES= -I$(INCLUDE_TOP)/stx/goodies/refactoryBrowser/helpers -I$(INCLUDE_TOP)/stx/goodies/refactoryBrowser/lint -I$(INCLUDE_TOP)/stx/goodies/sunit -I$(INCLUDE_TOP)/stx/libbasic -I$(INCLUDE_TOP)/stx/libcomp -I$(INCLUDE_TOP)/stx/libhtml -I$(INCLUDE_TOP)/stx/libtool -I$(INCLUDE_TOP)/stx/libview -I$(INCLUDE_TOP)/stx/libview2 -I$(INCLUDE_TOP)/stx/libwidg -I$(INCLUDE_TOP)/stx/libwidg2
+LOCALINCLUDES= -I$(INCLUDE_TOP)/stx/goodies/refactoryBrowser/helpers -I$(INCLUDE_TOP)/stx/goodies/refactoryBrowser/lint -I$(INCLUDE_TOP)/stx/libbasic -I$(INCLUDE_TOP)/stx/libcomp -I$(INCLUDE_TOP)/stx/libhtml -I$(INCLUDE_TOP)/stx/libtool -I$(INCLUDE_TOP)/stx/libview -I$(INCLUDE_TOP)/stx/libview2 -I$(INCLUDE_TOP)/stx/libwidg -I$(INCLUDE_TOP)/stx/libwidg2
 
 
 # if you need any additional defines for embedded C code,
@@ -137,7 +137,6 @@
 	cd $(TOP)/libview && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
 	cd $(TOP)/libview2 && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
 	cd $(TOP)/goodies/refactoryBrowser/browser && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
-	cd $(TOP)/goodies/sunit && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
 	cd $(TOP)/libwidg && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
 	cd $(TOP)/goodies/refactoryBrowser/lint && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
 	cd $(TOP)/libhtml && $(MAKE) "CFLAGS_LOCAL=$(GLOBALDEFINES)"
@@ -213,6 +212,7 @@
 $(OUTDIR)SmallSense__VariablePO.$(O) SmallSense__VariablePO.$(H): SmallSense__VariablePO.st $(INCLUDE_TOP)/jv/smallsense/SmallSense__PO.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libwidg2/HierarchicalItem.$(H) $(STCHDR)
 $(OUTDIR)SmallSense__GroovyCompletionEngineSimple.$(O) SmallSense__GroovyCompletionEngineSimple.$(H): SmallSense__GroovyCompletionEngineSimple.st $(INCLUDE_TOP)/jv/smallsense/SmallSense__CompletionEngine.$(H) $(INCLUDE_TOP)/jv/smallsense/SmallSense__JavaCompletionEngineSimple.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)SmallSense__GroovyEditSupport.$(O) SmallSense__GroovyEditSupport.$(H): SmallSense__GroovyEditSupport.st $(INCLUDE_TOP)/jv/smallsense/SmallSense__EditSupport.$(H) $(INCLUDE_TOP)/jv/smallsense/SmallSense__JavaEditSupport.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)SmallSense__MethodKeywordRestPO.$(O) SmallSense__MethodKeywordRestPO.$(H): SmallSense__MethodKeywordRestPO.st $(INCLUDE_TOP)/jv/smallsense/SmallSense__MethodPO.$(H) $(INCLUDE_TOP)/jv/smallsense/SmallSense__PO.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libwidg2/HierarchicalItem.$(H) $(STCHDR)
 $(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/lint/RBLintRule.$(H) $(INCLUDE_TOP)/stx/goodies/refactoryBrowser/lint/RBTransformationRule.$(H) $(INCLUDE_TOP)/stx/libbasic/Collection.$(H) $(INCLUDE_TOP)/stx/libbasic/ConfigurableFeatures.$(H) $(INCLUDE_TOP)/stx/libbasic/Dictionary.$(H) $(INCLUDE_TOP)/stx/libbasic/IdentityDictionary.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/Set.$(H) $(INCLUDE_TOP)/stx/libbasic/UserPreferences.$(H) $(INCLUDE_TOP)/stx/libcomp/AssignmentNode.$(H) $(INCLUDE_TOP)/stx/libcomp/BlockNode.$(H) $(INCLUDE_TOP)/stx/libcomp/MessageNode.$(H) $(INCLUDE_TOP)/stx/libcomp/ParseErrorNode.$(H) $(INCLUDE_TOP)/stx/libcomp/ParseNode.$(H) $(INCLUDE_TOP)/stx/libcomp/PrimaryNode.$(H) $(INCLUDE_TOP)/stx/libcomp/PrimitiveNode.$(H) $(INCLUDE_TOP)/stx/libcomp/StatementNode.$(H) $(INCLUDE_TOP)/stx/libcomp/VariableNode.$(H) $(INCLUDE_TOP)/stx/libhtml/HTMLDocumentFrame.$(H) $(INCLUDE_TOP)/stx/libhtml/HTMLDocumentView.$(H) $(INCLUDE_TOP)/stx/libtool/SystemBrowser.$(H) $(INCLUDE_TOP)/stx/libtool/Tools__BackgroundSourceProcessingService.$(H) $(INCLUDE_TOP)/stx/libtool/Tools__CodeCompletionService.$(H) $(INCLUDE_TOP)/stx/libtool/Tools__CodeHighlightingService.$(H) $(INCLUDE_TOP)/stx/libtool/Tools__CodeNavigationService.$(H) $(INCLUDE_TOP)/stx/libtool/Tools__CodeViewService.$(H) $(INCLUDE_TOP)/stx/libtool/Tools__NavigationState.$(H) $(INCLUDE_TOP)/stx/libtool/Tools__NewSystemBrowser.$(H) $(INCLUDE_TOP)/stx/libview/DeviceGraphicsContext.$(H) $(INCLUDE_TOP)/stx/libview/DisplaySurface.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsContext.$(H) $(INCLUDE_TOP)/stx/libview/GraphicsMedium.$(H) $(INCLUDE_TOP)/stx/libview/SimpleView.$(H) $(INCLUDE_TOP)/stx/libview/View.$(H) $(INCLUDE_TOP)/stx/libview2/ApplicationModel.$(H) $(INCLUDE_TOP)/stx/libview2/Model.$(H) $(INCLUDE_TOP)/stx/libwidg/EditTextView.$(H) $(INCLUDE_TOP)/stx/libwidg/ListView.$(H) $(INCLUDE_TOP)/stx/libwidg/TextCollector.$(H) $(INCLUDE_TOP)/stx/libwidg/TextView.$(H) $(INCLUDE_TOP)/stx/libwidg/Workspace.$(H) $(INCLUDE_TOP)/stx/libwidg2/DoWhatIMeanSupport.$(H) $(STCHDR)
 
 # ENDMAKEDEPEND --- do not remove this line
--- a/Make.spec	Tue Apr 08 15:03:38 2014 +0200
+++ b/Make.spec	Tue Apr 08 21:46:51 2014 +0200
@@ -101,6 +101,7 @@
 	SmallSense::VariablePO \
 	SmallSense::GroovyCompletionEngineSimple \
 	SmallSense::GroovyEditSupport \
+	SmallSense::MethodKeywordRestPO \
 
 
 
@@ -157,6 +158,7 @@
     $(OUTDIR_SLASH)SmallSense__VariablePO.$(O) \
     $(OUTDIR_SLASH)SmallSense__GroovyCompletionEngineSimple.$(O) \
     $(OUTDIR_SLASH)SmallSense__GroovyEditSupport.$(O) \
+    $(OUTDIR_SLASH)SmallSense__MethodKeywordRestPO.$(O) \
     $(OUTDIR_SLASH)extensions.$(O) \
 
 
--- a/SmallSense__CompletionController.st	Tue Apr 08 15:03:38 2014 +0200
+++ b/SmallSense__CompletionController.st	Tue Apr 08 21:46:51 2014 +0200
@@ -231,13 +231,14 @@
      the complection window should be closed or false
      if it shall be kept open."
 
-    | list prefix matcher matches1 matches2 |
+    | list prefix matcher1 matches1 matcher2 matches2 |
 
     list := completionView list.
-    matcher := CompletionEngine matcher.
+    matcher1 := CompletionEngine exactMatcher.
+    matcher2 := CompletionEngine inexactMatcher.
     prefix := support wordBeforeCursor.
 
-    matches1 := list select:[:po | po stringToComplete startsWith: prefix string ].
+    matches1 := list select:[:po | matcher1 value: prefix value: po stringToComplete ].
     matches1 notEmptyOrNil ifTrue:[
         matches1 size == 1 ifTrue:[
             completionView selection:  matches1 anElement.
@@ -245,7 +246,6 @@
                 self complete.
                 ^ true
             ].
-            ^ false
         ] ifFalse:[
             | selection |
 
@@ -255,11 +255,11 @@
                     ifFalse:[mostrelevant]
             ].
             completionView selection: selection.
-            ^ false.
-        ]
+        ].
+        ^ false
     ].
 
-    matches2 := completionView list select:[:po | matcher value: prefix value: po stringToComplete ].
+    matches2 := completionView list select:[:po | matcher2 value: prefix value: po stringToComplete ].
     matches2 notEmptyOrNil ifTrue:[
         matches2 size == 1 ifTrue:[
             completionView selection:  matches2 anElement.
@@ -279,7 +279,7 @@
     ^ false.
 
     "Created: / 27-09-2013 / 16:16:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 03-04-2014 / 23:57:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 08-04-2014 / 21:32:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !CompletionController methodsFor:'private-API'!
--- a/SmallSense__CompletionEngine.st	Tue Apr 08 15:03:38 2014 +0200
+++ b/SmallSense__CompletionEngine.st	Tue Apr 08 21:46:51 2014 +0200
@@ -12,6 +12,31 @@
 
 !CompletionEngine class methodsFor:'accessing'!
 
+exactMatcher
+    "Return a match block returning true, if given selector start with given prefix"
+
+    ^ [ :prefix :selector | selector startsWith: prefix ]
+
+    "Created: / 08-04-2014 / 21:31:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+inexactMatcher
+    "Return a match block returning true, if given prefix matches given selector"
+
+    ^ [ :prefix :selector |
+        prefix size < 5 ifTrue:[ 
+            selector startsWith: prefix.  
+        ] ifFalse:[ 
+            | part |
+
+            part := selector copyTo: (prefix size min: selector size).
+            (prefix levenshteinTo: part) < 15
+        ].
+    ].
+
+    "Created: / 08-04-2014 / 21:30:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 matcher
     "Return a match block returning true, if given prefix matches given selector"
 
@@ -68,28 +93,37 @@
 !CompletionEngine methodsFor:'completion-individual'!
 
 addMethodsStartingWith: prefix
-    ^ self addMethodsStartingWith: prefix filter: nil
+    ^ self addMethodsStartingWith: prefix stripOff: nil filter: nil
 
     "Created: / 24-07-2013 / 13:10:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 03-10-2013 / 17:59:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 08-04-2014 / 21:36:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+addMethodsStartingWith: prefix stripOff: stripoffPrefix 
+    ^ self addMethodsStartingWith: prefix stripOff: stripoffPrefix filter: nil
+
+    "Created: / 08-04-2014 / 21:36:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
-addMethodsStartingWith: prefix filter: filterOrNil
-    ^ self addMethodsStartingWith: prefix filter: filterOrNil matcher: CompletionEngine matcher.
+addMethodsStartingWith: prefix stripOff: stripoffPrefix filter: filterOrNil
+    | matcher |
 
-    "Created: / 03-10-2013 / 17:56:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 02-04-2014 / 23:30:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    matcher := stripoffPrefix isEmptyOrNil ifTrue:[ CompletionEngine inexactMatcher ] ifFalse:[ CompletionEngine exactMatcher ].
+    ^ self addMethodsStartingWith: prefix stripOff: stripoffPrefix filter: filterOrNil matcher: matcher.
+
+    "Created: / 08-04-2014 / 21:35:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
-addMethodsStartingWith: prefix filter: filterOrNil matcher: matcher
-    | selectors filter |
+addMethodsStartingWith: prefix stripOff: stripoffPrefix filter: filterOrNil matcher: matcher
+    | matchPrefix selectors filter |
 
     selectors := Dictionary new.
+    matchPrefix := stripoffPrefix isNil ifTrue:[ prefix ] ifFalse:[ stripoffPrefix , prefix ]. 
     filter := filterOrNil  isNil ifTrue:[ [:method | true ] ] ifFalse:[ filterOrNil  ].
 
     Smalltalk allClassesDo:[:class|
         class selectorsAndMethodsDo:[:selector :mthd |             
-            (mthd isSynthetic not and:[(filter value: mthd) and:[ matcher value: prefix value: selector]]) ifTrue:[
+            (mthd isSynthetic not and:[(filter value: mthd) and:[ matcher value: matchPrefix value: selector]]) ifTrue:[
                 | class skip |
 
                 class := mthd mclass superclass.
@@ -115,10 +149,11 @@
     selectors keysAndValuesDo: [:selector :classes|
         result add:(MethodPO 
                 name:selector
-                class:(classes size == 1 ifTrue:[classes anElement] ifFalse:[classes])).
+                class:(classes size == 1 ifTrue:[classes anElement] ifFalse:[classes])
+                stripOff: stripoffPrefix)
     ]
 
-    "Created: / 02-04-2014 / 23:17:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Created: / 08-04-2014 / 21:34:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !CompletionEngine methodsFor:'completion-private'!
--- a/SmallSense__JavaCompletionEngineSimple.st	Tue Apr 08 15:03:38 2014 +0200
+++ b/SmallSense__JavaCompletionEngineSimple.st	Tue Apr 08 21:46:51 2014 +0200
@@ -248,9 +248,10 @@
 !
 
 addMethodsStartingWith: prefix    
-    ^ self addMethodsStartingWith: prefix filter: [:m | m isJavaMethod ]
+    ^ self addMethodsStartingWith: prefix stripOff: nil filter: [:m | m isJavaMethod ]
 
     "Created: / 03-10-2013 / 18:01:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 08-04-2014 / 21:37:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !JavaCompletionEngineSimple methodsFor:'completion-private'!
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SmallSense__MethodKeywordRestPO.st	Tue Apr 08 21:46:51 2014 +0200
@@ -0,0 +1,81 @@
+"{ Package: 'jv:smallsense' }"
+
+"{ NameSpace: SmallSense }"
+
+MethodPO subclass:#MethodKeywordRestPO
+	instanceVariableNames:'keywords'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'SmallSense-Core-Interface-PO'
+!
+
+!MethodKeywordRestPO class methodsFor:'Instance creation'!
+
+name:nm class:class stripOff: prefix
+    ^ self new
+        name: nm;
+        class: class;
+        keywords: (nm copyFrom: prefix size + 1);
+        yourself
+
+    "Created: / 08-04-2014 / 21:22:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!MethodKeywordRestPO class methodsFor:'accessing'!
+
+icon
+    "This resource specification was automatically generated
+     by the ImageEditor of ST/X."
+
+    "Do not manually edit this!! If it is corrupted,
+     the ImageEditor may not be able to read the specification."
+
+    "
+     self icon inspect
+     ImageEditor openOnClass:self andSelector:#icon
+     Icon flushCachedIcons
+    "
+
+    <resource: #image>
+
+    ^Icon
+        constantNamed:'SmallSense::MethodKeywordRestPO icon'
+        ifAbsentPut:[(Depth1Image new) width:13; height:11; bits:(ByteArray fromPackedString:'@@H@@@@@@@@@@@@@@@P@@@@E@@@@@0@a') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((Depth1Image new) width:13; height:11; bits:(ByteArray fromPackedString:'@@\@A0@G@@\@A0@GY&]&Y0@G@@\@A0@a') ; yourself); yourself]
+! !
+
+!MethodKeywordRestPO methodsFor:'accessing'!
+
+icon
+    ^ self class icon
+!
+
+keywords
+    ^ keywords
+!
+
+keywords:something
+    keywords := something.
+!
+
+label
+
+    label isNil ifTrue:[
+        label := keywords.
+    ].
+    ^ label
+
+    "Created: / 08-04-2014 / 21:08:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+stringToCompleteForLanguage: language
+
+    "/ This PO is only valid for Smalltalk language...
+    self assert: language isSmalltalk.
+
+    ^ String 
+        fromStringCollection: (keywords tokensBasedOn: $:)
+        separatedBy: ':  '.
+
+    "Created: / 08-04-2014 / 21:10:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
--- a/SmallSense__MethodPO.st	Tue Apr 08 15:03:38 2014 +0200
+++ b/SmallSense__MethodPO.st	Tue Apr 08 21:46:51 2014 +0200
@@ -12,12 +12,22 @@
 
 !MethodPO class methodsFor:'Instance creation'!
 
-name:name class:class 
+name:nm class:class 
     ^ (self new)
-        name:name;
+        name:nm;
         class:class.
 
     "Created: / 17-10-2013 / 01:04:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+name:nm class:class stripOff: prefix
+    ^ prefix notNil ifTrue:[ 
+        MethodKeywordRestPO name: nm class: class stripOff: prefix.
+    ] ifFalse:[ 
+        self name: nm class: class.
+    ].
+
+    "Created: / 08-04-2014 / 21:20:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !MethodPO methodsFor:'accessing'!
--- a/SmallSense__SmalltalkCompletionEngine.st	Tue Apr 08 15:03:38 2014 +0200
+++ b/SmallSense__SmalltalkCompletionEngine.st	Tue Apr 08 21:46:51 2014 +0200
@@ -234,6 +234,93 @@
     "Modified: / 22-01-2014 / 19:48:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+addMethodsForType: type prefix: prefix stripOff: stripprefix
+
+    type isUnknownType ifFalse:[
+        self addMethodsForType:type stripOff: stripprefix.
+        
+        "/ If the type is union of more than 6 types, then
+        "/ assume that the inferencer is likely wrong.
+        "/ then, if the prefix is at least 3 chars,
+        "/ also add methods with that prefix.
+        
+        ((type classes size > 6) and:[ prefix > 2 ]) ifTrue:[
+            self addMethodsStartingWith:prefix stripOff: stripprefix
+        ].
+    ] ifTrue:[
+        self addMethodsStartingWith:prefix stripOff: stripprefix  
+    ].
+
+    "Created: / 08-04-2014 / 21:04:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+addMethodsForType: type stripOff: stripprefix     
+    | classes seen |
+
+    classes := type classes.
+    "/ Hack for Boolean: ifTrue:iFalse: etc are not defined
+    "/ in Boolean ?!!?
+    (classes size == 1 and:[classes anElement == Boolean ]) ifTrue:[
+        classes := Array with: True with: False.
+    ].
+    classes size == 1 ifTrue:[
+        classes anElement == JavaPackage class ifTrue:[  
+            "/ Special hack for JAVA: for pattern `JAVA java lang reflect`
+            "/ complete all Java classes in that package
+            | node |
+
+            node := result context node.
+            node isUnaryMessage ifTrue:[
+                | package |
+                "/ Compute package prefix...
+
+                package := node selector.
+                node := node receiver.
+                [ node isUnaryMessage ] whileTrue:[
+                    package := node selector , '/' , package.
+                    node := node receiver.
+                ].
+                self addJavaClassesInPackage: package.
+                ^ self.
+            ]
+        ]
+    ].
+
+    seen := Set new.
+    classes do: [:each | 
+        | class |
+
+        class := each.
+        [ class notNil and:[(seen includes: class) not]] whileTrue: [
+            seen add: class.
+            "/ Now, special care for Java classes, sigh...
+            (class isMetaclass and:[class theNonMetaclass isJavaClass]) ifTrue:[
+                class theNonMetaclass selectorsAndMethodsDo: [:selector :met | 
+                    met isStatic ifTrue:[
+                        result add: (MethodPO 
+                                    name: selector
+                                    class: met mclass).
+                    ].
+                ].
+            ] ifFalse:[
+                class selectorsAndMethodsDo: [:selector :met | 
+                    met isSynthetic ifFalse:[
+                        (stripprefix isNil or:[ selector size > stripprefix size and:[selector startsWith: stripprefix]]) ifTrue:[
+                            result add: (MethodPO 
+                                        name: selector
+                                        class: met mclass
+                                        stripOff: stripprefix).
+                        ].
+                    ]
+                ].
+            ].
+            class := class superclass.
+        ]
+    ].
+
+    "Created: / 08-04-2014 / 21:23:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 addPools
     | class |
 
@@ -431,51 +518,47 @@
     "Created: / 26-11-2011 / 17:07:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
-completeIn:node
+completeIn:node 
     "return collection which can be afterNode"
     
     node isVariableNode ifTrue:[
-        node name first isUppercase ifTrue:[
-            self addGlobalsStartingWith: node name.
-            self addClassVariables.
-            self addPools.
-            self addPrivateClasses.
-        ] ifFalse:[
-            self addVariablesFor: node
-        ].
-        ^self.
+        self completeInVariableNode:node.
+        ^ self.
     ].
-
     node isMessage ifTrue:[
-        | type |
-
-        type := node receiver inferedType.
-        Debug ifTrue:[
-            Transcript showCR: '--> completing messages for ' , type printString.
-        ].
-
-        type isUnknownType ifFalse:[
-            self addMethodsForType: type.
-            "/ If the type is union of more than 6 types, then
-            "/ assume that the inferencer is likely wrong.
-            "/ then, if the prefix is at least 3 chars,
-            "/ also add methods with that prefix.
-            ((type classes size > 6) and:[node selector size > 2]) ifTrue:[
-                self addMethodsStartingWith: node selector.
-            ].
-        ] ifTrue:[
-            self addMethodsStartingWith: node selector.
-        ].
-
-        ^self.
+        self completeInMessageNode:node.
+        ^ self
     ].
-
-    self breakPoint: #jv.
+    self breakPoint:#jv.
 
     "Created: / 07-03-2011 / 18:59:02 / Jakub <zelenja7@fel.cvut.cz>"
     "Modified: / 08-04-2011 / 09:31:51 / Jakub <zelenja7@fel.cvut.cz>"
     "Created: / 26-11-2011 / 17:07:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 22-01-2014 / 09:10:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 08-04-2014 / 20:52:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+completeInMessageNode:node 
+    | parent |
+
+
+    self addMethodsForType: node receiver inferedType prefix: node selector stripOff: nil.
+    parent := node parent.
+    parent isMessage ifTrue:[
+        self addMethodsForType: parent receiver inferedType prefix: node selector stripOff: parent selector.
+    ].
+
+    "Modified (format): / 08-04-2014 / 21:16:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+completeInVariableNode:node 
+    node name first isUppercase ifTrue:[
+        self addGlobalsStartingWith:node name.
+        self addClassVariables.
+        self addPools.
+        self addPrivateClasses.
+    ] ifFalse:[
+        self addVariablesFor:node
+    ]
 ! !
 
 !SmalltalkCompletionEngine class methodsFor:'documentation'!
--- a/SmallSense__SmalltalkInferencerParameters.st	Tue Apr 08 15:03:38 2014 +0200
+++ b/SmallSense__SmalltalkInferencerParameters.st	Tue Apr 08 21:46:51 2014 +0200
@@ -9,6 +9,7 @@
 	category:'SmallSense-Smalltalk-Types-Inference'
 !
 
+
 !SmalltalkInferencerParameters class methodsFor:'initialization'!
 
 initialize
@@ -22,5 +23,12 @@
     "Modified: / 01-03-2014 / 23:23:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!SmalltalkInferencerParameters class methodsFor:'documentation'!
+
+version_HG
+
+    ^ '$Changeset: <not expanded> $'
+! !
+
 
 SmalltalkInferencerParameters initialize!
--- a/abbrev.stc	Tue Apr 08 15:03:38 2014 +0200
+++ b/abbrev.stc	Tue Apr 08 21:46:51 2014 +0200
@@ -1,7 +1,6 @@
 # automagically generated by the project definition
 # this file is needed for stc to be able to compile modules independently.
 # it provides information about a classes filename, category and especially namespace.
-SmallSense::BaseTestClass SmallSense__BaseTestClass jv:smallsense 'SmallSense-Tests' 1
 SmallSense::CodeHighlightingService SmallSense__CodeHighlightingService jv:smallsense 'SmallSense-Core-Services' 0
 SmallSense::CodeNavigationService SmallSense__CodeNavigationService jv:smallsense 'SmallSense-Core-Services' 0
 SmallSense::CompletionContext SmallSense__CompletionContext jv:smallsense 'SmallSense-Core' 0
@@ -30,7 +29,6 @@
 SmallSense::SmalltalkQuickFixer SmallSense__SmalltalkQuickFixer jv:smallsense 'SmallSense-Smalltalk-Lint' 0
 SmallSense::SmalltalkSyntaxHighlighter SmallSense__SmalltalkSyntaxHighlighter jv:smallsense 'SmallSense-Smalltalk' 3
 SmallSense::SmalltalkUnacceptedMethodEnvironment SmallSense__SmalltalkUnacceptedMethodEnvironment jv:smallsense 'SmallSense-Smalltalk-Lint' 0
-SmallSense::TestCase SmallSense__TestCase jv:smallsense 'SmallSense-Tests' 1
 SmallSense::Type SmallSense__Type jv:smallsense 'SmallSense-Smalltalk-Types' 0
 SmallSense::TypeHolder SmallSense__TypeHolder jv:smallsense 'SmallSense-Smalltalk-Types' 0
 jv_smallsense jv_smallsense jv:smallsense '* Projects & Packages *' 3
@@ -38,22 +36,25 @@
 SmallSense::ClassPO SmallSense__ClassPO jv:smallsense 'SmallSense-Core-Interface-PO' 0
 SmallSense::ClassType SmallSense__ClassType jv:smallsense 'SmallSense-Smalltalk-Types' 0
 SmallSense::ConstantPO SmallSense__ConstantPO jv:smallsense 'SmallSense-Core-Interface-PO' 0
-SmallSense::FinderTests SmallSense__FinderTests jv:smallsense 'SmallSense-Tests' 1
 SmallSense::GenericEditSupport SmallSense__GenericEditSupport jv:smallsense 'SmallSense-Core-Services' 0
 SmallSense::JavaCompletionEngineSimple SmallSense__JavaCompletionEngineSimple jv:smallsense 'SmallSense-Java' 0
 SmallSense::JavaEditSupport SmallSense__JavaEditSupport jv:smallsense 'SmallSense-Java' 0
 SmallSense::JavaImportPO SmallSense__JavaImportPO jv:smallsense 'SmallSense-Java-Interface-PO' 0
 SmallSense::MethodInfo SmallSense__MethodInfo jv:smallsense 'SmallSense-Smalltalk-Types-Info' 0
 SmallSense::MethodPO SmallSense__MethodPO jv:smallsense 'SmallSense-Core-Interface-PO' 0
-SmallSense::RecognizerTests SmallSense__RecognizerTests jv:smallsense 'SmallSense-Tests' 1
 SmallSense::SmalltalkCompletionEngine SmallSense__SmalltalkCompletionEngine jv:smallsense 'SmallSense-Smalltalk' 0
 SmallSense::SmalltalkEditSupport SmallSense__SmalltalkEditSupport jv:smallsense 'SmallSense-Smalltalk' 0
 SmallSense::SmalltalkInferencer SmallSense__SmalltalkInferencer jv:smallsense 'SmallSense-Smalltalk-Types-Inference' 0
 SmallSense::SmalltalkParseNodeFinder SmallSense__SmalltalkParseNodeFinder jv:smallsense 'SmallSense-Smalltalk' 0
-SmallSense::SmalltalkParserTests SmallSense__SmalltalkParserTests jv:smallsense 'SmallSense-Tests' 1
 SmallSense::SnippetPO SmallSense__SnippetPO jv:smallsense 'SmallSense-Core-Interface-PO' 0
 SmallSense::UnionType SmallSense__UnionType jv:smallsense 'SmallSense-Smalltalk-Types' 0
 SmallSense::UnknownType SmallSense__UnknownType jv:smallsense 'SmallSense-Smalltalk-Types' 1
 SmallSense::VariablePO SmallSense__VariablePO jv:smallsense 'SmallSense-Core-Interface-PO' 0
 SmallSense::GroovyCompletionEngineSimple SmallSense__GroovyCompletionEngineSimple jv:smallsense 'SmallSense-Groovy' 0
 SmallSense::GroovyEditSupport SmallSense__GroovyEditSupport jv:smallsense 'SmallSense-Groovy' 0
+SmallSense::MethodKeywordRestPO SmallSense__MethodKeywordRestPO jv:smallsense 'SmallSense-Core-Interface-PO' 0
+SmallSense::BaseTestClass SmallSense__BaseTestClass jv:smallsense 'SmallSense-Tests' 1
+SmallSense::FinderTests SmallSense__FinderTests jv:smallsense 'SmallSense-Tests' 1
+SmallSense::RecognizerTests SmallSense__RecognizerTests jv:smallsense 'SmallSense-Tests' 1
+SmallSense::SmalltalkParserTests SmallSense__SmalltalkParserTests jv:smallsense 'SmallSense-Tests' 1
+SmallSense::TestCase SmallSense__TestCase jv:smallsense 'SmallSense-Tests' 1
--- a/bc.mak	Tue Apr 08 15:03:38 2014 +0200
+++ b/bc.mak	Tue Apr 08 21:46:51 2014 +0200
@@ -34,7 +34,7 @@
 
 
 
-LOCALINCLUDES= -I$(INCLUDE_TOP)\stx\goodies\refactoryBrowser\helpers -I$(INCLUDE_TOP)\stx\goodies\refactoryBrowser\lint -I$(INCLUDE_TOP)\stx\goodies\sunit -I$(INCLUDE_TOP)\stx\libbasic -I$(INCLUDE_TOP)\stx\libcomp -I$(INCLUDE_TOP)\stx\libhtml -I$(INCLUDE_TOP)\stx\libtool -I$(INCLUDE_TOP)\stx\libview -I$(INCLUDE_TOP)\stx\libview2 -I$(INCLUDE_TOP)\stx\libwidg -I$(INCLUDE_TOP)\stx\libwidg2
+LOCALINCLUDES= -I$(INCLUDE_TOP)\stx\goodies\refactoryBrowser\helpers -I$(INCLUDE_TOP)\stx\goodies\refactoryBrowser\lint -I$(INCLUDE_TOP)\stx\libbasic -I$(INCLUDE_TOP)\stx\libcomp -I$(INCLUDE_TOP)\stx\libhtml -I$(INCLUDE_TOP)\stx\libtool -I$(INCLUDE_TOP)\stx\libview -I$(INCLUDE_TOP)\stx\libview2 -I$(INCLUDE_TOP)\stx\libwidg -I$(INCLUDE_TOP)\stx\libwidg2
 LOCALDEFINES=
 
 STCLOCALOPT=-package=$(PACKAGE) -I. $(LOCALINCLUDES) -headerDir=. $(STCLOCALOPTIMIZATIONS) $(STCWARNINGS) $(LOCALDEFINES)  -varPrefix=$(LIBNAME)
@@ -60,7 +60,6 @@
 	pushd ..\..\stx\libview & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
 	pushd ..\..\stx\libview2 & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
 	pushd ..\..\stx\goodies\refactoryBrowser\browser & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
-	pushd ..\..\stx\goodies\sunit & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
 	pushd ..\..\stx\libwidg & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
 	pushd ..\..\stx\goodies\refactoryBrowser\lint & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
 	pushd ..\..\stx\libhtml & $(MAKE_BAT) "CFLAGS_LOCAL=$(GLOBALDEFINES) "
@@ -137,6 +136,7 @@
 $(OUTDIR)SmallSense__VariablePO.$(O) SmallSense__VariablePO.$(H): SmallSense__VariablePO.st $(INCLUDE_TOP)\jv\smallsense\SmallSense__PO.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libwidg2\HierarchicalItem.$(H) $(STCHDR)
 $(OUTDIR)SmallSense__GroovyCompletionEngineSimple.$(O) SmallSense__GroovyCompletionEngineSimple.$(H): SmallSense__GroovyCompletionEngineSimple.st $(INCLUDE_TOP)\jv\smallsense\SmallSense__CompletionEngine.$(H) $(INCLUDE_TOP)\jv\smallsense\SmallSense__JavaCompletionEngineSimple.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)SmallSense__GroovyEditSupport.$(O) SmallSense__GroovyEditSupport.$(H): SmallSense__GroovyEditSupport.st $(INCLUDE_TOP)\jv\smallsense\SmallSense__EditSupport.$(H) $(INCLUDE_TOP)\jv\smallsense\SmallSense__JavaEditSupport.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)SmallSense__MethodKeywordRestPO.$(O) SmallSense__MethodKeywordRestPO.$(H): SmallSense__MethodKeywordRestPO.st $(INCLUDE_TOP)\jv\smallsense\SmallSense__MethodPO.$(H) $(INCLUDE_TOP)\jv\smallsense\SmallSense__PO.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libwidg2\HierarchicalItem.$(H) $(STCHDR)
 $(OUTDIR)extensions.$(O): extensions.st $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\lint\RBLintRule.$(H) $(INCLUDE_TOP)\stx\goodies\refactoryBrowser\lint\RBTransformationRule.$(H) $(INCLUDE_TOP)\stx\libbasic\Collection.$(H) $(INCLUDE_TOP)\stx\libbasic\ConfigurableFeatures.$(H) $(INCLUDE_TOP)\stx\libbasic\Dictionary.$(H) $(INCLUDE_TOP)\stx\libbasic\IdentityDictionary.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\Set.$(H) $(INCLUDE_TOP)\stx\libbasic\UserPreferences.$(H) $(INCLUDE_TOP)\stx\libcomp\AssignmentNode.$(H) $(INCLUDE_TOP)\stx\libcomp\BlockNode.$(H) $(INCLUDE_TOP)\stx\libcomp\MessageNode.$(H) $(INCLUDE_TOP)\stx\libcomp\ParseErrorNode.$(H) $(INCLUDE_TOP)\stx\libcomp\ParseNode.$(H) $(INCLUDE_TOP)\stx\libcomp\PrimaryNode.$(H) $(INCLUDE_TOP)\stx\libcomp\PrimitiveNode.$(H) $(INCLUDE_TOP)\stx\libcomp\StatementNode.$(H) $(INCLUDE_TOP)\stx\libcomp\VariableNode.$(H) $(INCLUDE_TOP)\stx\libhtml\HTMLDocumentFrame.$(H) $(INCLUDE_TOP)\stx\libhtml\HTMLDocumentView.$(H) $(INCLUDE_TOP)\stx\libtool\SystemBrowser.$(H) $(INCLUDE_TOP)\stx\libtool\Tools__BackgroundSourceProcessingService.$(H) $(INCLUDE_TOP)\stx\libtool\Tools__CodeCompletionService.$(H) $(INCLUDE_TOP)\stx\libtool\Tools__CodeHighlightingService.$(H) $(INCLUDE_TOP)\stx\libtool\Tools__CodeNavigationService.$(H) $(INCLUDE_TOP)\stx\libtool\Tools__CodeViewService.$(H) $(INCLUDE_TOP)\stx\libtool\Tools__NavigationState.$(H) $(INCLUDE_TOP)\stx\libtool\Tools__NewSystemBrowser.$(H) $(INCLUDE_TOP)\stx\libview\DeviceGraphicsContext.$(H) $(INCLUDE_TOP)\stx\libview\DisplaySurface.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsContext.$(H) $(INCLUDE_TOP)\stx\libview\GraphicsMedium.$(H) $(INCLUDE_TOP)\stx\libview\SimpleView.$(H) $(INCLUDE_TOP)\stx\libview\View.$(H) $(INCLUDE_TOP)\stx\libview2\ApplicationModel.$(H) $(INCLUDE_TOP)\stx\libview2\Model.$(H) $(INCLUDE_TOP)\stx\libwidg\EditTextView.$(H) $(INCLUDE_TOP)\stx\libwidg\ListView.$(H) $(INCLUDE_TOP)\stx\libwidg\TextCollector.$(H) $(INCLUDE_TOP)\stx\libwidg\TextView.$(H) $(INCLUDE_TOP)\stx\libwidg\Workspace.$(H) $(INCLUDE_TOP)\stx\libwidg2\DoWhatIMeanSupport.$(H) $(STCHDR)
 
 # ENDMAKEDEPEND --- do not remove this line
--- a/jv_smallsense.st	Tue Apr 08 15:03:38 2014 +0200
+++ b/jv_smallsense.st	Tue Apr 08 21:46:51 2014 +0200
@@ -36,18 +36,17 @@
 !
 
 mandatoryPreRequisites
-    "list all required mandatory packages.
-     Packages are mandatory, if they contain superclasses of the package's classes
-     or classes which are extended by this package.
-     This list can be maintained manually or (better) generated and
-     updated by scanning the superclass hierarchies
-     (the browser has a menu function for that)"
+    "list packages which are mandatory as a prerequisite.
+     This are packages containing superclasses of my classes and classes which
+     are extended by myself.
+     They are mandatory, beacuse we need these packages as a prerequisite for loading and compiling.
+     This method is generated automatically,
+     by searching along the inheritance chain of all of my classes."
 
     ^ #(
         #'stx:goodies/refactoryBrowser/helpers'    "BrowserEnvironment - superclass of SmallSense::SmalltalkUnacceptedMethodEnvironment "
         #'stx:goodies/refactoryBrowser/lint'    "RBLintRule - extended "
-        #'stx:goodies/sunit'    "TestAsserter - superclass of SmallSense::BaseTestClass "
-        #'stx:libbasic'    "Collection - extended "
+        #'stx:libbasic'    "Autoload - superclass of SmallSense::BaseTestClass "
         #'stx:libcomp'    "AbstractSyntaxHighlighter - superclass of SmallSense::SmalltalkParser "
         #'stx:libhtml'    "HTMLDocumentFrame - extended "
         #'stx:libtool'    "AbstractSettingsApplication - superclass of SmallSense::SettingsAppl "
@@ -85,12 +84,11 @@
 !
 
 referencedPreRequisites
-    "list all packages containing classes referenced by the packages's members.
-     This list can be maintained manually or (better) generated and
-     updated by looking for global variable accesses
-     (the browser has a menu function for that)
-     However, often too much is found, and you may want to explicitely
-     exclude individual packages in the #excludedFromPreRequisites method."
+    "list packages which are a prerequisite, because they contain
+     classes which are referenced by my classes.
+     We do not need these packages as a prerequisite for loading or compiling.
+     This method is generated automatically,
+     by searching all classes (and their packages) which are referenced by my classes."
 
     ^ #(
         #'stx:goodies/refactoryBrowser/parser'    "RBFormatter - referenced by SmallSense::SmalltalkEditSupport>>electricInsertSnippetAfterDoubleColon "
@@ -162,7 +160,6 @@
 
     ^ #(
         "<className> or (<className> attributes...) in load order"
-        (#'SmallSense::BaseTestClass' autoload)
         #'SmallSense::CodeHighlightingService'
         #'SmallSense::CodeNavigationService'
         #'SmallSense::CompletionContext'
@@ -191,7 +188,6 @@
         #'SmallSense::SmalltalkQuickFixer'
         #'SmallSense::SmalltalkSyntaxHighlighter'
         #'SmallSense::SmalltalkUnacceptedMethodEnvironment'
-        (#'SmallSense::TestCase' autoload)
         #'SmallSense::Type'
         #'SmallSense::TypeHolder'
         #'jv_smallsense'
@@ -199,31 +195,34 @@
         #'SmallSense::ClassPO'
         #'SmallSense::ClassType'
         #'SmallSense::ConstantPO'
-        (#'SmallSense::FinderTests' autoload)
         #'SmallSense::GenericEditSupport'
         #'SmallSense::JavaCompletionEngineSimple'
         #'SmallSense::JavaEditSupport'
         #'SmallSense::JavaImportPO'
         #'SmallSense::MethodInfo'
         #'SmallSense::MethodPO'
-        (#'SmallSense::RecognizerTests' autoload)
         #'SmallSense::SmalltalkCompletionEngine'
         #'SmallSense::SmalltalkEditSupport'
         #'SmallSense::SmalltalkInferencer'
         #'SmallSense::SmalltalkParseNodeFinder'
-        (#'SmallSense::SmalltalkParserTests' autoload)
         #'SmallSense::SnippetPO'
         #'SmallSense::UnionType'
         #'SmallSense::UnknownType'
         #'SmallSense::VariablePO'
         #'SmallSense::GroovyCompletionEngineSimple'
         #'SmallSense::GroovyEditSupport'
+        #'SmallSense::MethodKeywordRestPO'
+        (#'SmallSense::BaseTestClass' autoload)
+        (#'SmallSense::FinderTests' autoload)
+        (#'SmallSense::RecognizerTests' autoload)
+        (#'SmallSense::SmalltalkParserTests' autoload)
+        (#'SmallSense::TestCase' autoload)
     )
 !
 
 extensionMethodNames
-    "lists the extension methods which are to be included in the project.
-     Entries are 2-element array literals, consisting of class-name and selector."
+    "list class/selector pairs of extensions.
+     A correponding method with real names must be present in my concrete subclasses"
 
     ^ #(
         ParseNode isSelector
--- a/libInit.cc	Tue Apr 08 15:03:38 2014 +0200
+++ b/libInit.cc	Tue Apr 08 21:46:51 2014 +0200
@@ -78,6 +78,7 @@
 _SmallSense__VariablePO_Init(pass,__pRT__,snd);
 _SmallSense__GroovyCompletionEngineSimple_Init(pass,__pRT__,snd);
 _SmallSense__GroovyEditSupport_Init(pass,__pRT__,snd);
+_SmallSense__MethodKeywordRestPO_Init(pass,__pRT__,snd);
 
 _jv_137smallsense_extensions_Init(pass,__pRT__,snd);
 __END_PACKAGE__();
--- a/smallsense.rc	Tue Apr 08 15:03:38 2014 +0200
+++ b/smallsense.rc	Tue Apr 08 21:46:51 2014 +0200
@@ -25,7 +25,7 @@
       VALUE "LegalCopyright", "Copyright Claus Gittinger 1988-2011\nCopyright eXept Software AG 1998-2011\0"
       VALUE "ProductName", "Smalltalk/X\0"
       VALUE "ProductVersion", "6.2.3.0\0"
-      VALUE "ProductDate", "Mon, 31 Mar 2014 21:41:22 GMT\0"
+      VALUE "ProductDate", "Tue, 08 Apr 2014 19:44:04 GMT\0"
     END
 
   END