From b285281869e7056c1d91cbc1ee9b624a08c6405e Mon Sep 17 00:00:00 2001 From: "bobo.yang" Date: Fri, 27 Dec 2024 08:18:19 +0800 Subject: [PATCH 1/2] feat: Add plugin version retrieval endpoint - Add new POST endpoint /get_extension_version to fetch plugin version - Implement PluginManagerCore to locate current plugin by classloader - Return version or "unknown" in standardized Result format --- src/main/kotlin/ai/devchat/plugin/IDEServer.kt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/kotlin/ai/devchat/plugin/IDEServer.kt b/src/main/kotlin/ai/devchat/plugin/IDEServer.kt index abc7278..b3930bf 100644 --- a/src/main/kotlin/ai/devchat/plugin/IDEServer.kt +++ b/src/main/kotlin/ai/devchat/plugin/IDEServer.kt @@ -49,6 +49,7 @@ import java.awt.Point import java.io.File import java.net.ServerSocket import kotlin.reflect.full.memberFunctions +import com.intellij.ide.plugins.PluginManagerCore @Serializable @@ -98,6 +99,17 @@ class IDEServer(private var project: Project): Disposable { json() } routing { + post("/get_extension_version") { + val currentPlugin = try { + PluginManagerCore.getLoadedPlugins().find { plugin -> + plugin.pluginClassLoader == IDEServer::class.java.classLoader + } + } catch (e: Exception) { + null + } + call.respond(Result(currentPlugin?.version ?: "unknown")) + } + post("/find_def_locations") { val body: ReqLocation = call.receive() val definitions = try { From 1af9a37db335218541e449fd0eda55ac8560784d Mon Sep 17 00:00:00 2001 From: "bobo.yang" Date: Fri, 27 Dec 2024 08:18:35 +0800 Subject: [PATCH 2/2] update gui submodule --- gui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui b/gui index c883677..2f6f379 160000 --- a/gui +++ b/gui @@ -1 +1 @@ -Subproject commit c8836777f0d09ce1328166abec5cebc480a2590a +Subproject commit 2f6f379e917ace3d5a1dab1307c9446a08144d81