A ScopeSelector object represents a single text selector used for the names of scopes in syntax grammars. These objects can be used to determine whether a specific region of text matches a specific subset of selector classes, such as for use in completions.

Added in Nova 3.

Class Methods


Creates a new scope selector from the provided string. The string must follow the standard format used for syntax grammar scopes: a set of alphanumeric identifiers that are separated by period (.) characters. The universal selector * is also allowed. Any other characters (including whitespace) will be ignored and stripped from the string.

The special class * is reserved to represent the universal selector, which will match any other selector compared to it. If this class is included as a component of any selector it will be assumed to also represent the universal selector.



An array of strings representing the set of period-separated classes that were specified in the string which created the selector. The classes are not guaranteed to be in any particular order, and may not represent the order that was originally specified.

This property is readonly.


The string which created the selector.

This property is readonly.



Returns a boolean value as to whether the selector or string provided matches the receiver. The argument must be either another ScopeSelector instance or a string that can be resolved as such. Passing any other value will raise an Error.