Chapter 3: customizing code view, About code hints, The codehints.xml file – Adobe Extending Dreamweaver CS4 User Manual
Page 36
30
Chapter 3: Customizing Code view
Adobe Dreamweaver uses two devices in Code view that help you enter code quickly and make your code readable and
accurate. These two devices are code hints and code coloring. In addition, Dreamweaver validates your code for the
target browsers that you specify and allows you to change default HTML formatting.
You can customize code hints and code coloring by modifying the XML files that implement them. You can add items
to the code hints menu by adding entries to the CodeHints.xml or SpryCodeHints.xml file. You can modify color
schemes by modifying the code coloring style file, Colors.xml, or you can change code coloring schemes or add new
ones by modifying one of the code coloring syntax files, such as CodeColoring.xml. You can also modify the Cascading
Style Sheet (CSS) profile file for your target browser to affect how Dreamweaver validates CSS properties and values.
You can also change the Dreamweaver default HTML formatting through the Preferences dialog box. The following
sections describe how to customize these features.
About code hints
Code hints are menus that Dreamweaver opens when you type certain character patterns in the Code view. Code hints
offer a typing shortcut by providing a list of strings that potentially complete the string you are typing. If the string you
are typing appears in the menu, you can scroll to it and press Enter or Return to complete your entry. For example,
when you type <, a pop-up menu shows a list of tag names. Instead of typing the rest of the tag name, you can select
the tag from the menu to include it in your text. Dreamweaver also provides code hints for the Spry framework.
Dreamweaver loads code hints menus from the CodeHints.xml file and any other XML files in the
Configuration/CodeHints folder. You can add code hints menus to Dreamweaver by defining them in your own XML
files using the XML schema format described in this topic, and placing them in the Configuration/CodeHints folder.
After Dreamweaver loads the contents of a code hints file, you can also add new code hints menus dynamically through
JavaScript. For example, JavaScript code populates the list of session variables in the Bindings panel. You can use the
same code to add a code hints menu, so when a user types "Session." in Code view, Dreamweaver displays a menu of
session variables. For information on using JavaScript to add or modify a code hints menu, see “Code Functions” in
the Dreamweaver API Reference.
Dreamweaver cannot express some types of code hints menus through the XML file or the JavaScript API. The
CodeHints.xml file, the SpryCodeHints.xml file, and the JavaScript API expose a useful subset of the code hints engine,
but some Dreamweaver functionality is not accessible. For example, there is no JavaScript hook to open a color picker,
so Dreamweaver cannot express the Attribute Values menu using JavaScript. You can only open a menu of text items
from which you can insert text.
Note: When you insert text, the insertion point is placed after the inserted string.
The CodeHints.xml file
The CodeHints.xml file contains the following entities:
•
A list of all the menu groups
Dreamweaver displays the list of menu groups when you select the code hints category from the Preferences dialog
box. You can open the Preferences dialog box by selecting Edit > Preferences. Dreamweaver provides the following
menu groups or types of code hints menus: Tag Names, Attribute Names, Attribute Values, Function Arguments,
Object Methods and Variables, and HTML Entities.