How do I change Eclipse to use spaces instead of tabs in Javascript editor?

Damen TheSifter picture Damen TheSifter · Jan 24, 2012 · Viewed 11.3k times · Source

I use the Eclipse JavaScript plugin, I have my text editor settings to "insert spaces as tabs" this works fine until I select a block of code and tab it or shift tab it, run JSLint and AARGghh! "Mixed spaces and tabs." is there something I am missing, is this possible?

Answer

Hauke Ingmar Schmidt picture Hauke Ingmar Schmidt · Jan 24, 2012

I am not exactly sure where you set the editor property "insert spaces as tabs". To set the tab policy you need to go to Window > Preferences > Javascript > Code Style > Formatter, create a new profile, edit it and set the Tab policy to "spaces only". Now when using the tab key spaces are inserted.