Javascript Eclipse Indentation problem with Object property

二次信任 提交于 2020-01-03 09:06:27

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!