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

Update org.jetbrains.intellij 1.15.0 -> 1.17.0 #343

Merged
merged 7 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ val isForceCodeSearchBuild = isForceBuild || properties("forceCodeSearchBuild")
plugins {
id("java")
// Dependencies are locked at this version to work with JDK 11 on CI.
id("org.jetbrains.kotlin.jvm") version "1.9.10"
id("org.jetbrains.intellij") version "1.15.0"
id("org.jetbrains.kotlin.jvm") version "1.9.22"
id("org.jetbrains.intellij") version "1.17.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

id("org.jetbrains.changelog") version "1.3.1"
id("com.diffplug.spotless") version "6.21.0"
id("com.diffplug.spotless") version "6.25.0"
}

group = properties("pluginGroup")
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/com/sourcegraph/cody/SubscriptionTabUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ fun fetchSubscriptionPanelData(
if (activeAccountType != null) {
ensureUserIdMatchInAgent(activeAccountType.id, server)
return if (activeAccountType.isDotcomAccount()) {
val codyProFeatureFlag = server.evaluateFeatureFlag(GetFeatureFlag("CodyProJetBrains"))
if (codyProFeatureFlag.get() != null && codyProFeatureFlag.get()!!) {
val codyProFeatureFlag =
server.evaluateFeatureFlag(GetFeatureFlag.CodyProJetBrains).get() == true
if (codyProFeatureFlag) {
val isCurrentUserPro = getIsCurrentUserPro(server) ?: false
CompletableFuture.completedFuture(
SubscriptionTabPanelData(
Expand Down
15 changes: 9 additions & 6 deletions src/main/java/com/sourcegraph/vcs/RepoUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,17 @@ private static String doReplacements(
agent.getServer().convertGitCloneURLToCodebaseName(new CloneURL(cloneURL)))
.completeOnTimeout(/* value= */ null, /* timeout= */ 4, TimeUnit.SECONDS)
.get();
}

if (codebaseName == null) {
logger.warn(
"Failed to convert git clone URL to codebase name for cloneURL via agent: " + cloneURL);
codebaseName = convertGitCloneURLToCodebaseNameOrError(cloneURL);
if (codebaseName == null) {
logger.warn(
"Failed to convert git clone URL to codebase name for cloneURL via agent for cloneUrl="
+ cloneURL);
}
}
return codebaseName;

return codebaseName != null
? codebaseName
: convertGitCloneURLToCodebaseNameOrError(cloneURL);
}

if (vcsType == VCSType.PERFORCE) {
Expand Down
12 changes: 0 additions & 12 deletions src/main/kotlin/com/sourcegraph/cody/CodyToolWindowContent.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import com.intellij.util.IconUtil
import com.intellij.util.concurrency.annotations.RequiresBackgroundThread
import com.intellij.util.concurrency.annotations.RequiresEdt
import com.intellij.xml.util.XmlStringUtil
import com.sourcegraph.cody.agent.CodyAgentServer
import com.sourcegraph.cody.agent.CodyAgentService
import com.sourcegraph.cody.agent.protocol.ChatMessage
import com.sourcegraph.cody.agent.protocol.ContextMessage
Expand Down Expand Up @@ -130,7 +129,6 @@ class CodyToolWindowContent(private val project: Project) : UpdatableChat {
CodyAgentService.applyAgentOnBackgroundThread(project) { agent ->
fetchSubscriptionPanelData(project, agent.server).thenAccept {
if (it != null) {

ApplicationManager.getApplication().invokeLater { refreshSubscriptionTab(it) }
}
}
Expand Down Expand Up @@ -183,16 +181,6 @@ class CodyToolWindowContent(private val project: Project) : UpdatableChat {
}
}

private fun getUserId(server: CodyAgentServer): 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.

unused

return server
.currentUserId()
.exceptionally {
logger.warn("Unable to fetch user id from agent")
null
}
.get()
}

@RequiresEdt
override fun refreshPanelsVisibility() {
val codyAuthenticationManager = CodyAuthenticationManager.instance
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
package com.sourcegraph.cody.agent.protocol

data class GetFeatureFlag(val flagName: String)
data class GetFeatureFlag(val flagName: 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.

I am preparing us to have two more ff here (#319). I tried to make it an enum but it did not work through the request to the agent.

companion object {
val CodyProJetBrains = GetFeatureFlag("CodyProJetBrains")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ abstract class CodyAutocompleteElementRenderer(
if (isCustomAutocompleteColorEnabled())
getCustomAutocompleteColor()?.let {
AutocompleteRenderUtil.getCustomTextAttributes(editor, it)
}
?: textAttributesFallback.get()
} ?: textAttributesFallback.get()
else textAttributesFallback.get()
}

Expand Down
3 changes: 1 addition & 2 deletions src/main/kotlin/com/sourcegraph/cody/chat/Chat.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ class Chat {
val contextMessages =
agentChatMessage.contextFiles?.map { contextFile: ContextFile ->
ContextMessage(Speaker.ASSISTANT, agentChatMessageText, contextFile)
}
?: emptyList()
} ?: emptyList()
chat.displayUsedContext(contextMessages)
chat.addMessageToChat(chatMessage)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ internal class CodyTokenCredentialsUi(
override fun getValidator(): () -> ValidationInfo? = {
getServerPathValidationInfo()
?: notBlank(tokenTextField, "Token cannot be empty")
?: custom(tokenTextField, "Invalid access token") {
?: custom(tokenTextField, "Invalid access token") {
AuthorizationUtil.isValidAccessToken(tokenTextField.text)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ class SettingsMigration : Activity {
private fun extractAccountType(project: Project): AccountType {
return project.service<CodyProjectService>().getInstanceType()?.let { toAccountType(it) }
?: service<CodyApplicationService>().getInstanceType()?.let { toAccountType(it) }
?: AccountType.DOTCOM
?: AccountType.DOTCOM
}

private fun toAccountType(it: String): AccountType? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private constructor(title: String, content: String, shouldShowUpgradeOption: Boo
if (activeAccountType != null && activeAccountType.isDotcomAccount()) {
return CodyAgentService.getAgent(project)
.thenCompose { agent ->
agent.server.evaluateFeatureFlag(GetFeatureFlag("CodyProJetBrains"))
agent.server.evaluateFeatureFlag(GetFeatureFlag.CodyProJetBrains)
}
.thenApply { it == true }
}
Expand Down
Loading