mapstruct / mapstruct-idea

An IntelliJ IDEA plugin for working with MapStruct
Other
136 stars 38 forks source link

Code completion: mapTo... suggestions take precedence over more useful suggestions #190

Closed kalvintamas closed 5 months ago

kalvintamas commented 5 months ago

When I invoke code completion (or the popup opens automatically as I write) there are always tons of mapper methods on top. This is annoying because I rarely use these mapper suggestions, I usually write/call them directly.

I didn't find a way to disable this in mapstruct, inspection, or other settings. But I don't want to disable/uninstall the plugin because it is helpful when writing mapstruct mappers.

Is there any method to disable these? Or could you implement it?

image

thunderhook commented 5 months ago

Hi @kalvintamas

Thanks for reaching out.

What code completions do you mean exactly with mapTo... suggestions? Do you mean the code completion of source, target and qualifiedByName inside @Mapping?

Yes, we can add a setting which disables code completion, but still provides the references.

Technical note for my future self or the one implementing it: return LookupElement.EMPTY_ARRAY in getVariantsInternal(PsiMethod) while leaving the code as is in getVariantsInternal(PsiType).

kalvintamas commented 5 months ago

I edited the original post by adding a screenshot for clarification.

I didn't mean the source, target etc. completions, they are pretty fine and useful, that's why I installed the plugin in the first place.

I don't know if IntelliJ provides a method to arrange the elements in the code completion popup list, it wouldn't be bad if you would leave these suggestions in code completion if you could e.g. move them down or make them only appear on typing "mapTo...". But if it isn't possible, providing a setting that removes them would also be a good thing, thank you.

thunderhook commented 5 months ago

Thanks for the clarification. These code suggestions are not coming from the MapStruct plugin. It must be another plugin.

There is nothing we can do about it. You can find the culprit by disabling some plugins. It would be good to know what caused this. Maybe you can give some insight when you find out.

I will close this issue for now. If it is still related to the mapstruct plugin, we can reopen it.

kalvintamas commented 4 months ago

Thank you for your help. Could you suggest who I could turn to for help? Is this a built-in IntelliJ feature?

thunderhook commented 4 months ago

Unfortunately not. I don't get these auto-completion suggestions with my Ultimate license.

If I were you, I would disable some plugins in Settings > Plugins or even use the Disable all downloaded plugins option there. Then see if it still happens and maybe raise an IntelliJ YouTrack issue.

kalvintamas commented 4 months ago

Thanks for your tip!

Actually I found the plugin responsible for this. It was JPA Buddy, and unfortunately, it doesn't have an option to disable only the mapTo... suggestions, you can only disable every smart code completion that comes from that plugin. Maybe if I contact them they can do something about it.