Closed sebasira closed 1 year ago
Which version of the plugin are you using?
Are suggestions missing in Java or Kotlin code?
In case you are using Lombok then it could be that the PSI from IntelliJ is not properly populated by the Lombok plugin. I would suggest trying to delombok your files and see if the suggestions work. Just to rule out Lombok.
I've recently installed the plugin (that same day), so I'm guessing it should be the latest. It's v1.2.3
Suggestions are missing in Java.
What I've try is removing the Lombok annotation from a class and manually create setter and getter, with the same result. Even try making the fields public.
I'll post a dummy code like the one I'm using, just in case you notice something
@Data
@EqualsAndHashCode(callSuper = false)
public class A_createDTO extends CreateDTO<A> {
private String name;
private String lastname;
private String city;
}
@Mapper
public interface AMapper {
@Mapping(target = "name", source = "nombre")
@Mapping(target = "lastname", source = "apellido")
@Mapping(target = "city", source = "ciudad")
A_createDTO createMapper(B b);
}
Maybe I miss-understand the features of the plugin. What I'm expecting is that whenever I type an annotation like this one:
@Mapping(target = "name", source = "nombre")
I start typing the target/source fields name an then I get the suggestions to prevent typos. Or after typing target=
get a suggested list of all fields in the Target class.
And FWIW this is how I declare the MapStruct depencency:
implementation 'org.mapstruct:mapstruct:1.4.1.Final'
annotationProcessor 'org.mapstruct:mapstruct-processor:1.4.1.Final'
testAnnotationProcessor 'org.mapstruct:mapstruct-processor:1.4.1.Final'
I'm aware that the MapStruct
documentation also suggest this other lines in the build.gradle
file:
plugins {
...
id 'net.ltgt.apt' version '0.15'
}
// You can integrate with your IDEs.
// See more details: https://github.com/tbroyer/gradle-apt-plugin#usage-with-ides
apply plugin: 'net.ltgt.apt-idea'
apply plugin: 'net.ltgt.apt-eclipse'
But I've remove those lines because the readme of gradle-apt-plugin says the following:
The goal of this plugin was to eventually no longer be needed, being superseded by built-in features. This has become a reality with Gradle 5.2 and IntelliJ IDEA 2019.1. tl;dr: this plugin is obsolete, don't use it. If you're using Eclipse though, continue reading.
I'm using Android Studio (based on InteliJ IDEA) and Gradle v6.5
More on this... same ins happening in IntelliJ IDEA, Spring Boot project (the Java backend of the previous mentioned Android app).
I use the same setup, so definitely I'm missing a step or have something miss-configured and I can not figured out what.
Any input would be appreciated! Thank you!
I start typing the target/source fields name an then I get the suggestions to prevent typos. Or after typing
target=
get a suggested list of all fields in the Target class.
The suggestions should be there after typing target="<caret>"
. You have to be inside the quotes in order for the suggestions to work.
Note: <caret>
represents the location of your cursor in the IDE
@filiphr thanks for your reply.
Yes that is what I would expect, but look at this screenshot:
As you can see it IDE (signals that the property vehicleAlias
is unmapped). I think that feature is part of the plugin so the plugin should be working. But when I have the cursor inside the quotes of the target, I get no suggestions. I also typed the first v (of vehicleAlias) and still no suggestion.
Any ideas?
I also encountered the same problem
IntelliJ IDEA 2020.3 (Ultimate Edition) Build #IU-203.5981.155, built on December 1, 2020
any progress?
Closing this, since I can't reproduce this
I'm trying to use this plugin in Android Studio (latests v4.1) and the autocomplete/assistant is not working while creating a
@Mapping
.I mean, the suggestions for the
target
andsource
fields. If I manually write them I can navigate to them, they are recognize but there's no assistant while creating it.I think that
Annotation Processor
was not enable, but it is. I'm also using Lombok and it's working fine (the Annotation Processor, I mean)I think I'm missing something here but I can't figure out what.
Thank you!