Open steverice opened 9 years ago
That would be great to clarify the language on that feature. I can tell you that the Visual Studio plugin trims all trailing whitespace of all lines in the documents, but other editors might handle it differently. I don't know.
Either way, it should probably be noted in the docs, as you say.
Indeed; it may also be helpful for plugin authors to clarify the intent so there isn't that sort of inconsistency among implementations.
All plugins I can remember trim all lines. Do you know any plugins which do differently?
No, but I've only used the VS and Sublime ones.
Notepad++ doesn't have an option to trim lines on save. A new macro has to be created. Not sure what to do.
@atwellpub if that's a feature that's important to you have you considered using an editor that has support for that setting? I know that SublimeText has it and I'm sure others.
Sublime text does provide this feature already, but being a PHP developer I am very hapily dependent on Notepad++'s quick-nav function parser, which I can't find for sublime anywhere.
I have done a small investigation and have not found that feature. I will gladly switch to an editor that provides me with both.
Hopefully someone using PHPStorm will chime in.
but ... writing a macro isn't that hard?
PhpStorm can do that: https://www.jetbrains.com/phpstorm/help/viewing-structure-of-a-source-file.html (not only for php)
@xuhdev I agree that writing a macro for Notepad++ shouldn't be hard, but I don't have any experience doing that in Notepad++, so I don't have much to offer.
It does seem that Alt+Shift+S
in Notepad++ will trim trailing whitespace, but remembering to do that isn't terribly convenient, is it? It should be automated and bound to the EditorConfig setting.
I still think considering other editors might be the best viable option for @atwellpub, because of the features he deems important. @atwellpub, I can tell you that I've extensively used all 3 of the editors mentioned (Notepad++, PHPStorm and SublimeText 2/3) as well as Visual Studio. The important thing is to use the tool you find makes yourself the most productive. Based on what you need, it sounds like PHPStorm might be the right tool for you.
I definitely would prefer having the three options that IntelliJ IDEA natively provides for what they name "Strip trailing spaces on save":
Trailing spaces should not appear in code, but when I modify others code, I don't want my commit to include lots of white space corrections. It makes it way harder to see in a quick diff what real code changes I did.
I agree that there would be value in a modified
setting:
[*]
trim_trailing_whitespace = modified
We can still use true
for all lines and your None scenario above would be the existing default.
@jedmao Exactly!
Issues in code editors:
I've combed through the documentation and can't find anything that explicitly answers this question: If I set
trim_trailing_whitespace
totrue
, does that mean trailing whitespace is trimmed from all lines or just modified lines?This comment suggests it's modified only. In any case that's an important thing to consider when deciding whether or not to enable that property.