pharo
pharo copied to clipboard
ecompletion in presence of keyword
When we have the following expression where | represents the caret
1 between: 1 an|
We get and:do:
while we would like to have between:and:
entriesDo: aBlock
"We try two approaches
- the first one is to see if we can take advantage that we are in the beginning of a keyword message.
For example imagine that the user
x at: a p|
we are trying to propose at:put:.
- the last one is to look globally in the method implementors and try to match.
"
astNode ifNotNil: [ :node | node parent ifNotNil: [ :parent | "Try first to continue the parent keyword message"
self halt.
(parent isMessage and: [ parent isKeyword ]) ifTrue: [
self systemNavigation
allSelectorsStartingWith: parent selector , filter completionString
do: [ :e |
aBlock value: ((NECSelectorEntry
contents: (e copyFrom: parent selector size + 1 to: e size)
node: astNode)
selector: e)
] ] ] ].
"Otherwise, just go wide"
self systemNavigation
allSelectorsStartingWith: filter completionString
do: [ :e |
aBlock value: (NECSelectorEntry contents: e node: astNode) ]
and and:do: is correct because there is between:and:do: now it means that allSelectorsStartingWith: do: does not sort selectors based on size.
Even if we sort the Symbol selectorTable the order does not change.
I will close it for now because we do not want to sort global symbols (but this is a pity).