https://kotlinlang.org logo
#getting-started
Title
# getting-started
e

elect

05/31/2023, 1:17 PM
Is there a way to have some code auto-generated during type-time via annotations or something else?
y

Youssef Shoaib [MOD]

05/31/2023, 3:29 PM
KSP can do that, thus having the generated classes visible in the type-system
e

elect

05/31/2023, 3:34 PM
coz I'd like to generate that way the sealed enums
y

Youssef Shoaib [MOD]

05/31/2023, 3:36 PM
Well that's what KSP does. The only issue is you have to build to get the new declarations, but I think there's an option in Intellij to auto-build as you type.
e

elect

05/31/2023, 3:50 PM
it'd be nice to have something connected to/triggered by the code highlighting, because I wouldn't want the autobuild as I type
y

Youssef Shoaib [MOD]

05/31/2023, 3:55 PM
Hmmm, the ksp generation itself takes barely any time, so I wonder if there's a way to have it constantly update the sources in the background
2 Views