Skip to content

Commit

Permalink
Remove potential infinite init loop (#2577)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mkondratek authored Nov 4, 2024
1 parent d21db31 commit bc926d1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/com/sourcegraph/cody/CodyToolWindowFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -39,6 +40,10 @@ public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindo
}

toolWindow.setAdditionalGearActions(customCodySettings);

WebUIService.getInstance(project)
.getViews$Sourcegraph()
.provideCodyToolWindowContent(toolWindowContent);
return null;
});
}
Expand Down
2 changes: 0 additions & 2 deletions src/main/kotlin/com/sourcegraph/cody/CodyToolWindowContent.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down

0 comments on commit bc926d1

Please sign in to comment.