Skip to content

Commit

Permalink
CompletionEntry: we do the wrapping too late. when we instantiate it …
Browse files Browse the repository at this point in the history
…we just have symbols, so we do not know what they

where originally (variable, selectors...)

Thus: create entries in the #completionEntries method 

TODO after this: we need to create one kind of  entries for selectors, other subclass for selectors
  • Loading branch information
MarcusDenker committed Nov 13, 2019
1 parent bbb812d commit 062631d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
7 changes: 3 additions & 4 deletions src/NECompletion/CompletionContext.class.st
Expand Up @@ -12,8 +12,7 @@ Class {
'node',
'isWorkspace',
'class',
'entries',
'sorter'
'entries'
],
#classVars : [
'SorterClass'
Expand Down Expand Up @@ -93,10 +92,10 @@ CompletionContext >> hasMessage [

{ #category : #entries }
CompletionContext >> initEntries [
| suggestionsList |
| suggestionsList sorter |
sorter := self class sorterClass new context: self.
suggestionsList := sorter sortCompletionList: node completionEntries.
^ suggestionsList collect: [ :each | NECEntry contents: each node: node ]
^ suggestionsList
]

{ #category : #accessing }
Expand Down
4 changes: 3 additions & 1 deletion src/NECompletion/RBLiteralValueNode.extension.st
Expand Up @@ -4,7 +4,9 @@ Extension { #name : #RBLiteralValueNode }
RBLiteralValueNode >> completionEntries [
value isSymbol ifFalse: [ ^ #() ].
"return all symbols that start with value"
^Symbol allSymbols select: [ :each | (each beginsWith: value) and: [each isLiteralSymbol]]
^Symbol allSymbols
select: [ :each | (each beginsWith: value) and: [each isLiteralSymbol]]
thenCollect: [ :each | NECEntry contents: each node: self ]
]

{ #category : #'*NECompletion' }
Expand Down
4 changes: 3 additions & 1 deletion src/NECompletion/RBProgramNode.extension.st
Expand Up @@ -13,5 +13,7 @@ RBProgramNode >> completionToken [
{ #category : #'*NECompletion' }
RBProgramNode >> select: aCollection beginningWith: aString [
"note: to be inlined into the senders"
^ aCollection select: [ :each | each beginsWith: aString asString ]
^ aCollection
select: [ :each | each beginsWith: aString asString ]
thenCollect: [ :each | NECEntry contents: each node: self ]
]

0 comments on commit 062631d

Please sign in to comment.