Configuring Javascript Styles

The following section describes the color settings related to the Javascript language. These settings are available from the File Types tab of the Settings dialog by selecting the "Javascript" category shown in the dialog below.

 

       

 

The following table describes the list of lexer settings that may be configured for the Javascript language type.

 

Lexer Setting

Description

Brace Highlighting

The Brace Highlighting category occurs when the cursor is adjacent to an opening brace that is matched by a closing brace or vice versa. Brace matching occurs on the following set of braces:

 

( and)

{ and }

[ and ]

 

The following example demonstrates this category:

 

    

 

In this case the opening { of the function and its closing } match and are categorized under brace highlighting and highlighted in the color and font specified by the user (red in this case).

 

Comments

The Comments category applies to:

 

  • single line comments of the form // ..

  • multi-line comments of the form /* ... */

 

The following example demonstrates this category:

 

    

 

In this case the comments are categorized as such and highlighted in the color and font specified by the user (green in this case).

 

Default

The Default category really only applies to virtual space that is not occupied by characters or whitespace. In this case both the foreground color and the font settings have no purpose, only the background color is used. It is provided to allow the user to maintain a consistent color across all styles when changing the background color.

 

The following example demonstrates this category:

 

    

 

In this case all virtual space that is not occupied by characters or whitespace is categorized in the default category and highlighted in the color and font specified by the user (gray background in this case).

 

Identifiers

The Identifiers category applies to such things as variable names, function instantiations, function arguments, etc.

 

The following example demonstrates this category:

 

    

 

In this case the words document, all, elementId and getElementById are categorized as identifiers and highlighted in the color and font specified by the user (red in this case).

 

Indent Guides

The Indent Guides category applies to the indent guides if they are displayed. Note that the font size does not apply. For more information please refer to the indent guides topic.

 

The following example demonstrates the this category:

 

    

 

In this case the indent guides are displayed and highlighted in the color specified by the user (red in this case). The font and background color settings have minimal affect on the appearance of indent guides.

 

Keywords

The Keywords category applies to the Javascript keywords that form part of the language standard. These directives are user configurable and may be specified by selecting the Keywords tab for the Javascript language type.

 

The following example demonstrates this category:

 

    

 

In this case the words if, return, and else are categorized as keywords and are highlighted in the color and font specified by the user (red in this case).

 

Line Numbers

The Line Numbers category applies to the line numbers displayed in the left hand column.

 

The following example demonstrates this category:

 

    

 

In this case the line numbers are highlighted in the color and font specified by the user (silver in this case).

 

Mismatched Brace

The Mismatched Brace category occurs when an opening brace has no closing brace or vice versa. This will only be displayed if the cursor currently located adjacent to the brace. Brace matching occurs on the following sets of braces:

 

( and)

{ and }

[ and ]

 

The following example demonstrates this category:

 

    

 

In this case the opening( in the function call has no closing bracket so it is categorized as a mismatched and highlighted in the color and font specified by the user (red in this case).

 

Numbers

The Numbers category applies to any numbers contained in the file. Line numbers are categorized separately.

 

The following example demonstrates this category:

 

    

 

In this case the number 20 is categorized as such and are highlighted in the color and font specified by the user. (red in this case).

 

Open Strings

The Open Strings category applies to both single and double quoted strings that have not been closed by a corresponding closing single or double quote.

 

The following example demonstrates this category:

 

    

 

In this case the string starting with "undefined is categorized as an open string because there is no closing quote at the end of the string. It is highlighted in the color and font specified by the user (red in this case).

 

Operators

The Operators category applies to any operators contained in the file such as +, -, ++, <, >, etc. Note that braces are highlighted in an alternate color if the cursor is adjacent. Refer to the Brace Highlighting and Mismatched Brace categories for more information.

 

The following example demonstrates this category:

 

    

 

In this case the operators (, ), ==,||,{,} and ; are categorized as operators and are highlighted in the color and font specified by the user. (red in this case).

 

Regular Expressions

The Regular Expressions category matches any regular expressions that are defined using the /.../ format. It does not match expressions declared using the global RegExp object.

 

    

 

In this case the regular expression /(One|Two|Three) Matches/ is categorized as a regular expression and highlighted in the color and font specified by the user. (red in this case)

 

Secondary Keywords

The Secondary Keywords category is used to highlight any special keywords or identifiers that are not part of the primary keyword list. These secondary keywords or identifers are user configurable and may be specified by selecting the Keywords tab for the Javascript language type.

 

    

 

In this case the identifers document,all, andgetElementById are categorized as a secondary keywords or identifers and highlighted in the color and font specified by the user. (red in this case)

 

Strings

The Strings category applies to strings that are enclosed in double or single quotes.

 

The following example demonstrates an example of this category:

 

   

 

In this example the two instances of the string "undefined" are categorized as strings and highlighted in the color and font specified by the user (red in this case).

 

Whitespace and Control Characters

The Whitespace and Control characters category applies to any whitespace and control characters that are displayed.

 

The following example demonstrates this category:

 

    

 

In this case, any spaces, tabs or control characters are categorized as whitespace or control characters and highlighted in the color and font specified by the user (underlined red in this case).