Aptana将Dojo require数组和函数放在一行中,有没有办法将它们分散到多行中?

rnmwe5a2  于 2022-12-16  发布在  Dojo
关注(0)|答案(1)|浏览(168)

举一个极端的例子:

require(["dojo/_base/lang", "dojo/dnd/Manager", "js/desktop/desktopAvatar", "dijit/Menu", "dijit/MenuItem", "dojo/has", "dijit/layout/TabController", "js/desktop/desktopCommons", "dijit/layout/StackController", "dojo/dom-construct", "dojo/on", "dojo/query", "dojo/dom-attr", "dojo/dom-class", "dojo/dnd/common", "dojo/request/xhr", "dojo/json", "dojo/dom-form", "js/desktop/desktopSource", "dijit/popup", "js/desktop/desktopBorderContainer", "dojo/ready", "dojo/dom", "dijit/registry", "dojo/parser", "dijit/layout/TabContainer", "dijit/Dialog", "dijit/TooltipDialog", "dojox/layout/ContentPane"], function(lang, Manager, desktopAvatar, Menu, MenuItem, has, TabController, desktopCommons, StackController, domConstruct, on, query, domAttr, domClass, dndCommons, xhr, JSON, domForm, desktopSource, popup, DesktopBorderContainer, ready, dom, registry, parser) {

Eclipse中的默认Javascript编辑器应用以下格式:

require(
        [ "dojo/_base/lang", "dojo/dnd/Manager", "js/desktop/desktopAvatar",
                "dijit/Menu", "dijit/MenuItem", "dojo/has",
                "dijit/layout/TabController", "js/desktop/desktopCommons",
                "dijit/layout/StackController", "dojo/dom-construct",
                "dojo/on", "dojo/query", "dojo/dom-attr", "dojo/dom-class",
                "dojo/dnd/common", "dojo/request/xhr", "dojo/json",
                "dojo/dom-form", "js/desktop/desktopSource", "dijit/popup",
                "js/desktop/desktopBorderContainer", "dojo/ready", "dojo/dom",
                "dijit/registry", "dojo/parser", "dijit/layout/TabContainer",
                "dijit/Dialog", "dijit/TooltipDialog",
                "dojox/layout/ContentPane" ],
        function(lang, Manager, desktopAvatar, Menu, MenuItem, has,
                TabController, desktopCommons, StackController, domConstruct,
                on, query, domAttr, domClass, dndCommons, xhr, JSON, domForm,
                desktopSource, popup, DesktopBorderContainer, ready, dom,
                registry, parser) {

对于所有其他格式,Aptana工作得更好,但非常长的第一行使它更难添加新的必需项目等。
有没有一种方法可以使用Aptana Javascript格式,但是长数组和函数输入被分割成行?

yyyllmsg

yyyllmsg1#

我们也在使用Aptana &只需自己设置要求,并在每次输入后休息。
然后它看起来像这样:

require([
                    "dojo/_base/array",
                    "dojo/_base/Color",
                    "dojo/_base/window",
                    "dojo/dom",
                    "dojo/dom-construct",
                    "dojo/dom-style",
                    "dojo/json",
                    "dojo/on",
                    "dijit/registry",
                    "dojox/layout/FloatingPane"],
                     function(
                        array,
                        color,
                        win,
                        dom,
                        domConstruct,
                        domStyle,
                        JSON,
                        on,
                        registry,
                        FloatingPane){

这是最简单的方法,使它更清楚。

相关问题