Skip to content

Commit

Permalink
Merge pull request #3870 from continuedev/dallin/jetbrains-webview-msg
Browse files Browse the repository at this point in the history
Fix direct webview -> ide Jetbrains specific messages
  • Loading branch information
Patrick-Erichsen authored Jan 28, 2025
2 parents e67be03 + 9545cca commit b1ecf7b
Showing 1 changed file with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ class IdeProtocolClient(
val messageType = message.messageType
val dataElement = message.data

// A couple oddball messages respond directly to GUI, expect a different message format
// e.g. jetbrains/isOSREnabled
fun respondToWebview(content: Any) {
respond(mutableMapOf(
"done" to true,
"status" to "success",
"content" to content
))
}

try {
when (messageType) {
"showTutorial" -> {
Expand All @@ -63,12 +73,12 @@ class IdeProtocolClient(
"jetbrains/isOSREnabled" -> {
val isOSREnabled =
ServiceManager.getService(ContinueExtensionSettings::class.java).continueState.enableOSR
respond(isOSREnabled)
respondToWebview(isOSREnabled)
}

"jetbrains/getColors" -> {
val colors = GetTheme().getTheme();
respond(colors)
respondToWebview(colors)
}

"jetbrains/onLoad" -> {
Expand All @@ -78,7 +88,7 @@ class IdeProtocolClient(
"vscMachineId" to getMachineUniqueID(),
"vscMediaUrl" to "http://continue",
)
respond(jsonData)
respondToWebview(jsonData)
}

"getIdeSettings" -> {
Expand Down

0 comments on commit b1ecf7b

Please sign in to comment.