The JavaScript plugin provides syntax checking, scope checking, and structure browsing for JavaScript files. This plugin also supports JavaScript embedded in XHTML, XUL, and XBL documents.

Configuring Scope Check:

You may import external global names into your buffer to prevent the scope checker from flagging names that exist in the target environment. There are two ways to do this. The first way is by configuring the plugin options (Plugins menu -> Plugins Options -> JavaScript -> Scope Check). Here you can import predefined name lists or specify a list of external JavaScript files to extract the global names from. These settings will apply to all JavaScript buffers.

The predefined name lists are:

Description Name View
Combined DOM Window domwindow domwindow.js
Internet Explorer DOM Window iedomwindow iedomwindow.js
Mozilla DOM Window mozdomwindow mozdomwindow.js
Mozilla Chrome Window chromewindow chromewindow.js
Mozilla Component mozscript mozscript.js
XPCShell xpcshell xpcshell.js
Prototype prototype prototype.js
Dojo dojo dojo.js

You may also specify these settings on a per-buffer basis by including a mode line at the top of your JavaScript file. The line must begin and end with the delimiter “-*-” and contains a semicolon separated list of setting names, followed by a colon, followed by a comma separated list of values. For example:


// -*- js-standard: domwindow,dojo; js-import: globalscript.js; js-var:GlobalClass, global_fn; -*-

Possible setting names are

js-standard
A list of the name of one or more of the predefined global name sets defined in the table above
js-import
One or more files to import into the global scope. The path to the file may be absolute or relative. Relative paths are evaluated from the directory that contains the file in the buffer
js-var
One or more names to include into the global scope
js-preproc
Overrides the global setting for handling preprocessor tokens embedded in the JavaScript file. Possible values are: true, false