自用Eclipse代码格式化设置

自用项目中统一Eclipse格式化Java、JavaScript、JSP、HTML代码设置

1.Window->Preferences
//Java 格式化
2.Java->Code Style->Formatter->New->Edit->Line Wrapping
3.Maximum Line width = 180
4.Set line width for preview window = 180
//JavaScript 格式化
5.JavaScript->Code Style->Formatter->New->Edit->Line Wrapping
6.Maximum Line width = 180
7.Set line width for preview window = 180
8.Tab标签页->Comments
9.Maximum line width for comments = 180
//JSP|HTML页面 格式化
10.Web->HTML Files->Editor
Line width = 180
Inline Elements 选中所有-> Remove

格式化前:

<script>
		$("#loginBtn")
				.click(
						function() {
							$
									.ajax({
										url : "/Test/userInfo/login",
										type : 'POST',
										dataType : 'json',
										data : {
											userAccount : $("#userAccount")
													.val(),
											password : $("#password").val()
										},
										success : function(data, textStatus,
												xhr) {

											window.location.href = "/Test/userInfo/userlogin";
										},
										error : function(xhr, textStatus,
												errorThrown) {
											//alert("登录异常请重新登录")
											$.messager.show({
												title : '提示',
												msg : '登录异常请重新登录',
											});

										},
										complete : function() {
											//  $yr.closeMask();
										}
									});

						});
</script>

格式化后:

<script>
		$("#loginBtn").click(function() {
			$.ajax({
				url : "/Test/userInfo/login",
				type : 'POST',
				dataType : 'json',
				data : {
					userAccount : $("#userAccount").val(),
					password : $("#password").val()
				},
				success : function(data, textStatus, xhr) {

					window.location.href = "/Test/userInfo/userlogin";
				},
				error : function(xhr, textStatus, errorThrown) {
					//alert("登录异常请重新登录")
					$.messager.show({
						title : '提示',
						msg : '登录异常请重新登录',
					});

				},
				complete : function() {
					//  $yr.closeMask();
				}
			});

		});
</script>


评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值