orion.edit.occurrences

The orion.edit.occurrences service allows plugins to compute identifier occurrences for specific content types.

Service methods

Implementations of orion.edit.occurrences must define the following function:

computeOccurrences(editorContext, context)
editorContext is an orion.edit.EditorContext object that contains all of the information about the current editor.
context is an object that contains the current selection in the editor to find occurrences for.

Service attributes

Implementations of orion.edit.occurrences may define the following attributes:

contentType
Array An array of Content Type IDs for which this occurrence computer is valid.
pattern
String A string to create a regular expression to determine if this occurrence service applies to the current context. This attribute has been

deprecated in favor of contentType.

Examples

The following example is how Orion plugs in occurrence support for JavaScript:

var provider = new orion.PluginProvider();
provider.registerService('orion.edit.occurrences', 
   {
       computeOccurrences: function(editorContext, context) {
	   return [];
       }
   {
     contentType: ["application/javascript"]
   });
provider.connect();