Skip to content

Commit

Permalink
Merge diff
Browse files Browse the repository at this point in the history
  • Loading branch information
cbart committed Jan 31, 2024
1 parent 19698e1 commit 623d90a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/com/sourcegraph/cody/agent/CodyAgentClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class CodyAgentClient {
private static final Logger logger = Logger.getInstance(CodyAgentClient.class);
// Callback that is invoked when the agent sends a "chat/updateMessageInProgress" notification.
@Nullable public Consumer<WebviewPostMessageParams> onNewMessage;
@Nullable public ConfigFeaturesObserver onSetConfigFeatures;
@Nullable public Editor editor;

/**
Expand Down Expand Up @@ -66,5 +67,10 @@ public void webviewPostMessage(WebviewPostMessageParams params) {
logger.debug("onNewMessage is null or message type is not transcript");
logger.debug(String.format("webview/postMessage %s: %s", params.getId(), extensionMessage));
}
if (onSetConfigFeatures != null
&& extensionMessage.getType().equals(ExtensionMessage.Type.SET_CONFIG_FEATURES)) {
ApplicationManager.getApplication()
.invokeLater(() -> onSetConfigFeatures.update(extensionMessage.getConfigFeatures()));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ data class ExtensionMessage(
object Type {
const val TRANSCRIPT = "transcript"
const val ERRORS = "errors"
const val SET_CONFIG_FEATURES = "setConfigFeatures"
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/main/kotlin/com/sourcegraph/cody/agent/CodyAgent.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.sourcegraph.cody.agent

import com.intellij.ide.plugins.PluginManagerCore
import com.intellij.openapi.components.service
import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.extensions.PluginId
import com.intellij.openapi.project.Project
Expand Down Expand Up @@ -94,6 +95,7 @@ private constructor(
try {
val conn = startAgentProcess()
val client = CodyAgentClient()
client.onSetConfigFeatures = project.service<CurrentConfigFeatures>()
val launcher = startAgentLauncher(conn, client)
val server = launcher.remoteProxy
val listeningToJsonRpc = launcher.startListening()
Expand Down

0 comments on commit 623d90a

Please sign in to comment.