Skip to content

Commit

Permalink
add editor completion [feenkcom/gtoolkit#3983]
Browse files Browse the repository at this point in the history
  • Loading branch information
JurajKubelka committed Sep 26, 2024
1 parent 73666e7 commit dcdad06
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
12 changes: 9 additions & 3 deletions src/GToolkit-Coder-UI/GtFilterTextModel.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,25 @@ Class {
#instVars : [
'text',
'inputFilter',
'completion'
'completionBuilder'
],
#category : #'GToolkit-Coder-UI-Filters - Models'
}

{ #category : #accessing }
GtFilterTextModel >> completion [
^ completion
<return: #GtCompletionStrategy or: nil>
^ completionBuilder value
]

{ #category : #accessing }
GtFilterTextModel >> completion: aCompletionBuilder [
completion := aCompletionBuilder
completionBuilder := aCompletionBuilder
]

{ #category : #accessing }
GtFilterTextModel >> completionDo: aBlock [
self completion ifNotNil: aBlock
]

{ #category : #accessing }
Expand Down
15 changes: 14 additions & 1 deletion src/GToolkit-Coder-UI/GtFilterTextSettingsElement.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ Class {
#name : #GtFilterTextSettingsElement,
#superclass : #GtFilterSettingsElement,
#instVars : [
'editorElement'
'editorElement',
'completionController'
],
#category : #'GToolkit-Coder-UI-Filters - Widgets'
}
Expand Down Expand Up @@ -83,10 +84,22 @@ GtFilterTextSettingsElement >> subscribeToFilterViewModel [
to: self
]

{ #category : #'private - updating' }
GtFilterTextSettingsElement >> updateEditorCompletionController [
completionController ifNotNil: [ :aController |
completionController := nil.
aController uninstall ].

self filterViewModel completionDo: [ :aStrategy |
completionController := GtCompletionController on: editorElement strategy: aStrategy.
completionController install ]
]

{ #category : #'private - updating' }
GtFilterTextSettingsElement >> updateEditorElement [
self updateEditorElementInputFilter.
self updateEditorElementText.
self updateEditorCompletionController.
]

{ #category : #'private - updating' }
Expand Down
6 changes: 6 additions & 0 deletions src/GToolkit-Coder-UI/GtFilterTextViewModel.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ Class {
#category : #'GToolkit-Coder-UI-Filters - View Models'
}

{ #category : #accessing }
GtFilterTextViewModel >> completionDo: aBlock [
self hasFilterModel ifFalse: [ ^ self ].
self filterModel completionDo: aBlock
]

{ #category : #accessing }
GtFilterTextViewModel >> filterElementClass [
^ GtFilterTextSettingsElement
Expand Down

0 comments on commit dcdad06

Please sign in to comment.