5

I am running Eclipse 3.6 (Helios 20110218-0911) on Ubuntu 11.04. Under Preferences, I 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.

enter image description here

Nevertheless, when I save my JavaScript file in Eclipse, there is still trailing whitespace at the end of my lines.

What am I missing?

bolinfest
  • 3,710
  • 2
  • 27
  • 40

3 Answers3

7

'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)

atlanto
  • 1,601
  • 1
  • 11
  • 10
  • Thanks. Unfortunately, I use both Java and JavaScript in the same project, so I'm not sure that this will work for me, as my project is currently configured as a Java project. Though I don't know why it should matter what the nature of my project is to Eclipse. – bolinfest Oct 10 '11 at 17:32
  • 3
    I was able to change my project to a faceted project with both Java and Javascript selected as Project Facets. – pimlottc Feb 04 '14 at 18:33
  • 1
    Here's how I did it in Luna Service Release 2 (4.4.2): 1. Select Project / Properties from the menu. 2. Click on Project Facets. 3. Check "JavaScript" and click OK. 4. Select Project / Properties from the menu again. 5. There should now be a JavaScript section. Go to Editor / Save Actions under this section and configure it there. – thdoan Sep 29 '15 at 09:19
0

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.

0Mission0
  • 1
  • 1
0

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.)

Developer Guy
  • 2,318
  • 6
  • 19
  • 37
Rudy
  • 1
  • 1