• Packages
  • Themes
  • Documentation
  • Blog
  • Discussions

Chapter 1: Getting Started

  • Why Atom?
  • Installing Atom
  • Atom Basics
  • Summary

Chapter 2: Using Atom

  • Atom Packages
  • Moving in Atom
  • Atom Selections
  • Editing and Deleting Text
  • Find and Replace
  • Snippets
  • Autocomplete
  • Folding
  • Panes
  • Pending Pane Items
  • Grammar
  • Version Control in Atom
  • GitHub package
  • Writing in Atom
  • Basic Customization
  • Summary

Chapter 3: Hacking Atom

  • Tools of the Trade
  • The Init File
  • Package: Word Count
  • Package: Modifying Text
  • Package: Active Editor Info
  • Creating a Theme
  • Creating a Grammar
  • Creating a Legacy TextMate Grammar
  • Publishing
  • Iconography
  • Debugging
  • Writing specs
  • Handling URIs
  • Cross-Platform Compatibility
  • Converting from TextMate
  • Hacking on Atom Core
  • Contributing to Official Atom Packages
  • Creating a Fork of a Core Package in atom/atom
  • Maintaining a Fork of a Core Package in atom/atom
  • Summary

Chapter 4: Behind Atom

  • Configuration API
  • Keymaps In-Depth
  • Scoped Settings, Scopes and Scope Descriptors
  • Serialization in Atom
  • Developing Node Modules
  • Interacting With Other Packages Via Services
  • Maintaining Your Packages
  • How Atom Uses Chromium Snapshots
  • Summary

Reference: API

  • AtomEnvironment
  • BufferedNodeProcess
  • BufferedProcess
  • Clipboard
  • Color
  • CommandRegistry
  • CompositeDisposable
  • Config
  • ContextMenuManager
  • Cursor
  • Decoration
  • DeserializerManager
  • Directory
  • DisplayMarker
  • DisplayMarkerLayer
  • Disposable
  • Dock
  • Emitter
  • File
  • GitRepository
  • Grammar
  • GrammarRegistry
  • Gutter
  • HistoryManager
  • KeymapManager
  • LayerDecoration
  • MarkerLayer
  • MenuManager
  • Notification
  • NotificationManager
  • Package
  • PackageManager
  • Pane
  • Panel
  • PathWatcher
  • Point
  • Project
  • Range
  • ScopeDescriptor
  • Selection
  • StyleManager
  • Task
  • TextBuffer
  • TextEditor
  • ThemeManager
  • TooltipManager
  • ViewRegistry
  • Workspace
  • WorkspaceCenter

Appendix A: Resources

  • Glossary

Appendix B: FAQ

  • Is Atom open source?
  • What does Atom cost?
  • What platforms does Atom run on?
  • How can I contribute to Atom?
  • Why does Atom collect usage data?
  • Atom in the cloud?
  • What's the difference between an IDE and an editor?
  • How can I tell if subpixel antialiasing is working?
  • Why is Atom deleting trailing whitespace? Why is there a newline at the end of the file?
  • What does Safe Mode do?
  • I have a question about a specific Atom community package. Where is the best place to ask it?
  • I’m using an international keyboard and keys that use AltGr or Ctrl+Alt aren’t working
  • I’m having a problem with Julia! What do I do?
  • I’m getting an error about a “self-signed certificate”. What do I do?
  • I’m having a problem with PlatformIO! What do I do?
  • How do I make Atom recognize a file with extension X as language Y?
  • How do I make the Welcome screen stop showing up?
  • How do I preview web page changes automatically?
  • How do I accept input from my program or script when using the script package?
  • I am unable to update to the latest version of Atom on macOS. How do I fix this?
  • I’m trying to change my syntax colors from styles.less, but it isn’t working!
  • How do I build or execute code I've written in Atom?
  • How do I uninstall Atom on macOS?
  • macOS Mojave font rendering change
  • Why does macOS say that Atom wants to access my calendar, contacts, photos, etc.?
  • How do I turn on line wrap?
  • The menu bar disappeared, how do I get it back?
  • How do I use a newline in the result of find and replace?
  • What is this line on the right in the editor view?

Appendix C: Shadow DOM

  • Removing Shadow DOM styles

Appendix D: Upgrading to 1.0 APIs

  • Upgrading Your Package
  • Upgrading Your UI Theme Or Package Selectors
  • Upgrading Your Syntax Theme

Appendix E: Atom server-side APIs

  • Atom package server API
  • Atom update server API

  • mac
  • windows
  • linux

DisplayMarker Essential

Represents a buffer annotation that remains logically stationary even as the buffer changes. This is used to represent cursors, folds, snippet targets, misspelled words, and anything else that needs to track a logical location in the buffer over time.

DisplayMarker Creation

Use DisplayMarkerLayer::markBufferRange or DisplayMarkerLayer::markScreenRange rather than creating Markers directly.

