Skip to content

Commit b0bb226

Browse files
committed
fix(gui): refactor event dispatcher initialization #51
We've refactored the initialization of the event dispatcher in the `AutoDevInputSection` class to ensure it is created in a more efficient manner, directly assigning it to a variable instead of going through an intermediate `EventDispatcher.create` call. This change improves code readability and maintainability.
1 parent 0b513e4 commit b0bb226

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

src/main/kotlin/cc/unitmesh/devti/gui/chat/AutoDevInputSection.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ class AutoDevInputSection(private val project: Project, val disposable: Disposab
5757
private var customRag: ComboBox<CustomRagApp> = ComboBox(MutableCollectionComboBoxModel(listOf()))
5858
private val logger = logger<AutoDevInputSection>()
5959

60-
val editorListeners: EventDispatcher<AutoDevInputListener> =
61-
EventDispatcher.create(AutoDevInputListener::class.java)
60+
val editorListeners = EventDispatcher.create(AutoDevInputListener::class.java)
6261
private var tokenizer: Tokenizer? = null
6362
var text: String
6463
get() {

src/main/kotlin/cc/unitmesh/devti/provider/PromptStrategy.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ abstract class PromptStrategy : LazyExtensionInstance<PromptStrategy>() {
2828

2929
private val tokenizer: Tokenizer = TokenizerImpl.INSTANCE
3030

31-
override fun getImplementationClassName(): String? {
32-
return implementationClass
33-
}
31+
override fun getImplementationClassName(): String? = implementationClass
3432

3533
open fun tokenLength(): Int = AutoDevSettingsState.maxTokenLength
3634
fun count(code: String): Int = tokenizer.count(code)

0 commit comments

Comments
 (0)