Draw lines between methods in code editor of IntelliJ
Asked Answered
T

1

28

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.

Trumantrumann answered 25/8, 2018 at 0:47 Comment(0)
T
55

“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

Trumantrumann answered 25/8, 2018 at 0:47 Comment(2)
It seems that it doesn't work for JavaScript. Any clues?Nutwood
Why is only the foreground colour adjustable? I'd like to change the separator's style. For example, for using equal signs instead of a thin line of underscores...Tankersley

© 2022 - 2024 — McMap. All rights reserved.