[英]How to set indentation of array's elements in Java Script source code in Eclipse?
How can I configure formatting options in Eclipse for Java Script source code so that having this code: 如何在Eclipse for Java Script源代码中配置格式选项,以便具有以下代码:
var o = {
items: [{
xtype: 'grid',
columns: [<cursor here>{header: 'Column One'}],
}],
};
after pressing Enter
I get this 按
Enter
我得到这个
var o = {
items: [{
xtype: 'grid',
columns: [
{header: 'Column One'}],
}],
};
instead of the default: 而不是默认值:
var o = {
items: [{
xtype: 'grid',
columns: [
{header: 'Column One'}],
}],
};
I'd like to have initializers of array's elements indented with one level of indentation (tab in my case) not aligned with the opening bracket. 我想让数组元素的初始化程序缩进一个级别的缩进(在我的情况下为制表符),而不与左括号对齐。 I can't get the right indentation even manually - given this code
给定此代码,我什至无法手动获得正确的缩进
var o = {
items: [{
xtype: 'grid',
columns: [
{header: 'Column One'}], // cursor at the beginning of this line
}],
};
after pressing Tab
twice I get the same indentation as after pressing Enter
above. 两次按
Tab
,我得到的缩进与按上面的Enter
后相同。
I'm using JavaScript Development Tools ver. 我正在使用JavaScript开发工具版本。 1.3.0.v201103031824 from Eclipse Web Tools Platform.
Eclipse Web工具平台上的1.3.0.v201103031824。
Hope this helps albeit a bit late... 希望这会有所帮助,尽管有点晚了...
You can change the Formatter for JavaScript in Eclipse->Preferences 您可以在Eclipse-> Preferences中更改JavaScript的Formatter
Goto JavaScript->Code Style->Formatter 转到JavaScript->代码样式->格式化程序
Edit to create your custom profile and make changes to the following: 编辑以创建您的自定义配置文件,并进行以下更改:
In the Line Wrapping Tab 在“行包装”选项卡中
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.