SmallSense__CompletionResult.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Thu, 17 Oct 2013 01:41:47 +0100
changeset 132 7c23c51d2cfd
parent 108 71471dc81e77
child 249 8bc64027b189
permissions -rw-r--r--
Completion insertion refactoring. Added language and codeView into CompletionContext. Added context slot into PO so the PO itself know the completion context and can tweak its presentation accordingly. Also, actual text insertion is now delegated to the PO so the PO can insert proper text according to the context (especially - language)

"{ Package: 'jv:smallsense' }"

"{ NameSpace: SmallSense }"

SortedCollection subclass:#CompletionResult
	instanceVariableNames:'context'
	classVariableNames:''
	poolDictionaries:''
	category:'SmallSense-Core'
!

!CompletionResult class methodsFor:'instance creation'!

new
    ^ self sortBlock:[:a :b | a label < b label ].

    "Created: / 26-09-2013 / 11:01:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!CompletionResult methodsFor:'accessing'!

context
    ^ context
!

context:aCompletionContext
    context := aCompletionContext.
    self do:[:each | each context: context ].

    "Modified: / 17-10-2013 / 01:13:05 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !

!CompletionResult methodsFor:'adding & removing'!

add:anObject
    anObject context: context.
    ^ super add: anObject

    "Created: / 17-10-2013 / 01:02:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!

addAll:aCollection
    "add all elements of the argument, aCollection to the receiver.
     Returns the argument, aCollection (sigh)."

    aCollection do:[:each | each context: context ].
    ^ super addAll: aCollection

    "Created: / 17-10-2013 / 01:06:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !