Reputation: 5226
In Eclipse, I can press Alt+Shift+J and get a javadoc comment automatically generated with fields, returns, or whatever would be applicable for that specific javadoc comment. I'm assuming that IntelliJ IDEA has this feature. Can anyone tell me if there is a keyboard shortcut for this?
Upvotes: 200
Views: 210045
Reputation: 351
you can create live template and use that in this case.
First, type the below text in your intellij idea
/**
* @author HOSSAIN
* @since 02 JUN, 2024
*/
select the whole text, now select the tab "Code" at the top of your intellij IDEA, then select "Save as Live Template" then give a template name, click "Apply" & "OK".
now, your template is saved. All you need is to put the cursor on the IDE and type the template name that you just saved, hit enter, Bingo!
Upvotes: 0
Reputation: 28593
Typing /**
+ then pressing Enter above a method signature will create Javadoc stubs for you.
Upvotes: 401
Reputation: 690
Shortcut Alt+Enter shows intention actions where you can choose "Add Javadoc".
Upvotes: 43
Reputation: 2106
You can use the action 'Fix doc comment'. It doesn't have a default shortcut, but you can assign the Alt+Shift+J shortcut to it in the Keymap, because this shortcut isn't used for anything else.
By default, you can also press Ctrl+Shift+A two times and begin typing Fix doc comment
in order to find the action.
Upvotes: 100