-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't automatically trim trailing whitespace on the current line #34701
Don't automatically trim trailing whitespace on the current line #34701
Conversation
76dd750
to
a672240
Compare
This prevents the cursor from moving unexpectedly when saving a file. "Trim Trailing Whitespace On Save" is now enabled by default, as this changes makes it much more convenient to use. Manual whitespace trimming operations (such as using the menu option) will still trim trailing whitespace on the current line.
a672240
to
5d36dbb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't looked at the code, but I would expect it to remove all whitespace regardless of caret placement (seen in QTCreator, Kate and Sublime Text.).
However, Intellij contains an option to ignore lines that contain a caret, don't know if its worth going down that route?
I would also expect the trimming to happen on all lines, regardless of which one has the caret. It might be a mild allowance if you type some code, press Return to go to the next line (indented automatically), and then save, thus losing indentation, but apart from that, I don't see much need to make this optional. What are the situations you saw where whitespace trimming would be problematic on the line with the caret? |
When you enable whitespace trimming on save, it requires you to reindent the line you were working on after saving (if it's a blank line). For instance, JetBrains IDEs will never trim whitespace on the current line. That said, saving is automatic in those IDEs, so you usually never press Ctrl + S in the first place. On the other hand, it's true that many IDEs trim whitespace on the current line when you enable the option to trim it when saving (like Visual Studio Code). |
Based on the above might be worth closing, and seeing if users want this as a setting via a proposal? |
Closing in favor of godotengine/godot-proposals#3229. |
This prevents the cursor from moving unexpectedly when saving a file.
"Trim Trailing Whitespace On Save" is now enabled by default, as this change makes it much more convenient to use.
Manual whitespace trimming operations (such as using the menu option) will still trim trailing whitespace on the current line.