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 (https://github.com/Kotlin/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? 

1

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

0

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.

0

请先登录再写评论。