Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcusDenker committed Dec 6, 2019
1 parent 1e42ec9 commit bfa8c7b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/NECompletion/RBProgramNode.extension.st
Expand Up @@ -4,7 +4,7 @@ Extension { #name : #RBProgramNode }
RBProgramNode >> completionEntries: offset [
"for now we give all selectors and gloabls as a fallback"
| selectors globals |

self methodNode sourceCode ifNil: [ ^#() ].
selectors := Symbol selectorTable
select: [ :each | each beginsWith: (self completionToken: offset)]
thenCollect: [ :each | NECSymbolEntry contents: each node: self ].
Expand All @@ -20,6 +20,8 @@ RBProgramNode >> completionEntries: offset [
{ #category : #'*NECompletion' }
RBProgramNode >> completionToken: offset [
"fall back: if we are not able to parse to something better, we use the word before the cursor"
^self methodNode sourceCode wordBefore: offset

^ self methodNode sourceCode
ifNil: [ String new ]
ifNotNil: [ :source | source wordBefore: offset ]
]

0 comments on commit bfa8c7b

Please sign in to comment.