Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spec code completion #5671

Merged
merged 6 commits into from Feb 14, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/Rubric/RubScrolledTextMorph.class.st
Expand Up @@ -267,6 +267,12 @@ RubScrolledTextMorph >> columnRuler [
^ self rulerNamed: #column
]

{ #category : #accessing }
RubScrolledTextMorph >> completionEngine: aCompletionEngine [

self textArea editor completionEngine: aCompletionEngine
]

{ #category : #configure }
RubScrolledTextMorph >> configureGhostText: aTextArea [
aTextArea width: self scrollBounds width.
Expand Down
8 changes: 5 additions & 3 deletions src/Rubric/RubSmalltalkEditor.class.st
Expand Up @@ -357,7 +357,10 @@ RubSmalltalkEditor >> completionAround: aBlock keyStroke: anEvent [

{ #category : #'completion engine' }
RubSmalltalkEditor >> completionEngine [
^ completionEngine

^ completionEngine ifNil: [
self completionEngine: CompletionEngineClass new.
completionEngine ]
]

{ #category : #'completion engine' }
Expand Down Expand Up @@ -735,8 +738,7 @@ RubSmalltalkEditor >> implementorsOfIt: aKeyboardEvent [
{ #category : #initialization }
RubSmalltalkEditor >> initialize [
super initialize.
notificationStrategy := RubTextInsertionStrategy new editor: self.
CompletionEngineClass ifNotNil: [self completionEngine: CompletionEngineClass new]
notificationStrategy := RubTextInsertionStrategy new editor: self
]

{ #category : #keymapping }
Expand Down
3 changes: 2 additions & 1 deletion src/Spec2-Adapters-Morphic/SpMorphicTextAdapter.class.st
Expand Up @@ -41,7 +41,8 @@ SpMorphicTextAdapter >> buildWidget [
yourself.

self setEditingModeFor: newWidget.

self presenter completionEngine ifNotNil: [ :engine | newWidget completionEngine: engine ].
self presenter whenCompletionEngineChangedDo: [ :engine | newWidget completionEngine: engine ].
self presenter whenTextChangedDo: [ :text | self setText: text to: newWidget ].
self presenter whenPlaceholderChangedDo: [ :text | self setGhostText: text to: newWidget ].

Expand Down
22 changes: 21 additions & 1 deletion src/Spec2-Core/SpCodePresenter.class.st
Expand Up @@ -9,7 +9,8 @@ Class {
'#doItContext => SpObservableSlot',
'#doItReceiver => SpObservableSlot',
'#behavior => SpObservableSlot',
'#syntaxHighlight => SpObservableSlot'
'#syntaxHighlight => SpObservableSlot',
'#completionEngine => SpObservableSlot'
],
#category : #'Spec2-Core-Widgets-Text'
}
Expand Down Expand Up @@ -116,6 +117,18 @@ SpCodePresenter >> behavior: aClass [
behavior := aClass
]

{ #category : #accessing }
SpCodePresenter >> completionEngine [

^ completionEngine
]

{ #category : #api }
SpCodePresenter >> completionEngine: aCompletionEngine [

completionEngine := aCompletionEngine
]

{ #category : #'api-doIt' }
SpCodePresenter >> doItContext [

Expand Down Expand Up @@ -217,6 +230,13 @@ SpCodePresenter >> whenBehaviorChangedDo: aBlock [
whenChangedDo: aBlock
]

{ #category : #'api-events' }
SpCodePresenter >> whenCompletionEngineChangedDo: aBlock [
"Set a block to perform when the syntax highlight is enabled/disabled"

self property: #completionEngine whenChangedDo: aBlock
]

{ #category : #'api-events' }
SpCodePresenter >> whenSyntaxHighlightChangedDo: aBlock [
"Set a block to perform when the syntax highlight is enabled/disabled"
Expand Down