From bc926d126f7c8371431fb2dc659e0fd805ef68a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Kondratek?= Date: Mon, 4 Nov 2024 16:00:28 +0100 Subject: [PATCH] Remove potential infinite init loop (#2577) Accidentally, I found an infinite loop in cody tool window content initialization. It was likely a reason of the recent CI failures. This PR eliminates the risk of the inifinite loop. ## Test plan 1. Run integrationTests locally - should be all green, no sus logs, or errros indicating a loop in call stack --- .github/workflows/test.yml | 2 +- .../java/com/sourcegraph/cody/CodyToolWindowFactory.java | 5 +++++ .../kotlin/com/sourcegraph/cody/CodyToolWindowContent.kt | 2 -- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d67bfdb4e5..be7cc6de11 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,7 +7,7 @@ on: jobs: test: name: JetBrains tests - runs-on: macos-latest + runs-on: ubuntu-latest steps: - name: Fetch Sources uses: actions/checkout@v4 diff --git a/src/main/java/com/sourcegraph/cody/CodyToolWindowFactory.java b/src/main/java/com/sourcegraph/cody/CodyToolWindowFactory.java index b5f6d4c4ea..f0fa0cdd64 100644 --- a/src/main/java/com/sourcegraph/cody/CodyToolWindowFactory.java +++ b/src/main/java/com/sourcegraph/cody/CodyToolWindowFactory.java @@ -9,6 +9,7 @@ import com.intellij.ui.content.Content; import com.intellij.ui.content.ContentFactory; import com.sourcegraph.cody.config.actions.OpenCodySettingsEditorAction; +import com.sourcegraph.cody.ui.web.WebUIService; import com.sourcegraph.config.ConfigUtil; import com.sourcegraph.config.OpenPluginSettingsAction; import org.jetbrains.annotations.NotNull; @@ -39,6 +40,10 @@ public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindo } toolWindow.setAdditionalGearActions(customCodySettings); + + WebUIService.getInstance(project) + .getViews$Sourcegraph() + .provideCodyToolWindowContent(toolWindowContent); return null; }); } diff --git a/src/main/kotlin/com/sourcegraph/cody/CodyToolWindowContent.kt b/src/main/kotlin/com/sourcegraph/cody/CodyToolWindowContent.kt index 65366be585..e247e4ab51 100644 --- a/src/main/kotlin/com/sourcegraph/cody/CodyToolWindowContent.kt +++ b/src/main/kotlin/com/sourcegraph/cody/CodyToolWindowContent.kt @@ -48,8 +48,6 @@ class CodyToolWindowContent(val project: Project) { cardPanel.add(MissingJcefPanel(), CHANGE_RUNTIME_PANEL, CHANGE_RUNTIME_PANEL_INDEX) cardPanel.add(ErrorPanel(), ERROR_PANEL, ERROR_INDEX) - WebUIService.getInstance(project).views.provideCodyToolWindowContent(this) - refreshPanelsVisibility() }