Automatic code conversion on paste like "convert java code when paste it to .kt file"


I want to implement plugin for IntelliJ IDEA, which will convert HTML code to kotlinx.html (

I understand how to implement it by action (for example by selecting html text and pressing shortcut). But I can't find any documentation on how to implement behavior like automatic Java to Kotlin conversion when pasting Java code to .kt file.

Hot to register action, which will work on "paste" action in .kt file? 


Isn't com.intellij.codeInsight.editorActions.CopyPastePreProcessor is what you need?


Plugin development documentation is not a full reference, unfortunately. It's more like jump start, giving you an architectural overview and examples for your first steps.

Next step is search IDEA itself for classes and read javadocs, usually classes have human-friendly names. For example in you case `Go To Class` and `CopyPaste` could help a lot. Not all classes and interfaces are documented properly though, again, unfortunately. In such cases - debugging may help.

And this forum ofc.


Please sign in to leave a comment.