mirror of
https://github.com/Kilo-Org/kilocode.git
synced 2026-09-24 16:02:55 +08:00
fix(jetbrains): open created worktree editor
This commit is contained in:
+1
@@ -72,6 +72,7 @@ class AgentManagerPanel(
|
||||
// Focus the list so the freshly created worktree renders as an active selection rather
|
||||
// than the inactive highlight it would get while focus stays on the toolbar.
|
||||
if (list.select(key)) list.focusList()
|
||||
item(key)?.takeIf { !controller.isPending(it.id) }?.let { open(it, focus = false) }
|
||||
}
|
||||
controller.onCreateFailure = { err -> notifyCreateFailed(err) }
|
||||
controller.onRemoveSuccess = { item -> close(item) }
|
||||
|
||||
+17
@@ -68,6 +68,23 @@ class AgentManagerPanelTest : BasePlatformTestCase() {
|
||||
assertEquals(created.id, edt { (list.selectedValue as ActiveListItem).key })
|
||||
}
|
||||
|
||||
fun `test creating a worktree opens the created worktree session editor`() {
|
||||
val controller = WorktreeController(service, "/test", coroutines.scope)
|
||||
val panel = edt { AgentManagerPanel(testRootDisposable, controller, project) }
|
||||
|
||||
edt { controller.create("feature/y", null) }
|
||||
flush()
|
||||
|
||||
val list = edt { UIUtil.findComponentOfType(panel, JBList::class.java)!! }
|
||||
val created = edt { controller.model.getElementAt(0) }
|
||||
assertEquals(created.id, edt { (list.selectedValue as ActiveListItem).key })
|
||||
val file = edt { FileEditorManager.getInstance(project).openFiles.single() as KiloVirtualFile }
|
||||
assertEquals(WorktreeSessionEditorKind.ID, file.path.kind)
|
||||
assertEquals(created.path, file.path.params["path"])
|
||||
assertSame(WorktreeSessionEditorKind.fileType(file.path.params), file.fileType)
|
||||
assertEquals(false, file.getUserData(KiloVfsManager.FOCUS))
|
||||
}
|
||||
|
||||
fun `test panel hides worktree search field`() {
|
||||
val controller = WorktreeController(service, "/test", coroutines.scope)
|
||||
val panel = edt { AgentManagerPanel(testRootDisposable, controller) }
|
||||
|
||||
Reference in New Issue
Block a user