Skip to content

Commit

Permalink
Pass project to CodyAgentClient
Browse files Browse the repository at this point in the history
  • Loading branch information
mkondratek committed Aug 13, 2024
1 parent f4815d4 commit fde87a9
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ kotlin.stdlib.default.dependency=false
nodeBinaries.commit=8755ae4c05fd476cd23f2972049111ba436c86d4
nodeBinaries.version=v20.12.2
cody.autocomplete.enableFormatting=true
cody.commit=a7ba3c987888439299edb6c215bb8b3ed4765d1d
cody.commit=7537429109d9eaf61da6daf49716abe169fbad6f
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.intellij.openapi.fileChooser.FileChooserFactory;
import com.intellij.openapi.fileChooser.FileSaverDescriptor;
import com.intellij.openapi.fileChooser.FileSaverDialog;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFileWrapper;
import com.sourcegraph.cody.agent.protocol.*;
import com.sourcegraph.cody.agent.protocol_generated.DisplayCodeLensParams;
Expand Down Expand Up @@ -34,9 +35,11 @@ public class CodyAgentClient {
private static final Logger logger = Logger.getInstance(CodyAgentClient.class);

@NotNull NativeWebviewProvider webview;
Project project;

CodyAgentClient(@NotNull NativeWebviewProvider webviewProvider) {
CodyAgentClient(@NotNull NativeWebviewProvider webviewProvider, Project project) {
this.webview = webviewProvider;
this.project = project;
}

// TODO: Remove this once we stop sniffing postMessage.
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/com/sourcegraph/cody/agent/CodyAgent.kt
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ private constructor(
fun create(project: Project): CompletableFuture<CodyAgent> {
try {
val conn = startAgentProcess()
val client = CodyAgentClient(WebUIServiceWebviewProvider(project))
val client = CodyAgentClient(WebUIServiceWebviewProvider(project), project)
client.onSetConfigFeatures = project.service<CurrentConfigFeatures>()
val launcher = startAgentLauncher(conn, client)
val server = launcher.remoteProxy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class CodyAgentClientTest : BasePlatformTestCase() {
private val condition = lock.newCondition()

private fun client(): CodyAgentClient {
val client = CodyAgentClient(StubWebviewProvider())
val client = CodyAgentClient(StubWebviewProvider(), project)
client.onSetConfigFeatures = ConfigFeaturesObserver {
lock.lock()
try {
Expand Down

0 comments on commit fde87a9

Please sign in to comment.