Skip to content

Commit 3c391a1

Browse files
ipttonCopilot
andauthored
fix #387 model.update parameter should use MutableList (#388)
* chore(build): 允许在 gradle.properties 中配置本地运行的 idea 版本与构建版本不同 * chore(build): 默认用 community 运行 * feat(quick-assistant): add ESC handler for inlay panel && dismiss previous inlay panel when new one shown Handle ESC key to dispose inlay panel and cleanup resources. Track current panel instance for proper disposal close #375 * Update core/src/main/kotlin/cc/unitmesh/devti/actions/quick/QuickAssistantAction.kt Co-authored-by: Copilot <[email protected]> * Update core/src/main/kotlin/cc/unitmesh/devti/actions/quick/QuickAssistantAction.kt Co-authored-by: Copilot <[email protected]> * refactor(quick-assistant): clean up imports and extract inlay panel disposal logic * fix(agent): model.update use Java List type, in kotlin should use MutableList close #387 --------- Co-authored-by: Copilot <[email protected]>
1 parent 1fe90b5 commit 3c391a1

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

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

+8-8
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import cc.unitmesh.devti.AutoDevNotifications
66
import cc.unitmesh.devti.agent.custom.model.CustomAgentConfig
77
import cc.unitmesh.devti.agent.custom.model.CustomAgentState
88
import cc.unitmesh.devti.completion.AutoDevInputLookupManagerListener
9+
import cc.unitmesh.devti.gui.AutoDevCoolBorder
910
import cc.unitmesh.devti.gui.chat.ui.file.RelatedFileListCellRenderer
1011
import cc.unitmesh.devti.gui.chat.ui.file.RelatedFileListViewModel
1112
import cc.unitmesh.devti.gui.chat.ui.file.WorkspaceFilePanel
@@ -45,7 +46,6 @@ import com.intellij.openapi.wm.IdeFocusManager
4546
import com.intellij.openapi.wm.impl.InternalDecorator
4647
import com.intellij.psi.PsiElement
4748
import com.intellij.psi.PsiManager
48-
import cc.unitmesh.devti.gui.AutoDevCoolBorder
4949
import com.intellij.ui.HintHint
5050
import com.intellij.ui.MutableCollectionComboBoxModel
5151
import com.intellij.ui.SimpleListCellRenderer
@@ -187,9 +187,9 @@ class AutoDevInputSection(private val project: Project, val disposable: Disposab
187187
}
188188
}
189189
customAgent.selectedItem = defaultRag
190-
190+
191191
// Add action listener to refresh agent list when dropdown is clicked
192-
customAgent.addActionListener {
192+
customAgent.addActionListener {
193193
if (customAgent.isPopupVisible) {
194194
refreshAgentList()
195195
}
@@ -373,20 +373,20 @@ class AutoDevInputSection(private val project: Project, val disposable: Disposab
373373
buttonPanel.isEnabled = true
374374
}
375375

376-
private fun loadAgents(): List<CustomAgentConfig> {
376+
private fun loadAgents(): MutableList<CustomAgentConfig> {
377377
val rags = CustomAgentConfig.loadFromProject(project)
378378

379-
if (rags.isEmpty()) return listOf(defaultRag)
379+
if (rags.isEmpty()) return mutableListOf(defaultRag)
380380

381-
return listOf(defaultRag) + rags
381+
return (listOf(defaultRag) + rags).toMutableList()
382382
}
383-
383+
384384
private fun refreshAgentList() {
385385
val currentSelection = customAgent.selectedItem
386386
val agents = loadAgents()
387387
val model = customAgent.model as MutableCollectionComboBoxModel<CustomAgentConfig>
388388
model.update(agents)
389-
389+
390390
// Try to restore the previous selection
391391
if (currentSelection != null && agents.contains(currentSelection)) {
392392
customAgent.selectedItem = currentSelection

0 commit comments

Comments
 (0)