如何在STS中以更好的方式格式化JS代码

时间:2019-03-16 06:57:01

标签: eclipse

手动格式化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 上面的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 后如何保持上述格式?

0 个答案:

没有答案