Head and Tail

Markers always have a head and sometimes have a tail. If you think of a marker as an editor selection, the tail is the part that’s stationary and the head is the part that moves when the mouse is moved. A marker without a tail always reports an empty range at the head position. A marker with a head position greater than the tail is in a “normal” orientation. If the head precedes the tail the marker is in a “reversed” orientation.

Validity

Markers are considered valid when they are first created. Depending on the invalidation strategy you choose, certain changes to the buffer can cause a marker to become invalid, for example if the text surrounding the marker is deleted. The strategies, in order of descending fragility:

  • never: The marker is never marked as invalid. This is a good choice for markers representing selections in an editor.
  • surround: The marker is invalidated by changes that completely surround it.
  • overlap: The marker is invalidated by changes that surround the start or end of the marker. This is the default.
  • inside: The marker is invalidated by changes that extend into the inside of the marker. Changes that end at the marker’s start or start at the marker’s end do not invalidate the marker.
  • touch: The marker is invalidated by a change that touches the marked region in any way, including changes that end at the marker’s start or start at the marker’s end. This is the most fragile strategy.

See TextBuffer::markRange for usage.

Construction and Destruction

::destroy()

Destroys the marker, causing it to emit the ‘destroyed’ event. Once destroyed, a marker cannot be restored by undo/redo operations.

::copy(properties)

Creates and returns a new DisplayMarker with the same properties as this marker.

Selection markers (markers with a custom property type: "selection") should be copied with a different type value, for example with marker.copy({type: null}). Otherwise, the new marker’s selection will be merged with this marker’s selection, and a null value will be returned.

Argument Description

properties

optional

Object properties to associate with the new marker. The new marker’s properties are computed by extending this marker’s properties with properties.

Return values

Returns a DisplayMarker.

Event Subscription

::onDidChange(callback)

Invoke the given callback when the state of the marker changes.

Argument Description

callback

Function to be called when the marker changes.

event

Object with the following keys:

oldHeadBufferPosition

Point representing the former head buffer position

newHeadBufferPosition

Point representing the new head buffer position

oldTailBufferPosition

Point representing the former tail buffer position

newTailBufferPosition

Point representing the new tail buffer position

oldHeadScreenPosition

Point representing the former head screen position

newHeadScreenPosition

Point representing the new head screen position

oldTailScreenPosition

Point representing the former tail screen position

newTailScreenPosition

Point representing the new tail screen position

wasValid

Boolean indicating whether the marker was valid before the change

isValid

Boolean indicating whether the marker is now valid

hadTail

Boolean indicating whether the marker had a tail before the change

hasTail

Boolean indicating whether the marker now has a tail

oldProperties

Object containing the marker’s custom properties before the change.

newProperties

Object containing the marker’s custom properties after the change.

textChanged

Boolean indicating whether this change was caused by a textual change to the buffer or whether the marker was manipulated directly via its public API.

Return values

Returns a Disposable on which .dispose() can be called to unsubscribe.

::onDidDestroy(callback)

Invoke the given callback when the marker is destroyed.

Argument Description

callback

Function to be called when the marker is destroyed.

Return values

Returns a Disposable on which .dispose() can be called to unsubscribe.

TextEditorMarker Details

::isValid()

Return values

Returns a Boolean indicating whether the marker is valid. Markers can be invalidated when a region surrounding them in the buffer is changed.

::isDestroyed()

Return values

Returns a Boolean indicating whether the marker has been destroyed. A marker can be invalid without being destroyed, in which case undoing the invalidating operation would restore the marker. Once a marker is destroyed by calling DisplayMarker::destroy, no undo/redo operation can ever bring it back.

::isReversed()

Return values

Returns a Boolean indicating whether the head precedes the tail.

::isExclusive()

Return values

Returns a Boolean indicating whether changes that occur exactly at the marker’s head or tail cause it to move.

::getInvalidationStrategy()

Get the invalidation strategy for this marker.

Valid values include: never, surround, overlap, inside, and touch.

Return values

Returns a String.

::getProperties()

Return values

Returns an Object containing any custom properties associated with the marker.

::setProperties(properties)

Merges an Object containing new properties into the marker’s existing properties.

Argument Description

properties

Object

::matchesProperties()

Return values

Returns whether this marker matches the given parameters. The parameters are the same as DisplayMarkerLayer::findMarkers.

Comparing to other markers

::compare(other)

Compares this marker to another based on their ranges.

Argument Description

other

DisplayMarker

Return values

Returns a Number

::isEqual(other)

Argument Description

other

DisplayMarker other marker

Return values

Returns a Boolean indicating whether this marker is equivalent to another marker, meaning they have the same range and options.

Managing the marker's range

::getBufferRange()

Gets the buffer range of this marker.

Return values

Returns a Range.

