3 Replies Latest reply on Jun 27, 2014 8:30 AM by Carl Von Stetten

    Javascript code assist

    Bert.Dilliën Level 1

      Hi,

       

      In CB3 I just noticed that Javascript code assist does not assist locally created parameters and functions!

       

      Is there a fix for this or do I download Aptana plugin?

       

      Platform:

      Windows 8.1 x64 Enterprise

      Coldfusion Builder 3 (Build 290048)

       

      Regards Bert.

        • 1. Re: Javascript code assist
          Carl Von Stetten Adobe Community Professional & MVP

          do I download Aptana plugin?

          OMG please NO! Aptana is a bloated pig, and is what made CFBuilder 2 so slow.

           

          I would suggest putting your JavaScript code in a separate file from your ColdFusion page, and using the <script> tag to load it in.  If you need to pass ColdFusion variables into JavaScript, put a small <script> block on the CFML page wrapped in <cfoutput> just to create and populate the JavaScript variables, then add a second <script> tag to load your external JavaScript file.

           

          By keeping your JavaScript separate from CFML code you achieve multiple benefits:

          1. The built-in JavaScript parser/syntax highlighter will actually work, as those CF Builder features are somewhat dependent on recognizing the file extension to know which parser to use.
          2. Maintenance of your application will be easier, because you don't have a mixture of CFML and JS code in the same file, and thus the files will be smaller and more targeted.
          3. You can run your JavaScript file through "linters" to validate syntax.
          4. You can minify your external JavaScript code files for better performance.
          5. If you use build tools such as Grunt or Gulp, you can automate 3 and 4 without potentially breaking any CFML code in the process.
          6. Probably additional benefits I'm not thinking of at the moment (someone will chime in I'm sure).

           

          HTH,

          -Carl V.

          • 2. Re: Javascript code assist
            Bert.Dilliën Level 1

            Hi Carl,

             

            Thanks for your reply, your first line made me laugh :-)

             

            I maybe did not specify enough, but I worked with Javascript for the past 12 years. I evolved some time ago to separate JS code from CFM code and in the recent years I used YUICompressor to minify all my JS and CSS code files. (via site Online YUI Compressor) Last year I managed to get YUICompressor to work in from within my eclipse (CB 2) as a 'Build Action'. I used Node.js to download the YUICompressor package and I made a BAT file which is used in the Build Action. Made life a lot simpler...

             

            In Aptana's defense, they really had a very good idea by combining all code assist on one page. CB 2 did take over that philosophy by extending the Apatana plugin with CFM markup language if I believe.

             

            From your response I read that there is currently no descend Javascript code assist plugin shipped with CB 3. I did find the plugin 'Javascript Development Tools' from the Eclispe Kepler update site. I guess I will give that one a go.

             

            Any other suggestions for a descend plugin?

             

            Thanks,

            Regards Bert.

            • 3. Re: Javascript code assist
              Carl Von Stetten Adobe Community Professional & MVP

              Bert,

               

              OK, sounds like you have a pretty good development approach.  I haven't had much time to look at the JavaScript tooling in CFBuilder 3, but I just took a look.  Beyond introspecting the current file for functions that exist in it, it doesn't appear to do much else.  I tried loading the JDT stuff from Eclipse too, and didn't see much improvement.

               

              I found that the CFBuilder 2 Aptana code assist for JavaScript that was embedded in CFML files didn't work very well, but it did work fine on .js source files.  I think Adobe's focus in CFBuilder 3 was to improve performance (the number 1 complaint about previous releases), so removing Aptana was the right move from that perspective; however, that left the JS/CSS tooling a bit weak.  Hopefully, someone else can chime in if they've found good JavaScript plugins for Eclipse Kepler (I'm also eager to find some good stuff).  Otherwise, I'll have to drop out to a separate editor for JS work (like Brackets or something else).

               

              -Carl V.