refactor: clean up agent tab initialization
Some checks failed
Build / Build (push) Has been cancelled
Build / Verify Plugin (push) Has been cancelled

This commit is contained in:
Carl-Robert Linnupuu 2026-01-16 15:09:37 +00:00
parent b81eeee470
commit 043d4fe4e9
2 changed files with 3 additions and 24 deletions

View file

@ -23,22 +23,7 @@ class AgentToolWindowContentManager(private val project: Project) : Disposable {
}
})
val storedSessions = sessionState.getSessionIds()
if (storedSessions.isEmpty()) {
createNewAgentTab()
} else {
storedSessions.forEach { sessionId ->
createNewAgentTab(sessionId = sessionId, select = false)
}
sessionState.getLastActiveSessionId()?.let { lastActive ->
tabbedPane.tryFindTabTitle(lastActive).ifPresent { title ->
val tabIndex = tabbedPane.indexOfTab(title)
if (tabIndex >= 0) {
tabbedPane.selectedIndex = tabIndex
}
}
}
}
createNewAgentTab()
return tabbedPane
}

View file

@ -85,10 +85,7 @@ class SelectionTagProcessor(
}
promptBuilder.append(
"""
# User has highlighted code:
${CompletionRequestUtil.formatCode(selectedText, tagDetails.virtualFile.path)}
""".trimIndent()
CompletionRequestUtil.formatCode(selectedText, tagDetails.virtualFile.path)
)
}
}
@ -104,10 +101,7 @@ class EditorSelectionTagProcessor(
}
promptBuilder.append(
"""
# User has highlighted code:
${CompletionRequestUtil.formatCode(selectedText, tagDetails.virtualFile.path)}
""".trimIndent()
CompletionRequestUtil.formatCode(selectedText, tagDetails.virtualFile.path)
)
}
}