Read more

RubyMine: Better soft wraps

Henning Koch
February 12, 2017Software engineer at makandra GmbH

Sometimes your code has long lines:

describe 'foo' do
  describe 'bar' do
    really_long_line_really_long_line_really_long_line
    another_line
Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

When you're working with multiple editor panes, such code will often be wider than the pane area:

describe 'foo' do                |
  describe 'bar' do              |
    really_long_line_really_long_|
    another_line                 |

To help with this you can activate Soft wraps in the RubyMine options under General → Editor .

Your code will now look like this:

describe 'foo' do                |
  describe 'bar' do              |
    really_long_line_really_long_|
line_really_long_line            |
    another_line                 |

Note that the new line breaks are just a visualization, they won't appear in your files.

I also recommend the option Use original line's indent for wrapped parts to make the lines easier to parse. With this option, your code looks like this:

describe 'foo' do                |
  describe 'bar' do              |
    really_long_line_really_long_|
      line_really_long_line      |
    another_line                 |
Posted by Henning Koch to makandra dev (2017-02-12 09:55)