How can you set up Eclipse to remove trailing whitespace when saving a JavaScript file?
I am running Eclipse 3.6 (Helios 20110218-0911) on Ubuntu 11.04. Under Preferences, I 开发者_JAVA技巧have gone to the following panel:
JavaScript -> Editor -> Save Actions.
The "Additional actions" checkbox is checked and "Remove trailing whitespaces on all lines" is selected.
Nevertheless, when I save my JavaScript file in Eclipse, there is still trailing whitespace at the end of my lines.
What am I missing?
'Save Actions' for JavaScript is available in the JavaScript project(the project with JavaScript nature) only.
(If you can see 'Convert to JavaScript Project' in 'Configure' menu when right-click the project, try it)
I recently faced the same problem. The only way I found is to convert your project to Javascript project. Right click your project folder in the Explorer, choose [Configure] -> [Convert to Javascript project] and the Javascript Save Action will start to work.
Unfortunately, I don't know how to convert it back. Since it's not a big problem for me, the way Converting it to javascript project indeed helps me a lot.
For the latest Eclipse - Version: Oxygen.3a Release (4.7.3a) Build id: 20180405-1200
The default key-binding shift+ctrl+backspace, which binds to the function "Removes the trailing whitespace of each line" will remove trailing space chars for the entire file.
(The key-binding shift+ctrl+backspace is probably already there in many earlier releases as well.)
精彩评论