sindresorhus / atom-editorconfig

Helps developers maintain consistent coding styles between different editors
https://atom.io/packages/editorconfig
MIT License
812 stars 80 forks source link

Improving implementation of `max_line_length` #143

Closed florianb closed 7 years ago

florianb commented 7 years ago

It turned out that even the EditorConfig-specification requires max_line_length being applied by inserting (hard) wraps, a raising user base treats that as unexpected if they explicitly disabled "Soft Wraps" in Atom.

How should the implementation of max_line_length being improved to fit the user expectations better?

  1. The overall Atom-configuration of "Soft Wraps" should be respected.
  2. The gutter should be shown 2.1 Therefore the default wrap-guide should still be hidden

and

❓ The EditorConfigs-wrap-guide should turn red if any line exceeds the max_line_length

florianb commented 7 years ago

I proposed a change of the official max_line_length-property -- support would be appreciated: https://github.com/editorconfig/editorconfig/issues/280

mik01aj commented 7 years ago

I'm not sure if this is related, but I noticed that enabling max_line_length = 80 in my (global) .editorconfig causes the wrap-guide to disappear. And removing this line causes the guide to appear again. Looks like a bug to me.

florianb commented 7 years ago

Hi @mik01aj, thank you for reporting this. It might be that the wrap-guide implementation is faulty due to the current transition of Atom towards 1.13. To take care about your issue i'd like to ask you to open a new issue containing all necessary information. Thanks in advance! 👍

mik01aj commented 7 years ago

Ok, see #163.

rjmunro commented 7 years ago

IMHO max_line_length should position the wrap-guide, and possibly highlight any characters that are past it, e.g. with a red background. It should probably integrate with how the linter plugins work. As Atom doesn't have a built in text wrap command, it can't do much else, unless it implemented wrap functionality itself, or worked in cooperation with another plugin.

What the spec means by hard wrapping is that when the file is saved, no lines should be longer than the length specified. Therefore soft wrapping is almost the exact opposite of what it should do as it makes it look like the file complies with the preferred width when it doesn't.

manuelbieh commented 7 years ago

softwrap, in my opinion, makes absolutely no sense here. The editorconfig spec says hardwrap - hardwrapping is not possible so using softwrap instead is just "for the user's eyes". Setting the wrap-guide to max_line_length should be fine to indicate that the code should wrap just there.

The user's softwrap setting(s) should be taken into consideration here. If the user has softwrap enabled, atom-editorconfig should softwrap at max_line_length. If it's disabled the wrap-guide should be moved to max_line_length (as it was a few weeks ago iirc).

vosi commented 7 years ago

It's so annoying that I can't switch off softwrap, that I had to disable editorconfig plugin

I want to control this, but I can't, it doesn't respect settings

I just want to see a guide/highlight/semi-visible_hint/younameit there, and I'm not pep8/other code standards addicted, sometimes, for your own internal code its just ok

florianb commented 7 years ago

The max_line_length will respect at least the SoftWrap setting in the next minor-release.