#FEATURE by cg
class: DoWhatIMeanSupport
comment/format in: #codeCompletionForSmalltalkMethod:orClass:context:codeView:into:
changed: #tryCodeCompletionWithSource:nodeInterval:at:mustBeExpression:into:
inst creation messages
--- a/DoWhatIMeanSupport.st Tue Mar 21 12:09:25 2017 +0100
+++ b/DoWhatIMeanSupport.st Wed Mar 22 12:35:53 2017 +0100
@@ -1639,7 +1639,7 @@
] ifFalse:[
suggestions := suggestions asOrderedCollection.
actions isBlock ifTrue:[
- actions := Array new:suggestions size withAll:actions.
+ actions := Array new:(suggestions size) withAll:actions.
].
actions := actions asOrderedCollection.
listOfSuggestions doWithIndex:[:suggestion :idx |
@@ -1718,6 +1718,7 @@
"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"
! !
!DoWhatIMeanSupport methodsFor:'code completion - obsolete'!
@@ -4460,7 +4461,20 @@
^ self.
].
].
- "/ nodeParent isNil or:[nodeParent isMessage not]
+ "/ if right after a global, which is a class, look for implemented instance creation methods; offer them
+ node isGlobal ifTrue:[
+ |class instCreators selectors|
+
+ (class := Smalltalk classNamed:node name) notNil ifTrue:[
+ (instCreators := class theMetaclass methodsInCategory:'instance creation') notEmpty ifTrue:[
+ selectors := instCreators collect:[:m | m selector].
+ actionBlock
+ value:selectors
+ value:(selectors collect:[:sel | self editActionToInsert:sel])
+ value:'instance creation'.
+ ].
+ ].
+ ]
].
false ifTrue:[
@@ -4662,7 +4676,7 @@
self information:'Node is neither variable nor message.'.
"Modified: / 04-07-2006 / 18:48:26 / fm"
- "Modified: / 01-03-2017 / 15:06:05 / cg"
+ "Modified: / 22-03-2017 / 12:33:31 / cg"
!
withoutSelectorsUnlikelyFor:aClass from:selectorsArg forPartial:partialSelector