|
Speaker: Robin Debreuil
Learn to leverage Code Assist and available documentation from other JavaScript libraries.
|
Hi, this is Robin again, and we'll be going over Code Assist profiles in this
presentation.
First of all, what is Code Assist exactly? Well, much like it sounds, it's the
ability to get insight onto your code as you're typing. For example, here we have
a function declared and if we invoke it here or later in the program, you can see,
first of all, we have a proposal window here that tells us all the properties or
functions that are available. Then, if we open the paren, it'll tell us what Args
we need to us and what type they are. So, for example, here we can say that's a string,
we know it, and now we're on the second paren, we can see it, it's highlighted in bold
and that's a number. Alright. So that's was Arg Assist is.
But very quickly you may find that in JavaScript and HTML especially, you'll be
working with multiple files at once. So what we need is a way of grouping these files
together, so it's not all the JavaScript files in our entire hard drive, but a subset
of those.
The first thing we have here is what's called the Code Assist profiles window.
As you can see from the text in there, you can drag any HTML or JavaScript file
into the window, and it will become part of a profile. We call this the default profile.
Just like before, we can open it up and get Code Assist against it. You can see here,
this comes from file1.js and it's myFunction, just like before.
Well, the second thing we can do is drag a second file into that profile. Now if we
open it, we can see that this second file also has insight into the first file.
If we spell that correctly, we can see we have myFunction from file1 and the currently
declared myFunction2 from file2. If we chose myFunction1 just like before, we get
Argument Assist. We know this is supposed to be a string and this is supposed to
be a number. We can go to the other file.
One of the things we can do now, we can hover over myFunction. We can tell where
that's coming from and we can also navigate or press the F3 key and go right to
that declaration. Now we're back in file1.
From file1, because these are both in the same profile, of course, we can see
myFunction2 from file2. So these now become a set. Of course, we get Arg Assist on
this as well, if we like. We can close this profile out now and close these files.
We won't save them.
Next, we can look at HTML Code Assist. Here we have an HTML file. You notice
automatically there was a Code Assist profile created. It added file1.js and
file2.js automatically. If you look at the script tags in the demo.html, you can
see there's file1 and file2. As we add and remove script tags here, you can see
that they're added and removed from the profile. We can also reorder these and
they'll be reordered in the profile. Of course, now that we have Code Assist on
these two files, if we type myFunction here, we get file1.js and, just like before,
we can add a string parameter and we can add a number parameter.
The last thing you might want to do is if you right click, you can make this
profile permanent. That means the next time you start up the editor, it will
automatically open demo.html profile and that will include these files. Thank you.
That concludes this presentation and I hope you enjoy the new Aptana IDE.
[End of Video]
|