With my IDE plugin, my field resolves fine once it...
# compiler
r
With my IDE plugin, my field resolves fine once it is typed, but doesn't appear in autocomplete. Is there an extension point I'm missing? I'm using
generateSyntheticProperties
in my
SyntheticResolveExtension
It seems that when I'm typing, I receive calls to
generateSyntheticProperties
with the typed name followed by
IntellijIdeaRulezzz
, but even adding the property descriptor there doesn't make it show up
I suspect this is because the synthetic field isn't present in the .class file (its added to the IR), but I'm not sure how to get it to show up there.
s
If the field is added to IR, it most probably is there in resulting bytecode. IDEA decompiler relies on Kotlin metadata to show you the fields, most probably that's why you don't see it. If you add it on the IR step, frontend is unaware of your synthetic property, so it should be added as a descriptor in resolve extension. However, I am not quite sure why it doesn't show up when you adding it.
r
hmm. Is there a way to add that metadata? And it does show up eventually (if I type the whole name), just not for autocomplete, so its clearly being detected at some point.
Do you know of any examples where this works? Because there is no
getSyntheticPropertyNames
and the place where
getSyntheticFunctionNames
is used just calls super for properties. Is it possible it isn't implemented yet for properties?
s
I think it is not, at least it didn't work last time I checked
A workaround could be to add a supertype interface which has the property you need
r
yeah, I'm probably going to just make a function, all I wanted was a getter anyways. Do you know if there's an open issue or if I should make one?
s
No idea 🙂
r
There is also the SyntheticScopeProvider
which you can use to return an arbitrary number of members for a given set of types the autocomplete and other parts asks for
That is what shows up in autocomplete as you type