Java Reference
In-Depth Information
Completion
settings panel. Other code-completion options on this panel affect
code completion with
HTML
and
CSS
as they do with other file types.
Fo r
HTML
tags, any required attributes are immediately added when you use the
code-completion feature. You can use the
Ta b
key to jump between attributes, filling
in these values. For
HTML
attributes and
CSS
properties that specify a specific set
of legal values,
IDEA
's code-completion features offer these as suggestions. A typical
example is the
align
attribute, which must be
justify
,
center
,
left
, or
right
.
C o d e c o m p l e t i o n i n
HTML
and
CSS
also applies to file references made through
src
and
href
attributes. For example, when you include an external JavaScript file
or create an anchor tag,
IDEA
provides you with a list of matching files and folders
in the same folder as the source file. You can also provide a starting point if your
resources are located in another directory, such as
../images
or
/scripts
. Note that
only paths located in the current project's content roots are considered for com-
pletion, because all paths outside the project are invisible to
IDEA
.
Another good example of the new code-completion features for
HTML
and
JavaScript is the
HTML
event handlers.
IDEA
offers any JavaScript methods avail-
able to the current document as candidates for a tag's event handler attributes,
such as
onLoad()
or
onMouseOver()
.
For JavaScript,
IDEA
offers completion based on JavaScript keywords, vari-
ables, parameters, and functions defined in your script. Functions, parameters,
and variables have appropriate icons in the completion drop-downs to identify
them. This includes all scripts in the current page, as well as any locally included
script files. However,
IDEA
doesn't offer code completion against objects defined
outside of the core JavaScript specification. Therefore, don't expect it to com-
plete against window, document, or other objects and methods commonly avail-
able in the browser. One notable exception is the
W3C
Document Object Model
API
(the
DOM
) for navigating through
HTML
;
IDEA
provides code completion
and
API
assistance for this popular specification.
When a code-completion suggestion list appears to complete a tag, at-
tribute, or property, you can use the context help feature (
Ctrl+Q
) to
reference help directly within the list. Use the arrow keys to select the
item you're interested in.
TIP
Syntax validation
While you type,
IDEA
is hard at work making sure your
HTML
,
CSS
, and JavaScript
are properly formatted and following correct language syntax. Problems are
flagged appropriately as warnings and errors, just as they are when you're working