Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Draw lines between methods in code editor of IntelliJ

Is there a way to make IntelliJ distinguish where each method’s body starts and stops? Perhaps drawing a line to separate the methods visually?

Seems kind of silly nowadays to be typing a “flower box” of asterisks as comments around method headings. The IDE should know where each method begins and ends.

like image 641
Basil Bourque Avatar asked Aug 25 '18 00:08

Basil Bourque


1 Answers

“Method separators”

Yes. IntelliJ calls the feature “method separators”.

In Preferences > Editor > General > Appearance, check the Show method separators box.

screen shot of Preferences dialog box showing 'Show method separators' checkbox

You can even control the color of the line drawn between methods. See Preferences > Editor > Color Scheme > General > Code > Method separator color > Foreground field where you can type in a the hex triplet code for a color in RGB. The default in the Darcula theme is 4D4D4D.

screen shot of Preferences showing 'Method separator color' editor

The code editor then displays a line across the pane, directly above the name of the method. For example, in this screenshot see the line above the method named MainView.

screen shot of IntelliJ method editor displaying a thin line above a method name

like image 120
Basil Bourque Avatar answered Sep 23 '22 22:09

Basil Bourque