Is there any way to mark generated code as non-edi...
# ksp
t
Is there any way to mark generated code as non-editable to IntelliJ/Android Studio?
y
If you try to edit code in build folder, i think IJ already warns you. Can you explain a little bit more about your use case? (E.g. why do you want to do it?)
d
In addition to what Yigit said, many libraries use comments as warnings to discourage editing generated code. For example, Moshi adds a “Code generated by moshi-kotlin-codegen. Do not edit.” file comment: https://github.com/square/moshi/blob/e6110de8c358b76296500cb86fa17b9b4c7897f9/mosh[…]/java/com/squareup/moshi/kotlin/codegen/api/AdapterGenerator.kt
t
Thanks, yeah I will most likely add comments. I'm mostly just worried about newer developers following source and editing the file. In my intellij in the default ksp config the files themselves don't have a warning when trying to edit
It seems like it's not being marked as a Generated Sources root. When I do that manually it warns as expected
Seems covered by https://youtrack.jetbrains.com/issue/KT-45161 but the ticket hasn't gotten much attention