> Is there IDE support for `Import` annotations...
# scripting
e
Is there IDE support for
Import
annotations?
So I put “log statements” (diagnostics) in the refinement handler and it turns out that kotlinscript does in fact support it … 😄 Its honestly amazing. The actual initial issue was that I defined a complex annotation sort of and so script annotation processing wasn’t able to correctly parse my annotation and was returning an
InvalidScriptResolverAnnotation
annotation error. Had to replace with plain string fields to get it to work like:
Copy code
// take 1:
annotation class Res(val key: String, val code: Array<String>, val value: Array<String>) // choke 💀
// take 2:
annotation class Res(val key: String, vararg val entries: Entry) { // choke 💀
  annotation class Entry(val code: String, val value: String)
}
// take 3:
@Repeatable
annotation class Res(val key: String, val code: String, val value: String) // 👍
3 is obviously the least desirable of all the options but its what works currently. I am generating kts files on the go based on annotation and they are correctly imported and referenced. Probably because I am generating directly into the src folder where the original script lives but I believe it should still work perfectly if the kts files are generated into src/resource folders (based on the
ide.acceptedLocations
config)
n
so what does this Res annotation do ?
i intend to add a annotation like this:
annotation class Include(val path: String)
that just does add a .kt file in a predefined include folder
e
In my case i was defining resources for script authors. Kinda like string resources on android. It was more exploratory to see if that sort of API was possible
i
apparently this the same problem, @SrSouza reported few days ago here. I’ll try to investigate it.
e
Thanks @ilya.chernikov If there is a tracking issue I’ll like to star it. Let me know if you need more info.
i