问题
Ok, I have a problem with eclipse/javascript. The identation inside of an object property is 8 spaces and it pisses me off. I want it to be 4 spaces. What do I need to change in order to fix that? I want eclipse to format it like "b".
var a = {
t: 'Hi'
};
var b = {
t: 'Hi'
};
Thanks in advance.
回答1:
Eclipse Indigo (for J2EE)
Window -> Preferences -> JavaScript -> Code Style -> Formatter
then Edit...
Line Wrapping -> Expressions -> Object initializers -> Indentation policy: Indent by one
回答2:
I have the same problem (also for Array).
The only thing that works for me is to disable the Smart Insert Mode (CTRL + Shift + Insert) to indent the first property, then if you enable it again it should be working properly.
回答3:
I think you want to check your Javascript formatter.
Go to Window->Preferences and type "Formatter" in the search box. From there you can modify the code style for specific languages.
来源:https://stackoverflow.com/questions/6472719/javascript-eclipse-indentation-problem-with-object-property