Javascript Eclipse Indentation Problem with Object Property

Ok, I have a problem with eclipse / javascript. The identification inside the property of the object is 8 spaces, and this pissed me off. I want it to be 4 spaces. What do I need to change to fix this? I want the eclipse to format it as "b".

var a = { t: 'Hi' }; var b = { t: 'Hi' }; 

Thanks in advance.

+7
source share
3 answers

Eclipse Indigo (for J2EE)

Window → Settings → JavaScript → Code Style → Formatter

then Edit ...

Linear packaging → Expressions → Object initializers → Indentation policy: Indent one by one

screenshot for configuration

+14
source

I have the same problem (also for Array).

The only thing that works for me is to disable Smart Insert Mode (CTRL + Shift + Insert) to postpone the first property, and then if you turn it on again, it should work correctly.

+3
source

I think you want to check your Javascript formatter.

Go to Window-> Preferences and enter "Formatter" in the search field. From there, you can change the code style for certain languages.

0
source

All Articles