Symbol

A Symbol represents a symbolic construct within an editor’s text, such as a function, type, or interface. Extensions can request symbols from a TextEditor instance at specific positions in the text.

The Symbol class is not subclassable.

Properties

type

The type of the symbol, as a string.

This property is readonly.

The following symbol types are currently supported:

Types Description Notes
type A generic object type or metatype.
class An object class type.
category An extension to a type.
interface An interface of type conformance.
enum An enumeration of values.
union A union of types.
struct A simple type structure.
Callables Description Notes
function A self-contained callable.
method A callable member of an object.
closure A self-contained closure.
constructor An object type constructor.
destructor An object type destructor. Added in Nova 4.
getter An object property getter.
setter An object property setter.
static-method A static callable member of a type. Added in Nova 4.
Values Description Notes
constant A non-modifyable value.
variable A modifyable value.
property An object property value.
argument An argument passed to a callable.
color A color value.
enum-member A member value of an enumeration.
static-property A static type property value. Added in Nova 4.
Expressions Description Notes
expression An inline expression.
statement An inline statement.
block A code block.
heading A markup heading.
comment A code comment.
package A logical code package.
file A referenced document.
reference An external reference.
keyword A syntactic keyword.
bookmark A code bookmark.
Stylesheets Description Notes
style-ruleset A set of rules, such as CSS attributes.
style-directive A set of directives, such as a CSS @at-rule.
style-id A style ID selector.
style-class A style class selector.
style-pseudoclass A style pseudo-class selector.
style-pseudoelement A style pseudo-element selector.
Tags Description Notes
tag A generic markup tag.
tag-head A document head (metadata) tag.
tag-title A document title tag.
tag-meta A document metadata item tag.
tag-link An external resource reference tag (link).
tag-body A document body tag.
tag-script An scripting reference tag.
tag-style A styleset reference tag.
tag-heading A heading tag (h1, etc.).
tag-section A section tag (section, nav, etc.).
tag-container A generic container tag (div, span).
tag-ul An unordered list tag.
tag-ol An ordered list tag.
tag-li A list item tag.
tag-anchor An external resource anchor tag (a).
tag-image An external image reference tag (img).
tag-media An external media asset reference tag (audio, etc.).
tag-form A form tag.
tag-form-field A form field tag.
tag-framework A framework tag (PHP, etc).

range

The range of the symbol within the text, as a Range object.

This property is readonly.

name

The name of the symbol as used in quick open and autocomplete.

This property is readonly.

nameRange

The range of the symbol’s name within the text, as a Range object. This does not necessarily match exactly with the name property, such as if transformations were made on the name during symbolication.

This property is readonly.

displayName

The name of the symbol as presented in the Symbols list. This may include additional contextual information not included in the text.

This property is readonly.

comment

The comment text associated with the symbol, if any.

This property is readonly.

parent

The parent symbol containing the receiver, if any. For example, a method symbol’s parent might be a containing class).

This property is readonly.