Configure editor to remove whitespaces in blank lines
Answered
Is it possible to configure an editor in pycharm to automatically remove whitespaces in blank lines and trailing whitespaces when saving a file.
Please sign in to leave a comment.
I, too, discovered my issue, but it was not the fix Wayne offered. After digging through other editor options I found a language-specific option (PHP in my case) in "Default Settings" at Default Settings >> Editor >> Code Style >> PHP >> Tabs and Indents (tab) >> "Keep Indents on Empty Lines" (check box). After unchecking "Keep Indents on Empty Lines", my problem was solved.
Hope this helps!
Yes please add an option to remove trailing spaces in Python docstrings. It used to work with old PyCharm versions but the latest version does no longer strip all trailing white spaces in docstrings. It is extremely disruptive to be honest.
Hello Volodymyr,
Settings | Editor | Strip trailing spaces on Save | All
--
Dmitry Jemerov
Development Lead
JetBrains, Inc.
http://www.jetbrains.com/
"Develop with Pleasure!"
What worked for me is un-tick the option 'Always keep trailing space on caret line' underneath the 'Strip trailing spaces on Save' option
I had this issue and I fixed it on Preferences|Editor|Code Style|JavaScript <—here you choose the language you are using. There is a checkbox: Keep Indents On Empty Lines. For no reason I checked that checkbox and unchecked it again, clicked on Apply and then it magically worked. If you want to see the whitespace go to Editor|General|Appearance| and check Show Whitespaces. Create a whitespace anywhere and hit save you will see how whitespace is remove. The thing is that you have to move the caret to any other line and not keep it in the same line where you created whitespace.
This option seems to be unavailable for C# in Rider.
I have the same issue in Webstorm: trailing spaces in empty lines are not removed after saving even in case "Settings | Editor | Strip trailing spaces on Save | All"
Hi Dmitry, I'm having an issue with this feature.
I've created this video documenting my problem: https://www.youtube.com/watch?v=QgSpKoErotA&feature=youtu.be
Is there a way I can set pycharm to remove trailing whitespace on lines that are within a function?
Thank you for any help,
Max
I'm having this trouble with trailing spaces in docstrings. I understand that spacing in string literals need to be kept, but could we have an option to strip trailing spaces in docstrings, where trailing spacing is undesirable?
This is an issue for me too
Jake! Thank you very much! This is answer on the topic. I puzzled why it works fine for me on Windows and does not work on OS X.
And the reason is the checkbox in code style for particular language.
I really appreciate your help!
@Rich Burdon
If your question is the same as OP, please look in [File | Settings | Editor | General >> Save Files]
It's 2020 and the issue still occurs
solution provided by @... works, thx, Jetbrains pls fix this issue!
+1 I, too, am having this issue.
Have tried all of these steps, but still doesn't work for me on OSX.
What did work was disabling "settings may be overridden by EditorConfig"
Rich Burdon Do you mind sharing where you found the "settings may be overridden by EditorConfig" checkbox?
@Rand Voorhies
I get stuck with this every time I set up a new machine -- seeing my own post above from last year -- but that doesn't seem to work now.
Still don't see that checkbox -- or anything below "Detect and use existing file indents"
Yeah, I don't know if this was previously reported as a bug but I've just done so: https://youtrack.jetbrains.com/issue/IDEA-272196