How do I auto-remove trailing whitespace in Androi

2019-01-23 22:29发布

问题:

Similar to the question for eclipse,

  • How can I auto-remove trailing whitespace from the entire file being edited?
  • How can I auto-remove trailing whitespace only from the lines I changed?

回答1:

You can also enable it on save via the following preference (Editor -> General -> Other):

And for those wondering,

"Always keep trailing spaces on caret line"

If this option is selected, trailing spaces will not be stripped on the line where the caret is placed on save operation (for example, when you switch to another window).

(bigger image)



回答2:

Ha, it's as simple as Code->Reformat code... (option-cmd-L)