::getScreenRange()

Gets the screen range of this marker.

Return values

Returns a Range.

::setBufferRange(bufferRange, properties)

Modifies the buffer range of this marker.

Argument Description

bufferRange

The new Range to use

properties

optional

Object properties to associate with the marker.

reversed

Boolean If true, the marker will to be in a reversed orientation.

::setScreenRange(screenRange, options)

Modifies the screen range of this marker.

Argument Description

screenRange

The new Range to use

options

optional

An Object with the following keys:

reversed

Boolean If true, the marker will to be in a reversed orientation.

clipDirection

String If 'backward', returns the first valid position preceding an invalid position. If 'forward', returns the first valid position following an invalid position. If 'closest', returns the first valid position closest to an invalid position. Defaults to 'closest'. Applies to the start and end of the given range.

::getStartScreenPosition(options)

Retrieves the screen position of the marker’s start. This will always be less than or equal to the result of DisplayMarker::getEndScreenPosition.

Argument Description

options

optional

An Object with the following keys:

clipDirection

String If 'backward', returns the first valid position preceding an invalid position. If 'forward', returns the first valid position following an invalid position. If 'closest', returns the first valid position closest to an invalid position. Defaults to 'closest'. Applies to the start and end of the given range.

Return values

Returns a Point.

::getEndScreenPosition(options)

Retrieves the screen position of the marker’s end. This will always be greater than or equal to the result of DisplayMarker::getStartScreenPosition.

Argument Description

options

optional

An Object with the following keys:

clipDirection

String If 'backward', returns the first valid position preceding an invalid position. If 'forward', returns the first valid position following an invalid position. If 'closest', returns the first valid position closest to an invalid position. Defaults to 'closest'. Applies to the start and end of the given range.

Return values

Returns a Point.

Extended Methods

::getHeadBufferPosition()

Retrieves the buffer position of the marker’s head.

Return values

Returns a Point.

::setHeadBufferPosition(bufferPosition)

Sets the buffer position of the marker’s head.

Argument Description

bufferPosition

The new Point to use

::getHeadScreenPosition(options)

Retrieves the screen position of the marker’s head.

Argument Description

options

optional

An Object with the following keys:

clipDirection

String If 'backward', returns the first valid position preceding an invalid position. If 'forward', returns the first valid position following an invalid position. If 'closest', returns the first valid position closest to an invalid position. Defaults to 'closest'. Applies to the start and end of the given range.

Return values

Returns a Point.

::setHeadScreenPosition(screenPosition, options)

Sets the screen position of the marker’s head.

Argument Description

screenPosition

The new Point to use

options

optional

An Object with the following keys:

clipDirection

String If 'backward', returns the first valid position preceding an invalid position. If 'forward', returns the first valid position following an invalid position. If 'closest', returns the first valid position closest to an invalid position. Defaults to 'closest'. Applies to the start and end of the given range.

::getTailBufferPosition()

Retrieves the buffer position of the marker’s tail.

Return values

Returns a Point.

::setTailBufferPosition(bufferPosition)

Sets the buffer position of the marker’s tail.

Argument Description

bufferPosition

The new Point to use

::getTailScreenPosition(options)

Retrieves the screen position of the marker’s tail.

Argument Description

options

optional

An Object with the following keys:

clipDirection

String If 'backward', returns the first valid position preceding an invalid position. If 'forward', returns the first valid position following an invalid position. If 'closest', returns the first valid position closest to an invalid position. Defaults to 'closest'. Applies to the start and end of the given range.

Return values

Returns a Point.

::setTailScreenPosition(screenPosition, options)

Sets the screen position of the marker’s tail.

Argument Description

screenPosition

The new Point to use

options

optional

An Object with the following keys:

clipDirection

String If 'backward', returns the first valid position preceding an invalid position. If 'forward', returns the first valid position following an invalid position. If 'closest', returns the first valid position closest to an invalid position. Defaults to 'closest'. Applies to the start and end of the given range.

::getStartBufferPosition()

Retrieves the buffer position of the marker’s start. This will always be less than or equal to the result of DisplayMarker::getEndBufferPosition.

Return values

Returns a Point.

::getEndBufferPosition()

Retrieves the buffer position of the marker’s end. This will always be greater than or equal to the result of DisplayMarker::getStartBufferPosition.

Return values

Returns a Point.

::hasTail()

Return values

Returns a Boolean indicating whether the marker has a tail.

::plantTail()

Plants the marker’s tail at the current head position. After calling the marker’s tail position will be its head position at the time of the call, regardless of where the marker’s head is moved.

::clearTail()

Removes the marker’s tail. After calling the marker’s head position will be reported as its current tail position until the tail is planted again.

  • Terms of Use
  • Privacy
  • Code of Conduct
  • Releases
  • FAQ
  • Contact
  • Contribute!
with by