Class DecorationManagement

Defined in: lib/mixins/decoration-management.coffee
Inherits: Mixin

Overview

The mixin that provides the decorations API to the minimap editor view.

Instance Method Summary

Instance Method Details

::decorateMarker(marker, decorationParams) Source

Adds a decoration that tracks a Marker. When the marker moves, is invalidated, or is destroyed, the decoration will be updated to reflect the marker's state.

There are three types of supported decorations:

  • line: Fills the line background with the decoration color.
  • highlight: Renders a colored rectangle on the minimap. The highlight is rendered above the line's text.
  • highlight-over: Same as highlight.
  • highlight-under: Renders a colored rectangle on the minimap. The highlight is rendered below the line's text.

Parameters:

  • markerA Marker you want this decoration to follow.
  • (Object) decorationParamsAn Object representing the decoration eg. {type: 'gutter', class: 'linter-error'}. The object can have the following properties:
    • (String) typeThe type String. There are a few supported decoration types: line, highlight, highlight-over and highlight-under
    • (String) classThis CSS class String will be used to retrieve the background color of the decoration by building a scope corresponding to `.minimap .editor `.
    • (String) scopeThe scope String to use to retrieve the decoration background. Note that if the scope property is set, the class won't be used.
    • (String) colorThe color String to use to render the decoration. When set, neither scope nor class are used.

Returns:

  • Returns a Decoration object.

::decorationForId(id) Source

Returns the decoration with the passed-in id.

Parameters:

  • (Number) idThe decoration id Number.

Returns:

  • Returns a Decoration.

Array ::decorationsByTypesForRow(row, types..., decorations) Source

Returns all the decorations of the given type that intersect the passed-in row.

Parameters:

  • (Number) rowThe row Number.
  • (String) typesA list of decoration types String.
  • (Array) decorationsAn Array of decorations.

Returns:

  • (Array) — Returns an Array of decorations.

Array ::decorationsForScreenRowRange(startScreenRow, endScreenRow) Source

Returns all the decorations that intersect the passed-in row range.

Parameters:

  • (Number) startScreenRowThe index Number of the starting screen row.
  • (Number) endScreenRowThe index Number of the ending screen row.

Returns:

  • (Array) — Returns an Array of decorations.

::initializeDecorations() Source

Initializes the decorations related properties.

::onDidAddDecoration(callback) Source

::onDidChangeDecoration(callback) Source

::onDidRemoveDecoration(callback) Source

::onDidUpdateDecoration(callback) Source

::removeAllDecorationsForMarker(marker) Source

Removes all the decorations registered for the passed-in marker.

Parameters:

  • markerThe marker for which removing decorations.

::removeDecoration(decoration) Source

Removes a Decoration from this minimap.

Parameters:

  • decorationThe Decoration to remove.