Giter Site home page Giter Site logo

Comments (6)

greenarr0w avatar greenarr0w commented on July 18, 2024 2

Are there any news on this issue? It would be very nice to have kotlin support.

from mapstruct-idea.

lppedd avatar lppedd commented on July 18, 2024 1

@filiphr I can have a look at it, I want to keep using Kotlin and completion is always helpful. Could you maybe point to a starting class?

from mapstruct-idea.

filiphr avatar filiphr commented on July 18, 2024

The plugin uses the default way of accessing the annotations in elements. I have to dig in to understand how it works within kotlin. If someone has some idea or knows what exactly needs to be done I am looking forward to your help 😄

from mapstruct-idea.

filiphr avatar filiphr commented on July 18, 2024

One starting point would be Handling code from the IntelliJ SDK documentation.

As for the plugin some starting classes that you would need to look are:

<psi.referenceContributor language="JAVA" implementation="org.mapstruct.intellij.codeinsight.references.MapstructReferenceContributor" />
<methodReferencesSearch implementation="org.mapstruct.intellij.search.MappingMethodUsagesSearcher" />
<renameHandler implementation="org.mapstruct.intellij.rename.MapstructSourceTargetParameterRenameHandler"/>

The way the completion works is by providing references through a reference contributor. The MapstructReferenceContributor is the one that registers the contributors. I think that you can actually use the same implementation, but you would need to provide different MapstructElementUtils that would be able to get the PsiElement from the kotlin plugin.

The MappingMethodUsagesSearcher is something I needed to add for find usages to work. Maybe it would work ootb with Kotlin, as I don't see anything specific to Java in there.

The MapstructSourceTargetParameterRenameHandler is something I needed to add for renaming to work properly, I think that we can reuse that as well, but we would need to find a neat way to pass MAPPING_SOURCE_OR_TARGET as the Kotlin plugin dependency should be optional.

There are some tests, that might guide you and that you might be able to utilise for debugging

from mapstruct-idea.

filiphr avatar filiphr commented on July 18, 2024

@greenarr0w I haven't had a lot of time to look into this. If someone from the community would like to step up and help with this it would be much appreciated.

from mapstruct-idea.

filiphr avatar filiphr commented on July 18, 2024

Done in 41dd190 and 1119db7

thanks @ifrankwang for your work on this.

from mapstruct-idea.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.