Datasheet

18
Part I: Programming with JavaScript
Introducing programmer’s editors
A number of specialty editors have propped up which seek to fill the gap
between plain-text editors and the WYSIWYG tools. These editors write in
plain text, but they have additional features for programmers, including:
Awareness of languages: Programmer’s editors often know what lan-
guage you’re writing in and can adapt, helping you whether you’re writ-
ing HTML, JavaScript, or CSS code. Most general-purpose programmer’s
editors can handle all these languages natively, and often can help with
many more languages.
Syntax highlighting: Various elements are colored in different ways so
you can see what is in plain text, what is part of an HTML tag, and so on.
This simple feature can make it much easier to find problems like miss-
ing quotes, and to see the general structure of your page quickly.
Syntax support: Programmer’s editors often provide some sort of help
for remembering the syntax of your language. This boost can be in the
form of buttons and macros for handling common code, pre-written tem-
plates for standard layouts and patterns, and syntax completion (which
looks at what you’re typing and suggests completions based on the cur-
rent language you’re using).
Multiple document support: Advanced Web applications often involve
editing several different documents at once. You might have a dozen
Web pages with a few CSS style sheets and an external JavaScript file or
two. A programmer’s editor allows you to view and edit all these files
simultaneously. Many also allow you to generate a project file so you can
save all the related files automatically and load them in one batch.
Macro tools: Programming often requires repetitive typing tasks. Having
a feature that records and plays back sequences of keystrokes as macros
(short automated operations) can be incredibly helpful.
Debugging and preview support: Most programmer’s editors have a
tool for previewing your code in a browser (or sometimes directly in the
editor). The editors also often have tools for predicting certain errors,
or responding to errors when they occur. At a minimum, you need the
capability to jump directly to a particular line or section of your code.
Indentation support: Most programmers use indentation as a power-
ful tool to help them understand the structure of the Web documents
they’re building. A good editor can assist you with this indentation and
also help you recognize when you’ve made mistakes in the structure of
your document.
05_417997-ch01.indd 1805_417997-ch01.indd 18 10/26/09 9:55 PM10/26/09 9:55 PM