Format style of documentation comments in Intellij Idea using keyboard shortcuts

1

Approach

First of all we do not find in JavaDoc , in Java.

I have the following text that I want to insert as part of the JavDoc:

Esto es el commentario de JavaDoc que quiero exponer en la 
pagina de stackverflow y que despues voy a diseñar para que sea 
agregado a mi proyecto personal.
Pero tengo una serie de problemas a la hora de insertalo en Intellij IDEA 
que no me ocurre en Eclipse.

Example in Eclipse

Then show step by step how I do in Eclipse until I get the result I do not get in Intellij ':

  • First step. I start by putting the comment

  • Second Step I paste or write the corresponding text:

  • Third and last step I press the Ctrl + Shift + F key and get the following:

Problem

In Intellij I do the same but when you get to step three you do not do anything .

Doubt

What keys must be used or added to do the same in Intellij as in Eclipse?

    
asked by Nicolás Alarcón R. 24.04.2017 в 07:47
source

2 answers

1

Of this response from the StackOverflow in English: link

What is closest is Edit | Join Lines (Ctrl + Shift + J). You have to select the lines you want to join first. To cut long comments, activate the following Settings | Code Style | JavaDoc | Wrap at right margin.

On the other hand, if you are more comfortable with the eclipse shortcuts, you can configure them in the IntelliJ:

In this link it says as:

    
answered by 24.04.2017 / 08:13
source
1
  

UPDATE by comment and update of the question:

so maybe what you are looking for is this:

/** + EnterKey

where /** is what you write in the code and then you use EnterKey

an example:

/** + enter
public void mi_test(String test_parametro_1, String test_parametro_2){

}
/**
* @param test_parametro_1
* @param test_parametro_2
*
/
public void mi_test(String test_parametro_1, String test_parametro_2){

}

Added: For the third step, try the following Reformat code

Ctrl + Alt + L selecting, for Mac look in the guide that you leave in this answer, in the section Editing - > Reformat code .

It's the alternative for al: Ctrl + Alt + F of Eclipse but right now I can not prove it on Intellij Idea.

may not work as expected

If it does not work as expected, you can always use the following:

/** + EnterKey . then select the text you want to enter, and apply: Ctrl + Shif + / . then move or cut and paste, in the place you want, you just have to erase / * * / they are over, (not a practical solution) but it is what I can say right now, I can not try Ctrl + Alt + L .

If I have the possibility to use it I will see how it works and I will be able to delete this part if it is not necessary

  

ANCIENT

Maybe you can try the following (to use the shortcut by default):

Comment / uncomment with line comment Ctrl + /

Comment / uncomment with block comment Ctrl + Shift + /

For GNU / Linux

Comment line or selected lines (Line Comment):

Ctrl + /

Comment block of selected code (Block Comment):

Ctrl + Shif + /

For Windows

Comment line or selected lines (Line Comment):

Ctrl + /

Comment block of selected code (Block Comment):

Ctrl + Shif + /

For MAC

Use Cmd instead of Ctrl followed by the rest of the keys.

You can see other shortcuts here for different OS, shown for GNU / Linux and Windows and separate for Mac.

(search the link for the desired action, for example: Comment /uncomment with line comment on the Mac page, to see how it would be)

  

If you want to remap the shortcuts, you can look at this question / answer

    
answered by 24.04.2017 в 08:31