#UI_ENHANCEMENT by exept
authorClaus Gittinger <cg@exept.de>
Sun, 15 Sep 2019 18:56:02 +0200
changeset 6149 d8d846da0364
parent 6148 e3b389204cce
child 6150 d78950c03598
#UI_ENHANCEMENT by exept class: DoWhatIMeanSupport comment/format in: #codeCompletionForVariable:into: changed: #tryCodeCompletionWithSource:nodeInterval:at:mustBeExpression:into: class: DoWhatIMeanSupport class category of:16 methods
DoWhatIMeanSupport.st
--- a/DoWhatIMeanSupport.st	Sun Sep 15 18:54:25 2019 +0200
+++ b/DoWhatIMeanSupport.st	Sun Sep 15 18:56:02 2019 +0200
@@ -253,7 +253,7 @@
 	codeView:codeView into:actionBlock
 ! !
 
-!DoWhatIMeanSupport class methodsFor:'input completion support'!
+!DoWhatIMeanSupport class methodsFor:'input field completion support'!
 
 classCategoryCompletion:aPartialCategory inEnvironment:anEnvironment
     "given a partial class category name, return an array consisting of
@@ -3848,35 +3848,38 @@
     suggestionsWithInfo :=
         suggestions
             collect:[:eachName |
-                |val kind valAndKind printString|
+                |val kind valAndKind printString info|
 
                 valAndKind := self valueAndKindOfVariable:eachName.
-                valAndKind isNil ifTrue:[
-                    eachName
-                ] ifFalse:[
+                valAndKind notNil ifTrue:[
                     val := valAndKind first.
                     kind := valAndKind second.
 
                     val isBehavior ifTrue:[
                         val isLoaded ifFalse:[
-                            eachName,' (= ', ('autoloaded class in ',(val category ? 'unknown category')) allItalic,' )'
+                            info := 'autoloaded class in %1' bindWith:(val category ? 'unknown category').
                         ] ifTrue:[
                             val isNameSpace ifTrue:[
-                                eachName,' ( ', 'namespace' allItalic,' )'
+                                info := 'namespace'
                             ] ifFalse:[
-                                eachName,' (= ', ('class in ',(val category ? 'unknown category')) allItalic,' )'
+                                info := 'class in %1' bindWith:(val category ? 'unknown category')
                             ]
                         ]
                     ] ifFalse:[
                         "/ Parser findBest:30 selectorsFor:'isLite' in:nil forCompletion:true
 
                         (val isLiteral and:[ (printString := val printString) size < 15 ]) ifTrue:[
-                            eachName,' (= ',printString allItalic,' )'
+                            info := printString,', a ', kind
                         ] ifFalse:[
-                            eachName,' (= ',val class nameWithArticle allItalic,' )'
+                            info := val class nameWithArticle,', a ',kind
                         ].
                     ].
                 ].
+                info notNil ifTrue:[
+                    eachName,(' (',(' ',info,' ') allItalic,')') allGray
+                ] ifFalse:[
+                    eachName
+                ].
             ].
 
     editActions := suggestions collect:[:word |
@@ -4614,9 +4617,10 @@
     nodeParent := node parent.
 
     (node isVariable
-    and:[ nodeParent notNil
-    and:[ nodeParent isMessage
-    and:[ node stop < (characterPositionOfCursor-1) ]]]) ifTrue:[
+      and:[ nodeParent notNil
+      and:[ nodeParent isMessage
+      and:[ node stop < (characterPositionOfCursor-1) ]]]
+    ) ifTrue:[
         node := nodeParent.
         nodeParent := node parent.
     ].
@@ -4626,32 +4630,34 @@
     characterBeforeCursor == $. ifTrue:[ "at end of statement" ^ self].
  
     node isVariable ifTrue:[
-        |nodeIsInTemporaries nodeIsInBlockArguments nodeIsInMethodArguments |
-
-        nodeIsInTemporaries :=
+        |nodeIsInTemporariesDecl nodeIsInBlockArgumentsDecl nodeIsInMethodArgumentsDecl |
+
+        nodeIsInTemporariesDecl :=
             nodeParent notNil
             and:[ nodeParent isSequence
             and:[ nodeParent temporaries notEmptyOrNil
             and:[ node stop <= nodeParent temporaries last stop ]]]. 
 
-        nodeIsInBlockArguments :=
+        nodeIsInBlockArgumentsDecl :=
             node blockScope notNil
             and:[ node blockScope arguments notEmptyOrNil
             and:[ node stop <= node blockScope arguments last stop ]].
 
-        (nodeIsInBlockArguments not and:[rememberedScopeNodes notNil]) ifTrue:[
+        (nodeIsInBlockArgumentsDecl not and:[rememberedScopeNodes notNil]) ifTrue:[
             "/ sigh - parent (and therefore blockScope) is unknown if parser has error
-            nodeIsInBlockArguments := 
+            nodeIsInBlockArgumentsDecl := 
                 rememberedScopeNodes 
                     contains:[:scope |
+                        |scopeArgs|
+
                         (scope isMethod or:[scope isBlock])
-                        and:[scope arguments notEmpty
-                        and:[scope arguments first start <= node start
-                        and:[scope arguments last stop >= node stop]]].
+                        and:[(scopeArgs := scope arguments) notEmptyOrNil
+                        and:[scopeArgs first start <= node start
+                        and:[scopeArgs last stop >= node stop]]].
                     ].        
         ].
-        nodeIsInTemporaries ifTrue:[ self codeCompletionForTempVariable:node into:actionBlock. ^ self ]. 
-        nodeIsInBlockArguments ifTrue:[ self codeCompletionForBlockArgument:node into:actionBlock. ^ self ]. 
+        nodeIsInTemporariesDecl ifTrue:[ self codeCompletionForTempVariable:node into:actionBlock. ^ self ]. 
+        nodeIsInBlockArgumentsDecl ifTrue:[ self codeCompletionForBlockArgument:node into:actionBlock. ^ self ]. 
 
         "/ for variable completion, cursor must be right after the node 
         codeView characterPositionOfCursor = (node stop + 1) ifTrue:[