This walkthrough will instruct you on how to create a new web project and get started with your coding using a pre-documented JavaScript library. For this example, we will use jQuery.
Accessing your projects
- Click the Project Explorer tab to view your Studio projects.
- Create a new Web project.
- From the Studio File menu, select New > Project...
The New Project wizard opens. - On the New Project wizard, select Web Project.
- Click the Next button.
- In the Project name: field, type a name for your new project.
- Click the Next button.
- From the Project Template list, select a default template for the project if you like.
- Click the Finish button. Studio creates a new web project, with several files, depending on the project template you selected.
- From the Studio File menu, select New > Project...
This will create a new web project, but unlike Studio 2, most templates do not drop in a default set of JavaScript files for library support, as they quickly become outdated. Instead, download the library you are interested in using and drag and drop the files into your project as appropriate.
Adding a documented library for code assist
- Find a library you are interested in. Some examples are listed here: JavaScript Library Support
- Save it to your disk, and then drag it into your project. It does not matter where in the project it sits, so you can create a new folder for files like this if you like.
Viewing code assist (using jQuery as an example)
- Add the file from https://raw.github.com/aptana/javascript-jquery.ruble/master/support/jquery.1.4.2.sdocml. Make sure to save it with the .sdocml extension.
- If you do not have a JavaScript file in your project, create a new one by selecting the File menu, select New > File... and typing 'sample.js' or a different name if you prefer. Select Finish.
-
In your sample.js file, add the following snippet:
$(document).ready(
function
(){});
- Inside that, add the following line:
$("p")
- While entering that selector you should have seen documentation come up
for how to use the
$
function.
- While entering that selector you should have seen documentation come up
for how to use the
- Now insert your cursor just after "
$("p")
" and type.ad
and press ctrl+space.
Code Assist displays a list of jQuery functions that begin with the letters "ad" (for example, add, addClass, and so forth). Use Code Assist to help you code. - Start coding.
- As you type, notice that Code Assist is now active for the jQuery objects and functions that you use.
- Press ctrl+space at any time to activate Code Assist.