1

I want the formatter to break the line when the code reaches the right margin.

I found solution, but for older versions of IntelliJ. How can I do this in IntelliJ 2018?

Example:

first image

and then when I type toLowerCase, for example - to receive that: second image

LazyOne
  • 158,824
  • 45
  • 388
  • 391
exkid
  • 33
  • 2
  • 11
  • give an example of line you want to formatt and expecten result – Ruslan Feb 08 '19 at 12:41
  • That doesn't matter. I mean I want it to do it on every line. If I use autocompletion and the space to the right margin is not enough the line to be breaked. – exkid Feb 08 '19 at 12:47
  • You go to settings > editor > code style > java > wrapping and braces. You can set where the editor should break the lines there and how – Amir Schnell Feb 08 '19 at 12:56
  • I checked there. There's nothing like that. Only hard wrap. When I turn "Wrap on typing" it doesn't change anything. – exkid Feb 08 '19 at 12:59
  • 1
    Based on your second screenshot .. it's just a soft-wrap: the code is still on a single line but instead of horizontal scrolling the text is displayed on multiple lines (soft wrapped). Have a look at https://stackoverflow.com/a/45310682/783119 or https://stackoverflow.com/a/6649137/783119 – LazyOne Feb 08 '19 at 13:42
  • @LazyOne Yes. Actually this is soft-wrap and I make it to works.Thank you. But still can't set the wrap on typing to work. – exkid Feb 08 '19 at 15:03
  • It's all automatic -- use the first link to see if it's enabled for current file or not. You can then enable/disable for each file (has to be applied every time you open it) .. or enable/disable for all files by default. My first link has what to look for and where (answers are old .. but you can use search field and type `soft warp` there to narrow it) – LazyOne Feb 08 '19 at 15:21

1 Answers1

0

Go to Settings > Editor > Code Style > Java, switch to Wrapping and Braces tab and change Wrap on typing to Yes.

enter image description here

Andy Sug
  • 234
  • 2
  • 7