Skip to content

Commit d2d08b4

Browse files
authored
Merge pull request #217 from devchat-ai/feat/add-plugin-version-to-message-event
feat: Add plugin version retrieval endpoint and update GUI submodule
2 parents c4028cd + 1af9a37 commit d2d08b4

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/main/kotlin/ai/devchat/plugin/IDEServer.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ import java.awt.Point
4949
import java.io.File
5050
import java.net.ServerSocket
5151
import kotlin.reflect.full.memberFunctions
52+
import com.intellij.ide.plugins.PluginManagerCore
5253

5354

5455
@Serializable
@@ -98,6 +99,17 @@ class IDEServer(private var project: Project): Disposable {
9899
json()
99100
}
100101
routing {
102+
post("/get_extension_version") {
103+
val currentPlugin = try {
104+
PluginManagerCore.getLoadedPlugins().find { plugin ->
105+
plugin.pluginClassLoader == IDEServer::class.java.classLoader
106+
}
107+
} catch (e: Exception) {
108+
null
109+
}
110+
call.respond(Result(currentPlugin?.version ?: "unknown"))
111+
}
112+
101113
post("/find_def_locations") {
102114
val body: ReqLocation = call.receive()
103115
val definitions = try {

0 commit comments

Comments
 (0)