Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add plugin version retrieval endpoint and update GUI submodule #217

Merged
merged 2 commits into from
Dec 27, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
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
yangbobo2021 committed Dec 27, 2024
commit b285281869e7056c1d91cbc1ee9b624a08c6405e
12 changes: 12 additions & 0 deletions src/main/kotlin/ai/devchat/plugin/IDEServer.kt
Original file line number Diff line number Diff line change
@@ -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 {