Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Sourcegraph actions (search selection, open selection, etc) #325

Merged
merged 2 commits into from
Jan 22, 2024

Conversation

mkondratek
Copy link
Contributor

@mkondratek mkondratek commented Jan 22, 2024

Fixes #252.
Fixes #162.
Fixes #324.

Test plan

  • test Sourcegraph actions with Cody enabled
  • test Sourcegraph actions with Cody disabled

@mkondratek mkondratek self-assigned this Jan 22, 2024
@@ -156,7 +156,7 @@ class CodyToolWindowContent(private val project: Project) : UpdatableChat {
SUBSCRIPTION_TAB_INDEX)
}
subscriptionPanel.update(data.isCurrentUserPro)
} else {
} else if (SUBSCRIPTION_TAB_INDEX < tabbedPane.tabCount) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrel to the sourcegraph actions issue - minor fix (IndexOutOfBoundsException appeared once from this place)

Comment on lines +156 to +164
if (ConfigUtil.isCodyEnabled()) {
codebaseName =
CodyAgentService.getAgent(project)
.thenCompose(
agent ->
agent.getServer().convertGitCloneURLToCodebaseName(new CloneURL(cloneURL)))
.completeOnTimeout(/* value= */ null, /* timeout= */ 4, TimeUnit.SECONDS)
.get();
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's try to use agent only with Cody enabled. Also let's complete on timeout.

"Failed to convert git clone URL to codebase name for cloneURL: " + cloneURL);
logger.warn(
"Failed to convert git clone URL to codebase name for cloneURL via agent: " + cloneURL);
codebaseName = convertGitCloneURLToCodebaseNameOrError(cloneURL);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a fallback...


import java.net.URL

fun convertGitCloneURLToCodebaseNameOrError(cloneURL: String): String {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copied from the agent and translated (TS -> Kotlin)

@mkondratek mkondratek changed the title Fix subscription tab refresh Fix Sourcegraph actions (search selection, open selection, etc) Jan 22, 2024
Copy link
Contributor

@pkukielka pkukielka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mkondratek mkondratek merged commit 3d4c122 into main Jan 22, 2024
2 checks passed
@mkondratek mkondratek deleted the mkondratek/fix/sourcegraph-actions branch January 22, 2024 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants