Skip to content

Commit

Permalink
feat: differentiate Java files by colour & shape in the file tree (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgoudham authored Sep 13, 2024
1 parent 5aaca99 commit 5eb2a54
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

### 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!
- Upgrade submodule `vscode-icons` from v1.15.0 to v1.16.0 (See [vscode-icons CHANGELOG.md](https://github.com/catppuccin/vscode-icons/blob/main/CHANGELOG.md#v1160) for added icons and associations)

### Changed

### Deprecated
Expand Down
2 changes: 1 addition & 1 deletion generate/vscode-icons
Submodule vscode-icons updated 78 files
+55 −0 .github/workflows/previews.yml
+1 −0 .gitignore
+38 −0 CHANGELOG.md
+ assets/catwalk.webp
+ assets/frappe.webp
+ assets/latte.webp
+ assets/macchiato.webp
+ assets/mocha.webp
+3 −0 icons/css-variables/benchmark.svg
+0 −7 icons/css-variables/java-alt-1.svg
+0 −7 icons/css-variables/java-alt-2.svg
+0 −7 icons/css-variables/java-alt-3.svg
+3 −0 icons/css-variables/java-annotation.svg
+3 −0 icons/css-variables/java-class-abstract.svg
+3 −0 icons/css-variables/java-class-final.svg
+3 −0 icons/css-variables/java-class-sealed.svg
+1 −5 icons/css-variables/java-class.svg
+3 −0 icons/css-variables/java-enum.svg
+3 −0 icons/css-variables/java-exception.svg
+4 −0 icons/css-variables/java-interface.svg
+4 −0 icons/css-variables/java-record.svg
+3 −0 icons/frappe/benchmark.svg
+0 −7 icons/frappe/java-alt-1.svg
+0 −7 icons/frappe/java-alt-2.svg
+0 −7 icons/frappe/java-alt-3.svg
+3 −0 icons/frappe/java-annotation.svg
+3 −0 icons/frappe/java-class-abstract.svg
+3 −0 icons/frappe/java-class-final.svg
+3 −0 icons/frappe/java-class-sealed.svg
+1 −5 icons/frappe/java-class.svg
+3 −0 icons/frappe/java-enum.svg
+3 −0 icons/frappe/java-exception.svg
+4 −0 icons/frappe/java-interface.svg
+4 −0 icons/frappe/java-record.svg
+3 −0 icons/latte/benchmark.svg
+0 −7 icons/latte/java-alt-1.svg
+0 −7 icons/latte/java-alt-2.svg
+0 −7 icons/latte/java-alt-3.svg
+3 −0 icons/latte/java-annotation.svg
+3 −0 icons/latte/java-class-abstract.svg
+3 −0 icons/latte/java-class-final.svg
+3 −0 icons/latte/java-class-sealed.svg
+1 −5 icons/latte/java-class.svg
+3 −0 icons/latte/java-enum.svg
+3 −0 icons/latte/java-exception.svg
+4 −0 icons/latte/java-interface.svg
+4 −0 icons/latte/java-record.svg
+3 −0 icons/macchiato/benchmark.svg
+0 −7 icons/macchiato/java-alt-1.svg
+0 −7 icons/macchiato/java-alt-2.svg
+0 −7 icons/macchiato/java-alt-3.svg
+3 −0 icons/macchiato/java-annotation.svg
+3 −0 icons/macchiato/java-class-abstract.svg
+3 −0 icons/macchiato/java-class-final.svg
+3 −0 icons/macchiato/java-class-sealed.svg
+1 −5 icons/macchiato/java-class.svg
+3 −0 icons/macchiato/java-enum.svg
+3 −0 icons/macchiato/java-exception.svg
+4 −0 icons/macchiato/java-interface.svg
+4 −0 icons/macchiato/java-record.svg
+3 −0 icons/mocha/benchmark.svg
+0 −7 icons/mocha/java-alt-1.svg
+0 −7 icons/mocha/java-alt-2.svg
+0 −7 icons/mocha/java-alt-3.svg
+3 −0 icons/mocha/java-annotation.svg
+3 −0 icons/mocha/java-class-abstract.svg
+3 −0 icons/mocha/java-class-final.svg
+3 −0 icons/mocha/java-class-sealed.svg
+1 −5 icons/mocha/java-class.svg
+3 −0 icons/mocha/java-enum.svg
+3 −0 icons/mocha/java-exception.svg
+4 −0 icons/mocha/java-interface.svg
+4 −0 icons/mocha/java-record.svg
+2 −2 package.json
+679 −535 pnpm-lock.yaml
+3 −1 scripts/catwalk.ts
+3 −1 scripts/icons/preview.ts
+41 −2 src/defaults/fileIcons.ts
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
Expand All @@ -87,12 +90,15 @@ class IconProvider : IconProvider() {

private fun provideJavaIcons(): Map<String, Icon> {
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,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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("Exception")
}
}

0 comments on commit 5eb2a54

Please sign in to comment.