Is there a {@code } macro

... macro or keyboard shortcut to generate a "{@code }" statement while inside a Javadoc and the cursor being placed just before the closing curly bracket? Would be so awesome :)

4 comments
Comment actions Permalink

Hi reikje,

Do you mean generating '{@code'? It's not possible to do at the moment. However, you can make a live template that would allow to wrap any selected text into '{@code}'.

Denis

0
Comment actions Permalink

Here's a template of mine.
Installation instructions:
1. close all instances of IDEA
2. go into your <idea-confg>/templates/ directory
3. drop the attached file there. If the file already exists, copy the <template name="@code"...> section from the attachment and paste into your surround.xml file.

Usage instructions: select a javadoc fragment and press Ctrl+Alt+J.
Enjoy!

Hint to the JetBrains people: feel free to bundle this template into the next release.



Attachment(s):
surround.xml
1
Comment actions Permalink

I don't see that directory.  I see a fileTemplates directory.  I have IntelliJIdea2017.1 so maybe the directory changed for a newer version?  Is fileTemplates the new location?  Is there a way to do this manually from the Settings menus?

0

Please sign in to leave a comment.