23

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?

el-teedee
  • 1,293
  • 1
  • 15
  • 27
Damen TheSifter
  • 901
  • 1
  • 6
  • 17
  • possible duplicate of [How do I change Eclipse to use spaces instead of tabs?](http://stackoverflow.com/questions/407929/how-do-i-change-eclipse-to-use-spaces-instead-of-tabs) – sashoalm Aug 13 '15 at 12:37

1 Answers1

53

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.

Sara Fuerst
  • 5,688
  • 8
  • 43
  • 86
Hauke Ingmar Schmidt
  • 11,559
  • 1
  • 42
  • 50
  • very helpful Thanks! – Danda May 24 '16 at 13:54
  • maybe is a different Eclipse version but in my Version: 2021-12 (4.22.0) Build id: 20211202-1639 this menu doesn't exists. Maybe is Windows / preferences / web / client-side javascript / formatter but for me it doesn't work: in my js, "tabs" dont turn into "spaces" – Paolo Biavati Apr 27 '22 at 10:12