--- a/DoWhatIMeanSupport.st Sun May 01 09:41:34 2016 +0200
+++ b/DoWhatIMeanSupport.st Sun May 01 09:46:40 2016 +0200
@@ -2045,8 +2045,8 @@
offerParenthisationAroundNode parenthesisAroundIndex
parentNodeToParenthesize|
- Transcript show:'node '; show:node; show:' ; '.
- Transcript show:'msg in '; show:methodOrNil; show:' / '; showCR:classOrNil.
+ "/ Transcript show:'node '; show:node; show:' ; '.
+ "/ Transcript show:'msg in '; show:methodOrNil; show:' / '; showCR:classOrNil.
offerParenthisationAroundNode := nil.
@@ -2212,12 +2212,10 @@
"/ also, a good completion is to insert an argument;
"/ the name of the variable from the implementation, as comment, and selected might be a good one!!
"/ Array new:1
-Transcript show:'1: '; showCR:selector.
selector isKeyword ifTrue:[
(node arguments size = selector numArgs) ifTrue:[
offerParenthisationAroundNode := node
].
-Transcript show:'offer: '; showCR:offerParenthisationAroundNode.
codeView characterBeforeCursor == $: ifTrue:[
(bestSelectors select:[:sel | sel asLowercase startsWith:lcSelector]) isEmpty ifTrue:[
@@ -2245,7 +2243,6 @@
]
].
].
-Transcript show:'1b: '; showCR:selector.
] ifFalse:[
"/ when completing a non-keyword AND the parent is a keyword message,
"/ only consider longer keyword messages or unary messages
@@ -2254,13 +2251,10 @@
]
].
-Transcript show:'2: '; showCR:selector.
-
bestSelectors := bestSelectors asOrderedCollection sort:[:a :b | a size < b size].
(selector isUnarySelector and:[ parentNode notNil and:[ parentNode isMessage ]]) ifTrue:[
(selector2 := parentNode selector) isKeywordSelector ifTrue:[
-Transcript show:'3a: '; showCR:selector.
"/ if its a unary message AND the parent is a keyword node, look for parent completion too.
"/ i.e. look if there is a longer keyword possible
selector2 := selector2,selector.
@@ -2271,13 +2265,11 @@
"/ if the parent has a valid selector, offer parenthization
(Smalltalk someImplementorOf:selector2) notNil ifTrue:[
-offerParenthisationAroundNode notNil ifTrue:[ self halt ].
offerParenthisationAroundNode := parentNode.
].
] ifFalse:[
|kwSels|
-Transcript show:'3b: '; showCR:selector.
"/ if its a unary message AND the parent is a unary or binary node, try again, sending the partial message
"/ as a keyword to the parent node.
"/ this is the case when after "foo binOp bar if", which should include ifTrue: in the result.
@@ -2471,7 +2463,6 @@
allBest := (bestWithParenthesis ? #()) , allBest.
allBest isEmptyOrNil ifTrue:[
-Transcript showCR:'exit2'.
^ self
].
@@ -2699,7 +2690,7 @@
"Created: / 10-11-2006 / 13:18:27 / cg"
"Modified: / 16-02-2010 / 10:33:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 30-04-2016 / 21:40:11 / cg"
+ "Modified: / 01-05-2016 / 09:46:27 / cg"
!
codeCompletionForMethodSpec:node