Hey guys, I'm writing a compiler plugin for fun an...
# compiler
h
Hey guys, I'm writing a compiler plugin for fun and I'm generating additional functions in a class. Is there any way to include (in bytecode) generated things in for example the ide (intellij) completion? I mean without writing a custom intellij plugin? I want the ide to use the build for class compilation and the compilation output for Code completion somehow O:-)
3
r
Same issue here, @AdrianRaFo is helping us investigate
h
Has sth similar been done before? I mean using class files (probably from the build) for completion info in intellij?
i
Well, I did something like this before. Short answer is: "AFAIK, there is no way to extend scopes without creating another extension point in the compiler itself". Current support is limited for SamWithReceiver's needs. And this is how I wanted to do this: https://github.com/JetBrains/kotlin/compare/rr/androidCompatCompilerPlugin Unfortunately, the changes have not been merged.
h
Wow, now that's a lot of code! Very impressive. Looks like it is the missing link, although i just understand half of the code. Why is this Not merged and open since 2017? At least the extension point for scope additions for synthetic stuff should be accepted, this would open so many possibilities
s
You should add such synthesised declarations to compiler's descriptors. Take a look at
SyntheticResolveExtension
and classes implementing it, it may help
☝️ 2
h
Thanks, will take a look at it soon!
As soon as i implement generateSyntheticMethods (tbp as soon as i add things to result), my example project throws gc overhead error 🤔🤔