Topic
IC4NOTICE: developerWorks Community will be offline May 29-30, 2015 while we upgrade to the latest version of IBM Connections. For more information, read our upgrade FAQ.
1 reply Latest Post - ‏2012-04-09T14:42:40Z by SystemAdmin
rick.lacy
rick.lacy
15 Posts
ACCEPTED ANSWER

Pinned topic RAD 8.5 Beta - dojo tooling - some AMD syntax feedback

‏2012-04-07T21:47:12Z |
I was experimenting with dojo tooling in RAD 8.5 Beta. I used the most recent version of dojo (1.7.2) that I imported into the project.

Consider this basic snippet from an html file.


<script type=
"text/javascript"> require( 
// Set of module identifiers [ 
"dojo", 
"dojo/parser", 
"dijit/form/Button" ], 
// Callback function, invoked on dependencies evaluation results function(dojo, parser, button) 
{ dojo.ready(function() 
{ 
}); 
}); </script>


What I like:
Ctrl+click into dijit/form/Button takes me to the file. Excellent!
Pressing F3 over dijit/form/Button takes me to the file.

What I'd like to see:
Ctrl+click or F3 didn't do anything when over dojo/parser. I think this should work the same way.

It would be really awesome if the AMD tooling was smart enough to know that the button ref in the function argument meant dijit.form.button and let me drill down into it in a similar fasion.

Also, it would be cool if the tooling knew what I meant when I said something like var myButton = new button(); At least I can get around this by using a jsdoc @type attribute, though.
Now say I've made it to dijit/form/Button.js.

define([ 
"require", 
"dojo/_base/declare", 
// declare 
"dojo/dom-class", 
// domClass.toggle 
"dojo/_base/kernel", 
// kernel.deprecated 
"dojo/_base/lang", 
// lang.trim 
"dojo/ready", 
"./_FormWidget", 
"./_ButtonMixin", 
"dojo/text!./templates/Button.html" ], function(require, declare, domClass, kernel, lang, ready, _FormWidget, _ButtonMixin, template)
{   
/*===== var _FormWidget = dijit.form._FormWidget; var _ButtonMixin = dijit.form._ButtonMixin; =====*/   
// module: 
//               dijit/form/Button 
// summary: 
//          Button widget   
// Back compat w/1.6, remove for 2.0 

if(!kernel.isAsync)
{ ready(0, function()
{ var requires = [
"dijit/form/DropDownButton", 
"dijit/form/ComboButton", 
"dijit/form/ToggleButton"]; require(requires);       
// use indirection so modules not rolled into a build 
}); 
}   

return declare(
"dijit.form.Button", [_FormWidget, _ButtonMixin], 
{


What I like:
Hovering over the ./_FormWidget in the define and pressing F3 takes me to the file.
Pressing F3 over anything in the var requires = ... array takes me there. Excellent!
Pressing F4 still brings up hierarchy for dijit.form.Button.

What I'd like to see:
Where F3 works, I'd like to see Ctrl+click work for consistency with the html pages.

The files under dojo/* don't work well for following links like this. For example, F3 while over the dojo/_base/declare in the define doesn't do anything.

The same comments I made about being able to drill down into the arguments of the define callback function apply here.

In summary:
Dojo 1.7 support is looking very good - thanks!
I would like a few more options for drilling down into definitions like this with the new AMD syntax.
I think the highest priority thing for me anyway is to get the drill down into the dojo/* files working ok.
Making the tooling understand what the alias coming into the define callback is would be awesome.
  • SystemAdmin
    SystemAdmin
    590 Posts
    ACCEPTED ANSWER

    Re: RAD 8.5 Beta - dojo tooling - some AMD syntax feedback

    ‏2012-04-09T14:42:40Z  in response to rick.lacy
    Rick,

    Thank you for your wonderful analysis into Dojo 1.7.x support in Rational Application Developer 8.5 Beta.

    Most of your suggestions here are issues we are already aware of with the Beta and a couple we will be sure to look into.

    Thanks again for the suggestions and testing! Be sure to let us know if you discover anything else or have any other ideas for better Dojo 1.7.x/AMD support.

    Blue Skies,

    ~Ian