From 0adea49252370a39189db14d9916c68968111dcb Mon Sep 17 00:00:00 2001 From: sgoudham Date: Tue, 10 Sep 2024 00:13:38 +0100 Subject: [PATCH] feat: differentiate Java files by colour and shape --- CHANGELOG.md | 4 ++++ generate/vscode-icons | 2 +- gradle.properties | 2 +- .../jetbrains_icons/IconProvider.kt | 20 ++++++++++++------- .../jetbrains_icons/util/PsiClassUtils.kt | 12 +++++++++++ 5 files changed, 31 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f6a19b6..eb068fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ ### Added +- Differentiate Java files (Annotation, Class, Enum, etc.) by colour and shape in the file tree. If you know how to + implement these icons in the rest of the user interface, please reach out to us via the issue tracker or the + Catppuccin discord! + ### Changed ### Deprecated diff --git a/generate/vscode-icons b/generate/vscode-icons index 1a90668..5f807b0 160000 --- a/generate/vscode-icons +++ b/generate/vscode-icons @@ -1 +1 @@ -Subproject commit 1a90668e6ee0fbdf26f683e1cc37367a0e526871 +Subproject commit 5f807b0969d82e807671874e2d9022625b46cc55 diff --git a/gradle.properties b/gradle.properties index 645c701..a0b4044 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,6 +1,6 @@ pluginGroup=com.github.catppuccin.jetbrains_icons pluginName=Catppuccin Icons -pluginVersion=1.7.0 +pluginVersion=1.8.0 pluginSinceBuild=231 pluginUntilBuild=242.* platformType=IC diff --git a/src/main/kotlin/com/github/catppuccin/jetbrains_icons/IconProvider.kt b/src/main/kotlin/com/github/catppuccin/jetbrains_icons/IconProvider.kt index c7a1768..08eed18 100644 --- a/src/main/kotlin/com/github/catppuccin/jetbrains_icons/IconProvider.kt +++ b/src/main/kotlin/com/github/catppuccin/jetbrains_icons/IconProvider.kt @@ -74,10 +74,13 @@ class IconProvider : IconProvider() { file.accept(object : JavaRecursiveElementVisitor() { override fun visitClass(aClass: PsiClass) { when { + aClass.isAnnotationType -> fileType = "JAVA_ANNOTATION" aClass.isInterface -> fileType = "JAVA_INTERFACE" aClass.isEnum -> fileType = "JAVA_ENUM" - aClass.isAnnotationType -> fileType = "JAVA_ANNOTATION" aClass.isRecord -> fileType = "JAVA_RECORD" + PsiClassUtils.isException(aClass) -> fileType = "JAVA_EXCEPTION" + PsiClassUtils.isSealed(aClass) -> fileType = "JAVA_SEALED" + PsiClassUtils.isFinal(aClass) -> fileType = "JAVA_FINAL" PsiClassUtils.isAbstract(aClass) -> fileType = "JAVA_ABSTRACT" } } @@ -87,12 +90,15 @@ class IconProvider : IconProvider() { private fun provideJavaIcons(): Map { return mapOf( - "JAVA_INTERFACE" to icons.java_alt_1, - "JAVA_ENUM" to icons.java_alt_3, - "JAVA_ANNOTATION" to icons.java_alt_1, - "JAVA_RECORD" to icons.java_alt_2, - "JAVA_ABSTRACT" to icons.java_alt_1, - "JAVA_CLASS" to icons.java, + "JAVA_ANNOTATION" to icons.java_annotation, + "JAVA_INTERFACE" to icons.java_interface, + "JAVA_ENUM" to icons.java_enum, + "JAVA_RECORD" to icons.java_record, + "JAVA_EXCEPTION" to icons.java_exception, + "JAVA_ABSTRACT" to icons.java_class_abstract, + "JAVA_SEALED" to icons.java_class_sealed, + "JAVA_FINAL" to icons.java_class_final, + "JAVA_CLASS" to icons.java_class, ) } } diff --git a/src/main/kotlin/com/github/catppuccin/jetbrains_icons/util/PsiClassUtils.kt b/src/main/kotlin/com/github/catppuccin/jetbrains_icons/util/PsiClassUtils.kt index a2675b9..b76594e 100644 --- a/src/main/kotlin/com/github/catppuccin/jetbrains_icons/util/PsiClassUtils.kt +++ b/src/main/kotlin/com/github/catppuccin/jetbrains_icons/util/PsiClassUtils.kt @@ -7,4 +7,16 @@ object PsiClassUtils { fun isAbstract(psiClass: PsiClass): Boolean { return psiClass.hasModifierProperty(PsiModifier.ABSTRACT) } + + fun isSealed(psiClass: PsiClass): Boolean { + return psiClass.hasModifierProperty(PsiModifier.SEALED) + } + + fun isFinal(psiClass: PsiClass): Boolean { + return psiClass.hasModifierProperty(PsiModifier.FINAL) + } + + fun isException(psiClass: PsiClass): Boolean { + return psiClass.name!!.endsWith("com.github.catppuccin.jetbrains_icons.test.Exception") + } }