Hi , hope i'm at the right channel Using `KSClass...
# ksp
a
Hi , hope i'm at the right channel Using
KSClassDeclaration
for type
ClassKind.ENUM_CLASS
is it possible to get the names of the enums ?
j
from the declaration of the enum class, if you get
KSClassDeclaration.declarations
, you should get a list of declarations inside the enum class, and you can filter instances of
ClassKind.ENUM_ENTRY
to get the enum entries.
a
thanks for fast replay ! , i found them 😄
Copy code
fun KSClassDeclaration.getEnumEntries(): Sequence<KSDeclaration> {
    return declarations.filter { it.closestClassDeclaration()?.classKind == ClassKind.ENUM_ENTRY }
}