mapstruct / mapstruct-idea

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

Auto completion for InheritConfiguration#name, InheritInverseConfiguration#name #163

Open alexbudarov opened 9 months ago

alexbudarov commented 9 months ago

Example code:

@Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE, componentModel = MappingConstants.ComponentModel.SPRING)
public interface VisitMapper {
    @Mapping(source = "assignedVetId", target = "assignedVet.id")
    @Mapping(source = "petId", target = "pet.id")
    Visit toEntity(VisitDto visitDto);

    @InheritInverseConfiguration(name = "toEntity")
    VisitDto toDto(Visit visit);
}

The @InheritInverseConfiguration#name is referencing a method in the same interface - toEntity().

Would be great to have auto completion and navigation.

Documentation: https://mapstruct.org/documentation/stable/reference/html/#mapping-configuration-inheritance https://mapstruct.org/documentation/stable/reference/html/#inverse-mappings

filiphr commented 9 months ago

This is a good idea @alexbudarov.

For how to implement this we can look at the implementation for org.junit.jupiter.params.provider.MethodSource in IntelliJ itself.

If there is someone from the community that would like to work on this please let us know :)