Skip to content

Commit

Permalink
Revert redundant code (sourcegraph/jetbrains#2809) (#6260)
Browse files Browse the repository at this point in the history
Port sourcegraph/jetbrains@d2dda95

This PR removes redundant code.

## Test plan

1. Green CI

Authored by: Mikołaj Kondratek <[email protected]>
  • Loading branch information
dominiccooney authored Dec 5, 2024
1 parent 5686699 commit 2747e45
Show file tree
Hide file tree
Showing 30 changed files with 4 additions and 2,160 deletions.
19 changes: 0 additions & 19 deletions jetbrains/src/main/java/com/sourcegraph/cody/Icons.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

public interface Icons {
Icon CodyLogo = IconLoader.getIcon("/icons/codyLogo.svg", Icons.class);
Icon HiImCody = IconLoader.getIcon("/icons/hiImCodyLogo.svg", Icons.class);

interface Actions {
Icon Add = IconLoader.getIcon("/icons/actions/huge_plus.svg", Icons.class);
Expand All @@ -26,26 +25,8 @@ interface StatusBar {
IconLoader.getIcon("/icons/codyLogoMonochromaticUnavailable.svg", Icons.class);
}

interface Onboarding {
Icon Autocomplete = IconLoader.getIcon("/icons/onboarding/autocomplete.svg", Icons.class);
Icon Chat = IconLoader.getIcon("/icons/onboarding/chat.svg", Icons.class);
Icon Commands = IconLoader.getIcon("/icons/onboarding/commands.svg", Icons.class);
}

interface SignIn {
Icon Github = IconLoader.getIcon("/icons/signIn/sign-in-logo-github.svg", Icons.class);
Icon Gitlab = IconLoader.getIcon("/icons/signIn/sign-in-logo-gitlab.svg", Icons.class);
Icon Google = IconLoader.getIcon("/icons/signIn/sign-in-logo-google.svg", Icons.class);
}

interface Chat {
Icon ChatLeaf = IconLoader.getIcon("/icons/chat/chatLeaf.svg", Icons.class);
Icon Download = IconLoader.getIcon("/icons/chat/download.svg", Icons.class);
}

interface Edit {
Icon Error = IconLoader.getIcon("/icons/edit/error.svg", Icons.class);
Icon Beta = IconLoader.getIcon("/icons/edit/beta.svg", Icons.class);
}

interface LLM {
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ public static Optional<String> getEnterpriseAccessToken() {
return token;
}

public static void setApplicationEnterpriseAccessToken(@NotNull String accessToken) {
setApplicationLevelSecureConfig(enterpriseAccessTokenKeyParts, accessToken);
cachedEnterpriseAccessToken = accessToken;
}

// Empty string means empty or no token. No value means user denied access to token.
@NotNull
public static Optional<String> getDotComAccessToken() {
Expand All @@ -45,11 +40,6 @@ public static Optional<String> getDotComAccessToken() {
return token;
}

public static void setApplicationDotComAccessToken(@NotNull String accessToken) {
setApplicationLevelSecureConfig(dotComAccessTokenKeyParts, accessToken);
cachedDotComAccessToken = accessToken;
}

// Empty string means empty or no password. No value means user denied access to password.
@NotNull
private static Optional<String> getApplicationLevelSecureConfig(@NotNull List<String> keyParts) {
Expand All @@ -66,13 +56,6 @@ private static Optional<String> getApplicationLevelSecureConfig(@NotNull List<St
return Optional.of(password);
}

private static void setApplicationLevelSecureConfig(
@NotNull List<String> keyParts, @NotNull String accessToken) {
CredentialAttributes credentialAttributes = createCredentialAttributes(createKey(keyParts));
Credentials credentials = new Credentials(null, accessToken);
PasswordSafe.getInstance().set(credentialAttributes, credentials);
}

@NotNull
private static String createKey(@NotNull List<String> keyParts) {
return StringUtils.join(keyParts, ".");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,4 @@ public void loadState(@NotNull CodyProjectService settings) {
public String getEnterpriseAccessToken() {
return enterpriseAccessToken;
}

public boolean areChatPredictionsEnabled() {
// TODO: implement
return false;
}

public String getCodebase() {
// TODO: implement
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,4 @@ private static Properties readPropertiesFile(File file) throws IOException {

return properties;
}

public static boolean isVerboseLoggingEnabled() {
return Boolean.getBoolean("sourcegraph.verbose-logging");
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ package com.sourcegraph.cody.api

object SourcegraphGQLQueries {
const val getUserDetails = "graphql/query/getUserDetails.graphql"
const val getUserCodyProEnabled = "graphql/query/getUserCodyProEnabled.graphql"
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.sourcegraph.cody.auth
import com.intellij.util.xmlb.annotations.Attribute
import com.intellij.util.xmlb.annotations.Tag
import com.sourcegraph.cody.config.SourcegraphParseException
import com.sourcegraph.config.ConfigUtil
import java.net.URI
import java.util.regex.Pattern

Expand All @@ -27,7 +26,6 @@ data class SourcegraphServerPath(
get() = URI.create(url).host

companion object {
const val DEFAULT_HOST = ConfigUtil.DOTCOM_URL

// 1 - schema, 2 - host, 4 - port, 5 - path
private val URL_REGEX =
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package com.sourcegraph.cody.history.state
import com.intellij.openapi.components.BaseState
import com.intellij.util.xmlb.annotations.OptionTag
import com.intellij.util.xmlb.annotations.Tag
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter

@Tag("chat")
class ChatState() : BaseState() {
Expand All @@ -31,24 +29,4 @@ class ChatState() : BaseState() {

@get:OptionTag(tag = "enhancedContext", nameAttribute = "")
var enhancedContext: EnhancedContextState? by property()

private var updatedAtDate: LocalDateTime? = null

fun title(): String? = messages.firstOrNull()?.text?.take(48)

fun setUpdatedTimeAt(date: LocalDateTime) {
updatedAtDate = date
updatedAt = date.format(DATE_FORMAT)
}

fun getUpdatedTimeAt(): LocalDateTime {
if (updatedAt == null) return LocalDateTime.now()
if (updatedAtDate == null) updatedAtDate = LocalDateTime.parse(updatedAt, DATE_FORMAT)
return updatedAtDate ?: LocalDateTime.now()
}

companion object {

private val DATE_FORMAT = DateTimeFormatter.ISO_LOCAL_DATE_TIME
}
}
18 changes: 0 additions & 18 deletions jetbrains/src/main/kotlin/com/sourcegraph/cody/ui/Colors.kt

This file was deleted.

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions jetbrains/src/main/resources/icons/chat/chatLeaf.svg

This file was deleted.

7 changes: 0 additions & 7 deletions jetbrains/src/main/resources/icons/chat/download.svg

This file was deleted.

7 changes: 0 additions & 7 deletions jetbrains/src/main/resources/icons/chat/download_dark.svg

This file was deleted.

Loading

0 comments on commit 2747e45

Please sign in to comment.