--- a/SmallSense__EditSupport.st Wed Feb 11 22:38:49 2015 +0000
+++ b/SmallSense__EditSupport.st Thu Feb 12 00:30:40 2015 +0000
@@ -21,7 +21,7 @@
"{ NameSpace: SmallSense }"
Object subclass:#EditSupport
- instanceVariableNames:'service codeView textView backspaceIsUndo completionController
+ instanceVariableNames:'textView backspaceIsUndo completionController
completionEnvironment snippets ignoreKeystrokes
ignoreKeystrokesPosition'
classVariableNames:''
@@ -75,19 +75,11 @@
!EditSupport methodsFor:'accessing'!
-codeView
- ^ codeView
-
- "Created: / 21-01-2014 / 23:13:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 03-02-2014 / 23:28:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
environment
- "raise an error: this method should be implemented (TODO)"
-
- ^ service environment
+ ^ completionEnvironment ? Smalltalk
"Created: / 15-05-2014 / 16:44:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 11-02-2015 / 23:58:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
language
@@ -96,10 +88,6 @@
"Created: / 24-07-2013 / 23:44:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
-service
- ^ service
-!
-
textView
^ textView
@@ -360,24 +348,30 @@
UserPreferences current smallSenseCompletionEnabled ifTrue:[
self completionEngineClass notNil ifTrue:[
- controller := self completionControllerClass for: service textView.
+ controller := self completionControllerClass for: textView.
controller support: self.
- service textView completionSupport: controller.
+ textView completionSupport: controller.
].
].
"Created: / 18-05-2014 / 12:40:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 11-02-2015 / 23:44:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
-initializeForService:aSmallSenseService
- service := aSmallSenseService.
- codeView := aSmallSenseService codeView.
- textView := aSmallSenseService textView.
+initializeForService:anEditService
+ completionEnvironment := anEditService environment.
+ self initializeForTextView: anEditService textView.
+
+ "Created: / 27-09-2013 / 13:19:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 12-02-2015 / 00:16:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+initializeForTextView: anEditTextView
+ textView := anEditTextView.
backspaceIsUndo := false.
self initializeCompletion.
- "Created: / 27-09-2013 / 13:19:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 03-02-2014 / 23:28:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Created: / 12-02-2015 / 00:16:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!EditSupport methodsFor:'private'!
@@ -385,15 +379,15 @@
indentAtCursorLine
| line |
- line := service textView listAt: service textView cursorLine.
+ line := textView listAt: textView cursorLine.
^ line isNil ifTrue:[
- (service textView cursorCol - 1) max: 0.
+ (textView cursorCol - 1) max: 0.
] ifFalse:[
(line indexOfNonSeparator - 1) max: 0.
]
"Created: / 25-07-2013 / 00:13:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 25-10-2013 / 18:04:37 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 11-02-2015 / 23:44:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
wordBeforeCursor
@@ -449,7 +443,7 @@
| line scanner token tokenLastEndPosition |
scannerClass isNil ifTrue:[ ^ #() ].
- line := (service textView listAt: service textView cursorLine).
+ line := textView listAt: textView cursorLine.
line isNil ifTrue:[ ^ #() ].
scanner := scannerClass for: line string.
tokenLastEndPosition := 0.
@@ -472,7 +466,7 @@
].
"Created: / 22-10-2013 / 00:31:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 22-10-2013 / 12:01:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 11-02-2015 / 23:43:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
scanLineAtCursor
@@ -482,9 +476,10 @@
by four subsequent items in the array: token type, token value, start position, end position.
Thus, returned array size is always multiple of 4."
- ^ self scanLineAt: service codeView textView cursorLine using: self scannerClass
+ ^ self scanLineAt: textView cursorLine using: self scannerClass
"Created: / 22-10-2013 / 00:34:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 11-02-2015 / 23:44:03 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!EditSupport class methodsFor:'documentation'!