Is there an action to take over code snippets from JavaDoc?
已回答
Hi all!
I know of live templates but I don't want to create templates for this. Instead, I want to insert code snippets which are part of the JavaDoc of e.g. a method into my code.
Do you know of any builtin functionality in this direction? This could become even more interesting when the following Java feature becomes live: https://openjdk.java.net/jeps/413.
请先登录再写评论。
Could you please clarify with an example how should this work? Thank you.
Sure. Have e.g. a look at the JDK lib method java.nio.file.Files#newByteChannel. The method comment contains some example code. When I use this method in the code and I hit some magical key combination, the example is inserted into my code, like this:
Then I could pick the code snippet that I want to use and remove the rest.
This might not be the best example but I hope you get the point.
Thank you for clarifications! There is no such functionality exists. It possibly could be useful for someone. Please feel free to file such a request for people to vote on it. I think, it could also be implemented as a nice IDE plugin.
Thanks for the answer. Then I know what options I have.
Have a nice day!