mapstruct-idea icon indicating copy to clipboard operation
mapstruct-idea copied to clipboard

Add quick fix for can't map property X to Y

Open filiphr opened this issue 7 years ago • 5 comments

The eclipse plugin has a quick fix for the error "Can't map property X prop to Y prop. Consider to declare/implement a mapping method ...".

I still am not sure if IntelliJ has a way to register a quick fix for a warning / error (this is how Eclipse handles this now)

filiphr avatar Nov 24 '18 22:11 filiphr

It is possible, take a look at this official sample code.

thunderhook avatar Feb 02 '19 23:02 thunderhook

Thanks for the tip @thunderhook, I will have a look at it and see if we can do something about it.

filiphr avatar Feb 03 '19 19:02 filiphr

Btw, if you are interested in working on the plugin you can also provide a PR for this support 😉

filiphr avatar Feb 03 '19 19:02 filiphr

I'm sorry about my overhasty post about the sample code. That's just a sample to implement a quick-fix. After checking out the source I recognized that quick-fixes are already implemented, so there is nothing new for you to see here.

I tried to dig inside a little bit, but I have no experience in IntelliJ SDK, but I'll try my best if I find time.

thunderhook avatar Feb 03 '19 22:02 thunderhook

Yesterday I took some time to figure out how to get to the messages the annotation provider delivers. In previous versions it had been able to use a ClassPostProcessingCompiler but it is now deprecated, reffering to this site.

I tried to provide a custom BuildTargetScopeProvider but this is only called before the annotation processor generates the code. I also tried to hook into some phase where the messages are delivered to the CompileContext, but I had no luck for now. I'll try again in about a week.

thunderhook avatar Feb 06 '19 21:02 thunderhook