From 043d4fe4e96d8ce900081f2ce62e108de7575fa1 Mon Sep 17 00:00:00 2001 From: Carl-Robert Linnupuu Date: Fri, 16 Jan 2026 15:09:37 +0000 Subject: [PATCH] refactor: clean up agent tab initialization --- .../agent/AgentToolWindowContentManager.kt | 17 +---------------- .../codegpt/ui/textarea/TagProcessorFactory.kt | 10 ++-------- 2 files changed, 3 insertions(+), 24 deletions(-) diff --git a/src/main/kotlin/ee/carlrobert/codegpt/toolwindow/agent/AgentToolWindowContentManager.kt b/src/main/kotlin/ee/carlrobert/codegpt/toolwindow/agent/AgentToolWindowContentManager.kt index 6c8a6c67..988c17e7 100644 --- a/src/main/kotlin/ee/carlrobert/codegpt/toolwindow/agent/AgentToolWindowContentManager.kt +++ b/src/main/kotlin/ee/carlrobert/codegpt/toolwindow/agent/AgentToolWindowContentManager.kt @@ -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 } diff --git a/src/main/kotlin/ee/carlrobert/codegpt/ui/textarea/TagProcessorFactory.kt b/src/main/kotlin/ee/carlrobert/codegpt/ui/textarea/TagProcessorFactory.kt index b63ef4c9..42aae819 100644 --- a/src/main/kotlin/ee/carlrobert/codegpt/ui/textarea/TagProcessorFactory.kt +++ b/src/main/kotlin/ee/carlrobert/codegpt/ui/textarea/TagProcessorFactory.kt @@ -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) ) } }