首页 > 解决方案 > 如何在 STS 中以更好的方式格式化 JS 代码

问题描述

手动格式化 JS 代码后如下所示

txnDetailsTable = $('#transactionDetails').dataTable({
            bLengthChange : false,
            bInfo : false,
            bSort : false,
            autoWidth : false,
            columnDefs : [ {"width" : "15%","targets" : 0},
                {"width" : "7%","targets" : 1}, 
                {"width" : "5%","targets" : 2}, 
                {"width" : "33%","targets" : 3},
                {"width" : "5%","targets" : 4}, 
                {"width" : "5%","targets" : 5}, 
                {"width" : "12%","targets" : 6}, 
                {"width" : "13%","targets" : 7}, 
                {"width" : "13%","targets" : 8} 
                ],
            aoColumns : [ {
                "sType" : "date"
            }, null, null, null, null, null, null, null, null ]

按下ctrl++shiftF,上面的 JS 代码格式更改如下。

txnDetailsTable = $('#transactionDetails').dataTable({
                bLengthChange : false,
                bInfo : false,
                bSort : false,
                autoWidth : false,
                columnDefs : [ {
                    "width" : "15%",
                    "targets" : 0
                }, {
                    "width" : "7%",
                    "targets" : 1
                }, {
                    "width" : "5%",
                    "targets" : 2
                }, {
                    "width" : "33%",
                    "targets" : 3
                }, {
                    "width" : "5%",
                    "targets" : 4
                }, {
                    "width" : "5%",
                    "targets" : 5
                }, {
                    "width" : "12%",
                    "targets" : 6
                }, {
                    "width" : "13%",
                    "targets" : 7
                }, {
                    "width" : "13%",
                    "targets" : 8
                } ],
                aoColumns : [ {
                    "sType" : "date"
                }, null, null, null, null, null, null, null, null ]

ctrl按下++后如何保持上述shift格式F

标签: eclipse

解决方案


推荐阅读