JavaScriptUsersGuide

JavaScript Users Guide

Contents


Syntax (Semantic) Coloring

JavaScript editor highlights all kinds of keywords: identifiers, keywords, strings, numbers, regular expressions, comments and operators. Lexical and syntax errors are highlighted in editor, error stripe and gutter too. Different color is used for local variables and parameters.

http://wiki.netbeans.org/wiki/attach/JavaScriptUsersGuide/syntax_coloring_JavaScriptUsersGuide.png

Navigation display

The navigator displays the structure of the file, functions, local and global variables, parameters. Double clicking on an element in the navigator window warps to its source in the editor.

Code Folding

All functions and comments are foldable.

Go To Declaration

Right click on an element and choose Go To > Declaration, and it will warp to the declaration for the element, if possible.

This feature is also available via editor hyperlinks - hold the Control key (or the Command key on the mac) and as you drag the mouse over the source, identifiers are highlighted as hyperlinks. Clicking on a hyperlink will warp to its source if possible.

Code Completion

Some basic code completion is provided. When you hit Ctrl-Space, completion is provided for local and global variables, as well as method names, class names and constants in the same file.

In addition, various JavaScript and DOM builtins such as keywords and predefined constants, functions and interfaces are provided.

http://wiki.netbeans.org/wiki/attach/JavaScriptUsersGuide/code_completion_JavaScriptUsersGuide.png

Smart Indent

Pressing Return to create a new line causes the new line to be indented appropriately, e.g. same line as the previous line, or further indented when a new block is establishes, e.g. in an if statement, while statement, etc.

Pair Matching

The editor automatically highlights matching parentheses, braces, brackets, string delimiters, etc. In addition, as you're editing, the editor tries to automatically insert (and remove) matching delimiters automatically without getting in the way. The important part here is that while you're editing, the file stays valid such that code completion will work etc.

Find Usages

Find usages lists declaration and all usages of any local variable, global variable, parameter or function.

http://wiki.netbeans.org/wiki/attach/JavaScriptUsersGuide/find_ussages_JavaScriptUsersGuide.png

Rename Refactoring

Rename refactoring allows you you to quickly rename declaration and all usages of any local variable, global variable, parameter or function.

http://wiki.netbeans.org/wiki/attach/JavaScriptUsersGuide/rename_refactoring_JavaScriptUsersGuide.png

Run JavaScript

JDK 1.6 contains JavaScript engine (called Rhino). So, you are able to to run you script directly from NetBeans IDE on this platform. Right click on an editor and choose Run, and your script is executed, and output and errors redirected to output window.

Embedding

JavaScript code can be embedded in HTML or RHTML.


Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo