@types/atom
- Version 1.40.18
- Published
- 291 kB
- 1 dependency
- MIT license
Install
npm i @types/atom
yarn add @types/atom
pnpm add @types/atom
Overview
TypeScript definitions for atom
Index
Functions
Classes
File
- create()
- createReadStream()
- createWriteStream()
- exists()
- existsSync()
- getBaseName()
- getDigest()
- getDigestSync()
- getEncoding()
- getParent()
- getPath()
- getRealPath()
- getRealPathSync()
- isDirectory()
- isFile()
- isSymbolicLink()
- onDidChange()
- onDidDelete()
- onDidRename()
- onWillThrowWatchError()
- read()
- setEncoding()
- write()
- writeSync()
GitRepository
- checkoutHead()
- checkoutReference()
- destroy()
- getAheadBehindCount()
- getCachedPathStatus()
- getCachedUpstreamAheadBehindCount()
- getConfigValue()
- getDiffStats()
- getDirectoryStatus()
- getLineDiffs()
- getOriginURL()
- getPath()
- getPathStatus()
- getReferences()
- getReferenceTarget()
- getShortHead()
- getType()
- getUpstreamBranch()
- getWorkingDirectory()
- hasBranch()
- isDestroyed()
- isPathIgnored()
- isPathModified()
- isPathNew()
- isProjectAtRoot()
- isStatusModified()
- isStatusNew()
- isSubmodule()
- onDidChangeStatus()
- onDidChangeStatuses()
- onDidDestroy()
- open()
- relativize()
TextBuffer
- abortTransaction()
- addMarkerLayer()
- append()
- backwardsScan()
- backwardsScanInRange()
- characterIndexForPosition()
- clearUndoStack()
- clipPosition()
- clipRange()
- createCheckpoint()
- delete()
- deleteRow()
- deleteRows()
- deserialize()
- destroy()
- destroyed
- findMarkers()
- getChangesSinceCheckpoint()
- getDefaultMarkerLayer()
- getEncoding()
- getEndPosition()
- getFirstPosition()
- getId()
- getLastLine()
- getLastRow()
- getLength()
- getLineCount()
- getLines()
- getMarker()
- getMarkerCount()
- getMarkerLayer()
- getMarkers()
- getMaxCharacterIndex()
- getPath()
- getRange()
- getStoppedChangingDelay()
- getText()
- getTextInRange()
- getUri()
- groupChangesSinceCheckpoint()
- groupLastChanges()
- hasAstral()
- hasMultipleEditors()
- id
- insert()
- isAlive()
- isDestroyed()
- isEmpty()
- isInConflict()
- isModified()
- isRetained()
- isRowBlank()
- lineEndingForRow()
- lineForRow()
- lineLengthForRow()
- load()
- loadSync()
- markPosition()
- markRange()
- nextNonBlankRow()
- onDidChange()
- onDidChangeEncoding()
- onDidChangeModified()
- onDidChangePath()
- onDidChangeText()
- onDidConflict()
- onDidCreateMarker()
- onDidDelete()
- onDidDestroy()
- onDidReload()
- onDidSave()
- onDidStopChanging()
- onDidUpdateMarkers()
- onWillChange()
- onWillReload()
- onWillSave()
- onWillThrowWatchError()
- positionForCharacterIndex()
- previousNonBlankRow()
- rangeForRow()
- redo()
- refcount
- release()
- reload()
- replace()
- retain()
- revertToCheckpoint()
- save()
- saveAs()
- scan()
- scanInRange()
- serialize()
- setEncoding()
- setFile()
- setPath()
- setText()
- setTextInRange()
- setTextViaDiff()
- transact()
- undo()
TextEditor
- abortTransaction()
- addCursorAtBufferPosition()
- addCursorAtScreenPosition()
- addGutter()
- addMarkerLayer()
- addSelectionForBufferRange()
- addSelectionForScreenRange()
- autoIndentSelectedRows()
- backspace()
- backwardsScanInBufferRange()
- bufferPositionForScreenPosition()
- bufferRangeForScopeAtCursor()
- bufferRangeForScopeAtPosition()
- bufferRangeForScreenRange()
- clipBufferPosition()
- clipBufferRange()
- clipScreenPosition()
- clipScreenRange()
- copySelectedText()
- createCheckpoint()
- cutSelectedText()
- cutToEndOfBufferLine()
- cutToEndOfLine()
- decorateMarker()
- decorateMarkerLayer()
- delete()
- deleteLine()
- deleteToBeginningOfLine()
- deleteToBeginningOfSubword()
- deleteToBeginningOfWord()
- deleteToEndOfLine()
- deleteToEndOfSubword()
- deleteToEndOfWord()
- deleteToNextWordBoundary()
- deleteToPreviousWordBoundary()
- findMarkers()
- foldAll()
- foldAllAtIndentLevel()
- foldBufferRow()
- foldCurrentRow()
- foldSelectedLines()
- getBuffer()
- getCurrentParagraphBufferRange()
- getCursorAtScreenPosition()
- getCursorBufferPosition()
- getCursorBufferPositions()
- getCursors()
- getCursorScreenPosition()
- getCursorScreenPositions()
- getCursorsOrderedByBufferPosition()
- getDecorations()
- getDefaultMarkerLayer()
- getEncoding()
- getGrammar()
- getGutters()
- getHighlightDecorations()
- getLastBufferRow()
- getLastCursor()
- getLastScreenRow()
- getLastSelection()
- getLineCount()
- getLineDecorations()
- getLineHeightInPixels()
- getLineNumberDecorations()
- getLongTitle()
- getMarker()
- getMarkerCount()
- getMarkerLayer()
- getMarkers()
- getOverlayDecorations()
- getPath()
- getPlaceholderText()
- getRootScopeDescriptor()
- getScreenLineCount()
- getSelectedBufferRange()
- getSelectedBufferRanges()
- getSelectedScreenRange()
- getSelectedScreenRanges()
- getSelectedText()
- getSelections()
- getSelectionsOrderedByBufferPosition()
- getSoftTabs()
- getSoftWrapColumn()
- getTabLength()
- getTabText()
- getText()
- getTextInBufferRange()
- getTitle()
- getWordUnderCursor()
- groupChangesSinceCheckpoint()
- gutterWithName()
- hasMultipleCursors()
- id
- indentationForBufferRow()
- indentLevelForLine()
- indentSelectedRows()
- insertNewline()
- insertNewlineAbove()
- insertNewlineBelow()
- insertText()
- isBufferRowCommented()
- isEmpty()
- isFoldableAtBufferRow()
- isFoldableAtScreenRow()
- isFoldedAtBufferRow()
- isFoldedAtCursorRow()
- isFoldedAtScreenRow()
- isModified()
- isReadOnly()
- isSoftWrapped()
- lineTextForBufferRow()
- lineTextForScreenRow()
- lowerCase()
- markBufferPosition()
- markBufferRange()
- markScreenPosition()
- markScreenRange()
- moveDown()
- moveLeft()
- moveRight()
- moveToBeginningOfLine()
- moveToBeginningOfNextParagraph()
- moveToBeginningOfNextWord()
- moveToBeginningOfPreviousParagraph()
- moveToBeginningOfScreenLine()
- moveToBeginningOfWord()
- moveToBottom()
- moveToEndOfLine()
- moveToEndOfScreenLine()
- moveToEndOfWord()
- moveToFirstCharacterOfLine()
- moveToNextSubwordBoundary()
- moveToNextWordBoundary()
- moveToPreviousSubwordBoundary()
- moveToPreviousWordBoundary()
- moveToTop()
- moveUp()
- mutateSelectedText()
- observeCursors()
- observeDecorations()
- observeGrammar()
- observeGutters()
- observeSelections()
- onDidAddCursor()
- onDidAddDecoration()
- onDidAddGutter()
- onDidAddSelection()
- onDidChange()
- onDidChangeCursorPosition()
- onDidChangeEncoding()
- onDidChangeGrammar()
- onDidChangeModified()
- onDidChangePath()
- onDidChangePlaceholderText()
- onDidChangeSelectionRange()
- onDidChangeSoftWrapped()
- onDidChangeTitle()
- onDidConflict()
- onDidDestroy()
- onDidInsertText()
- onDidRemoveCursor()
- onDidRemoveDecoration()
- onDidRemoveGutter()
- onDidRemoveSelection()
- onDidSave()
- onDidStopChanging()
- onWillInsertText()
- outdentSelectedRows()
- pasteText()
- redo()
- revertToCheckpoint()
- save()
- saveAs()
- scan()
- scanInBufferRange()
- scopeDescriptorForBufferPosition()
- screenPositionForBufferPosition()
- screenRangeForBufferRange()
- scrollToBufferPosition()
- scrollToCursorPosition()
- scrollToScreenPosition()
- selectAll()
- selectDown()
- selectionIntersectsBufferRange()
- selectLargerSyntaxNode()
- selectLeft()
- selectLinesContainingCursors()
- selectMarker()
- selectRight()
- selectSmallerSyntaxNode()
- selectToBeginningOfLine()
- selectToBeginningOfNextParagraph()
- selectToBeginningOfNextWord()
- selectToBeginningOfPreviousParagraph()
- selectToBeginningOfWord()
- selectToBottom()
- selectToBufferPosition()
- selectToEndOfLine()
- selectToEndOfWord()
- selectToFirstCharacterOfLine()
- selectToNextSubwordBoundary()
- selectToNextWordBoundary()
- selectToPreviousSubwordBoundary()
- selectToPreviousWordBoundary()
- selectToScreenPosition()
- selectToTop()
- selectUp()
- selectWordsContainingCursors()
- setCursorBufferPosition()
- setCursorScreenPosition()
- setEncoding()
- setIndentationForBufferRow()
- setPlaceholderText()
- setReadOnly()
- setSelectedBufferRange()
- setSelectedBufferRanges()
- setSelectedScreenRange()
- setSelectedScreenRanges()
- setSoftTabs()
- setSoftWrapped()
- setTabLength()
- setText()
- setTextInBufferRange()
- syntaxTreeScopeDescriptorForBufferPosition()
- toggleFoldAtBufferRow()
- toggleLineCommentsInSelection()
- toggleSoftTabs()
- toggleSoftWrapped()
- tokenForBufferPosition()
- transact()
- transpose()
- undo()
- unfoldAll()
- unfoldBufferRow()
- unfoldCurrentRow()
- upperCase()
- usesSoftTabs()
Interfaces
AtomEnvironment
- beep()
- center()
- clipboard
- close()
- commands
- config
- confirm()
- contextMenu
- deserializers
- displayWindow()
- executeJavaScriptInDevTools()
- focus()
- getAppName()
- getConfigDirPath()
- getCurrentWindow()
- getLoadSettings()
- getPosition()
- getReleaseChannel()
- getSize()
- getStartupMarkers()
- getVersion()
- getWindowDimensions()
- getWindowLoadTime()
- grammars
- hide()
- history
- inDevMode()
- inSafeMode()
- inSpecMode()
- isFullScreen()
- isMaximized()
- isReleasedVersion()
- keymaps
- menu
- notifications
- onDidBeep()
- onDidThrowError()
- onWillThrowError()
- open()
- openDevTools()
- packages
- pickFolder()
- project
- reload()
- restartApplication()
- setFullScreen()
- setPosition()
- setSize()
- setWindowDimensions()
- show()
- styles
- textEditors
- themes
- toggleDevTools()
- toggleFullScreen()
- tooltips
- views
- whenShellEnvironmentLoaded()
- workspace
Cursor
- clearAutoscroll()
- clearSelection()
- compare()
- getBeginningOfCurrentWordBufferPosition()
- getBeginningOfNextWordBufferPosition()
- getBufferColumn()
- getBufferPosition()
- getBufferRow()
- getCurrentBufferLine()
- getCurrentLineBufferRange()
- getCurrentParagraphBufferRange()
- getCurrentWordBufferRange()
- getCurrentWordPrefix()
- getEndOfCurrentWordBufferPosition()
- getIndentLevel()
- getMarker()
- getNextWordBoundaryBufferPosition()
- getPreviousWordBoundaryBufferPosition()
- getScopeDescriptor()
- getScreenColumn()
- getScreenPosition()
- getScreenRow()
- getSyntaxTreeScopeDescriptor()
- hasPrecedingCharactersOnLine()
- isAtBeginningOfLine()
- isAtEndOfLine()
- isBetweenWordAndNonWord()
- isInsideWord()
- isLastCursor()
- isSurroundedByWhitespace()
- isVisible()
- moveDown()
- moveLeft()
- moveRight()
- moveToBeginningOfLine()
- moveToBeginningOfNextParagraph()
- moveToBeginningOfNextWord()
- moveToBeginningOfPreviousParagraph()
- moveToBeginningOfScreenLine()
- moveToBeginningOfWord()
- moveToBottom()
- moveToEndOfLine()
- moveToEndOfScreenLine()
- moveToEndOfWord()
- moveToFirstCharacterOfLine()
- moveToNextSubwordBoundary()
- moveToNextWordBoundary()
- moveToPreviousSubwordBoundary()
- moveToPreviousWordBoundary()
- moveToTop()
- moveUp()
- onDidChangePosition()
- onDidChangeVisibility()
- onDidDestroy()
- setBufferPosition()
- setScreenPosition()
- setVisible()
- skipLeadingWhitespace()
- subwordRegExp()
- wordRegExp()
DisplayMarker
- clearTail()
- compare()
- copy()
- destroy()
- getBufferRange()
- getEndBufferPosition()
- getEndScreenPosition()
- getHeadBufferPosition()
- getHeadScreenPosition()
- getInvalidationStrategy()
- getProperties()
- getScreenRange()
- getStartBufferPosition()
- getStartScreenPosition()
- getTailBufferPosition()
- getTailScreenPosition()
- hasTail()
- isDestroyed()
- isEqual()
- isExclusive()
- isReversed()
- isValid()
- matchesProperties()
- onDidChange()
- onDidDestroy()
- plantTail()
- setBufferRange()
- setHeadBufferPosition()
- setHeadScreenPosition()
- setProperties()
- setScreenRange()
- setTailBufferPosition()
- setTailScreenPosition()
Dock
- activate()
- activateNextPane()
- activatePreviousPane()
- getActivePane()
- getActivePaneItem()
- getPaneItems()
- getPanes()
- hide()
- isVisible()
- observeActivePane()
- observeActivePaneItem()
- observePaneItems()
- observePanes()
- observeVisible()
- onDidAddPane()
- onDidAddPaneItem()
- onDidChangeActivePane()
- onDidChangeActivePaneItem()
- onDidChangeHovered()
- onDidChangeVisible()
- onDidDestroyPane()
- onDidDestroyPaneItem()
- onDidStopChangingActivePaneItem()
- onWillDestroyPane()
- onWillDestroyPaneItem()
- show()
- toggle()
FindDisplayMarkerOptions
- containedInBufferRange
- containedInScreenRange
- containsBufferPosition
- containsBufferRange
- endBufferPosition
- endBufferRow
- endScreenPosition
- endScreenRow
- endsInBufferRange
- endsInScreenRange
- intersectsBufferRange
- intersectsBufferRowRange
- intersectsScreenRange
- intersectsScreenRowRange
- startBufferPosition
- startBufferRow
- startScreenPosition
- startScreenRow
- startsInBufferRange
- startsInScreenRange
GrammarRegistry
- addGrammar()
- assignLanguageMode()
- autoAssignLanguageMode()
- decodeTokens()
- getGrammars()
- getGrammarScore()
- grammarForScopeName()
- loadGrammar()
- loadGrammarSync()
- maintainLanguageMode()
- onDidAddGrammar()
- onDidRemoveGrammar()
- onDidUpdateGrammar()
- readGrammar()
- readGrammarSync()
- removeGrammar()
- removeGrammarForScopeName()
- selectGrammar()
KeymapManager
- add()
- addKeystrokeResolver()
- build()
- clear()
- destroy()
- findKeyBindings()
- getKeyBindings()
- getPartialMatchTimeout()
- handleKeyboardEvent()
- keystrokeForKeyboardEvent()
- loadKeymap()
- onDidFailToMatchBinding()
- onDidFailToReadFile()
- onDidMatchBinding()
- onDidPartiallyMatchBindings()
- onDidReloadKeymap()
- onDidUnloadKeymap()
- watchKeymap()
PackageManager
- activatePackage()
- deactivatePackage()
- disablePackage()
- enablePackage()
- getActivePackage()
- getActivePackages()
- getApmPath()
- getAvailablePackageMetadata()
- getAvailablePackageNames()
- getAvailablePackagePaths()
- getLoadedPackage()
- getLoadedPackages()
- getPackageDirPaths()
- hasActivatedInitialPackages()
- hasLoadedInitialPackages()
- isBundledPackage()
- isPackageActive()
- isPackageDisabled()
- isPackageLoaded()
- onDidActivateInitialPackages()
- onDidActivatePackage()
- onDidDeactivatePackage()
- onDidLoadInitialPackages()
- onDidLoadPackage()
- onDidTriggerActivationHook()
- onDidUnloadPackage()
- resolvePackagePath()
- triggerActivationHook()
- triggerDeferredActivationHooks()
Pane
- activate()
- activateItem()
- activateItemAtIndex()
- activateItemForURI()
- activateNextItem()
- activatePreviousItem()
- addItem()
- addItems()
- destroy()
- destroyActiveItem()
- destroyInactiveItems()
- destroyItem()
- destroyItems()
- getActiveItem()
- getActiveItemIndex()
- getItems()
- isActive()
- isDestroyed()
- itemAtIndex()
- itemForURI()
- moveItem()
- moveItemLeft()
- moveItemRight()
- moveItemToPane()
- observeActive()
- observeActiveItem()
- observeFlexScale()
- observeItems()
- onChooseLastMRUItem()
- onChooseNextMRUItem()
- onDidActivate()
- onDidAddItem()
- onDidChangeActive()
- onDidChangeActiveItem()
- onDidChangeFlexScale()
- onDidDestroy()
- onDidMoveItem()
- onDidRemoveItem()
- onDoneChoosingMRUItem()
- onWillDestroy()
- onWillDestroyItem()
- onWillRemoveItem()
- saveActiveItem()
- saveActiveItemAs()
- saveItem()
- saveItemAs()
- saveItems()
- splitDown()
- splitLeft()
- splitRight()
- splitUp()
Selection
- addSelectionAbove()
- addSelectionBelow()
- autoIndentSelectedRows()
- backspace()
- clear()
- compare()
- copy()
- cut()
- cutToEndOfBufferLine()
- cutToEndOfLine()
- delete()
- deleteLine()
- deleteSelectedText()
- deleteToBeginningOfLine()
- deleteToBeginningOfSubword()
- deleteToBeginningOfWord()
- deleteToEndOfLine()
- deleteToEndOfSubword()
- deleteToEndOfWord()
- deleteToNextWordBoundary()
- deleteToPreviousWordBoundary()
- expandOverLine()
- expandOverWord()
- fold()
- getBufferRange()
- getBufferRowRange()
- getScreenRange()
- getText()
- indentSelectedRows()
- insertText()
- intersectsBufferRange()
- intersectsWith()
- isEmpty()
- isReversed()
- isSingleScreenLine()
- joinLines()
- merge()
- onDidChangeRange()
- onDidDestroy()
- outdentSelectedRows()
- selectAll()
- selectDown()
- selectLeft()
- selectLine()
- selectRight()
- selectToBeginningOfLine()
- selectToBeginningOfNextParagraph()
- selectToBeginningOfNextWord()
- selectToBeginningOfPreviousParagraph()
- selectToBeginningOfWord()
- selectToBottom()
- selectToBufferPosition()
- selectToEndOfBufferLine()
- selectToEndOfLine()
- selectToEndOfWord()
- selectToFirstCharacterOfLine()
- selectToNextSubwordBoundary()
- selectToNextWordBoundary()
- selectToPreviousSubwordBoundary()
- selectToPreviousWordBoundary()
- selectToScreenPosition()
- selectToTop()
- selectUp()
- selectWord()
- setBufferRange()
- setScreenRange()
- toggleLineComments()
TextEditorElement
- getBaseCharacterWidth()
- getComponent()
- getModel()
- getNextUpdatePromise()
- getScrollHeight()
- getScrollLeft()
- getScrollTop()
- hasFocus()
- onDidAttach()
- onDidChangeScrollLeft()
- onDidChangeScrollTop()
- onDidDetach()
- pixelPositionForBufferPosition()
- pixelPositionForScreenPosition()
- scrollToBottom()
- scrollToTop()
- setScrollLeft()
- setScrollTop()
Workspace
- activateNextPane()
- activatePreviousPane()
- addBottomPanel()
- addFooterPanel()
- addHeaderPanel()
- addLeftPanel()
- addModalPanel()
- addOpener()
- addRightPanel()
- addTopPanel()
- buildTextEditor()
- createItemForURI()
- getActivePane()
- getActivePaneContainer()
- getActivePaneItem()
- getActiveTextEditor()
- getBottomDock()
- getBottomPanels()
- getCenter()
- getFooterPanels()
- getHeaderPanels()
- getLeftDock()
- getLeftPanels()
- getModalPanels()
- getPaneContainers()
- getPaneItems()
- getPanes()
- getRightDock()
- getRightPanels()
- getTextEditors()
- getTopPanels()
- hide()
- isTextEditor()
- observeActivePane()
- observeActivePaneItem()
- observeActiveTextEditor()
- observePaneItems()
- observePanes()
- observeTextEditors()
- onDidAddPane()
- onDidAddPaneItem()
- onDidAddTextEditor()
- onDidChangeActivePane()
- onDidChangeActivePaneItem()
- onDidChangeActiveTextEditor()
- onDidDestroyPane()
- onDidDestroyPaneItem()
- onDidOpen()
- onDidStopChangingActivePaneItem()
- onWillDestroyPane()
- onWillDestroyPaneItem()
- open()
- paneContainerForItem()
- paneContainerForURI()
- paneForItem()
- paneForURI()
- panelForItem()
- reopenItem()
- replace()
- scan()
- toggle()
WorkspaceCenter
- activateNextPane()
- activatePreviousPane()
- destroyActivePane()
- getActivePane()
- getActivePaneItem()
- getActiveTextEditor()
- getPaneItems()
- getPanes()
- getTextEditors()
- observeActivePane()
- observeActivePaneItem()
- observePaneItems()
- observePanes()
- observeTextEditors()
- onDidAddPane()
- onDidAddPaneItem()
- onDidAddTextEditor()
- onDidChangeActivePane()
- onDidChangeActivePaneItem()
- onDidDestroyPane()
- onDidDestroyPaneItem()
- onDidStopChangingActivePaneItem()
- onWillDestroyPane()
- onWillDestroyPaneItem()
- paneForItem()
- paneForURI()
- saveAll()
Type Aliases
Namespaces
Functions
function watchPath
watchPath: ( rootPath: string, options: {}, eventCallback: (events: FilesystemChangeEvent) => void) => Promise<PathWatcher>;
Invoke a callback with each filesystem event that occurs beneath a specified path. If you only need to watch events within the project's root paths, use Project::onDidChangeFiles instead.
Classes
class BufferedNodeProcess
class BufferedNodeProcess extends BufferedProcess {}
Like BufferedProcess, but accepts a Node script as the command to run. This is necessary on Windows since it doesn't support shebang #! lines.
constructor
constructor(options: NodeProcessOptions);
Runs the given Node script by spawning a new child process.
class BufferedProcess
class BufferedProcess {}
A wrapper which provides standard error/output line buffering for Node's ChildProcess.
constructor
constructor(options: ProcessOptions);
property process
readonly process?: any;
method kill
kill: () => void;
Terminate the process.
method onWillThrowError
onWillThrowError: ( callback: (errorObject: HandleableErrorEvent) => void) => Disposable;
Will call your callback when an error will be raised by the process. Usually this is due to the command not being available or not on the PATH. You can call handle() on the object passed to your callback to indicate that you have handled this error.
method start
start: () => void;
Runs the process.
class CompositeDisposable
class CompositeDisposable implements DisposableLike {}
An object that aggregates multiple Disposable instances together into a single disposable, so they can all be disposed as a group.
constructor
constructor(...disposables: DisposableLike[]);
Construct an instance, optionally with one or more disposables.
method add
add: (...disposables: DisposableLike[]) => void;
Add disposables to be disposed when the composite is disposed. If this object has already been disposed, this method has no effect.
method clear
clear: () => void;
Clear all disposables. They will not be disposed by the next call to dispose.
method delete
delete: (disposable: DisposableLike) => void;
Alias to CompositeDisposable::remove.
method dispose
dispose: () => void;
Dispose all disposables added to this composite disposable. If this object has already been disposed, this method has no effect.
method remove
remove: (disposable: DisposableLike) => void;
Remove a previously added disposable.
class Directory
class Directory {}
Represents a directory on disk that can be watched for changes.
constructor
constructor(directoryPath: string, symlink?: boolean);
Configures a new Directory instance, no files are accessed.
method contains
contains: (pathToCheck: string) => boolean;
Determines if the given path (real or symbolic) is inside this directory. This method does not actually check if the path exists, it just checks if the path is under this directory.
method create
create: (mode?: number) => Promise<boolean>;
Creates the directory on disk that corresponds to ::getPath() if no such directory already exists.
method exists
exists: () => Promise<boolean>;
Returns a promise that resolves to a boolean, true if the directory exists, false otherwise.
method existsSync
existsSync: () => boolean;
Returns a boolean, true if the directory exists, false otherwise.
method getBaseName
getBaseName: () => string;
Returns the string basename of the directory.
method getEntries
getEntries: ( callback: (error: Error | null, entries: Array<File | Directory>) => void) => void;
Reads file entries in this directory from disk asynchronously.
method getEntriesSync
getEntriesSync: () => Array<File | Directory>;
Reads file entries in this directory from disk synchronously.
method getFile
getFile: (filename: string) => File;
Traverse within this Directory to a child File. This method doesn't actually check to see if the File exists, it just creates the File object.
method getParent
getParent: () => Directory;
Traverse to the parent directory.
method getPath
getPath: () => string;
This may include unfollowed symlinks or relative directory entries. Or it may be fully resolved, it depends on what you give it.
method getRealPathSync
getRealPathSync: () => string;
All relative directory entries are removed and symlinks are resolved to their final destination.
method getSubdirectory
getSubdirectory: (dirname: string) => Directory;
Traverse within this a Directory to a child Directory. This method doesn't actually check to see if the Directory exists, it just creates the Directory object.
method isDirectory
isDirectory: () => this is Directory;
Returns a boolean, always true.
method isFile
isFile: () => this is File;
Returns a boolean, always false.
method isRoot
isRoot: () => boolean;
Return a boolean, true if this Directory is the root directory of the filesystem, or false if it isn't.
method isSymbolicLink
isSymbolicLink: () => boolean;
Returns a boolean indicating whether or not this is a symbolic link.
method onDidChange
onDidChange: (callback: () => void) => Disposable;
Invoke the given callback when the directory's contents change.
method relativize
relativize: (fullPath: string) => string;
Returns the relative string path to the given path from this directory.
class Disposable
class Disposable implements DisposableLike {}
A handle to a resource that can be disposed.
constructor
constructor(disposableAction?: () => void);
Construct a Disposable.
method disposalAction
disposalAction: () => void;
A callback which will be called within dispose().
method dispose
dispose: () => void;
Perform the disposal action, indicating that the resource associated with this disposable is no longer needed.
method isDisposable
static isDisposable: (object: object) => boolean;
Ensure that Object correctly implements the Disposable contract.
class Emitter
class Emitter<OptionalEmissions = { [key: string]: any }, RequiredEmissions = {}> implements DisposableLike {}
Utility class to be used when implementing event-based APIs that allows for handlers registered via ::on to be invoked with calls to ::emit.
constructor
constructor();
Construct an emitter.
method clear
clear: () => void;
Clear out any existing subscribers.
method dispose
dispose: () => boolean;
Unsubscribe all handlers.
method emit
emit: { <T extends keyof OptionalEmissions>( eventName: T, value?: OptionalEmissions[T] ): void; <T extends keyof RequiredEmissions>( eventName: T, value: RequiredEmissions[T] ): void;};
Invoke the handlers registered via ::on for the given event name.
method on
on: { <T extends keyof OptionalEmissions>( eventName: T, handler: (value?: OptionalEmissions[T]) => void ): Disposable; <T extends keyof RequiredEmissions>( eventName: T, handler: (value: RequiredEmissions[T]) => void ): Disposable;};
Registers a handler to be invoked whenever the given event is emitted.
method once
once: { <T extends keyof OptionalEmissions>( eventName: T, handler: (value?: OptionalEmissions[T]) => void ): Disposable; <T extends keyof RequiredEmissions>( eventName: T, handler: (value: RequiredEmissions[T]) => void ): Disposable;};
Register the given handler function to be invoked the next time an event with the given name is emitted via ::emit.
method preempt
preempt: { <T extends keyof OptionalEmissions>( eventName: T, handler: (value?: OptionalEmissions[T]) => void ): Disposable; <T extends keyof RequiredEmissions>( eventName: T, handler: (value: RequiredEmissions[T]) => void ): Disposable;};
Register the given handler function to be invoked before all other handlers existing at the time of subscription whenever events by the given name are emitted via ::emit.
class File
class File {}
Represents an individual file that can be watched, read from, and written to.
constructor
constructor(filePath: string, symlink?: boolean);
Configures a new File instance, no files are accessed.
method create
create: () => Promise<boolean>;
Creates the file on disk that corresponds to ::getPath() if no such file already exists.
method createReadStream
createReadStream: () => ReadStream;
Returns a stream to read the content of the file.
method createWriteStream
createWriteStream: () => WriteStream;
Returns a stream to write content to the file.
method exists
exists: () => Promise<boolean>;
Returns a promise that resolves to a boolean, true if the file exists, false otherwise.
method existsSync
existsSync: () => boolean;
Returns a boolean, true if the file exists, false otherwise.
method getBaseName
getBaseName: () => string;
Return the string filename without any directory information.
method getDigest
getDigest: () => Promise<string>;
Get the SHA-1 digest of this file.
method getDigestSync
getDigestSync: () => string;
Get the SHA-1 digest of this file.
method getEncoding
getEncoding: () => string;
Returns the string encoding name for this file (default: "utf8").
method getParent
getParent: () => Directory;
Return the Directory that contains this file.
method getPath
getPath: () => string;
Returns the string path for the file.
method getRealPath
getRealPath: () => Promise<string>;
Returns a promise that resolves to the file's completely resolved string path.
method getRealPathSync
getRealPathSync: () => string;
Returns this file's completely resolved string path.
method isDirectory
isDirectory: () => this is Directory;
Returns a boolean, always false.
method isFile
isFile: () => this is File;
Returns a boolean, always true.
method isSymbolicLink
isSymbolicLink: () => boolean;
Returns a boolean indicating whether or not this is a symbolic link.
method onDidChange
onDidChange: (callback: () => void) => Disposable;
Invoke the given callback when the file's contents change.
method onDidDelete
onDidDelete: (callback: () => void) => Disposable;
Invoke the given callback when the file is deleted.
method onDidRename
onDidRename: (callback: () => void) => Disposable;
Invoke the given callback when the file's path changes.
method onWillThrowWatchError
onWillThrowWatchError: ( callback: (event: PathWatchErrorThrownEvent) => void) => Disposable;
Invoke the given callback when there is an error with the watch. When your callback has been invoked, the file will have unsubscribed from the file watches.
method read
read: (flushCache?: boolean) => Promise<string | null>;
Reads the contents of the file.
method setEncoding
setEncoding: (encoding: string) => void;
Sets the file's character set encoding name.
method write
write: (text: string) => Promise<undefined>;
Overwrites the file with the given text.
method writeSync
writeSync: (text: string) => undefined;
Overwrites the file with the given text.
class GitRepository
class GitRepository {}
Represents the underlying git operations performed by Atom.
constructor
constructor( path: string, options?: { refreshOnWindowFocus?: boolean | undefined; config?: Config | undefined; project?: Project | undefined; });
method checkoutHead
checkoutHead: (path: string) => boolean;
Restore the contents of a path in the working directory and index to the version at HEAD.
method checkoutReference
checkoutReference: (reference: string, create: boolean) => boolean;
Checks out a branch in your repository.
method destroy
destroy: () => void;
Destroy this GitRepository object.
method getAheadBehindCount
getAheadBehindCount: ( reference: string, path?: string) => { ahead: number; behind: number };
Returns the number of commits behind the current branch is from the its upstream remote branch. The default reference is the HEAD.
Parameter reference
The branch reference name.
Parameter path
The path in the repository to get this ifnromation for, only needed if the repository contains submodules. Returns the number of commits behind the current branch is from its upstream remote branch.
method getCachedPathStatus
getCachedPathStatus: (path: string) => number | null;
Get the cached status for the given path.
method getCachedUpstreamAheadBehindCount
getCachedUpstreamAheadBehindCount: (path?: string) => { ahead: number; behind: number;};
Get the cached ahead/behind commit counts for the current branch's upstream branch.
method getConfigValue
getConfigValue: (key: string, path?: string) => string;
Returns the git configuration value specified by the key.
method getDiffStats
getDiffStats: (path: string) => { added: number; deleted: number };
Retrieves the number of lines added and removed to a path. This compares the working directory contents of the path to the HEAD version.
method getDirectoryStatus
getDirectoryStatus: (path: string) => number;
Get the status of a directory in the repository's working directory.
method getLineDiffs
getLineDiffs: ( path: string, text: string) => Array<{ oldStart: number; newStart: number; oldLines: number; newLines: number;}>;
Retrieves the line diffs comparing the HEAD version of the given path and the given text.
method getOriginURL
getOriginURL: (path?: string) => string;
Returns the origin url of the repository.
method getPath
getPath: () => string;
Returns the string path of the repository.
method getPathStatus
getPathStatus: (path: string) => number;
Get the status of a single path in the repository.
method getReferences
getReferences: (path?: string) => { heads: string[]; remotes: string[]; tags: string[];};
Gets all the local and remote references.
method getReferenceTarget
getReferenceTarget: (reference: string, path?: string) => string;
Returns the current string SHA for the given reference.
method getShortHead
getShortHead: (path?: string) => string;
Retrieves a shortened version of the HEAD reference value.
method getType
getType: () => 'git';
A string indicating the type of version control system used by this repository.
method getUpstreamBranch
getUpstreamBranch: (path?: string) => string | null;
Returns the upstream branch for the current HEAD, or null if there is no upstream branch for the current HEAD.
method getWorkingDirectory
getWorkingDirectory: () => string;
Returns the string working directory path of the repository.
method hasBranch
hasBranch: (branch: string) => boolean;
Returns true if the given branch exists.
method isDestroyed
isDestroyed: () => boolean;
Returns a boolean indicating if this repository has been destroyed.
method isPathIgnored
isPathIgnored: (path: string) => boolean;
Is the given path ignored?
method isPathModified
isPathModified: (path: string) => boolean;
Returns true if the given path is modified.
method isPathNew
isPathNew: (path: string) => boolean;
Returns true if the given path is new.
method isProjectAtRoot
isProjectAtRoot: () => boolean;
Returns true if at the root, false if in a subfolder of the repository.
method isStatusModified
isStatusModified: (status: number) => boolean;
Returns true if the given status indicates modification.
method isStatusNew
isStatusNew: (status: number) => boolean;
Returns true if the given status indicates a new path.
method isSubmodule
isSubmodule: (path: string) => boolean;
Is the given path a submodule in the repository?
method onDidChangeStatus
onDidChangeStatus: ( callback: (event: RepoStatusChangedEvent) => void) => Disposable;
Invoke the given callback when a specific file's status has changed. When a file is updated, reloaded, etc, and the status changes, this will be fired.
method onDidChangeStatuses
onDidChangeStatuses: (callback: () => void) => Disposable;
Invoke the given callback when a multiple files' statuses have changed.
method onDidDestroy
onDidDestroy: (callback: () => void) => Disposable;
Invoke the given callback when this GitRepository's destroy() method is invoked.
method open
static open: ( path: string, options?: { refreshOnWindowFocus?: boolean | undefined }) => GitRepository;
Creates a new GitRepository instance.
method relativize
relativize: () => string;
Makes a path relative to the repository's working directory.
class Notification
class Notification {}
A notification to the user containing a message and type.
constructor
constructor( type: 'info' | 'warning' | 'success', message: string, options?: NotificationOptions);
constructor
constructor( type: 'error' | 'fatal', message: string, options?: ErrorNotificationOptions);
method dismiss
dismiss: () => void;
Dismisses the notification, removing it from the UI. Calling this programmatically will call all callbacks added via onDidDismiss.
method getMessage
getMessage: () => string;
Returns the Notification's message.
method getType
getType: () => string;
Returns the Notification's type.
method onDidDismiss
onDidDismiss: (callback: (notification: Notification) => void) => Disposable;
Invoke the given callback when the notification is dismissed.
method onDidDisplay
onDidDisplay: (callback: (notification: Notification) => void) => Disposable;
Invoke the given callback when the notification is displayed.
class Point
class Point {}
Represents a point in a buffer in row/column coordinates.
constructor
constructor(row?: number, column?: number);
Construct a Point object
property column
column: number;
A zero-indexed number representing the column of the Point.
property row
row: number;
A zero-indexed number representing the row of the Point.
method compare
compare: (other: PointCompatible) => number;
Compare another Point to this Point instance. Returns -1 if this point precedes the argument. Returns 0 if this point is equivalent to the argument. Returns 1 if this point follows the argument.
method copy
copy: () => Point;
Returns a new Point with the same row and column.
method freeze
freeze: () => Readonly<Point>;
Makes this point immutable and returns itself.
method fromObject
static fromObject: (object: PointCompatible, copy?: boolean) => Point;
Create a Point from an array containing two numbers representing the row and column.
method isEqual
isEqual: (other: PointCompatible) => boolean;
Returns a boolean indicating whether this point has the same row and column as the given Point.
method isGreaterThan
isGreaterThan: (other: PointCompatible) => boolean;
Returns a Boolean indicating whether this point follows the given Point.
method isGreaterThanOrEqual
isGreaterThanOrEqual: (other: PointCompatible) => boolean;
Returns a Boolean indicating whether this point follows or is equal to the given Point.
method isLessThan
isLessThan: (other: PointCompatible) => boolean;
Returns a Boolean indicating whether this point precedes the given Point.
method isLessThanOrEqual
isLessThanOrEqual: (other: PointCompatible) => boolean;
Returns a Boolean indicating whether this point precedes or is equal to the given Point.
method min
static min: (point1: PointCompatible, point2: PointCompatible) => Point;
Returns the given Point that is earlier in the buffer.
method negate
negate: () => Point;
Returns a new Point with the row and column negated.
method serialize
serialize: () => [number, number];
Returns an array of this point's row and column.
method toArray
toArray: () => [number, number];
Returns an array of this point's row and column.
method toString
toString: () => string;
Returns a string representation of the point.
method translate
translate: (other: PointCompatible) => Point;
Build and return a new point by adding the rows and columns of the given point.
method traverse
traverse: (other: PointCompatible) => Point;
Build and return a new Point by traversing the rows and columns specified by the given point.
class Range
class Range {}
Represents a region in a buffer in row/column coordinates.
constructor
constructor(pointA?: PointCompatible, pointB?: PointCompatible);
Construct a Range object.
property end
end: Point;
A Point representing the end of the Range.
property start
start: Point;
A Point representing the start of the Range.
method compare
compare: (otherRange: RangeCompatible) => number;
Compare two Ranges. Returns -1 if this range starts before the argument or contains it. Returns 0 if this range is equivalent to the argument. Returns 1 if this range starts after the argument or is contained by it.
method containsPoint
containsPoint: (point: PointCompatible, exclusive?: boolean) => boolean;
Returns a boolean indicating whether this range contains the given point.
method containsRange
containsRange: (otherRange: RangeCompatible, exclusive?: boolean) => boolean;
Returns a boolean indicating whether this range contains the given range.
method copy
copy: () => Range;
Returns a new range with the same start and end positions.
method coversSameRows
coversSameRows: (otherRange: RangeLike) => boolean;
Returns a Boolean indicating whether this range starts and ends on the same row as the argument.
method deserialize
static deserialize: (array: object) => Range;
Call this with the result of Range::serialize to construct a new Range.
method freeze
freeze: () => Readonly<Range>;
Freezes the range and its start and end point so it becomes immutable and returns itself.
method fromObject
static fromObject: (object: RangeCompatible, copy?: boolean) => Range;
Convert any range-compatible object to a Range.
method getRowCount
getRowCount: () => number;
Get the number of rows in this range.
method getRows
getRows: () => number[];
Returns an array of all rows in the range.
method intersectsRow
intersectsRow: (row: number) => boolean;
Returns a boolean indicating whether this range intersects the given row number.
method intersectsRowRange
intersectsRowRange: (startRow: number, endRow: number) => boolean;
Returns a boolean indicating whether this range intersects the row range indicated by the given startRow and endRow numbers.
method intersectsWith
intersectsWith: (otherRange: RangeLike, exclusive?: boolean) => boolean;
Determines whether this range intersects with the argument.
method isEmpty
isEmpty: () => boolean;
Is the start position of this range equal to the end position?
method isEqual
isEqual: (otherRange: RangeCompatible) => boolean;
Returns a Boolean indicating whether this range has the same start and end points as the given Range.
method isSingleLine
isSingleLine: () => boolean;
Returns a boolean indicating whether this range starts and ends on the same row.
method negate
negate: () => Range;
Returns a new range with the start and end positions negated.
method serialize
serialize: () => number[][];
Returns a plain javascript object representation of the Range.
method toString
toString: () => string;
Returns a string representation of the range.
method translate
translate: (startDelta: PointCompatible, endDelta?: PointCompatible) => Range;
Build and return a new range by translating this range's start and end points by the given delta(s).
method traverse
traverse: (delta: PointCompatible) => Range;
Build and return a new range by traversing this range's start and end points by the given delta.
method union
union: (other: RangeLike) => Range;
Returns a new range that contains this range and the given range.
class Task
class Task {}
Run a node script in a separate process.
constructor
constructor(taskPath: string);
Creates a task. You should probably use .once
method cancel
cancel: () => boolean;
Cancel the running task and emit an event if it was canceled.
method on
on: (eventName: string, callback: (param: any) => void) => Disposable;
Call a function when an event is emitted by the child process.
method once
static once: (taskPath: string, ...args: any[]) => Task;
A helper method to easily launch and run a task once.
method send
send: (message: string | number | boolean | object | null | any[]) => void;
Send message to the task. Throws an error if this task has already been terminated or if sending a message to the child process fails.
method start
start: (...args: any[]) => void;
Starts the task. Throws an error if this task has already been terminated or if sending a message to the child process fails.
method terminate
terminate: () => void;
Forcefully stop the running task. No more events are emitted once this method is called.
class TextBuffer
class TextBuffer {}
A mutable text container with undo/redo support and the ability to annotate logical regions in the text.
constructor
constructor(text: string);
Create a new buffer with the given starting text.
constructor
constructor(params?: { text?: string | undefined; shouldDestroyOnFileDelete?(): boolean;});
Create a new buffer with the given params.
property destroyed
readonly destroyed: boolean;
Whether or not the bufffer has been destroyed.
property id
readonly id: string;
The unique identifier for this buffer.
property refcount
readonly refcount: number;
The number of retainers for the buffer.
method abortTransaction
abortTransaction: () => void;
Abort the currently running transaction.
Only intended to be called within the
fn
option to::transact
.
method addMarkerLayer
addMarkerLayer: (options?: { maintainHistory?: boolean | undefined; persistent?: boolean | undefined; role?: string | undefined;}) => MarkerLayer;
Create a layer to contain a set of related markers.
method append
append: (text: string, options?: TextEditOptions) => Range;
Append text to the end of the buffer.
method backwardsScan
backwardsScan: { (regex: RegExp, iterator: (params: BufferScanResult) => void): void; ( regex: RegExp, options: ScanContextOptions, iterator: (params: ContextualBufferScanResult) => void ): void;};
Scan regular expression matches in the entire buffer in reverse order, calling the given iterator function on each match.
method backwardsScanInRange
backwardsScanInRange: { ( regex: RegExp, range: RangeCompatible, iterator: (params: BufferScanResult) => void ): void; ( regex: RegExp, range: RangeCompatible, options: ScanContextOptions, iterator: (params: ContextualBufferScanResult) => void ): void;};
Scan regular expression matches in a given range in reverse order, calling the given iterator function on each match.
method characterIndexForPosition
characterIndexForPosition: (position: PointCompatible) => number;
Convert a position in the buffer in row/column coordinates to an absolute character offset, inclusive of line ending characters.
method clearUndoStack
clearUndoStack: () => void;
Clear the undo stack.
method clipPosition
clipPosition: (position: PointCompatible) => Point;
Clip the given point so it is at a valid position in the buffer.
method clipRange
clipRange: (range: RangeCompatible) => Range;
Clip the given range so it starts and ends at valid positions.
method createCheckpoint
createCheckpoint: (options?: HistoryTransactionOptions) => number;
Create a pointer to the current state of the buffer for use with
::revertToCheckpoint
and::groupChangesSinceCheckpoint
. A checkpoint ID value.
method delete
delete: (range: RangeCompatible) => Range;
Delete the text in the given range.
method deleteRow
deleteRow: (row: number) => Range;
Delete the line associated with a specified 0-indexed row.
Parameter row
A number representing the row to delete.
method deleteRows
deleteRows: (startRow: number, endRow: number) => Range;
Delete the lines associated with the specified 0-indexed row range.
If the row range is out of bounds, it will be clipped. If the
startRow
is greater than theendRow
, they will be reordered.
method deserialize
static deserialize: (params: object) => Promise<TextBuffer>;
Restore a TextBuffer based on an earlier state created using the TextBuffer::serialize method.
method destroy
destroy: () => void;
Destroy the buffer, even if there are retainers for it.
method findMarkers
findMarkers: (params: FindMarkerOptions) => Marker[];
Find markers conforming to the given parameters in the default marker layer.
method getChangesSinceCheckpoint
getChangesSinceCheckpoint: ( checkpoint: number) => Array<{ start: Point; oldExtent: Point; newExtent: Point; newText: string;}>;
Returns a list of changes since the given checkpoint. If the given checkpoint is no longer present in the undo history, this method will return an empty Array.
method getDefaultMarkerLayer
getDefaultMarkerLayer: () => MarkerLayer;
Get the default MarkerLayer.
method getEncoding
getEncoding: () => string;
Returns the string encoding of this buffer.
method getEndPosition
getEndPosition: () => Point;
Get the maximal position in the buffer, where new text would be appended.
method getFirstPosition
getFirstPosition: () => Point;
Get the first position in the buffer, which is always [0, 0].
method getId
getId: () => string;
Returns the unique identifier for this buffer.
method getLastLine
getLastLine: () => string;
Get the text of the last line of the buffer, without its line ending.
method getLastRow
getLastRow: () => number;
Get the last 0-indexed row in the buffer.
method getLength
getLength: () => number;
Get the length of the buffer's text.
method getLineCount
getLineCount: () => number;
Get the number of lines in the buffer.
method getLines
getLines: () => string[];
Get the text of all lines in the buffer, without their line endings.
method getMarker
getMarker: (id: number) => Marker;
Get an existing marker by its id from the default marker layer.
method getMarkerCount
getMarkerCount: () => number;
Get the number of markers in the default marker layer.
method getMarkerLayer
getMarkerLayer: (id: string) => MarkerLayer | undefined;
Get a MarkerLayer by id. Returns a MarkerLayer or undefined if no layer exists with the given id.
method getMarkers
getMarkers: () => Marker[];
Get all existing markers on the default marker layer.
method getMaxCharacterIndex
getMaxCharacterIndex: () => number;
Get the length of the buffer in characters.
method getPath
getPath: () => string | undefined;
Get the path of the associated file.
method getRange
getRange: () => Range;
Get the range spanning from [0, 0] to ::getEndPosition.
method getStoppedChangingDelay
getStoppedChangingDelay: () => number;
Get the number of milliseconds that will elapse without a change before ::onDidStopChanging observers are invoked following a change.
method getText
getText: () => string;
Get the entire text of the buffer. Avoid using this unless you know that the buffer's text is reasonably short.
method getTextInRange
getTextInRange: (range: RangeCompatible) => string;
Get the text in a range.
method getUri
getUri: () => string;
Get the path of the associated file.
method groupChangesSinceCheckpoint
groupChangesSinceCheckpoint: ( checkpoint: number, options?: HistoryTransactionOptions) => boolean;
Group all changes since the given checkpoint into a single transaction for purposes of undo/redo. A boolean indicating whether the operation succeeded.
method groupLastChanges
groupLastChanges: () => boolean;
Group the last two text changes for purposes of undo/redo.
This operation will only succeed if there are two changes on the undo stack. It will not group past the beginning of an open transaction. A boolean indicating whether the operation succeeded.
method hasAstral
hasAstral: () => boolean;
Return true if the buffer contains any astral-plane Unicode characters that are encoded as surrogate pairs.
method hasMultipleEditors
hasMultipleEditors: () => boolean;
Identifies if the buffer belongs to multiple editors.
method insert
insert: ( position: PointCompatible, text: string, options?: TextEditOptions) => Range;
Insert text at the given position.
method isAlive
isAlive: () => boolean;
Returns whether or not this buffer is alive.
method isDestroyed
isDestroyed: () => boolean;
Returns whether or not this buffer has been destroyed.
method isEmpty
isEmpty: () => boolean;
Determine whether the buffer is empty.
method isInConflict
isInConflict: () => boolean;
Determine if the in-memory contents of the buffer conflict with the on-disk contents of its associated file.
method isModified
isModified: () => boolean;
Determine if the in-memory contents of the buffer differ from its contents on disk. If the buffer is unsaved, always returns true unless the buffer is empty.
method isRetained
isRetained: () => boolean;
Returns whether or not this buffer has a retainer.
method isRowBlank
isRowBlank: (row: number) => boolean;
Determine if the given row contains only whitespace.
method lineEndingForRow
lineEndingForRow: (row: number) => string | undefined;
Get the line ending for the given 0-indexed row.
method lineForRow
lineForRow: (row: number) => string | undefined;
Get the text of the line at the given 0-indexed row, without its line ending.
Parameter row
A number representing the row.
method lineLengthForRow
lineLengthForRow: (row: number) => number;
Get the length of the line for the given 0-indexed row, without its line ending.
method load
static load: ( filePath: string | TextBufferFileBackend, params?: BufferLoadOptions) => Promise<TextBuffer>;
Create a new buffer backed by the given file path.
method loadSync
static loadSync: (filePath: string, params?: BufferLoadOptions) => TextBuffer;
Create a new buffer backed by the given file path. For better performance, use TextBuffer.load instead.
method markPosition
markPosition: ( position: PointCompatible, options?: { invalidate?: | 'never' | 'surround' | 'overlap' | 'inside' | 'touch' | undefined; exclusive?: boolean | undefined; }) => Marker;
Create a marker at the given position with no tail in the default marker layer.
method markRange
markRange: ( range: RangeCompatible, properties?: { reversed?: boolean | undefined; invalidate?: | 'never' | 'surround' | 'overlap' | 'inside' | 'touch' | undefined; exclusive?: boolean | undefined; }) => Marker;
Create a marker with the given range in the default marker layer.
method nextNonBlankRow
nextNonBlankRow: (startRow: number) => number | null;
Given a row, find the next row that's not blank. Returns a number or null if there's no next non-blank row.
method onDidChange
onDidChange: (callback: (event: BufferChangedEvent) => void) => Disposable;
Invoke the given callback synchronously when the content of the buffer changes. You should probably not be using this in packages.
method onDidChangeEncoding
onDidChangeEncoding: (callback: (encoding: string) => void) => Disposable;
Invoke the given callback when the value of ::getEncoding changes.
method onDidChangeModified
onDidChangeModified: (callback: (modified: boolean) => void) => Disposable;
Invoke the given callback if the value of ::isModified changes.
method onDidChangePath
onDidChangePath: (callback: (path: string) => void) => Disposable;
Invoke the given callback when the value of ::getPath changes.
method onDidChangeText
onDidChangeText: ( callback: (event: BufferStoppedChangingEvent) => void) => Disposable;
Invoke the given callback synchronously when a transaction finishes with a list of all the changes in the transaction.
method onDidConflict
onDidConflict: (callback: () => void) => Disposable;
Invoke the given callback when the in-memory contents of the buffer become in conflict with the contents of the file on disk.
method onDidCreateMarker
onDidCreateMarker: (callback: (marker: Marker) => void) => Disposable;
method onDidDelete
onDidDelete: (callback: () => void) => Disposable;
Invoke the given callback after the file backing the buffer is deleted.
method onDidDestroy
onDidDestroy: (callback: () => void) => Disposable;
Invoke the given callback when the buffer is destroyed.
method onDidReload
onDidReload: (callback: () => void) => Disposable;
Invoke the given callback after the buffer is reloaded from the contents of its file on disk.
method onDidSave
onDidSave: (callback: (event: FileSavedEvent) => void) => Disposable;
Invoke the given callback after the buffer is saved to disk.
method onDidStopChanging
onDidStopChanging: ( callback: (event: BufferStoppedChangingEvent) => void) => Disposable;
Invoke the given callback asynchronously following one or more changes after ::getStoppedChangingDelay milliseconds elapse without an additional change.
method onDidUpdateMarkers
onDidUpdateMarkers: (callback: () => void) => Disposable;
Invoke the given callback when all marker ::onDidChange observers have been notified following a change to the buffer.
method onWillChange
onWillChange: (callback: (event: BufferChangingEvent) => void) => Disposable;
Invoke the given callback synchronously before the content of the buffer changes.
method onWillReload
onWillReload: (callback: () => void) => Disposable;
Invoke the given callback before the buffer is reloaded from the contents of its file on disk.
method onWillSave
onWillSave: (callback: () => Promise<void> | void) => Disposable;
Invoke the given callback before the buffer is saved to disk. If the given callback returns a promise, then the buffer will not be saved until the promise resolves.
method onWillThrowWatchError
onWillThrowWatchError: ( callback: (errorObject: HandleableErrorEvent) => void) => Disposable;
Invoke the given callback when there is an error in watching the file.
method positionForCharacterIndex
positionForCharacterIndex: (offset: number) => Point;
Convert an absolute character offset, inclusive of newlines, to a position in the buffer in row/column coordinates.
method previousNonBlankRow
previousNonBlankRow: (startRow: number) => number | null;
Given a row, find the first preceding row that's not blank. Returns a number or null if there's no preceding non-blank row.
method rangeForRow
rangeForRow: (row: number, includeNewline?: boolean) => Range;
Get the range for the given row.
Parameter row
A number representing a 0-indexed row.
Parameter includeNewline
A boolean indicating whether or not to include the newline, which results in a range that extends to the start of the next line. (default: false)
method redo
redo: (options?: HistoryTraversalOptions) => boolean;
Redo the last operation. A boolean of whether or not a change was made.
method release
release: () => TextBuffer;
Releases a retainer on the buffer, destroying the buffer if there are no additional retainers.
method reload
reload: () => void;
Reload the buffer's contents from disk.
method replace
replace: (regex: RegExp, replacementText: string) => number;
Replace all regular expression matches in the entire buffer.
method retain
retain: () => TextBuffer;
Places a retainer on the buffer, preventing its destruction until the final retainer has called ::release().
method revertToCheckpoint
revertToCheckpoint: ( checkpoint: number, options?: HistoryTraversalOptions) => boolean;
Revert the buffer to the state it was in when the given checkpoint was created. A boolean indicating whether the operation succeeded.
method save
save: () => Promise<void>;
Save the buffer.
method saveAs
saveAs: (filePath: string) => Promise<void>;
Save the buffer at a specific path.
method scan
scan: { (regex: RegExp, iterator: (params: BufferScanResult) => void): void; ( regex: RegExp, options: ScanContextOptions, iterator: (params: ContextualBufferScanResult) => void ): void;};
Scan regular expression matches in the entire buffer, calling the given iterator function on each match.
method scanInRange
scanInRange: { ( regex: RegExp, range: RangeCompatible, iterator: (params: BufferScanResult) => void ): void; ( regex: RegExp, range: RangeCompatible, options: ScanContextOptions, iterator: (params: ContextualBufferScanResult) => void ): void;};
Scan regular expression matches in a given range , calling the given iterator function on each match.
method serialize
serialize: (options?: { markerLayers?: boolean | undefined; history?: boolean | undefined;}) => object;
Returns a plain javascript object representation of the TextBuffer.
method setEncoding
setEncoding: (encoding: string) => void;
Sets the character set encoding for this buffer.
method setFile
setFile: (fileBackend: TextBufferFileBackend) => void;
Experimental: Set a custom {TextBufferFileBackend} object as the buffer's backing store.
method setPath
setPath: (filePath: string) => void;
Set the path for the buffer's associated file.
method setText
setText: (text: string) => Range;
Replace the entire contents of the buffer with the given text.
method setTextInRange
setTextInRange: ( range: RangeCompatible, text: string, options?: TextEditOptions) => Range;
Set the text in the given range.
method setTextViaDiff
setTextViaDiff: (text: string) => void;
Replace the current buffer contents by applying a diff based on the given text.
method transact
transact: { <T>( optionsOrInterval: | number | ({ groupingInterval?: number | undefined; } & HistoryTransactionOptions), fn: () => T ): T; <T>(fn: () => T): T;};
Batch multiple operations as a single undo/redo step.
method undo
undo: (options?: HistoryTraversalOptions) => boolean;
Undo the last operation. If a transaction is in progress, aborts it. A boolean of whether or not a change was made.
class TextEditor
class TextEditor {}
This class represents all essential editing state for a single TextBuffer, including cursor and selection positions, folds, and soft wraps.
constructor
constructor(options?: {});
property id
readonly id: number;
method abortTransaction
abortTransaction: () => void;
Abort an open transaction, undoing any operations performed so far within the transaction.
method addCursorAtBufferPosition
addCursorAtBufferPosition: ( bufferPosition: PointCompatible, options?: { autoscroll?: boolean | undefined }) => Cursor;
Add a cursor at the given position in buffer coordinates.
method addCursorAtScreenPosition
addCursorAtScreenPosition: (screenPosition: PointCompatible) => Cursor;
Add a cursor at the position in screen coordinates.
method addGutter
addGutter: (options: GutterOptions) => Gutter;
Add a custom Gutter.
method addMarkerLayer
addMarkerLayer: (options?: { maintainHistory?: boolean | undefined; persistent?: boolean | undefined;}) => DisplayMarkerLayer;
Create a marker layer to group related markers.
method addSelectionForBufferRange
addSelectionForBufferRange: ( bufferRange: RangeCompatible, options?: { reversed?: boolean | undefined; preserveFolds?: boolean | undefined; }) => Selection;
Add a selection for the given range in buffer coordinates.
method addSelectionForScreenRange
addSelectionForScreenRange: ( screenRange: RangeCompatible, options?: { reversed?: boolean | undefined; preserveFolds?: boolean | undefined; }) => Selection;
Add a selection for the given range in screen coordinates.
method autoIndentSelectedRows
autoIndentSelectedRows: (options?: ReadonlyEditOptions) => void;
Indent rows intersecting selections based on the grammar's suggested indent level.
method backspace
backspace: (options?: ReadonlyEditOptions) => void;
For each selection, if the selection is empty, delete the character preceding the cursor. Otherwise delete the selected text.
method backwardsScanInBufferRange
backwardsScanInBufferRange: ( regex: RegExp, range: RangeCompatible, iterator: (params: BufferScanResult) => void) => void;
Scan regular expression matches in a given range in reverse order, calling the given iterator function on each match.
method bufferPositionForScreenPosition
bufferPositionForScreenPosition: ( bufferPosition: PointCompatible, options?: { clipDirection?: 'backward' | 'forward' | 'closest' | undefined }) => Point;
Convert a position in screen-coordinates to buffer-coordinates.
method bufferRangeForScopeAtCursor
bufferRangeForScopeAtCursor: (scopeSelector: string) => Range;
Get the range in buffer coordinates of all tokens surrounding the cursor that match the given scope selector.
method bufferRangeForScopeAtPosition
bufferRangeForScopeAtPosition: (scope: string, point: PointCompatible) => Range;
Undocumented: Buffer range for syntax scope at position
method bufferRangeForScreenRange
bufferRangeForScreenRange: (screenRange: RangeCompatible) => Range;
Convert a range in screen-coordinates to buffer-coordinates.
method clipBufferPosition
clipBufferPosition: (bufferPosition: PointCompatible) => Point;
Clip the given Point to a valid position in the buffer.
method clipBufferRange
clipBufferRange: (range: RangeCompatible) => Range;
Clip the start and end of the given range to valid positions in the buffer. See ::clipBufferPosition for more information.
method clipScreenPosition
clipScreenPosition: ( screenPosition: PointCompatible, options?: { clipDirection?: 'backward' | 'forward' | 'closest' | undefined }) => Point;
Clip the given Point to a valid position on screen.
method clipScreenRange
clipScreenRange: ( range: RangeCompatible, options?: { clipDirection?: 'backward' | 'forward' | 'closest' | undefined }) => Range;
Clip the start and end of the given range to valid positions on screen. See ::clipScreenPosition for more information.
method copySelectedText
copySelectedText: () => void;
For each selection, copy the selected text.
method createCheckpoint
createCheckpoint: () => number;
Create a pointer to the current state of the buffer for use with ::revertToCheckpoint and ::groupChangesSinceCheckpoint.
method cutSelectedText
cutSelectedText: (options?: ReadonlyEditOptions) => void;
For each selection, cut the selected text.
method cutToEndOfBufferLine
cutToEndOfBufferLine: (options?: ReadonlyEditOptions) => void;
For each selection, if the selection is empty, cut all characters of the containing buffer line following the cursor. Otherwise cut the selected text.
method cutToEndOfLine
cutToEndOfLine: (options?: ReadonlyEditOptions) => void;
For each selection, if the selection is empty, cut all characters of the containing screen line following the cursor. Otherwise cut the selected text.
method decorateMarker
decorateMarker: ( marker: DisplayMarker, decorationParams: DecorationOptions) => Decoration;
Add a decoration that tracks a DisplayMarker. When the marker moves, is invalidated, or is destroyed, the decoration will be updated to reflect the marker's state.
method decorateMarkerLayer
decorateMarkerLayer: ( markerLayer: MarkerLayer | DisplayMarkerLayer, decorationParams: DecorationLayerOptions) => LayerDecoration;
Add a decoration to every marker in the given marker layer. Can be used to decorate a large number of markers without having to create and manage many individual decorations.
method delete
delete: (options?: ReadonlyEditOptions) => void;
For each selection, if the selection is empty, delete the character following the cursor. Otherwise delete the selected text.
method deleteLine
deleteLine: (options?: ReadonlyEditOptions) => void;
Delete all lines intersecting selections.
method deleteToBeginningOfLine
deleteToBeginningOfLine: (options?: ReadonlyEditOptions) => void;
For each selection, if the selection is empty, delete all characters of the containing line that precede the cursor. Otherwise delete the selected text.
method deleteToBeginningOfSubword
deleteToBeginningOfSubword: (options?: ReadonlyEditOptions) => void;
For each selection, if the selection is empty, delete all characters of the containing subword following the cursor. Otherwise delete the selected text.
method deleteToBeginningOfWord
deleteToBeginningOfWord: (options?: ReadonlyEditOptions) => void;
For each selection, if the selection is empty, delete all characters of the containing word that precede the cursor. Otherwise delete the selected text.
method deleteToEndOfLine
deleteToEndOfLine: (options?: ReadonlyEditOptions) => void;
For each selection, if the selection is not empty, deletes the selection otherwise, deletes all characters of the containing line following the cursor. If the cursor is already at the end of the line, deletes the following newline.
method deleteToEndOfSubword
deleteToEndOfSubword: (options?: ReadonlyEditOptions) => void;
For each selection, if the selection is empty, delete all characters of the containing subword following the cursor. Otherwise delete the selected text.
method deleteToEndOfWord
deleteToEndOfWord: (options?: ReadonlyEditOptions) => void;
For each selection, if the selection is empty, delete all characters of the containing word following the cursor. Otherwise delete the selected text.
method deleteToNextWordBoundary
deleteToNextWordBoundary: (options?: ReadonlyEditOptions) => void;
Similar to ::deleteToEndOfWord, but deletes only up to the next word boundary.
method deleteToPreviousWordBoundary
deleteToPreviousWordBoundary: (options?: ReadonlyEditOptions) => void;
Similar to ::deleteToBeginningOfWord, but deletes only back to the previous word boundary.
method findMarkers
findMarkers: (properties: FindDisplayMarkerOptions) => DisplayMarker[];
Find all DisplayMarkers on the default marker layer that match the given properties.
This method finds markers based on the given properties. Markers can be associated with custom properties that will be compared with basic equality. In addition, there are several special properties that will be compared with the range of the markers rather than their properties.
method foldAll
foldAll: () => void;
Fold all foldable lines.
method foldAllAtIndentLevel
foldAllAtIndentLevel: (level: number) => void;
Fold all foldable lines at the given indent level.
Parameter level
A zero-indexed number.
method foldBufferRow
foldBufferRow: (bufferRow: number) => void;
Fold the given row in buffer coordinates based on its indentation level. If the given row is foldable, the fold will begin there. Otherwise, it will begin at the first foldable row preceding the given row.
method foldCurrentRow
foldCurrentRow: () => void;
Fold the most recent cursor's row based on its indentation level. The fold will extend from the nearest preceding line with a lower indentation level up to the nearest following row with a lower indentation level.
method foldSelectedLines
foldSelectedLines: () => void;
For each selection, fold the rows it intersects.
method getBuffer
getBuffer: () => TextBuffer;
Retrieves the current TextBuffer.
method getCurrentParagraphBufferRange
getCurrentParagraphBufferRange: () => Range;
Get the range of the paragraph surrounding the most recently added cursor.
method getCursorAtScreenPosition
getCursorAtScreenPosition: (position: PointCompatible) => Cursor | undefined;
Get a Cursor at given screen coordinates Point.
method getCursorBufferPosition
getCursorBufferPosition: () => Point;
Get the position of the most recently added cursor in buffer coordinates.
method getCursorBufferPositions
getCursorBufferPositions: () => Point[];
Get the position of all the cursor positions in buffer coordinates.
method getCursors
getCursors: () => Cursor[];
Get an Array of all Cursors.
method getCursorScreenPosition
getCursorScreenPosition: () => Point;
Get the position of the most recently added cursor in screen coordinates.
method getCursorScreenPositions
getCursorScreenPositions: () => Point[];
Get the position of all the cursor positions in screen coordinates.
method getCursorsOrderedByBufferPosition
getCursorsOrderedByBufferPosition: () => Cursor[];
Get all Cursors, ordered by their position in the buffer instead of the order in which they were added.
method getDecorations
getDecorations: (propertyFilter?: DecorationOptions) => Decoration[];
Get all decorations.
method getDefaultMarkerLayer
getDefaultMarkerLayer: () => DisplayMarkerLayer;
Get the default DisplayMarkerLayer. All marker APIs not tied to an explicit layer interact with this default layer.
method getEncoding
getEncoding: () => string;
Returns the string character set encoding of this editor's text buffer.
method getGrammar
getGrammar: () => Grammar;
Get the current Grammar of this editor.
method getGutters
getGutters: () => Gutter[];
Get this editor's gutters.
method getHighlightDecorations
getHighlightDecorations: (propertyFilter?: DecorationOptions) => Decoration[];
Get all decorations of type 'highlight'.
method getLastBufferRow
getLastBufferRow: () => number;
Returns a number representing the last zero-indexed buffer row number of the editor.
method getLastCursor
getLastCursor: () => Cursor;
Returns the most recently added Cursor.
method getLastScreenRow
getLastScreenRow: () => number;
Returns a number representing the last zero-indexed screen row number of the editor.
method getLastSelection
getLastSelection: () => Selection;
Get the most recently added Selection.
method getLineCount
getLineCount: () => number;
Returns a number representing the number of lines in the buffer.
method getLineDecorations
getLineDecorations: (propertyFilter?: DecorationOptions) => Decoration[];
Get all decorations of type 'line'.
method getLineHeightInPixels
getLineHeightInPixels: () => number;
Retrieves the rendered line height in pixels.
method getLineNumberDecorations
getLineNumberDecorations: (propertyFilter?: DecorationOptions) => Decoration[];
Get all decorations of type 'line-number'.
method getLongTitle
getLongTitle: () => string;
Get unique title for display in other parts of the UI, such as the window title. If the editor's buffer is unsaved, its title is "untitled" If the editor's buffer is saved, its unique title is formatted as one of the following,
"" when it is the only editing buffer with this file name. " — " when other buffers have this file name.
method getMarker
getMarker: (id: number) => DisplayMarker;
Get the DisplayMarker on the default layer for the given marker id.
method getMarkerCount
getMarkerCount: () => number;
Get the number of markers in the default marker layer.
method getMarkerLayer
getMarkerLayer: (id: number) => DisplayMarkerLayer | undefined;
Get a DisplayMarkerLayer by id.
method getMarkers
getMarkers: () => DisplayMarker[];
Get all DisplayMarkers on the default marker layer. Consider using ::findMarkers.
method getOverlayDecorations
getOverlayDecorations: (propertyFilter?: DecorationOptions) => Decoration[];
Get all decorations of type 'overlay'.
method getPath
getPath: () => string | undefined;
Returns the string path of this editor's text buffer.
method getPlaceholderText
getPlaceholderText: () => string;
Retrieves the greyed out placeholder of a mini editor.
method getRootScopeDescriptor
getRootScopeDescriptor: () => ScopeDescriptor;
Returns a ScopeDescriptor that includes this editor's language. e.g. [".source.ruby"], or [".source.coffee"].
method getScreenLineCount
getScreenLineCount: () => number;
Returns a number representing the number of screen lines in the editor. This accounts for folds.
method getSelectedBufferRange
getSelectedBufferRange: () => Range;
Get the Range of the most recently added selection in buffer coordinates.
method getSelectedBufferRanges
getSelectedBufferRanges: () => Range[];
Get the Ranges of all selections in buffer coordinates. The ranges are sorted by when the selections were added. Most recent at the end.
method getSelectedScreenRange
getSelectedScreenRange: () => Range;
Get the Range of the most recently added selection in screen coordinates.
method getSelectedScreenRanges
getSelectedScreenRanges: () => Range[];
Get the Ranges of all selections in screen coordinates. The ranges are sorted by when the selections were added. Most recent at the end.
method getSelectedText
getSelectedText: () => string;
Get the selected text of the most recently added selection.
method getSelections
getSelections: () => Selection[];
Get current Selections.
method getSelectionsOrderedByBufferPosition
getSelectionsOrderedByBufferPosition: () => Selection[];
Get all Selections, ordered by their position in the buffer instead of the order in which they were added.
method getSoftTabs
getSoftTabs: () => boolean;
Returns a boolean indicating whether softTabs are enabled for this editor.
method getSoftWrapColumn
getSoftWrapColumn: () => number;
Gets the column at which column will soft wrap.
method getTabLength
getTabLength: () => number;
Get the on-screen length of tab characters.
method getTabText
getTabText: () => string;
Get the text representing a single level of indent. If soft tabs are enabled, the text is composed of N spaces, where N is the tab length. Otherwise the text is a tab character (\t).
method getText
getText: () => string;
Returns a string representing the entire contents of the editor.
method getTextInBufferRange
getTextInBufferRange: (range: RangeCompatible) => string;
Get the text in the given range in buffer coordinates.
method getTitle
getTitle: () => string;
Get the editor's title for display in other parts of the UI such as the tabs. If the editor's buffer is saved, its title is the file name. If it is unsaved, its title is "untitled".
method getWordUnderCursor
getWordUnderCursor: (options?: { wordRegex?: RegExp | undefined; includeNonWordCharacters?: boolean | undefined; allowPrevious?: boolean | undefined;}) => string;
Returns the word surrounding the most recently added cursor.
method groupChangesSinceCheckpoint
groupChangesSinceCheckpoint: (checkpoint: number) => boolean;
Group all changes since the given checkpoint into a single transaction for purposes of undo/redo. If the given checkpoint is no longer present in the undo history, no grouping will be performed and this method will return false.
method gutterWithName
gutterWithName: (name: string) => Gutter | null;
Get the gutter with the given name.
method hasMultipleCursors
hasMultipleCursors: () => boolean;
Returns a boolean indicating whether or not there are multiple cursors.
method indentationForBufferRow
indentationForBufferRow: (bufferRow: number) => number;
Get the indentation level of the given buffer row. Determines how deeply the given row is indented based on the soft tabs and tab length settings of this editor. Note that if soft tabs are enabled and the tab length is 2, a row with 4 leading spaces would have an indentation level of 2.
method indentLevelForLine
indentLevelForLine: (line: string) => number;
Get the indentation level of the given line of text. Determines how deeply the given line is indented based on the soft tabs and tab length settings of this editor. Note that if soft tabs are enabled and the tab length is 2, a row with 4 leading spaces would have an indentation level of 2.
method indentSelectedRows
indentSelectedRows: (options?: ReadonlyEditOptions) => void;
Indent rows intersecting selections by one level.
method insertNewline
insertNewline: (options?: ReadonlyEditOptions) => void;
For each selection, replace the selected text with a newline.
method insertNewlineAbove
insertNewlineAbove: (options?: ReadonlyEditOptions) => void;
For each cursor, insert a newline at the end of the preceding line.
method insertNewlineBelow
insertNewlineBelow: (options?: ReadonlyEditOptions) => void;
For each cursor, insert a newline at beginning the following line.
method insertText
insertText: ( text: string, options?: TextInsertionOptions & ReadonlyEditOptions) => Range | false;
method isBufferRowCommented
isBufferRowCommented: (bufferRow: number) => boolean;
Determine if the given row is entirely a comment.
method isEmpty
isEmpty: () => boolean;
Returns boolean true if this editor has no content.
method isFoldableAtBufferRow
isFoldableAtBufferRow: (bufferRow: number) => boolean;
Determine whether the given row in buffer coordinates is foldable. A foldable row is a row that starts a row range that can be folded.
method isFoldableAtScreenRow
isFoldableAtScreenRow: (bufferRow: number) => boolean;
Determine whether the given row in screen coordinates is foldable. A foldable row is a row that starts a row range that can be folded.
method isFoldedAtBufferRow
isFoldedAtBufferRow: (bufferRow: number) => boolean;
Determine whether the given row in buffer coordinates is folded.
method isFoldedAtCursorRow
isFoldedAtCursorRow: () => boolean;
Determine whether the most recently added cursor's row is folded.
method isFoldedAtScreenRow
isFoldedAtScreenRow: (screenRow: number) => boolean;
Determine whether the given row in screen coordinates is folded.
method isModified
isModified: () => boolean;
Returns boolean true if this editor has been modified.
method isReadOnly
isReadOnly: () => boolean;
Whether or not this editor is in read-only mode.
method isSoftWrapped
isSoftWrapped: () => boolean;
Determine whether lines in this editor are soft-wrapped.
method lineTextForBufferRow
lineTextForBufferRow: (bufferRow: number) => string;
Returns a string representing the contents of the line at the given buffer row.
method lineTextForScreenRow
lineTextForScreenRow: (screenRow: number) => string;
Returns a string representing the contents of the line at the given screen row.
method lowerCase
lowerCase: (options?: ReadonlyEditOptions) => void;
Convert the selected text to lower case. For each selection, if the selection is empty, converts the containing word to upper case. Otherwise convert the selected text to upper case.
method markBufferPosition
markBufferPosition: ( bufferPosition: PointCompatible, options?: { invalidate?: | 'never' | 'surround' | 'overlap' | 'inside' | 'touch' | undefined; }) => DisplayMarker;
Create a marker on the default marker layer with the given buffer position and no tail. To group multiple markers together in their own private layer, see ::addMarkerLayer.
method markBufferRange
markBufferRange: ( range: RangeCompatible, properties?: { maintainHistory?: boolean | undefined; reversed?: boolean | undefined; invalidate?: | 'never' | 'surround' | 'overlap' | 'inside' | 'touch' | undefined; }) => DisplayMarker;
Create a marker on the default marker layer with the given range in buffer coordinates. This marker will maintain its logical location as the buffer is changed, so if you mark a particular word, the marker will remain over that word even if the word's location in the buffer changes.
method markScreenPosition
markScreenPosition: ( screenPosition: PointCompatible, options?: { invalidate?: | 'never' | 'surround' | 'overlap' | 'inside' | 'touch' | undefined; clipDirection?: 'backward' | 'forward' | 'closest' | undefined; }) => DisplayMarker;
Create a marker on the default marker layer with the given screen position and no tail. To group multiple markers together in their own private layer, see ::addMarkerLayer.
method markScreenRange
markScreenRange: ( range: RangeCompatible, properties?: { maintainHistory?: boolean | undefined; reversed?: boolean | undefined; invalidate?: | 'never' | 'surround' | 'overlap' | 'inside' | 'touch' | undefined; }) => DisplayMarker;
Create a marker on the default marker layer with the given range in screen coordinates. This marker will maintain its logical location as the buffer is changed, so if you mark a particular word, the marker will remain over that word even if the word's location in the buffer changes.
method moveDown
moveDown: (lineCount?: number) => void;
Move every cursor down one row in screen coordinates.
method moveLeft
moveLeft: (columnCount?: number) => void;
Move every cursor left one column.
method moveRight
moveRight: (columnCount?: number) => void;
Move every cursor right one column.
method moveToBeginningOfLine
moveToBeginningOfLine: () => void;
Move every cursor to the beginning of its line in buffer coordinates.
method moveToBeginningOfNextParagraph
moveToBeginningOfNextParagraph: () => void;
Move every cursor to the beginning of the next paragraph.
method moveToBeginningOfNextWord
moveToBeginningOfNextWord: () => void;
Move every cursor to the beginning of the next word.
method moveToBeginningOfPreviousParagraph
moveToBeginningOfPreviousParagraph: () => void;
Move every cursor to the beginning of the previous paragraph.
method moveToBeginningOfScreenLine
moveToBeginningOfScreenLine: () => void;
Move every cursor to the beginning of its line in screen coordinates.
method moveToBeginningOfWord
moveToBeginningOfWord: () => void;
Move every cursor to the beginning of its surrounding word.
method moveToBottom
moveToBottom: () => void;
Move every cursor to the bottom of the buffer. If there are multiple cursors, they will be merged into a single cursor.
method moveToEndOfLine
moveToEndOfLine: () => void;
Move every cursor to the end of its line in buffer coordinates.
method moveToEndOfScreenLine
moveToEndOfScreenLine: () => void;
Move every cursor to the end of its line in screen coordinates.
method moveToEndOfWord
moveToEndOfWord: () => void;
Move every cursor to the end of its surrounding word.
method moveToFirstCharacterOfLine
moveToFirstCharacterOfLine: () => void;
Move every cursor to the first non-whitespace character of its line.
method moveToNextSubwordBoundary
moveToNextSubwordBoundary: () => void;
Move every cursor to the next subword boundary.
method moveToNextWordBoundary
moveToNextWordBoundary: () => void;
Move every cursor to the next word boundary.
method moveToPreviousSubwordBoundary
moveToPreviousSubwordBoundary: () => void;
Move every cursor to the previous subword boundary.
method moveToPreviousWordBoundary
moveToPreviousWordBoundary: () => void;
Move every cursor to the previous word boundary.
method moveToTop
moveToTop: () => void;
Move every cursor to the top of the buffer. If there are multiple cursors, they will be merged into a single cursor.
method moveUp
moveUp: (lineCount?: number) => void;
Move every cursor up one row in screen coordinates.
method mutateSelectedText
mutateSelectedText: (fn: (selection: Selection, index: number) => void) => void;
Mutate the text of all the selections in a single transaction. All the changes made inside the given function can be reverted with a single call to ::undo.
method observeCursors
observeCursors: (callback: (cursor: Cursor) => void) => Disposable;
Calls your callback when a Cursor is added to the editor. Immediately calls your callback for each existing cursor.
method observeDecorations
observeDecorations: (callback: (decoration: Decoration) => void) => Disposable;
Calls your callback with each Decoration added to the editor. Calls your callback immediately for any existing decorations.
method observeGrammar
observeGrammar: (callback: (grammar: Grammar) => void) => Disposable;
Calls your callback when the grammar that interprets and colorizes the text has been changed. Immediately calls your callback with the current grammar.
method observeGutters
observeGutters: (callback: (gutter: Gutter) => void) => Disposable;
Calls your callback when a Gutter is added to the editor. Immediately calls your callback for each existing gutter.
method observeSelections
observeSelections: (callback: (selection: Selection) => void) => Disposable;
Calls your callback when a Selection is added to the editor. Immediately calls your callback for each existing selection.
method onDidAddCursor
onDidAddCursor: (callback: (cursor: Cursor) => void) => Disposable;
Calls your callback when a Cursor is added to the editor.
method onDidAddDecoration
onDidAddDecoration: (callback: (decoration: Decoration) => void) => Disposable;
Calls your callback when a Decoration is added to the editor.
method onDidAddGutter
onDidAddGutter: (callback: (gutter: Gutter) => void) => Disposable;
Calls your callback when a Gutter is added to the editor.
method onDidAddSelection
onDidAddSelection: (callback: (selection: Selection) => void) => Disposable;
Calls your callback when a Selection is added to the editor.
method onDidChange
onDidChange: (callback: (event: EditorChangedEvent[]) => void) => Disposable;
Invoke the given callback synchronously when the content of the buffer changes.
method onDidChangeCursorPosition
onDidChangeCursorPosition: ( callback: (event: CursorPositionChangedEvent) => void) => Disposable;
Calls your callback when a Cursor is moved. If there are multiple cursors, your callback will be called for each cursor.
method onDidChangeEncoding
onDidChangeEncoding: (callback: (encoding: string) => void) => Disposable;
Calls your callback when the buffer's encoding has changed.
method onDidChangeGrammar
onDidChangeGrammar: (callback: (grammar: Grammar) => void) => Disposable;
Calls your callback when the grammar that interprets and colorizes the text has been changed.
method onDidChangeModified
onDidChangeModified: (callback: (modified: boolean) => void) => Disposable;
Calls your callback when the result of ::isModified changes.
method onDidChangePath
onDidChangePath: (callback: (path: string) => void) => Disposable;
Calls your callback when the buffer's path, and therefore title, has changed.
method onDidChangePlaceholderText
onDidChangePlaceholderText: ( callback: (placeholderText: string) => void) => Disposable;
Calls your callback when the placeholder text is changed.
method onDidChangeSelectionRange
onDidChangeSelectionRange: ( callback: (event: SelectionChangedEvent) => void) => Disposable;
Calls your callback when a selection's screen range changes.
method onDidChangeSoftWrapped
onDidChangeSoftWrapped: (callback: (softWrapped: boolean) => void) => Disposable;
Calls your callback when soft wrap was enabled or disabled.
method onDidChangeTitle
onDidChangeTitle: (callback: (title: string) => void) => Disposable;
Calls your callback when the buffer's title has changed.
method onDidConflict
onDidConflict: (callback: () => void) => Disposable;
Calls your callback when the buffer's underlying file changes on disk at a moment when the result of ::isModified is true.
method onDidDestroy
onDidDestroy: (callback: () => void) => Disposable;
Invoke the given callback when the editor is destroyed.
method onDidInsertText
onDidInsertText: (callback: (event: { text: string }) => void) => Disposable;
Calls your callback after text has been inserted.
method onDidRemoveCursor
onDidRemoveCursor: (callback: (cursor: Cursor) => void) => Disposable;
Calls your callback when a Cursor is removed from the editor.
method onDidRemoveDecoration
onDidRemoveDecoration: ( callback: (decoration: Decoration) => void) => Disposable;
Calls your callback when a Decoration is removed from the editor.
method onDidRemoveGutter
onDidRemoveGutter: (callback: (name: string) => void) => Disposable;
Calls your callback when a Gutter is removed from the editor.
method onDidRemoveSelection
onDidRemoveSelection: (callback: (selection: Selection) => void) => Disposable;
Calls your callback when a Selection is removed from the editor.
method onDidSave
onDidSave: (callback: (event: { path: string }) => void) => Disposable;
Invoke the given callback after the buffer is saved to disk.
method onDidStopChanging
onDidStopChanging: ( callback: (event: BufferStoppedChangingEvent) => void) => Disposable;
Invoke callback when the buffer's contents change. It is emit asynchronously 300ms after the last buffer change. This is a good place to handle changes to the buffer without compromising typing performance.
method onWillInsertText
onWillInsertText: ( callback: (event: { text: string; cancel(): void }) => void) => Disposable;
Calls your callback before text has been inserted.
method outdentSelectedRows
outdentSelectedRows: (options?: ReadonlyEditOptions) => void;
Outdent rows intersecting selections by one level.
method pasteText
pasteText: (options?: TextInsertionOptions & ReadonlyEditOptions) => void;
For each selection, replace the selected text with the contents of the clipboard. If the clipboard contains the same number of selections as the current editor, each selection will be replaced with the content of the corresponding clipboard selection text.
method redo
redo: (options?: ReadonlyEditOptions) => void;
Redo the last change.
method revertToCheckpoint
revertToCheckpoint: (checkpoint: number) => boolean;
Revert the buffer to the state it was in when the given checkpoint was created. The redo stack will be empty following this operation, so changes since the checkpoint will be lost. If the given checkpoint is no longer present in the undo history, no changes will be made to the buffer and this method will return false.
method save
save: () => Promise<void>;
Saves the editor's text buffer. See TextBuffer::save for more details.
method saveAs
saveAs: (filePath: string) => Promise<void>;
Saves the editor's text buffer as the given path. See TextBuffer::saveAs for more details.
method scan
scan: { ( regex: RegExp, options: ScanContextOptions, iterator: (params: ContextualBufferScanResult) => void ): void; (regex: RegExp, iterator: (params: BufferScanResult) => void): void;};
Scan regular expression matches in the entire buffer, calling the given iterator function on each match.
::scan functions as the replace method as well via the replace.
method scanInBufferRange
scanInBufferRange: ( regex: RegExp, range: RangeCompatible, iterator: (params: BufferScanResult) => void) => void;
Scan regular expression matches in a given range, calling the given iterator. function on each match.
method scopeDescriptorForBufferPosition
scopeDescriptorForBufferPosition: ( bufferPosition: PointCompatible) => ScopeDescriptor;
Get the syntactic scopeDescriptor for the given position in buffer coordinates.
method screenPositionForBufferPosition
screenPositionForBufferPosition: ( bufferPosition: PointCompatible, options?: { clipDirection?: 'backward' | 'forward' | 'closest' | undefined }) => Point;
Convert a position in buffer-coordinates to screen-coordinates.
method screenRangeForBufferRange
screenRangeForBufferRange: (bufferRange: RangeCompatible) => Range;
Convert a range in buffer-coordinates to screen-coordinates.
method scrollToBufferPosition
scrollToBufferPosition: ( bufferPosition: PointCompatible, options?: { center?: boolean | undefined }) => void;
Scrolls the editor to the given buffer position.
method scrollToCursorPosition
scrollToCursorPosition: (options?: { center?: boolean | undefined }) => void;
Scroll the editor to reveal the most recently added cursor if it is off-screen.
method scrollToScreenPosition
scrollToScreenPosition: ( screenPosition: PointCompatible, options?: { center?: boolean | undefined }) => void;
Scrolls the editor to the given screen position.
method selectAll
selectAll: () => void;
Select all text in the buffer. This method merges multiple selections into a single selection.
method selectDown
selectDown: (rowCount?: number) => void;
Move the cursor of each selection one character downward while preserving the selection's tail position. This method may merge selections that end up intersecting.
method selectionIntersectsBufferRange
selectionIntersectsBufferRange: (bufferRange: RangeLike) => boolean;
Determine if a given range in buffer coordinates intersects a selection.
method selectLargerSyntaxNode
selectLargerSyntaxNode: () => void;
For each selection, select the syntax node that contains that selection.
method selectLeft
selectLeft: (columnCount?: number) => void;
Move the cursor of each selection one character leftward while preserving the selection's tail position. This method may merge selections that end up intersecting.
method selectLinesContainingCursors
selectLinesContainingCursors: () => void;
For each cursor, select the containing line. This method merges selections on successive lines.
method selectMarker
selectMarker: (marker: DisplayMarker) => Range | undefined;
Select the range of the given marker if it is valid.
method selectRight
selectRight: (columnCount?: number) => void;
Move the cursor of each selection one character rightward while preserving the selection's tail position. This method may merge selections that end up intersecting.
method selectSmallerSyntaxNode
selectSmallerSyntaxNode: () => void;
Undo the effect a preceding call to
::selectLargerSyntaxNode
.
method selectToBeginningOfLine
selectToBeginningOfLine: () => void;
Move the cursor of each selection to the beginning of its line while preserving the selection's tail position. This method may merge selections that end up intersecting.
method selectToBeginningOfNextParagraph
selectToBeginningOfNextParagraph: () => void;
Expand selections to the beginning of the next paragraph. Operates on all selections. Moves the cursor to the beginning of the next paragraph while preserving the selection's tail position.
method selectToBeginningOfNextWord
selectToBeginningOfNextWord: () => void;
Expand selections to the beginning of the next word. Operates on all selections. Moves the cursor to the beginning of the next word while preserving the selection's tail position.
method selectToBeginningOfPreviousParagraph
selectToBeginningOfPreviousParagraph: () => void;
Expand selections to the beginning of the next paragraph. Operates on all selections. Moves the cursor to the beginning of the next paragraph while preserving the selection's tail position.
method selectToBeginningOfWord
selectToBeginningOfWord: () => void;
Expand selections to the beginning of their containing word. Operates on all selections. Moves the cursor to the beginning of the containing word while preserving the selection's tail position.
method selectToBottom
selectToBottom: () => void;
Selects from the top of the first selection in the buffer to the end of the buffer. This method merges multiple selections into a single selection.
method selectToBufferPosition
selectToBufferPosition: (position: PointCompatible) => void;
Select from the current cursor position to the given position in buffer coordinates. This method may merge selections that end up intersecting.
method selectToEndOfLine
selectToEndOfLine: () => void;
Move the cursor of each selection to the end of its line while preserving the selection's tail position. This method may merge selections that end up intersecting.
method selectToEndOfWord
selectToEndOfWord: () => void;
Expand selections to the end of their containing word. Operates on all selections. Moves the cursor to the end of the containing word while preserving the selection's tail position.
method selectToFirstCharacterOfLine
selectToFirstCharacterOfLine: () => void;
Move the cursor of each selection to the first non-whitespace character of its line while preserving the selection's tail position. If the cursor is already on the first character of the line, move it to the beginning of the line. This method may merge selections that end up intersecting.
method selectToNextSubwordBoundary
selectToNextSubwordBoundary: () => void;
For each selection, move its cursor to the next subword boundary while maintaining the selection's tail position. This method may merge selections that end up intersecting.
method selectToNextWordBoundary
selectToNextWordBoundary: () => void;
For each selection, move its cursor to the next word boundary while maintaining the selection's tail position. This method may merge selections that end up intersecting.
method selectToPreviousSubwordBoundary
selectToPreviousSubwordBoundary: () => void;
For each selection, move its cursor to the preceding subword boundary while maintaining the selection's tail position. This method may merge selections that end up intersecting.
method selectToPreviousWordBoundary
selectToPreviousWordBoundary: () => void;
For each selection, move its cursor to the preceding word boundary while maintaining the selection's tail position. This method may merge selections that end up intersecting.
method selectToScreenPosition
selectToScreenPosition: (position: PointCompatible) => void;
Select from the current cursor position to the given position in screen coordinates. This method may merge selections that end up intersecting.
method selectToTop
selectToTop: () => void;
Select from the top of the buffer to the end of the last selection in the buffer. This method merges multiple selections into a single selection.
method selectUp
selectUp: (rowCount?: number) => void;
Move the cursor of each selection one character upward while preserving the selection's tail position. This method may merge selections that end up intersecting.
method selectWordsContainingCursors
selectWordsContainingCursors: () => void;
Select the word surrounding each cursor.
method setCursorBufferPosition
setCursorBufferPosition: ( position: PointCompatible, options?: { autoscroll?: boolean | undefined }) => void;
Move the cursor to the given position in buffer coordinates. If there are multiple cursors, they will be consolidated to a single cursor.
method setCursorScreenPosition
setCursorScreenPosition: ( position: PointCompatible, options?: { autoscroll?: boolean | undefined }) => void;
Move the cursor to the given position in screen coordinates. If there are multiple cursors, they will be consolidated to a single cursor.
method setEncoding
setEncoding: (encoding: string) => void;
Set the character set encoding to use in this editor's text buffer.
method setIndentationForBufferRow
setIndentationForBufferRow: ( bufferRow: number, newLevel: number, options?: { preserveLeadingWhitespace?: boolean | undefined }) => void;
Set the indentation level for the given buffer row. Inserts or removes hard tabs or spaces based on the soft tabs and tab length settings of this editor in order to bring it to the given indentation level. Note that if soft tabs are enabled and the tab length is 2, a row with 4 leading spaces would have an indentation level of 2.
method setPlaceholderText
setPlaceholderText: (placeholderText: string) => void;
Set the greyed out placeholder of a mini editor. Placeholder text will be displayed when the editor has no content.
method setReadOnly
setReadOnly: (readonly: boolean) => void;
Sets the read-only state for the editor.
method setSelectedBufferRange
setSelectedBufferRange: ( bufferRange: RangeCompatible, options?: { reversed?: boolean | undefined; preserveFolds?: boolean | undefined; }) => void;
Set the selected range in buffer coordinates. If there are multiple selections, they are reduced to a single selection with the given range.
method setSelectedBufferRanges
setSelectedBufferRanges: ( bufferRanges: readonly RangeCompatible[], options?: { reversed?: boolean | undefined; preserveFolds?: boolean | undefined; }) => void;
Set the selected ranges in buffer coordinates. If there are multiple selections, they are replaced by new selections with the given ranges.
method setSelectedScreenRange
setSelectedScreenRange: ( screenRange: RangeCompatible, options?: { reversed?: boolean | undefined }) => void;
Set the selected range in screen coordinates. If there are multiple selections, they are reduced to a single selection with the given range.
method setSelectedScreenRanges
setSelectedScreenRanges: ( screenRanges: readonly RangeCompatible[], options?: { reversed?: boolean | undefined }) => void;
Set the selected ranges in screen coordinates. If there are multiple selections, they are replaced by new selections with the given ranges.
method setSoftTabs
setSoftTabs: (softTabs: boolean) => void;
Enable or disable soft tabs for this editor.
method setSoftWrapped
setSoftWrapped: (softWrapped: boolean) => boolean;
Enable or disable soft wrapping for this editor.
method setTabLength
setTabLength: (tabLength: number) => void;
Set the on-screen length of tab characters. Setting this to a number will override the editor.tabLength setting.
method setText
setText: (text: string, options?: ReadonlyEditOptions) => void;
Replaces the entire contents of the buffer with the given string.
method setTextInBufferRange
setTextInBufferRange: ( range: RangeCompatible, text: string, options?: TextEditOptions & ReadonlyEditOptions) => Range;
Set the text in the given Range in buffer coordinates.
method syntaxTreeScopeDescriptorForBufferPosition
syntaxTreeScopeDescriptorForBufferPosition: ( bufferPosition: PointCompatible) => ScopeDescriptor;
Get the syntactic tree {ScopeDescriptor} for the given position in buffer coordinates or the syntactic {ScopeDescriptor} for TextMate language mode
method toggleFoldAtBufferRow
toggleFoldAtBufferRow: (bufferRow: number) => void;
Fold the given buffer row if it isn't currently folded, and unfold it otherwise.
method toggleLineCommentsInSelection
toggleLineCommentsInSelection: (options?: ReadonlyEditOptions) => void;
Toggle line comments for rows intersecting selections. If the current grammar doesn't support comments, does nothing.
method toggleSoftTabs
toggleSoftTabs: () => boolean;
Toggle soft tabs for this editor.
method toggleSoftWrapped
toggleSoftWrapped: () => boolean;
Toggle soft wrapping for this editor.
method tokenForBufferPosition
tokenForBufferPosition: (pos: PointCompatible) => { value: string; scopes: string[];};
Undocumented: Get syntax token at buffer position
method transact
transact: { (fn: () => void): void; (groupingInterval: number, fn: () => void): void;};
Batch multiple operations as a single undo/redo step. Any group of operations that are logically grouped from the perspective of undoing and redoing should be performed in a transaction. If you want to abort the transaction, call ::abortTransaction to terminate the function's execution and revert any changes performed up to the abortion.
method transpose
transpose: (options?: ReadonlyEditOptions) => void;
For each selection, transpose the selected text. If the selection is empty, the characters preceding and following the cursor are swapped. Otherwise, the selected characters are reversed.
method undo
undo: (options?: ReadonlyEditOptions) => void;
Undo the last change.
method unfoldAll
unfoldAll: () => void;
Unfold all existing folds.
method unfoldBufferRow
unfoldBufferRow: (bufferRow: number) => void;
Unfold all folds containing the given row in buffer coordinates.
method unfoldCurrentRow
unfoldCurrentRow: () => void;
Unfold the most recent cursor's row by one level.
method upperCase
upperCase: (options?: ReadonlyEditOptions) => void;
Convert the selected text to upper case. For each selection, if the selection is empty, converts the containing word to upper case. Otherwise convert the selected text to upper case.
method usesSoftTabs
usesSoftTabs: () => boolean | undefined;
Determine if the buffer uses hard or soft tabs.
Interfaces
interface AddedKeystrokeResolverEvent
interface AddedKeystrokeResolverEvent {}
property event
event: KeyboardEvent;
The raw DOM 3
KeyboardEvent
being resolved. See the DOM API documentation for more details.
property keymap
keymap: object;
An object mapping DOM 3
KeyboardEvent.code
values to objects with the typed character for that key in each modifier state, based on the current operating system layout.
property keystroke
keystroke: string;
The currently resolved keystroke string. If your function returns a falsy value, this is how Atom will resolve your keystroke.
property layoutName
layoutName: string;
The OS-specific name of the current keyboard layout.
interface AtomEnvironment
interface AtomEnvironment {}
Atom global for dealing with packages, themes, menus, and the window. An instance of this class is always available as the atom global.
property clipboard
readonly clipboard: Clipboard;
A Clipboard instance.
property commands
readonly commands: CommandRegistry;
A CommandRegistry instance.
property config
readonly config: Config;
A Config instance.
property contextMenu
readonly contextMenu: ContextMenuManager;
A ContextMenuManager instance.
property deserializers
readonly deserializers: DeserializerManager;
A DeserializerManager instance.
property grammars
readonly grammars: GrammarRegistry;
A GrammarRegistry instance.
property history
readonly history: HistoryManager;
A HistoryManager instance.
property keymaps
readonly keymaps: KeymapManager;
A KeymapManager instance.
property menu
readonly menu: MenuManager;
A MenuManager instance.
property notifications
readonly notifications: NotificationManager;
A NotificationManager instance.
property packages
readonly packages: PackageManager;
A PackageManager instance.
property project
readonly project: Project;
A Project instance.
property styles
readonly styles: StyleManager;
A StyleManager instance.
property textEditors
readonly textEditors: TextEditorRegistry;
A TextEditorRegistry instance.
property themes
readonly themes: ThemeManager;
A ThemeManager instance.
property tooltips
readonly tooltips: TooltipManager;
A TooltipManager instance.
property views
readonly views: ViewRegistry;
A ViewRegistry instance.
property workspace
readonly workspace: Workspace;
A Workspace instance.
method beep
beep: () => void;
Visually and audibly trigger a beep.
method center
center: () => void;
Move current window to the center of the screen.
method close
close: () => void;
Close the current window.
method confirm
confirm: { ( options: ConfirmationOptions, callback: (response: number, checkboxChecked: boolean) => void ): void; (options: { message: string; detailedMessage?: string; buttons?: readonly string[]; }): void; (options: { message: string; detailedMessage?: string; buttons?: { [key: string]: () => void }; }): number;};
A flexible way to open a dialog akin to an alert dialog. If a callback is provided, then the confirmation will work asynchronously, which is recommended.
If the dialog is closed (via
Esc
key orX
in the top corner) without selecting a button the first button will be clicked unless a "Cancel" or "No" button is provided.Returns the chosen button index number if the buttons option was an array.
Parameter response
The index of the button that was clicked.
Parameter checkboxChecked
The checked state of the checkbox if
checkboxLabel
was set. Otherwise false.A flexible way to open a dialog akin to an alert dialog. If a callback is provided, then the confirmation will work asynchronously, which is recommended.
If the dialog is closed (via
Esc
key orX
in the top corner) without selecting a button the first button will be clicked unless a "Cancel" or "No" button is provided.Returns the chosen button index number if the buttons option was an array.
method displayWindow
displayWindow: () => Promise<undefined>;
Restores the full screen and maximized state after the window has resized to prevent resize glitches.
method executeJavaScriptInDevTools
executeJavaScriptInDevTools: (code: string) => void;
Execute code in dev tools.
method focus
focus: () => void;
Focus the current window.
method getAppName
getAppName: () => string;
Get the full name of this Atom release (e.g. "Atom", "Atom Beta")
method getConfigDirPath
getConfigDirPath: () => string;
Undocumented: get Atom config directory path
method getCurrentWindow
getCurrentWindow: () => object;
Get the current window.
method getLoadSettings
getLoadSettings: () => WindowLoadSettings;
Get the load settings for the current window.
method getPosition
getPosition: () => { x: number; y: number };
Get the position of current window.
method getReleaseChannel
getReleaseChannel: () => 'dev' | 'nightly' | 'beta' | 'stable';
Gets the release channel of the Atom application. Returns the release channel, which can be 'dev', 'nightly', 'beta', or 'stable'.
method getSize
getSize: () => { width: number; height: number };
Get the size of current window.
method getStartupMarkers
getStartupMarkers: () => TimingMarker[];
Get the all the markers with the information about startup time.
method getVersion
getVersion: () => string;
Get the version of the Atom application.
method getWindowDimensions
getWindowDimensions: () => { x: number; y: number; width: number; height: number;};
Get the dimensions of this window.
method getWindowLoadTime
getWindowLoadTime: () => number;
Get the time taken to completely load the current window.
method hide
hide: () => void;
Hide the current window.
method inDevMode
inDevMode: () => boolean;
Returns a boolean that is true if the current window is in development mode.
method inSafeMode
inSafeMode: () => boolean;
Returns a boolean that is true if the current window is in safe mode.
method inSpecMode
inSpecMode: () => boolean;
Returns a boolean that is true if the current window is running specs.
method isFullScreen
isFullScreen: () => boolean;
Returns a boolean that is true if the current window is in full screen mode.
method isMaximized
isMaximized: () => boolean;
Returns a boolean that is true if the current window is maximized.
method isReleasedVersion
isReleasedVersion: () => boolean;
Returns a boolean that is true if the current version is an official release.
method onDidBeep
onDidBeep: (callback: () => void) => Disposable;
Invoke the given callback whenever ::beep is called.
method onDidThrowError
onDidThrowError: (callback: (event: ExceptionThrownEvent) => void) => Disposable;
Invoke the given callback whenever there is an unhandled error.
method onWillThrowError
onWillThrowError: ( callback: (event: PreventableExceptionThrownEvent) => void) => Disposable;
Invoke the given callback when there is an unhandled error, but before the devtools pop open.
method open
open: (params?: { pathsToOpen: readonly string[]; newWindow?: boolean | undefined; devMode?: boolean | undefined; safeMode?: boolean | undefined;}) => void;
Open a new Atom window using the given options.
method openDevTools
openDevTools: () => Promise<null>;
Open the dev tools for the current window.
method pickFolder
pickFolder: (callback: (paths: string[] | null) => void) => void;
Prompt the user to select one or more folders.
method reload
reload: () => void;
Reload the current window.
method restartApplication
restartApplication: () => void;
Relaunch the entire application.
method setFullScreen
setFullScreen: (fullScreen: boolean) => void;
Set the full screen state of the current window.
method setPosition
setPosition: (x: number, y: number) => void;
Set the position of current window.
method setSize
setSize: (width: number, height: number) => void;
Set the size of current window.
method setWindowDimensions
setWindowDimensions: (dimensions: { x?: number | undefined; y?: number | undefined; width?: number | undefined; height?: number | undefined;}) => Promise<object>;
Set the dimensions of the window.
method show
show: () => void;
Show the current window.
method toggleDevTools
toggleDevTools: () => Promise<null>;
Toggle the visibility of the dev tools for the current window.
method toggleFullScreen
toggleFullScreen: () => void;
Toggle the full screen state of the current window.
method whenShellEnvironmentLoaded
whenShellEnvironmentLoaded: (callback: () => void) => Disposable;
Invoke the given callback as soon as the shell environment is loaded (or immediately if it was already loaded).
interface BufferChangedEvent
interface BufferChangedEvent {}
property changes
changes: Array<{ /** * The Range of the deleted text in the contents of the buffer as it existed * before the batch of changes reported by this event. */ oldRange: Range;
/** The Range of the inserted text in the current contents of the buffer. */ newRange: Range;}>;
An array of objects summarizing the aggregated changes that occurred during the transaction.
property newRange
newRange: Range;
Range of the new text.
property newText
newText: string;
String containing the text that was inserted.
property oldRange
oldRange: Range;
Range of the old text.
property oldText
oldText: string;
String containing the text that was replaced.
interface BufferChangingEvent
interface BufferChangingEvent {}
property oldRange
oldRange: Range;
Range of the old text.
interface BufferLoadOptions
interface BufferLoadOptions {}
property encoding
encoding?: string | undefined;
The file's encoding.
method shouldDestroyOnFileDelete
shouldDestroyOnFileDelete: () => boolean;
A function that returns a boolean indicating whether the buffer should be destroyed if its file is deleted.
interface BufferScanResult
interface BufferScanResult {}
interface BufferStoppedChangingEvent
interface BufferStoppedChangingEvent {}
property changes
changes: TextChange[];
interface BuildEnvironmentOptions
interface BuildEnvironmentOptions {}
property applicationDelegate
applicationDelegate?: object | undefined;
An object responsible for Atom's interaction with the browser process and host OS. Use buildDefaultApplicationDelegate for a default instance.
property configDirPath
configDirPath?: string | undefined;
A path to the configuration directory (usually ~/.atom).
property document
document?: Document | undefined;
A document global.
property enablePersistence
enablePersistence?: boolean | undefined;
A boolean indicating whether the Atom environment should save or load state from the file system. You probably want this to be false.
property window
window?: Window | undefined;
A window global.
interface CancellablePromise
interface CancellablePromise<T> extends Promise<T> {}
method cancel
cancel: () => void;
interface Clipboard
interface Clipboard {}
Represents the clipboard used for copying and pasting in Atom.
method read
read: () => string;
Read the text from the clipboard.
method readWithMetadata
readWithMetadata: () => { text: string; metadata: object };
Read the text from the clipboard and return both the text and the associated metadata.
method write
write: (text: string, metadata?: object) => void;
Write the given text to the clipboard.
interface Color
interface Color {}
A simple color class returned from Config::get when the value at the key path is of type 'color'.
method toHexString
toHexString: () => string;
Returns a string in the form '#abcdef'.
method toRGBAString
toRGBAString: () => string;
Returns a string in the form 'rgba(25, 50, 75, .9)'.
interface CommandEvent
interface CommandEvent<CurrentTarget extends EventTarget = EventTarget> extends CustomEvent {}
This custom subclass of CustomEvent exists to provide the ::abortKeyBinding method, as well as versions of the ::stopPropagation methods that record the intent to stop propagation so event bubbling can be properly simulated for detached elements.
property currentTarget
currentTarget: CurrentTarget;
property keyBindingAborted
keyBindingAborted: boolean;
property propagationStopped
propagationStopped: boolean;
method abortKeyBinding
abortKeyBinding: () => void;
method stopImmediatePropagation
stopImmediatePropagation: () => CustomEvent;
method stopPropagation
stopPropagation: () => CustomEvent;
interface CommandRegistry
interface CommandRegistry {}
Associates listener functions with commands in a context-sensitive way using CSS selectors.
method add
add: { <T extends keyof CommandRegistryTargetMap>( target: T, commandName: string, listener: CommandRegistryListener<CommandRegistryTargetMap[T]> ): Disposable; <T extends Node>( target: T, commandName: string, listener: CommandRegistryListener<T> ): Disposable; <T extends keyof CommandRegistryTargetMap>( target: T, commands: { [key: string]: CommandRegistryListener<CommandRegistryTargetMap[T]>; } ): CompositeDisposable; <T extends Node>( target: T, commands: { [key: string]: CommandRegistryListener<T> } ): CompositeDisposable;};
Register a single command.
Register multiple commands.
method dispatch
dispatch: (target: Node, commandName: string) => Promise<void> | null;
Simulate the dispatch of a command on a DOM node. Either a Promise that resolves after all handlers complete or null if no handlers were matched.
method findCommands
findCommands: (params: { target: string | Node;}) => Array<{ name: string; displayName: string; description?: string | undefined; tags?: string[] | undefined;}>;
Find all registered commands matching a query.
method onDidDispatch
onDidDispatch: (callback: (event: CommandEvent) => void) => Disposable;
Invoke the given callback after dispatching a command event.
method onWillDispatch
onWillDispatch: (callback: (event: CommandEvent) => void) => Disposable;
Invoke the given callback before dispatching a command event.
interface CommandRegistryTargetMap
interface CommandRegistryTargetMap extends HTMLElementTagNameMap {}
index signature
[key: string]: EventTarget;
interface Config
interface Config {}
Used to access all of Atom's configuration details.
method get
get: <T extends never>( keyPath: T, options?: { sources?: string[] | undefined; excludeSources?: string[] | undefined; scope?: string[] | ScopeDescriptor | undefined; }) => ConfigValues[T];
Retrieves the setting for the given key.
method getAll
getAll: <T extends never>( keyPath: T, options?: { sources?: string[] | undefined; excludeSources?: string[] | undefined; scope?: ScopeDescriptor | undefined; }) => Array<{ scopeDescriptor: ScopeDescriptor; value: ConfigValues[T] }>;
Get all of the values for the given key-path, along with their associated scope selector.
method getSchema
getSchema: (keyPath: string) => object | null;
Retrieve the schema for a specific key path. The schema will tell you what type the keyPath expects, and other metadata about the config option.
method getSources
getSources: () => string[];
Get an Array of all of the source Strings with which settings have been added via ::set.
method getUserConfigPath
getUserConfigPath: () => string;
Get the string path to the config file being used.
method observe
observe: { <T extends never>( keyPath: T, callback: (value: ConfigValues[T]) => void ): Disposable; <T extends never>( keyPath: T, options: { scope: string[] | ScopeDescriptor }, callback: (value: ConfigValues[T]) => void ): Disposable;};
Add a listener for changes to a given key path. This is different than ::onDidChange in that it will immediately call your callback with the current value of the config entry.
method onDidChange
onDidChange: { <T = any>( callback: (values: { newValue: T; oldValue: T }) => void ): Disposable; <T extends never>( keyPath: T, callback: (values: { newValue: ConfigValues[T]; oldValue?: ConfigValues[T]; }) => void ): Disposable; <T extends never>( keyPath: T, options: { scope: string[] | ScopeDescriptor }, callback: (values: { newValue: ConfigValues[T]; oldValue?: ConfigValues[T]; }) => void ): Disposable;};
Add a listener for changes to a given key path. If keyPath is not specified, your callback will be called on changes to any key.
method set
set: <T extends never>( keyPath: T, value: ConfigValues[T], options?: { scopeSelector?: string | undefined; source?: string | undefined }) => void;
Sets the value for a configuration setting. This value is stored in Atom's internal configuration file.
method transact
transact: (callback: () => void) => void;
Suppress calls to handler functions registered with ::onDidChange and ::observe for the duration of callback. After callback executes, handlers will be called once if the value for their key-path has changed.
method unset
unset: ( keyPath: string, options?: { scopeSelector?: string | undefined; source?: string | undefined }) => void;
Restore the setting at keyPath to its default value.
interface ConfigValues
interface ConfigValues {}
Allows you to strongly type Atom configuration variables. Additional key:value pairings merged into this interface will result in configuration values under the value of each key being templated by the type of the associated value.
interface ConfirmationOptions
interface ConfirmationOptions {}
property buttons
buttons?: readonly string[] | undefined;
The text for the buttons.
property cancelId
cancelId?: number | undefined;
The index of the button to be used to cancel the dialog, via the
Esc
key. By default this is assigned to the first button with "cancel" or "no" as the label. If no such labeled buttons exist and this option is not set, 0 will be used as the return value or callback response.This option is ignored on Windows.
property checkboxChecked
checkboxChecked?: boolean | undefined;
Initial checked state of the checkbox. false by default.
property checkboxLabel
checkboxLabel?: string | undefined;
If provided, the message box will include a checkbox with the given label.
property defaultId
defaultId?: number | undefined;
The index for the button to be selected by default in the prompt.
property detail
detail?: string | undefined;
Additional information regarding the message.
property icon
icon?: object | undefined;
An Electron NativeImage to use as the prompt's icon.
property message
message?: string | undefined;
The content of the message box.
property noLink
noLink?: boolean | undefined;
On Windows, Electron will try to figure out which one of the buttons are common buttons (like
Cancel
orYes
), and show the others as command links in the dialog. This can make the dialog appear in the style of modern Windows apps. If you don't like this behavior, you can set noLink to true.
property normalizeAccessKeys
normalizeAccessKeys?: boolean | undefined;
Normalize the keyboard access keys across platforms. Atom defaults this to true.
property title
title?: string | undefined;
The title for the prompt.
property type
type?: 'none' | 'info' | 'error' | 'question' | 'warning' | undefined;
The type of the confirmation prompt.
interface ContextMenuItemOptions
interface ContextMenuItemOptions {}
property after
after?: readonly string[] | undefined;
Place this menu item after the menu items representing the given commands.
property afterGroupContaining
afterGroupContaining?: readonly string[] | undefined;
Place this menu item's group after the containing group of the menu items representing the given commands.
property before
before?: readonly string[] | undefined;
Place this menu item before the menu items representing the given commands.
property beforeGroupContaining
beforeGroupContaining?: readonly string[] | undefined;
Place this menu item's group before the containing group of the menu items representing the given commands.
property command
command?: string | undefined;
The command to invoke on the target of the right click that invoked the context menu.
property enabled
enabled?: boolean | undefined;
Whether the menu item should be clickable. Disabled menu items typically appear grayed out. Defaults to true.
property label
label?: string | undefined;
The menu item's label.
property submenu
submenu?: readonly ContextMenuOptions[] | undefined;
An array of additional items.
property visible
visible?: boolean | undefined;
Whether the menu item should appear in the menu. Defaults to true.
method created
created: (event: Event) => void;
A function that is called on the item each time a context menu is created via a right click.
method shouldDisplay
shouldDisplay: (event: Event) => void;
A function that is called to determine whether to display this item on a given context menu deployment.
interface ContextMenuManager
interface ContextMenuManager {}
Provides a registry for commands that you'd like to appear in the context menu.
method add
add: (itemsBySelector: { [key: string]: readonly ContextMenuOptions[];}) => Disposable;
Add context menu items scoped by CSS selectors.
interface ContextualBufferScanResult
interface ContextualBufferScanResult extends BufferScanResult {}
property leadingContextLines
leadingContextLines: string[];
property trailingContextLines
trailingContextLines: string[];
interface CopyMarkerOptions
interface CopyMarkerOptions {}
property exclusive
exclusive?: boolean | undefined;
Indicates whether insertions at the start or end of the marked range should be interpreted as happening outside the marker.
property invalidate
invalidate?: 'never' | 'surround' | 'overlap' | 'inside' | 'touch' | undefined;
Determines the rules by which changes to the buffer invalidate the marker.
property properties
properties?: object | undefined;
Custom properties to be associated with the marker.
property reversed
reversed?: boolean | undefined;
Creates the marker in a reversed orientation.
property tailed
tailed?: boolean | undefined;
Whether or not the marker should be tailed.
interface Cursor
interface Cursor {}
The Cursor class represents the little blinking line identifying where text can be inserted.
method clearAutoscroll
clearAutoscroll: () => void;
Prevents this cursor from causing scrolling.
method clearSelection
clearSelection: () => void;
Deselects the current selection.
method compare
compare: (otherCursor: Cursor) => number;
Compare this cursor's buffer position to another cursor's buffer position. See Point::compare for more details.
method getBeginningOfCurrentWordBufferPosition
getBeginningOfCurrentWordBufferPosition: (options?: { wordRegex?: RegExp | undefined; includeNonWordCharacters?: boolean | undefined; allowPrevious?: boolean | undefined;}) => Point;
Retrieves the buffer position of where the current word starts.
method getBeginningOfNextWordBufferPosition
getBeginningOfNextWordBufferPosition: (options?: { wordRegex?: RegExp | undefined;}) => Point;
Retrieves the buffer position of where the next word starts.
method getBufferColumn
getBufferColumn: () => number;
Returns the cursor's current buffer column.
method getBufferPosition
getBufferPosition: () => Point;
Returns the current buffer position as an Array.
method getBufferRow
getBufferRow: () => number;
Retrieves the cursor's current buffer row.
method getCurrentBufferLine
getCurrentBufferLine: () => string;
Returns the cursor's current buffer row of text excluding its line ending.
method getCurrentLineBufferRange
getCurrentLineBufferRange: (options?: { includeNewline?: boolean | undefined;}) => Range;
Returns the buffer Range for the current line.
method getCurrentParagraphBufferRange
getCurrentParagraphBufferRange: () => Range;
Retrieves the range for the current paragraph. A paragraph is defined as a block of text surrounded by empty lines or comments.
method getCurrentWordBufferRange
getCurrentWordBufferRange: (options?: { wordRegex?: RegExp | undefined;}) => Range;
Returns the buffer Range occupied by the word located under the cursor.
method getCurrentWordPrefix
getCurrentWordPrefix: () => string;
Returns the characters preceding the cursor in the current word.
method getEndOfCurrentWordBufferPosition
getEndOfCurrentWordBufferPosition: (options?: { wordRegex?: RegExp | undefined; includeNonWordCharacters?: boolean | undefined;}) => Point;
Retrieves the buffer position of where the current word ends.
method getIndentLevel
getIndentLevel: () => number;
Returns the indentation level of the current line.
method getMarker
getMarker: () => DisplayMarker;
Returns the underlying DisplayMarker for the cursor. Useful with overlay Decorations.
method getNextWordBoundaryBufferPosition
getNextWordBoundaryBufferPosition: (options?: { wordRegex?: RegExp | undefined;}) => Point;
Returns buffer position of the next word boundary. It might be on the current word, or the previous word.
method getPreviousWordBoundaryBufferPosition
getPreviousWordBoundaryBufferPosition: (options?: { wordRegex?: RegExp | undefined;}) => Point;
Returns buffer position of previous word boundary. It might be on the current word, or the previous word.
method getScopeDescriptor
getScopeDescriptor: () => ScopeDescriptor;
Retrieves the scope descriptor for the cursor's current position.
method getScreenColumn
getScreenColumn: () => number;
Returns the cursor's current screen column.
method getScreenPosition
getScreenPosition: () => Point;
Returns the screen position of the cursor as a Point.
method getScreenRow
getScreenRow: () => number;
Returns the cursor's current screen row.
method getSyntaxTreeScopeDescriptor
getSyntaxTreeScopeDescriptor: () => ScopeDescriptor;
Retrieves the syntax tree scope descriptor for the cursor's current position.
method hasPrecedingCharactersOnLine
hasPrecedingCharactersOnLine: () => boolean;
Returns true if this cursor has no non-whitespace characters before its current position.
method isAtBeginningOfLine
isAtBeginningOfLine: () => boolean;
Returns whether the cursor is at the start of a line.
method isAtEndOfLine
isAtEndOfLine: () => boolean;
Returns whether the cursor is on the line return character.
method isBetweenWordAndNonWord
isBetweenWordAndNonWord: () => boolean;
This method returns false if the character before or after the cursor is whitespace.
method isInsideWord
isInsideWord: (options?: { wordRegex?: RegExp | undefined }) => boolean;
Returns whether this cursor is between a word's start and end.
method isLastCursor
isLastCursor: () => boolean;
Identifies if this cursor is the last in the TextEditor. "Last" is defined as the most recently added cursor.
method isSurroundedByWhitespace
isSurroundedByWhitespace: () => boolean;
Identifies if the cursor is surrounded by whitespace. "Surrounded" here means that the character directly before and after the cursor are both whitespace.
method isVisible
isVisible: () => boolean;
Returns the visibility of the cursor.
method moveDown
moveDown: ( rowCount?: number, options?: { moveToEndOfSelection?: boolean | undefined }) => void;
Moves the cursor down one screen row.
method moveLeft
moveLeft: ( columnCount?: number, options?: { moveToEndOfSelection?: boolean | undefined }) => void;
Moves the cursor left one screen column.
method moveRight
moveRight: ( columnCount?: number, options?: { moveToEndOfSelection?: boolean | undefined }) => void;
Moves the cursor right one screen column.
method moveToBeginningOfLine
moveToBeginningOfLine: () => void;
Moves the cursor to the beginning of the buffer line.
method moveToBeginningOfNextParagraph
moveToBeginningOfNextParagraph: () => void;
Moves the cursor to the beginning of the next paragraph.
method moveToBeginningOfNextWord
moveToBeginningOfNextWord: () => void;
Moves the cursor to the beginning of the next word.
method moveToBeginningOfPreviousParagraph
moveToBeginningOfPreviousParagraph: () => void;
Moves the cursor to the beginning of the previous paragraph.
method moveToBeginningOfScreenLine
moveToBeginningOfScreenLine: () => void;
Moves the cursor to the beginning of the line.
method moveToBeginningOfWord
moveToBeginningOfWord: () => void;
Moves the cursor to the beginning of the word.
method moveToBottom
moveToBottom: () => void;
Moves the cursor to the bottom of the buffer.
method moveToEndOfLine
moveToEndOfLine: () => void;
Moves the cursor to the end of the buffer line.
method moveToEndOfScreenLine
moveToEndOfScreenLine: () => void;
Moves the cursor to the end of the line.
method moveToEndOfWord
moveToEndOfWord: () => void;
Moves the cursor to the end of the word.
method moveToFirstCharacterOfLine
moveToFirstCharacterOfLine: () => void;
Moves the cursor to the beginning of the first character in the line.
method moveToNextSubwordBoundary
moveToNextSubwordBoundary: () => void;
Moves the cursor to the next subword boundary.
method moveToNextWordBoundary
moveToNextWordBoundary: () => void;
Moves the cursor to the next word boundary.
method moveToPreviousSubwordBoundary
moveToPreviousSubwordBoundary: () => void;
Moves the cursor to the previous subword boundary.
method moveToPreviousWordBoundary
moveToPreviousWordBoundary: () => void;
Moves the cursor to the previous word boundary.
method moveToTop
moveToTop: () => void;
Moves the cursor to the top of the buffer.
method moveUp
moveUp: ( rowCount?: number, options?: { moveToEndOfSelection?: boolean | undefined }) => void;
Moves the cursor up one screen row.
method onDidChangePosition
onDidChangePosition: ( callback: (event: CursorPositionChangedEvent) => void) => Disposable;
Calls your callback when the cursor has been moved.
method onDidChangeVisibility
onDidChangeVisibility: (callback: (visibility: boolean) => void) => Disposable;
Calls your callback when the cursor's visibility has changed.
method onDidDestroy
onDidDestroy: (callback: () => void) => Disposable;
Calls your callback when the cursor is destroyed.
method setBufferPosition
setBufferPosition: ( bufferPosition: PointCompatible, options?: { autoscroll?: boolean | undefined }) => void;
Moves a cursor to a given buffer position.
method setScreenPosition
setScreenPosition: ( screenPosition: PointCompatible, options?: { autoscroll?: boolean | undefined }) => void;
Moves a cursor to a given screen position.
method setVisible
setVisible: (visible: boolean) => void;
Sets whether the cursor is visible.
method skipLeadingWhitespace
skipLeadingWhitespace: () => void;
Moves the cursor to the beginning of the buffer line, skipping all whitespace.
method subwordRegExp
subwordRegExp: (options?: { backwards?: boolean | undefined }) => RegExp;
Get the RegExp used by the cursor to determine what a "subword" is.
method wordRegExp
wordRegExp: (options?: { includeNonWordCharacters?: boolean | undefined;}) => RegExp;
Get the RegExp used by the cursor to determine what a "word" is.
interface CursorPositionChangedEvent
interface CursorPositionChangedEvent {}
property cursor
cursor: Cursor;
property newBufferPosition
newBufferPosition: Point;
property newScreenPosition
newScreenPosition: Point;
property oldBufferPosition
oldBufferPosition: Point;
property oldScreenPosition
oldScreenPosition: Point;
property textChanged
textChanged: boolean;
interface Decoration
interface Decoration {}
Represents a decoration that follows a DisplayMarker. A decoration is basically a visual representation of a marker. It allows you to add CSS classes to line numbers in the gutter, lines, and add selection-line regions around marked ranges of text.
property id
readonly id: number;
The identifier for this Decoration.
method destroy
destroy: () => void;
Destroy this marker decoration. You can also destroy the marker if you own it, which will destroy this decoration.
method getId
getId: () => number;
An id unique across all Decoration objects.
method getMarker
getMarker: () => DisplayMarker;
Returns the marker associated with this Decoration.
method getProperties
getProperties: () => DecorationOptions;
Returns the Decoration's properties.
method isType
isType: (type: string | string[]) => boolean;
Check if this decoration is of the given type.
Parameter type
A decoration type, such as
line-number
orline
. This may also be an array of decoration types, with isType returning true if the decoration's type matches any in the array.
method onDidChangeProperties
onDidChangeProperties: ( callback: (event: DecorationPropsChangedEvent) => void) => Disposable;
When the Decoration is updated via Decoration::setProperties.
method onDidDestroy
onDidDestroy: (callback: () => void) => Disposable;
Invoke the given callback when the Decoration is destroyed.
method setProperties
setProperties: (newProperties: DecorationOptions) => void;
Update the marker with new Properties. Allows you to change the decoration's class.
interface DecorationLayerOptions
interface DecorationLayerOptions extends SharedDecorationOptions {}
property type
type?: | 'line' | 'line-number' | 'text' | 'highlight' | 'block' | 'cursor' | undefined;
One of several supported decoration types.
interface DecorationOptions
interface DecorationOptions extends SharedDecorationOptions {}
property gutterName
gutterName?: string | undefined;
The name of the gutter we're decorating, if type is "gutter".
property type
type?: | 'line' | 'line-number' | 'text' | 'highlight' | 'overlay' | 'gutter' | 'block' | 'cursor' | undefined;
One of several supported decoration types.
interface DecorationPropsChangedEvent
interface DecorationPropsChangedEvent {}
property newProperties
newProperties: DecorationOptions;
Object the new parameters the decoration now has
property oldProperties
oldProperties: DecorationOptions;
Object the old parameters the decoration used to have.
interface Deserializer
interface Deserializer {}
property name
name: string;
method deserialize
deserialize: (state: object) => object;
interface DeserializerManager
interface DeserializerManager {}
Manages the deserializers used for serialized state.
method add
add: (...deserializers: Deserializer[]) => Disposable;
Register the given class(es) as deserializers.
method deserialize
deserialize: (state: object) => object | undefined;
Deserialize the state and params.
interface DisplayMarker
interface DisplayMarker {}
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.
method clearTail
clearTail: () => void;
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.
method compare
compare: (other: DisplayMarker) => number;
Compares this marker to another based on their ranges.
method copy
copy: (options?: CopyMarkerOptions) => DisplayMarker;
Creates and returns a new DisplayMarker with the same properties as this marker.
method destroy
destroy: () => void;
Destroys the marker, causing it to emit the 'destroyed' event. Once destroyed, a marker cannot be restored by undo/redo operations.
method getBufferRange
getBufferRange: () => Range;
Gets the buffer range of this marker.
method getEndBufferPosition
getEndBufferPosition: () => Point;
Retrieves the buffer position of the marker's end. This will always be greater than or equal to the result of DisplayMarker::getStartBufferPosition.
method getEndScreenPosition
getEndScreenPosition: (options?: { clipDirection: 'backward' | 'forward' | 'closest';}) => Point;
Retrieves the screen position of the marker's end. This will always be greater than or equal to the result of DisplayMarker::getStartScreenPosition.
method getHeadBufferPosition
getHeadBufferPosition: () => Point;
Retrieves the buffer position of the marker's head.
method getHeadScreenPosition
getHeadScreenPosition: (options?: { clipDirection: 'backward' | 'forward' | 'closest';}) => Point;
Retrieves the screen position of the marker's head.
method getInvalidationStrategy
getInvalidationStrategy: () => string;
Get the invalidation strategy for this marker. Valid values include: never, surround, overlap, inside, and touch.
method getProperties
getProperties: () => object;
Returns an Object containing any custom properties associated with the marker.
method getScreenRange
getScreenRange: () => Range;
Gets the screen range of this marker.
method getStartBufferPosition
getStartBufferPosition: () => Point;
Retrieves the buffer position of the marker's start. This will always be less than or equal to the result of DisplayMarker::getEndBufferPosition.
method getStartScreenPosition
getStartScreenPosition: (options?: { clipDirection: 'backward' | 'forward' | 'closest';}) => Point;
Retrieves the screen position of the marker's start. This will always be less than or equal to the result of DisplayMarker::getEndScreenPosition.
method getTailBufferPosition
getTailBufferPosition: () => Point;
Retrieves the buffer position of the marker's tail.
method getTailScreenPosition
getTailScreenPosition: (options?: { clipDirection: 'backward' | 'forward' | 'closest';}) => Point;
Retrieves the screen position of the marker's tail.
method hasTail
hasTail: () => boolean;
Returns a boolean indicating whether the marker has a tail.
method isDestroyed
isDestroyed: () => boolean;
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.
method isEqual
isEqual: (other: DisplayMarker) => boolean;
Returns a boolean indicating whether this marker is equivalent to another marker, meaning they have the same range and options.
method isExclusive
isExclusive: () => boolean;
Returns a boolean indicating whether changes that occur exactly at the marker's head or tail cause it to move.
method isReversed
isReversed: () => boolean;
Returns a boolean indicating whether the head precedes the tail.
method isValid
isValid: () => boolean;
Returns a boolean indicating whether the marker is valid. Markers can be invalidated when a region surrounding them in the buffer is changed.
method matchesProperties
matchesProperties: (attributes: FindDisplayMarkerOptions) => boolean;
Returns whether this marker matches the given parameters.
method onDidChange
onDidChange: ( callback: (event: DisplayMarkerChangedEvent) => void) => Disposable;
Invoke the given callback when the state of the marker changes.
method onDidDestroy
onDidDestroy: (callback: () => void) => Disposable;
Invoke the given callback when the marker is destroyed.
method plantTail
plantTail: () => void;
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.
method setBufferRange
setBufferRange: ( bufferRange: RangeCompatible, properties?: { reversed: boolean }) => void;
Modifies the buffer range of this marker.
method setHeadBufferPosition
setHeadBufferPosition: (bufferPosition: PointCompatible) => void;
Sets the buffer position of the marker's head.
method setHeadScreenPosition
setHeadScreenPosition: ( screenPosition: PointCompatible, options?: { clipDirection: 'backward' | 'forward' | 'closest' }) => void;
Sets the screen position of the marker's head.
method setProperties
setProperties: (properties: object) => void;
Merges an Object containing new properties into the marker's existing properties.
method setScreenRange
setScreenRange: ( screenRange: RangeCompatible, options?: { reversed?: boolean | undefined; clipDirection?: 'backward' | 'forward' | 'closest' | undefined; }) => void;
Modifies the screen range of this marker.
method setTailBufferPosition
setTailBufferPosition: (bufferPosition: PointCompatible) => void;
Sets the buffer position of the marker's tail.
method setTailScreenPosition
setTailScreenPosition: ( screenPosition: PointCompatible, options?: { clipDirection: 'backward' | 'forward' | 'closest' }) => void;
Sets the screen position of the marker's tail.
interface DisplayMarkerChangedEvent
interface DisplayMarkerChangedEvent {}
property hadTail
hadTail: boolean;
Boolean indicating whether the marker had a tail before the change.
property hasTail
hasTail: boolean;
Boolean indicating whether the marker now has a tail
property isValid
isValid: boolean;
Boolean indicating whether the marker is now valid.
property newHeadBufferPosition
newHeadBufferPosition: Point;
Point representing the new head buffer position.
property newHeadScreenPosition
newHeadScreenPosition: Point;
Point representing the new head screen position.
property newProperties
newProperties: object;
-DEPRECATED- Object containing the marker's custom properties after the change.
Deprecated
property newTailBufferPosition
newTailBufferPosition: Point;
Point representing the new tail buffer position.
property newTailScreenPosition
newTailScreenPosition: Point;
Point representing the new tail screen position.
property oldHeadBufferPosition
oldHeadBufferPosition: Point;
Point representing the former head buffer position.
property oldHeadScreenPosition
oldHeadScreenPosition: Point;
Point representing the former head screen position.
property oldProperties
oldProperties: object;
-DEPRECATED- Object containing the marker's custom properties before the change.
Deprecated
property oldTailBufferPosition
oldTailBufferPosition: Point;
property oldTailScreenPosition
oldTailScreenPosition: Point;
Point representing the former tail screen position.
property textChanged
textChanged: boolean;
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.
property wasValid
wasValid: boolean;
Boolean indicating whether the marker was valid before the change.
interface DisplayMarkerLayer
interface DisplayMarkerLayer {}
Experimental: A container for a related set of markers at the DisplayLayer level. Wraps an underlying MarkerLayer on the TextBuffer.
This API is experimental and subject to change on any release.
property id
readonly id: string;
The identifier for the underlying MarkerLayer.
method clear
clear: () => void;
Destroy all markers in this layer.
method destroy
destroy: () => void;
Destroy this layer.
method findMarkers
findMarkers: (properties: FindDisplayMarkerOptions) => DisplayMarker[];
Find markers in the layer conforming to the given parameters.
This method finds markers based on the given properties. Markers can be associated with custom properties that will be compared with basic equality. In addition, there are several special properties that will be compared with the range of the markers rather than their properties.
method getMarker
getMarker: (id: number) => DisplayMarker;
Get an existing marker by its id.
method getMarkerCount
getMarkerCount: () => number;
Get the number of markers in the marker layer.
method getMarkers
getMarkers: () => DisplayMarker[];
Get all markers in the layer.
method isDestroyed
isDestroyed: () => boolean;
Determine whether this layer has been destroyed.
method markBufferPosition
markBufferPosition: ( bufferPosition: PointCompatible, options?: { invalidate?: | 'never' | 'surround' | 'overlap' | 'inside' | 'touch' | undefined; exclusive?: boolean | undefined; }) => DisplayMarker;
Create a marker on this layer with its head at the given buffer position and no tail.
method markBufferRange
markBufferRange: ( range: RangeCompatible, options?: { reversed?: boolean | undefined; invalidate?: | 'never' | 'surround' | 'overlap' | 'inside' | 'touch' | undefined; exclusive?: boolean | undefined; }) => DisplayMarker;
Create a marker with the given buffer range.
method markScreenPosition
markScreenPosition: ( screenPosition: PointCompatible, options?: { invalidate?: | 'never' | 'surround' | 'overlap' | 'inside' | 'touch' | undefined; exclusive?: boolean | undefined; clipDirection?: 'backward' | 'forward' | 'closest' | undefined; }) => DisplayMarker;
Create a marker on this layer with its head at the given screen position and no tail.
method markScreenRange
markScreenRange: ( range: RangeCompatible, options?: { reversed?: boolean | undefined; invalidate?: | 'never' | 'surround' | 'overlap' | 'inside' | 'touch' | undefined; exclusive?: boolean | undefined; clipDirection?: 'backward' | 'forward' | 'closest' | undefined; }) => DisplayMarker;
Create a marker with the given screen range.
method onDidCreateMarker
onDidCreateMarker: ( callback: (marker: DisplayMarker | Marker) => void) => Disposable;
Subscribe to be notified synchronously whenever markers are created on this layer. Avoid this method for optimal performance when interacting with layers that could contain large numbers of markers.
method onDidDestroy
onDidDestroy: (callback: () => void) => Disposable;
Subscribe to be notified synchronously when this layer is destroyed.
method onDidUpdate
onDidUpdate: (callback: () => void) => Disposable;
Subscribe to be notified asynchronously whenever markers are created, updated, or destroyed on this layer. Prefer this method for optimal performance when interacting with layers that could contain large numbers of markers.
interface DisposableLike
interface DisposableLike {}
method dispose
dispose: () => void;
interface Dock
interface Dock {}
A container at the edges of the editor window capable of holding items.
method activate
activate: () => void;
Show the dock and focus its active Pane.
method activateNextPane
activateNextPane: () => boolean;
Make the next pane active.
method activatePreviousPane
activatePreviousPane: () => boolean;
Make the previous pane active.
method getActivePane
getActivePane: () => Pane;
Get the active Pane.
method getActivePaneItem
getActivePaneItem: () => object;
Get the active Pane's active item.
method getPaneItems
getPaneItems: () => object[];
Get all pane items in the dock.
method getPanes
getPanes: () => Pane[];
Returns an Array of Panes.
method hide
hide: () => void;
Hide the dock and activate the WorkspaceCenter if the dock was was previously focused.
method isVisible
isVisible: () => boolean;
Check if the dock is visible.
method observeActivePane
observeActivePane: (callback: (pane: Pane) => void) => Disposable;
Invoke the given callback with the current active pane and when the active pane changes.
method observeActivePaneItem
observeActivePaneItem: (callback: (item: object) => void) => Disposable;
Invoke the given callback with the current active pane item and with all future active pane items in the dock.
method observePaneItems
observePaneItems: (callback: (item: object) => void) => Disposable;
Invoke the given callback with all current and future panes items in the dock.
method observePanes
observePanes: (callback: (pane: Pane) => void) => Disposable;
Invoke the given callback with all current and future panes in the dock.
method observeVisible
observeVisible: (callback: (visible: boolean) => void) => Disposable;
Invoke the given callback with the current and all future visibilities of the dock.
method onDidAddPane
onDidAddPane: (callback: (event: { pane: Pane }) => void) => Disposable;
Invoke the given callback when a pane is added to the dock.
method onDidAddPaneItem
onDidAddPaneItem: ( callback: (event: PaneItemObservedEvent) => void) => Disposable;
Invoke the given callback when a pane item is added to the dock.
method onDidChangeActivePane
onDidChangeActivePane: (callback: (pane: Pane) => void) => Disposable;
Invoke the given callback when the active pane changes.
method onDidChangeActivePaneItem
onDidChangeActivePaneItem: (callback: (item: object) => void) => Disposable;
Invoke the given callback when the active pane item changes.
Because observers are invoked synchronously, it's important not to perform any expensive operations via this method. Consider ::onDidStopChangingActivePaneItem to delay operations until after changes stop occurring.
method onDidChangeHovered
onDidChangeHovered: (callback: (hovered: boolean) => void) => Disposable;
Invoke the given callback when the hovered state of the dock changes.
Parameter hovered
Is the dock now hovered?
method onDidChangeVisible
onDidChangeVisible: (callback: (visible: boolean) => void) => Disposable;
Invoke the given callback when the visibility of the dock changes.
method onDidDestroyPane
onDidDestroyPane: (callback: (event: { pane: Pane }) => void) => Disposable;
Invoke the given callback when a pane is destroyed in the dock.
method onDidDestroyPaneItem
onDidDestroyPaneItem: ( callback: (event: PaneItemObservedEvent) => void) => Disposable;
Invoke the given callback when a pane item is destroyed.
method onDidStopChangingActivePaneItem
onDidStopChangingActivePaneItem: ( callback: (item: object) => void) => Disposable;
Invoke the given callback when the active pane item stops changing.
method onWillDestroyPane
onWillDestroyPane: (callback: (event: { pane: Pane }) => void) => Disposable;
Invoke the given callback before a pane is destroyed in the dock.
method onWillDestroyPaneItem
onWillDestroyPaneItem: ( callback: (event: PaneItemObservedEvent) => void | Promise<void>) => Disposable;
Invoke the given callback when a pane item is about to be destroyed, before the user is prompted to save it.
Parameter callback
The function to be called before pane items are destroyed. If this function returns a Promise, then the item will not be destroyed until the promise resolves.
method show
show: () => void;
Show the dock without focusing it.
method toggle
toggle: () => void;
Toggle the dock's visibility without changing the Workspace's active pane container.
interface EditorChangedEvent
interface EditorChangedEvent {}
interface ErrorNotificationOptions
interface ErrorNotificationOptions extends NotificationOptions {}
property stack
stack?: string | undefined;
interface ExceptionThrownEvent
interface ExceptionThrownEvent {}
property column
column: number;
property line
line: number;
property message
message: string;
property originalError
originalError: Error;
property url
url: string;
interface FailedKeybindingMatchEvent
interface FailedKeybindingMatchEvent {}
property keyboardEventTarget
keyboardEventTarget: Element;
The DOM element that was the target of the most recent keyboard event.
property keystrokes
keystrokes: string;
The string of keystrokes that failed to match the binding.
interface FailedKeymapFileReadEvent
interface FailedKeymapFileReadEvent {}
interface FileSavedEvent
interface FileSavedEvent {}
property path
path: string;
The path to which the buffer was saved.
interface FilesystemChangeBasic
interface FilesystemChangeBasic< Action extends 'created' | 'modified' | 'deleted' | 'renamed' = | 'created' | 'modified' | 'deleted'> {}
interface FilesystemChangeRename
interface FilesystemChangeRename extends FilesystemChangeBasic<'renamed'> {}
property oldPath
oldPath: string;
For rename events, a string containing the filesystem entry's former absolute path.
interface FindDisplayMarkerOptions
interface FindDisplayMarkerOptions {}
property containedInBufferRange
containedInBufferRange?: RangeCompatible | undefined;
Only include markers contained in this Range in buffer coordinates.
property containedInScreenRange
containedInScreenRange?: RangeCompatible | undefined;
Only include markers contained in this Range in screen coordinates.
property containsBufferPosition
containsBufferPosition?: PointCompatible | undefined;
Only include markers containing this Point in buffer coordinates.
property containsBufferRange
containsBufferRange?: RangeCompatible | undefined;
Only include markers containing this Range in buffer coordinates.
property endBufferPosition
endBufferPosition?: PointCompatible | undefined;
Only include markers ending at this Point in buffer coordinates.
property endBufferRow
endBufferRow?: number | undefined;
Only include markers ending at this row in buffer coordinates.
property endScreenPosition
endScreenPosition?: PointCompatible | undefined;
Only include markers ending at this Point in screen coordinates.
property endScreenRow
endScreenRow?: number | undefined;
Only include markers ending at this row in screen coordinates.
property endsInBufferRange
endsInBufferRange?: RangeCompatible | undefined;
Only include markers ending inside this Range in buffer coordinates.
property endsInScreenRange
endsInScreenRange?: RangeCompatible | undefined;
Only include markers ending inside this Range in screen coordinates.
property intersectsBufferRange
intersectsBufferRange?: RangeCompatible | undefined;
Only include markers intersecting this Range in buffer coordinates.
property intersectsBufferRowRange
intersectsBufferRowRange?: [number, number] | undefined;
Only include markers intersecting this Array of [startRow, endRow] in buffer coordinates.
property intersectsScreenRange
intersectsScreenRange?: RangeCompatible | undefined;
Only include markers intersecting this Range in screen coordinates.
property intersectsScreenRowRange
intersectsScreenRowRange?: [number, number] | undefined;
Only include markers intersecting this Array of [startRow, endRow] in screen coordinates.
property startBufferPosition
startBufferPosition?: PointCompatible | undefined;
Only include markers starting at this Point in buffer coordinates.
property startBufferRow
startBufferRow?: number | undefined;
Only include markers starting at this row in buffer coordinates.
property startScreenPosition
startScreenPosition?: PointCompatible | undefined;
Only include markers starting at this Point in screen coordinates.
property startScreenRow
startScreenRow?: number | undefined;
Only include markers starting at this row in screen coordinates.
property startsInBufferRange
startsInBufferRange?: RangeCompatible | undefined;
Only include markers starting inside this Range in buffer coordinates.
property startsInScreenRange
startsInScreenRange?: RangeCompatible | undefined;
Only include markers starting inside this Range in screen coordinates.
interface FindMarkerOptions
interface FindMarkerOptions {}
property containsPoint
containsPoint?: PointCompatible | undefined;
Only include markers that contain the given Point, inclusive.
property containsRange
containsRange?: RangeCompatible | undefined;
Only include markers that contain the given Range, inclusive.
property endPosition
endPosition?: PointCompatible | undefined;
Only include markers that end at the given Point.
property endRow
endRow?: number | undefined;
Only include markers that end at the given row number.
property endsInRange
endsInRange?: RangeCompatible | undefined;
Only include markers that end inside the given Range.
property intersectsRow
intersectsRow?: number | undefined;
Only include markers that intersect the given row number.
property startPosition
startPosition?: PointCompatible | undefined;
Only include markers that start at the given Point.
property startRow
startRow?: number | undefined;
Only include markers that start at the given row number.
property startsInRange
startsInRange?: RangeCompatible | undefined;
Only include markers that start inside the given Range.
interface FullKeybindingMatchEvent
interface FullKeybindingMatchEvent {}
property binding
binding: KeyBinding;
The KeyBinding that the keystrokes matched.
property keyboardEventTarget
keyboardEventTarget: Element;
The DOM element that was the target of the most recent keyboard event.
property keystrokes
keystrokes: string;
The string of keystrokes that matched the binding.
interface Grammar
interface Grammar {}
Grammar that tokenizes lines of text.
property name
readonly name: string;
The name of the Grammar.
property scopeName
readonly scopeName: string;
Undocumented: scope name of the Grammar.
method onDidUpdate
onDidUpdate: (callback: () => void) => Disposable;
method tokenizeLine
tokenizeLine: { (line: string, ruleStack?: null, firstLine?: boolean): TokenizeLineResult; ( line: string, ruleStack: GrammarRule[], firstLine?: false ): TokenizeLineResult;};
Tokenizes the line of text.
Parameter line
A string of text to tokenize.
Parameter ruleStack
An optional array of rules previously returned from this method. This should be null when tokenizing the first line in the file.
Parameter firstLine
A optional boolean denoting whether this is the first line in the file which defaults to
false
. An object representing the result of the tokenize.
method tokenizeLines
tokenizeLines: (text: string) => GrammarToken[][];
Tokenize all lines in the given text.
Parameter text
A string containing one or more lines. An array of token arrays for each line tokenized.
interface GrammarRegistry
interface GrammarRegistry {}
Registry containing one or more grammars.
method addGrammar
addGrammar: (grammar: Grammar) => Disposable;
Add a grammar to this registry. A 'grammar-added' event is emitted after the grammar is added.
Parameter grammar
The Grammar to add. This should be a value previously returned from ::readGrammar or ::readGrammarSync. Returns a Disposable on which
.dispose()
can be called to remove the grammar.
method assignLanguageMode
assignLanguageMode: (buffer: TextBuffer, languageId: string) => boolean;
Force a TextBuffer to use a different grammar than the one that would otherwise be selected for it.
Parameter buffer
The buffer whose grammar will be set.
Parameter languageId
The identifier of the desired language. Returns a boolean that indicates whether the language was successfully found.
method autoAssignLanguageMode
autoAssignLanguageMode: (buffer: TextBuffer) => void;
Remove any language mode override that has been set for the given TextBuffer. This will assign to the buffer the best language mode available.
method decodeTokens
decodeTokens: (lineText: string, tags: Array<number | string>) => GrammarToken[];
Convert compact tags representation into convenient, space-inefficient tokens.
Parameter lineText
The text of the tokenized line.
Parameter tags
The tags returned from a call to Grammar::tokenizeLine(). An array of Token instances decoded from the given tags.
method getGrammars
getGrammars: () => Grammar[];
Get all the grammars in this registry. A non-empty array of Grammar instances.
method getGrammarScore
getGrammarScore: ( grammar: Grammar, filePath: string, contents: string) => number;
Returns a number representing how well the grammar matches the
filePath
andcontents
.Parameter grammar
The grammar to score.
Parameter filePath
A string file path.
Parameter contents
A string of text for that file path.
method grammarForScopeName
grammarForScopeName: (scopeName: string) => Grammar | undefined;
Get a grammar with the given scope name.
Parameter scopeName
A string such as
source.js
. A Grammar or undefined.
method loadGrammar
loadGrammar: ( grammarPath: string, callback: (error: Error | null, grammar?: Grammar) => void) => void;
Read a grammar asynchronously and add it to the registry.
Parameter grammarPath
The absolute file path to the grammar.
Parameter callback
The function to be invoked once the Grammar has been read in and added to the registry.
method loadGrammarSync
loadGrammarSync: (grammarPath: string) => Grammar;
Read a grammar synchronously and add it to this registry.
Parameter grammarPath
The absolute file path to the grammar. The newly loaded Grammar.
method maintainLanguageMode
maintainLanguageMode: (buffer: TextBuffer) => Disposable;
Set a TextBuffer's language mode based on its path and content, and continue to update its language mode as grammars are added or updated, or the buffer's file path changes.
Parameter buffer
The buffer whose language mode will be maintained. A Disposable that can be used to stop updating the buffer's language mode.
method onDidAddGrammar
onDidAddGrammar: (callback: (grammar: Grammar) => void) => Disposable;
Invoke the given callback when a grammar is added to the registry.
Parameter callback
The callback to be invoked whenever a grammar is added. A Disposable on which
.dispose()
can be called to unsubscribe.
method onDidRemoveGrammar
onDidRemoveGrammar: (callback: (grammar: Grammar) => void) => Disposable;
Invoke the given callback when a grammar is removed from the registry.
Parameter callback
The callback to be invoked whenever a grammar is removed. A Disposable on which
.dispose()
can be called to unsubscribe.
method onDidUpdateGrammar
onDidUpdateGrammar: (callback: (grammar: Grammar) => void) => Disposable;
Invoke the given callback when a grammar is updated due to a grammar it depends on being added or removed from the registry.
Parameter callback
The callback to be invoked whenever a grammar is updated. A Disposable on which
.dispose()
can be called to unsubscribe.
method readGrammar
readGrammar: ( grammarPath: string, callback: (error: Error | null, grammar?: Grammar) => void) => void;
Read a grammar asynchronously but don't add it to the registry.
Parameter grammarPath
The absolute file path to the grammar.
Parameter callback
The function to be invoked once the Grammar has been read in.
method readGrammarSync
readGrammarSync: (grammarPath: string) => Grammar;
Read a grammar synchronously but don't add it to the registry.
Parameter grammarPath
The absolute file path to a grammar. The newly loaded Grammar.
method removeGrammar
removeGrammar: (grammar: Grammar) => void;
Remove the given grammar from this registry.
Parameter grammar
The grammar to remove. This should be a grammar previously added to the registry from ::addGrammar.
method removeGrammarForScopeName
removeGrammarForScopeName: (scopeName: string) => Grammar | undefined;
Remove the grammar with the given scope name.
Parameter scopeName
A string such as
source.js
. Returns the removed Grammar or undefined.
method selectGrammar
selectGrammar: (filePath: string, fileContents: string) => Grammar;
Select a grammar for the given file path and file contents.
This picks the best match by checking the file path and contents against each grammar.
Parameter filePath
A string file path.
Parameter fileContents
A string of text for that file path.
interface GrammarRule
interface GrammarRule {}
property contentScopeName
contentScopeName: string;
property rule
rule: object;
property scopeName
scopeName: string;
interface GrammarToken
interface GrammarToken {}
interface Gutter
interface Gutter {}
Represents a gutter within a TextEditor.
method decorateMarker
decorateMarker: ( marker: DisplayMarker, decorationParams: DecorationOptions) => Decoration;
Add a decoration that tracks a DisplayMarker. When the marker moves, is invalidated, or is destroyed, the decoration will be updated to reflect the marker's state.
method destroy
destroy: () => void;
Destroys the gutter.
method hide
hide: () => void;
Hide the gutter.
method isVisible
isVisible: () => boolean;
Determine whether the gutter is visible.
method onDidChangeVisible
onDidChangeVisible: (callback: (gutter: Gutter) => void) => Disposable;
Calls your callback when the gutter's visibility changes.
method onDidDestroy
onDidDestroy: (callback: () => void) => Disposable;
Calls your callback when the gutter is destroyed.
method show
show: () => void;
Show the gutter.
interface GutterOptions
interface GutterOptions {}
property class
class?: string | undefined;
String added to the CSS classnames of the gutter's root DOM element.
property labelFn
labelFn?: ((lineData: LineDataExtended) => string) | undefined;
Function called by a 'line-number' gutter to generate the label for each line number element. Should return a String that will be used to label the corresponding line.
property name
name: string;
(required) A unique String to identify this gutter.
property onMouseDown
onMouseDown?: ((lineData: LineData) => void) | undefined;
Function to be called when a mousedown event is received by a line-number element within this type: 'line-number' Gutter. If unspecified, the default behavior is to select the clicked buffer row.
property onMouseMove
onMouseMove?: ((lineData: LineData) => void) | undefined;
Function to be called when a mousemove event occurs on a line-number element within within this type: 'line-number' Gutter.
property priority
priority?: number | undefined;
A Number that determines stacking order between gutters. Lower priority items are forced closer to the edges of the window. (default: -100)
property type
type?: 'decorated' | 'line-number' | undefined;
String specifying the type of gutter to create. 'decorated' gutters are useful as a destination for decorations created with Gutter::decorateMarker. 'line-number' gutters.
property visible
visible?: boolean | undefined;
Boolean specifying whether the gutter is visible initially after being created. (default: true)
interface HandleableErrorEvent
interface HandleableErrorEvent {}
interface HistoryManager
interface HistoryManager {}
History manager for remembering which projects have been opened. An instance of this class is always available as the atom.history global. The project history is used to enable the 'Reopen Project' menu.
method clearProjects
clearProjects: () => void;
Clear all projects from the history. Note: This is not a privacy function - other traces will still exist, e.g. window state.
method getProjects
getProjects: () => ProjectHistory[];
Obtain a list of previously opened projects.
method onDidChangeProjects
onDidChangeProjects: ( callback: (args: { reloaded: boolean }) => void) => Disposable;
Invoke the given callback when the list of projects changes.
interface HistoryTransactionOptions
interface HistoryTransactionOptions {}
property selectionsMarkerLayer
selectionsMarkerLayer?: MarkerLayer | undefined;
When provided, skip taking snapshot for other selections markerLayers except given one.
interface HistoryTraversalOptions
interface HistoryTraversalOptions {}
property selectionsMarkerLayer
selectionsMarkerLayer?: MarkerLayer | undefined;
Restore snapshot of selections marker layer to given selectionsMarkerLayer.
interface Invisibles
interface Invisibles {}
property cr
cr?: boolean | string | undefined;
Character used to render carriage return characters (for Microsoft-style line endings) when the
Show Invisibles
setting is enabled.
property eol
eol?: boolean | string | undefined;
Character used to render newline characters (\n) when the
Show Invisibles
setting is enabled.
property space
space?: boolean | string | undefined;
Character used to render leading and trailing space characters when the
Show Invisibles
setting is enabled.
property tab
tab?: boolean | string | undefined;
Character used to render hard tab characters (\t) when the
Show Invisibles
setting is enabled.
interface JQueryCompatible
interface JQueryCompatible<Element extends Node = HTMLElement> extends Iterable<Element> {}
property jquery
jquery: string;
interface KeyBinding
interface KeyBinding {}
property command
command: string;
property enabled
enabled: boolean;
property keystrokeArray
keystrokeArray: string[];
property keystrokeCount
keystrokeCount: number;
property keystrokes
keystrokes: string;
property selector
selector: string;
property source
source: string;
property specificity
specificity: number;
method compare
compare: (other: KeyBinding) => number;
Compare another KeyBinding to this instance. Returns <= -1 if the argument is considered lesser or of lower priority. Returns 0 if this binding is equivalent to the argument. Returns >= 1 if the argument is considered greater or of higher priority.
method matches
matches: (keystroke: string) => boolean;
Determines whether the given keystroke matches any contained within this binding.
interface KeymapLoadedEvent
interface KeymapLoadedEvent {}
property path
path: string;
The path of the keymap file.
interface KeymapManager
interface KeymapManager {}
Allows commands to be associated with keystrokes in a context-sensitive way. In Atom, you can access a global instance of this object via
atom.keymaps
.
method add
add: ( source: string, bindings: { [key: string]: { [key: string]: string } }, priority?: number) => Disposable;
Add sets of key bindings grouped by CSS selector.
method addKeystrokeResolver
addKeystrokeResolver: ( resolver: (event: AddedKeystrokeResolverEvent) => string) => Disposable;
Customize translation of raw keyboard events to keystroke strings.
method build
build: ( source: string, bindings: { [key: string]: { [key: string]: string } }, priority?: number) => KeyBinding[];
Construct KeyBindings from an object grouping them by CSS selector.
method clear
clear: () => void;
Clear all registered key bindings and enqueued keystrokes. For use in tests.
method destroy
destroy: () => void;
Unwatch all watched paths.
method findKeyBindings
findKeyBindings: (params?: { keystrokes?: string | undefined; command?: string | undefined; target?: Element | undefined;}) => KeyBinding[];
Get the key bindings for a given command and optional target.
method getKeyBindings
getKeyBindings: () => KeyBinding[];
Get all current key bindings.
method getPartialMatchTimeout
getPartialMatchTimeout: () => number;
Get the number of milliseconds allowed before pending states caused by partial matches of multi-keystroke bindings are terminated.
method handleKeyboardEvent
handleKeyboardEvent: (event: KeyboardEvent) => void;
Dispatch a custom event associated with the matching key binding for the given
KeyboardEvent
if one can be found.
method keystrokeForKeyboardEvent
keystrokeForKeyboardEvent: (event: KeyboardEvent) => string;
Translates a keydown event to a keystroke string.
method loadKeymap
loadKeymap: ( bindingsPath: string, options?: { watch?: boolean | undefined; priority?: number | undefined }) => void;
Load the key bindings from the given path.
method onDidFailToMatchBinding
onDidFailToMatchBinding: ( callback: (event: FailedKeybindingMatchEvent) => void) => Disposable;
Invoke the given callback when one or more keystrokes fail to match any bindings.
method onDidFailToReadFile
onDidFailToReadFile: ( callback: (error: FailedKeymapFileReadEvent) => void) => Disposable;
Invoke the given callback when a keymap file not able to be loaded.
method onDidMatchBinding
onDidMatchBinding: ( callback: (event: FullKeybindingMatchEvent) => void) => Disposable;
Invoke the given callback when one or more keystrokes completely match a key binding.
method onDidPartiallyMatchBindings
onDidPartiallyMatchBindings: ( callback: (event: PartialKeybindingMatchEvent) => void) => Disposable;
Invoke the given callback when one or more keystrokes partially match a binding.
method onDidReloadKeymap
onDidReloadKeymap: (callback: (event: KeymapLoadedEvent) => void) => Disposable;
Invoke the given callback when a keymap file is reloaded.
method onDidUnloadKeymap
onDidUnloadKeymap: (callback: (event: KeymapLoadedEvent) => void) => Disposable;
Invoke the given callback when a keymap file is unloaded.
method watchKeymap
watchKeymap: (filePath: string, options?: { priority: number }) => void;
Cause the keymap to reload the key bindings file at the given path whenever it changes.
interface LayerDecoration
interface LayerDecoration {}
Represents a decoration that applies to every marker on a given layer. Created via TextEditor::decorateMarkerLayer.
method destroy
destroy: () => void;
Destroys the decoration.
method getProperties
getProperties: () => DecorationLayerOptions;
Get this decoration's properties.
method isDestroyed
isDestroyed: () => boolean;
Determine whether this decoration is destroyed.
method setProperties
setProperties: (newProperties: DecorationLayerOptions) => void;
Set this decoration's properties.
method setPropertiesForMarker
setPropertiesForMarker: ( marker: DisplayMarker | Marker, properties: DecorationLayerOptions) => void;
Override the decoration properties for a specific marker.
interface LineData
interface LineData {}
interface LineDataExtended
interface LineDataExtended extends LineData {}
Object containing information about each line to label.
property foldable
foldable: boolean;
Boolean that is true if a fold may be created here.
property maxDigits
maxDigits: number;
Number the maximum number of digits necessary to represent any known screen row.
property softWrapped
softWrapped: boolean;
Boolean if this screen row is the soft-wrapped continuation of the same buffer row.
interface Marker
interface Marker {}
Represents a buffer annotation that remains logically stationary even as the buffer changes.
property id
readonly id: number;
The identifier for this Marker.
method clearTail
clearTail: () => boolean;
Removes the marker's tail. Returns a boolean indicating whether or not the marker was updated.
method compare
compare: (other: Marker) => number;
Compares this marker to another based on their ranges. Returns "-1" if this marker precedes the argument. Returns "0" if this marker is equivalent to the argument. Returns "1" if this marker follows the argument.
method copy
copy: (options?: CopyMarkerOptions) => Marker;
Creates and returns a new Marker with the same properties as this marker.
method destroy
destroy: () => void;
Destroys the marker, causing it to emit the "destroyed" event.
method getEndPosition
getEndPosition: () => Point;
Returns a point representing the end position of the marker, which could be the head or tail position, depending on its orientation.
method getHeadPosition
getHeadPosition: () => Point;
Returns a point representing the marker's current head position.
method getInvalidationStrategy
getInvalidationStrategy: () => string;
Get the invalidation strategy for this marker.
method getRange
getRange: () => Range;
Returns the current range of the marker. The range is immutable.
method getStartPosition
getStartPosition: () => Point;
Returns a point representing the start position of the marker, which could be the head or tail position, depending on its orientation.
method getTailPosition
getTailPosition: () => Point;
Returns a point representing the marker's current tail position.
method hasTail
hasTail: () => boolean;
Returns a boolean indicating whether the marker has a tail.
method isDestroyed
isDestroyed: () => boolean;
Is the marker destroyed?
method isEqual
isEqual: (other: Marker) => boolean;
Returns a boolean indicating whether this marker is equivalent to another marker, meaning they have the same range and options.
method isExclusive
isExclusive: () => boolean;
Returns a boolean indicating whether changes that occur exactly at the marker's head or tail cause it to move.
method isReversed
isReversed: () => boolean;
Returns a boolean indicating whether the head precedes the tail.
method isValid
isValid: () => boolean;
Is the marker valid?
method onDidChange
onDidChange: (callback: (event: MarkerChangedEvent) => void) => Disposable;
Invoke the given callback when the state of the marker changes.
method onDidDestroy
onDidDestroy: (callback: () => void) => Disposable;
Invoke the given callback when the marker is destroyed.
method plantTail
plantTail: () => boolean;
Plants the marker's tail at the current head position. Returns a boolean indicating whether or not the marker was updated.
method setHeadPosition
setHeadPosition: (position: PointCompatible) => boolean;
Sets the head position of the marker. Returns a boolean indicating whether or not the marker was updated.
method setRange
setRange: ( range: RangeCompatible, params?: { reversed?: boolean | undefined; exclusive?: boolean | undefined }) => boolean;
Sets the range of the marker. Returns a boolean indicating whether or not the marker was updated.
method setTailPosition
setTailPosition: (position: PointCompatible) => boolean;
Sets the tail position of the marker. Returns a boolean indicating whether or not the marker was updated.
interface MarkerChangedEvent
interface MarkerChangedEvent {}
property hadTail
hadTail: boolean;
Boolean indicating whether the marker had a tail before the change.
property hasTail
hasTail: boolean;
Boolean indicating whether the marker now has a tail.
property isValid
isValid: boolean;
Boolean indicating whether the marker is now valid.
property newHeadPosition
newHeadPosition: Point;
Point representing the new head position.
property newProperties
newProperties: object;
-DEPRECATED- Object containing the marker's custom properties after the change.
Deprecated
property newTailPosition
newTailPosition: Point;
Point representing the new tail position.
property oldHeadPosition
oldHeadPosition: Point;
Point representing the former head position.
property oldProperties
oldProperties: object;
-DEPRECATED- Object containing the marker's custom properties before the change.
Deprecated
property oldTailPosition
oldTailPosition: Point;
Point representing the former tail position.
property textChanged
textChanged: boolean;
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.
property wasValid
wasValid: boolean;
Boolean indicating whether the marker was valid before the change.
interface MarkerLayer
interface MarkerLayer {}
Experimental: A container for a related set of markers.
property id
readonly id: string;
The identifier for this MarkerLayer.
method clear
clear: () => void;
Remove all markers from this layer.
method copy
copy: () => MarkerLayer;
Create a copy of this layer with markers in the same state and locations.
method destroy
destroy: () => boolean;
Destroy this layer.
method findMarkers
findMarkers: (params: FindMarkerOptions) => Marker[];
Find markers in the layer conforming to the given parameters.
method getMarker
getMarker: (id: number) => Marker | undefined;
Get an existing marker by its id.
method getMarkerCount
getMarkerCount: () => number;
Get the number of markers in the marker layer.
method getMarkers
getMarkers: () => Marker[];
Get all existing markers on the marker layer.
method getRole
getRole: () => string | undefined;
Get the role of the marker layer e.g. "atom.selection".
method isDestroyed
isDestroyed: () => boolean;
Determine whether this layer has been destroyed.
method markPosition
markPosition: ( position: PointCompatible, options?: { invalidate?: | 'never' | 'surround' | 'overlap' | 'inside' | 'touch' | undefined; exclusive?: boolean | undefined; }) => Marker;
Create a marker at with its head at the given position with no tail.
method markRange
markRange: ( range: RangeCompatible, options?: { reversed?: boolean | undefined; invalidate?: | 'never' | 'surround' | 'overlap' | 'inside' | 'touch' | undefined; exclusive?: boolean | undefined; }) => Marker;
Create a marker with the given range.
method onDidCreateMarker
onDidCreateMarker: (callback: (marker: Marker) => void) => Disposable;
Subscribe to be notified synchronously whenever markers are created on this layer.
method onDidDestroy
onDidDestroy: (callback: () => void) => Disposable;
Subscribe to be notified synchronously when this layer is destroyed.
method onDidUpdate
onDidUpdate: (callback: () => void) => Disposable;
Subscribe to be notified asynchronously whenever markers are created, updated, or destroyed on this layer.
interface MenuManager
interface MenuManager {}
Provides a registry for menu items that you'd like to appear in the application menu.
interface MenuOptions
interface MenuOptions {}
interface NodeProcessOptions
interface NodeProcessOptions {}
property args
args?: readonly string[] | undefined;
The array of arguments to pass to the command.
property command
command: string;
The command to execute.
property options
options?: SpawnProcessOptions | undefined;
The options object to pass to Node's ChildProcess.spawn method.
method exit
exit: (code: number) => void;
The callback which receives a single argument containing the exit status.
method stderr
stderr: (data: string) => void;
The callback that receives a single argument which contains the standard error output from the command.
method stdout
stdout: (data: string) => void;
The callback that receives a single argument which contains the standard output from the command.
interface NotificationManager
interface NotificationManager {}
A notification manager used to create Notifications to be shown to the user.
method addError
addError: (message: string, options?: ErrorNotificationOptions) => Notification;
Add an error notification.
method addFatalError
addFatalError: ( message: string, options?: ErrorNotificationOptions) => Notification;
Add a fatal error notification.
method addInfo
addInfo: (message: string, options?: NotificationOptions) => Notification;
Add an informational notification.
method addSuccess
addSuccess: (message: string, options?: NotificationOptions) => Notification;
Add a success notification.
method addWarning
addWarning: (message: string, options?: NotificationOptions) => Notification;
Add a warning notification.
method clear
clear: () => void;
Clear all the notifications.
method getNotifications
getNotifications: () => readonly Notification[];
Get all the notifications.
method onDidAddNotification
onDidAddNotification: ( callback: (notification: Notification) => void) => Disposable;
Invoke the given callback after a notification has been added.
method onDidClearNotifications
onDidClearNotifications: (callback: () => void) => Disposable;
Invoke the given callback after the notifications have been cleared.
interface NotificationOptions
interface NotificationOptions {}
property buttons
buttons?: | Array<{ className?: string | undefined; onDidClick?(event: MouseEvent): void; text?: string | undefined; }> | undefined;
property description
description?: string | undefined;
property detail
detail?: string | undefined;
property dismissable
dismissable?: boolean | undefined;
property icon
icon?: string | undefined;
interface Package
interface Package {}
Loads and activates a package's main module and resources such as stylesheets, keymaps, grammar, editor properties, and menus.
property name
readonly name: string;
The name of the Package.
property path
readonly path: string;
The path to the Package on disk.
method getBuildFailureOutput
getBuildFailureOutput: () => string | null;
If a previous rebuild failed, get the contents of stderr.
method isCompatible
isCompatible: () => boolean;
Are all native modules depended on by this package correctly compiled against the current version of Atom?
method onDidDeactivate
onDidDeactivate: (callback: () => void) => Disposable;
Invoke the given callback when all packages have been activated.
method rebuild
rebuild: () => Promise<{ code: number; stdout: string; stderr: string }>;
Rebuild native modules in this package's dependencies for the current version of Atom.
interface PackageManager
interface PackageManager {}
Package manager for coordinating the lifecycle of Atom packages.
method activatePackage
activatePackage: (nameOrPath: string) => Promise<Package>;
Activate a single package by name or path.
method deactivatePackage
deactivatePackage: ( nameOrPath: string, suppressSerialization?: boolean) => Promise<void>;
Deactivate a single package by name or path.
method disablePackage
disablePackage: (name: string) => Package | undefined;
Disable the package with the given name.
method enablePackage
enablePackage: (name: string) => Package | undefined;
Enable the package with the given name.
method getActivePackage
getActivePackage: (name: string) => Package | undefined;
Get the active Package with the given name.
method getActivePackages
getActivePackages: () => Package[];
Get an Array of all the active Packages.
method getApmPath
getApmPath: () => string;
Get the path to the apm command.
method getAvailablePackageMetadata
getAvailablePackageMetadata: () => string[];
Returns an Array of strings of all the available package metadata.
method getAvailablePackageNames
getAvailablePackageNames: () => string[];
Returns an Array of strings of all the available package names.
method getAvailablePackagePaths
getAvailablePackagePaths: () => string[];
Returns an Array of strings of all the available package paths.
method getLoadedPackage
getLoadedPackage: (name: string) => Package | undefined;
Get the loaded Package with the given name.
method getLoadedPackages
getLoadedPackages: () => Package[];
Get an Array of all the loaded Packages.
method getPackageDirPaths
getPackageDirPaths: () => string[];
Get the paths being used to look for packages.
method hasActivatedInitialPackages
hasActivatedInitialPackages: () => boolean;
Returns a boolean indicating whether package activation has occurred.
method hasLoadedInitialPackages
hasLoadedInitialPackages: () => boolean;
Returns a boolean indicating whether package loading has occurred.
method isBundledPackage
isBundledPackage: (name: string) => boolean;
Is the package with the given name bundled with Atom?
method isPackageActive
isPackageActive: (name: string) => boolean;
Is the Package with the given name active?
method isPackageDisabled
isPackageDisabled: (name: string) => boolean;
Is the package with the given name disabled?
method isPackageLoaded
isPackageLoaded: (name: string) => boolean;
Is the package with the given name loaded?
method onDidActivateInitialPackages
onDidActivateInitialPackages: (callback: () => void) => Disposable;
Invoke the given callback when all packages have been activated.
method onDidActivatePackage
onDidActivatePackage: (callback: (package: Package) => void) => Disposable;
Invoke the given callback when a package is activated.
method onDidDeactivatePackage
onDidDeactivatePackage: (callback: (package: Package) => void) => Disposable;
Invoke the given callback when a package is deactivated.
method onDidLoadInitialPackages
onDidLoadInitialPackages: (callback: () => void) => Disposable;
Invoke the given callback when all packages have been loaded.
method onDidLoadPackage
onDidLoadPackage: (callback: (package: Package) => void) => Disposable;
Invoke the given callback when a package is loaded.
method onDidTriggerActivationHook
onDidTriggerActivationHook: (hook: string, callback: () => void) => Disposable;
Undocumented: invoke the given callback when an activation hook is triggered
method onDidUnloadPackage
onDidUnloadPackage: (callback: (package: Package) => void) => Disposable;
Invoke the given callback when a package is unloaded.
method resolvePackagePath
resolvePackagePath: (name: string) => string | undefined;
Resolve the given package name to a path on disk.
method triggerActivationHook
triggerActivationHook: (hook: string) => void;
Triggers the given package activation hook.
method triggerDeferredActivationHooks
triggerDeferredActivationHooks: () => void;
Trigger all queued activation hooks immediately.
interface Pane
interface Pane {}
A container for presenting content in the center of the workspace.
method activate
activate: () => void;
Makes this pane the active pane, causing it to gain focus.
method activateItem
activateItem: (item: object, options?: { pending: boolean }) => void;
Make the given item active, causing it to be displayed by the pane's view.
method activateItemAtIndex
activateItemAtIndex: (index: number) => void;
Activate the item at the given index.
method activateItemForURI
activateItemForURI: (uri: string) => boolean;
Activate the first item that matches the given URI.
method activateNextItem
activateNextItem: () => void;
Makes the next item active.
method activatePreviousItem
activatePreviousItem: () => void;
Makes the previous item active.
method addItem
addItem: ( item: object, options?: { index?: number | undefined; pending?: boolean | undefined }) => object;
Add the given item to the pane.
method addItems
addItems: (items: object[], index?: number) => object[];
Add the given items to the pane.
method destroy
destroy: () => void;
Close the pane and destroy all its items.
method destroyActiveItem
destroyActiveItem: () => Promise<boolean>;
Destroy the active item and activate the next item.
method destroyInactiveItems
destroyInactiveItems: () => Promise<boolean[]>;
Destroy all items except for the active item.
method destroyItem
destroyItem: (item: object, force?: boolean) => Promise<boolean>;
Destroy the given item.
method destroyItems
destroyItems: () => Promise<boolean[]>;
Destroy all items.
method getActiveItem
getActiveItem: () => object;
Get the active pane item in this pane.
method getActiveItemIndex
getActiveItemIndex: () => number;
Get the index of the active item.
method getItems
getItems: () => object[];
Get the items in this pane.
method isActive
isActive: () => boolean;
Determine whether the pane is active.
method isDestroyed
isDestroyed: () => boolean;
Determine whether this pane has been destroyed.
method itemAtIndex
itemAtIndex: (index: number) => object | undefined;
Return the item at the given index.
method itemForURI
itemForURI: (uri: string) => object | undefined;
Return the first item that matches the given URI or undefined if none exists.
method moveItem
moveItem: (item: object, index: number) => void;
Move the given item to the given index.
method moveItemLeft
moveItemLeft: () => void;
Move the active tab to the left.
method moveItemRight
moveItemRight: () => void;
Move the active tab to the right.
method moveItemToPane
moveItemToPane: (item: object, pane: Pane, index: number) => void;
Move the given item to the given index on another pane.
method observeActive
observeActive: (callback: (active: boolean) => void) => Disposable;
Invoke the given callback with the current and future values of the ::isActive property.
method observeActiveItem
observeActiveItem: (callback: (activeItem: object) => void) => Disposable;
Invoke the given callback with the current and future values of ::getActiveItem.
method observeFlexScale
observeFlexScale: (callback: (flexScale: number) => void) => Disposable;
Invoke the given callback with the current and future values of ::getFlexScale.
method observeItems
observeItems: (callback: (item: object) => void) => Disposable;
Invoke the given callback with all current and future items.
method onChooseLastMRUItem
onChooseLastMRUItem: ( callback: (previousRecentlyUsedItem: object) => void) => Disposable;
Invoke the given callback when ::activatePreviousRecentlyUsedItem has been called, either initiating or continuing a reverse MRU traversal of pane items.
method onChooseNextMRUItem
onChooseNextMRUItem: ( callback: (nextRecentlyUsedItem: object) => void) => Disposable;
Invoke the given callback when ::activateNextRecentlyUsedItem has been called, either initiating or continuing a forward MRU traversal of pane items.
method onDidActivate
onDidActivate: (callback: () => void) => Disposable;
Invoke the given callback when the pane is activated.
method onDidAddItem
onDidAddItem: ( callback: (event: PaneListItemShiftedEvent) => void) => Disposable;
Invoke the given callback when an item is added to the pane.
method onDidChangeActive
onDidChangeActive: (callback: (active: boolean) => void) => Disposable;
Invoke the given callback when the value of the ::isActive property changes.
method onDidChangeActiveItem
onDidChangeActiveItem: (callback: (activeItem: object) => void) => Disposable;
Invoke the given callback when the value of ::getActiveItem changes.
method onDidChangeFlexScale
onDidChangeFlexScale: (callback: (flexScale: number) => void) => Disposable;
Invoke the given callback when the pane resizes.
method onDidDestroy
onDidDestroy: (callback: () => void) => Disposable;
Invoke the given callback when the pane is destroyed.
method onDidMoveItem
onDidMoveItem: (callback: (event: PaneItemMovedEvent) => void) => Disposable;
Invoke the given callback when an item is moved within the pane.
method onDidRemoveItem
onDidRemoveItem: ( callback: (event: PaneListItemShiftedEvent) => void) => Disposable;
Invoke the given callback when an item is removed from the pane.
method onDoneChoosingMRUItem
onDoneChoosingMRUItem: (callback: () => void) => Disposable;
Invoke the given callback when ::moveActiveItemToTopOfStack has been called, terminating an MRU traversal of pane items and moving the current active item to the top of the stack. Typically bound to a modifier (e.g. CTRL) key up event.
method onWillDestroy
onWillDestroy: (callback: () => void) => Disposable;
Invoke the given callback before the pane is destroyed.
method onWillDestroyItem
onWillDestroyItem: ( callback: (event: PaneListItemShiftedEvent) => void) => Disposable;
Invoke the given callback before items are destroyed.
method onWillRemoveItem
onWillRemoveItem: ( callback: (event: PaneListItemShiftedEvent) => void) => Disposable;
Invoke the given callback before an item is removed from the pane.
method saveActiveItem
saveActiveItem: <T = void>( nextAction?: (error?: Error) => T) => Promise<T> | undefined;
Save the active item.
method saveActiveItemAs
saveActiveItemAs: <T = void>( nextAction?: (error?: Error) => T) => Promise<T> | undefined;
Prompt the user for a location and save the active item with the path they select.
method saveItem
saveItem: <T = void>( item: object, nextAction?: (error?: Error) => T) => Promise<T> | undefined;
Save the given item.
method saveItemAs
saveItemAs: <T = void>( item: object, nextAction?: (error?: Error) => T) => Promise<T> | undefined;
Prompt the user for a location and save the active item with the path they select.
method saveItems
saveItems: () => void;
Save all items.
method splitDown
splitDown: (params?: { items?: object[] | undefined; copyActiveItem?: boolean | undefined;}) => Pane;
Creates a new pane below the receiver.
method splitLeft
splitLeft: (params?: { items?: object[] | undefined; copyActiveItem?: boolean | undefined;}) => Pane;
Create a new pane to the left of this pane.
method splitRight
splitRight: (params?: { items?: object[] | undefined; copyActiveItem?: boolean | undefined;}) => Pane;
Create a new pane to the right of this pane.
method splitUp
splitUp: (params?: { items?: object[] | undefined; copyActiveItem?: boolean | undefined;}) => Pane;
Creates a new pane above the receiver.
interface PaneItemMovedEvent
interface PaneItemMovedEvent {}
interface PaneItemObservedEvent
interface PaneItemObservedEvent {}
interface PaneItemOpenedEvent
interface PaneItemOpenedEvent extends PaneItemObservedEvent {}
property uri
uri: string;
interface Panel
interface Panel<T = object> {}
A container representing a panel on the edges of the editor window. You should not create a Panel directly, instead use Workspace::addTopPanel and friends to add panels.
property visible
readonly visible: boolean;
Whether or not the Panel is visible.
method destroy
destroy: () => void;
Destroy and remove this panel from the UI.
method getItem
getItem: () => T;
Returns the panel's item.
method getPriority
getPriority: () => number;
Returns a number indicating this panel's priority.
method hide
hide: () => void;
Hide this panel.
method isVisible
isVisible: () => boolean;
Returns a boolean true when the panel is visible.
method onDidChangeVisible
onDidChangeVisible: (callback: (visible: boolean) => void) => Disposable;
Invoke the given callback when the pane hidden or shown.
method onDidDestroy
onDidDestroy: (callback: (panel: Panel<T>) => void) => Disposable;
Invoke the given callback when the pane is destroyed.
method show
show: () => void;
Show this panel.
interface PaneListItemShiftedEvent
interface PaneListItemShiftedEvent {}
interface PartialKeybindingMatchEvent
interface PartialKeybindingMatchEvent {}
property keyboardEventTarget
keyboardEventTarget: Element;
DOM element that was the target of the most recent keyboard event.
property keystrokes
keystrokes: string;
The string of keystrokes that matched the binding.
property partiallyMatchedBindings
partiallyMatchedBindings: KeyBinding[];
The KeyBindings that the keystrokes partially matched.
interface PathWatcher
interface PathWatcher extends DisposableLike {}
Manage a subscription to filesystem events that occur beneath a root directory.
method dispose
dispose: () => void;
Unsubscribe all subscribers from filesystem events. Native resources will be released asynchronously, but this watcher will stop broadcasting events immediately.
method getStartPromise
getStartPromise: () => Promise<void>;
Return a Promise that will resolve when the underlying native watcher is ready to begin sending events.
method onDidError
onDidError: (callback: (error: Error) => void) => Disposable;
Invokes a function when any errors related to this watcher are reported.
interface PathWatchErrorThrownEvent
interface PathWatchErrorThrownEvent {}
interface PixelPosition
interface PixelPosition {}
interface PointLike
interface PointLike {}
The interface that should be implemented for all "point-compatible" objects.
interface PreventableExceptionThrownEvent
interface PreventableExceptionThrownEvent extends ExceptionThrownEvent {}
method preventDefault
preventDefault: () => void;
interface ProcessOptions
interface ProcessOptions extends NodeProcessOptions {}
property autoStart
autoStart?: boolean | undefined;
Whether the command will automatically start when this BufferedProcess is created.
interface Project
interface Project {}
Represents a project that's opened in Atom.
method addPath
addPath: (projectPath: string) => void;
Add a path to the project's list of root paths.
method contains
contains: (pathToCheck: string) => boolean;
Determines whether the given path (real or symbolic) is inside the project's directory.
method getDirectories
getDirectories: () => Directory[];
Get an Array of Directorys associated with this project.
method getPaths
getPaths: () => string[];
Get an Array of strings containing the paths of the project's directories.
method getRepositories
getRepositories: () => GitRepository[];
Get an Array of GitRepositorys associated with the project's directories.
This method will be removed in 2.0 because it does synchronous I/O.
method getWatcherPromise
getWatcherPromise: (projectPath: string) => Promise<PathWatcher>;
Access a promise that resolves when the filesystem watcher associated with a project root directory is ready to begin receiving events.
method observeBuffers
observeBuffers: (callback: (buffer: TextBuffer) => void) => Disposable;
Invoke the given callback with all current and future text buffers in the project.
method observeRepositories
observeRepositories: ( callback: (repository: GitRepository) => void) => Disposable;
Invoke the given callback with all current and future repositories in the project.
method onDidAddBuffer
onDidAddBuffer: (callback: (buffer: TextBuffer) => void) => Disposable;
Invoke the given callback when a text buffer is added to the project.
method onDidAddRepository
onDidAddRepository: ( callback: (repository: GitRepository) => void) => Disposable;
Invoke the given callback when a repository is added to the project.
method onDidChangeFiles
onDidChangeFiles: ( callback: (events: FilesystemChangeEvent) => void) => Disposable;
Invoke a callback when a filesystem change occurs within any open project path.
method onDidChangePaths
onDidChangePaths: (callback: (projectPaths: string[]) => void) => Disposable;
Invoke the given callback when the project paths change.
method onDidReplace
onDidReplace: ( callback: (projectSpec: ProjectSpecification | null | undefined) => void) => Disposable;
Invoke a callback whenever the project's configuration has been replaced.
method relativize
relativize: (fullPath: string) => string;
Get the relative path from the project directory to the given path.
method relativizePath
relativizePath: (fullPath: string) => [string | null, string];
Get the path to the project directory that contains the given path, and the relative path from that project directory to the given path.
method removePath
removePath: (projectPath: string) => void;
Remove a path from the project's list of root paths.
method repositoryForDirectory
repositoryForDirectory: (directory: Directory) => Promise<GitRepository | null>;
Get the repository for a given directory asynchronously.
method setPaths
setPaths: (projectPaths: string[]) => void;
Set the paths of the project's directories.
interface ProjectHistory
interface ProjectHistory {}
property lastOpened
lastOpened: Date;
property paths
paths: string[];
interface ProjectSpecification
interface ProjectSpecification {}
property config
config?: ConfigValues | undefined;
property originPath
originPath: string;
property paths
paths: string[];
interface RangeLike
interface RangeLike {}
The interface that should be implemented for all "range-compatible" objects.
interface ReadonlyEditOptions
interface ReadonlyEditOptions {}
property bypassReadOnly
bypassReadOnly?: boolean | undefined;
Whether the readonly protections on the text editor should be ignored.
interface RepoStatusChangedEvent
interface RepoStatusChangedEvent {}
property path
path: string;
property pathStatus
pathStatus: number;
This value can be passed to ::isStatusModified or ::isStatusNew to get more information.
interface ScanContextOptions
interface ScanContextOptions {}
property leadingContextLineCount
leadingContextLineCount?: number | undefined;
The number of lines before the matched line to include in the results object.
property trailingContextLineCount
trailingContextLineCount?: number | undefined;
The number of lines after the matched line to include in the results object.
interface ScandalResult
interface ScandalResult {}
interface ScopeDescriptor
interface ScopeDescriptor {}
Wraps an array of strings. The Array describes a path from the root of the syntax tree to a token including all scope names for the entire path.
method getScopesArray
getScopesArray: () => readonly string[];
Returns all scopes for this descriptor.
interface Selection
interface Selection {}
Represents a selection in the TextEditor.
method addSelectionAbove
addSelectionAbove: () => void;
Moves the selection up one row.
method addSelectionBelow
addSelectionBelow: () => void;
Moves the selection down one row.
method autoIndentSelectedRows
autoIndentSelectedRows: (options?: ReadonlyEditOptions) => void;
Sets the indentation level of all selected rows to values suggested by the relevant grammars.
method backspace
backspace: (options?: ReadonlyEditOptions) => void;
Removes the first character before the selection if the selection is empty otherwise it deletes the selection.
method clear
clear: (options?: { autoscroll?: boolean | undefined }) => void;
Clears the selection, moving the marker to the head.
method compare
compare: (otherSelection: Selection) => number;
Compare this selection's buffer range to another selection's buffer range. See Range::compare for more details.
method copy
copy: (maintainClipboard?: boolean, fullLine?: boolean) => void;
Copies the current selection to the clipboard.
method cut
cut: ( maintainClipboard?: boolean, fullLine?: boolean, options?: ReadonlyEditOptions) => void;
Copies the selection to the clipboard and then deletes it.
method cutToEndOfBufferLine
cutToEndOfBufferLine: ( maintainClipboard?: boolean, options?: ReadonlyEditOptions) => void;
Cuts the selection until the end of the buffer line.
method cutToEndOfLine
cutToEndOfLine: ( maintainClipboard?: boolean, options?: ReadonlyEditOptions) => void;
Cuts the selection until the end of the screen line.
method delete
delete: (options?: ReadonlyEditOptions) => void;
Removes the selection or the next character after the start of the selection if the selection is empty.
method deleteLine
deleteLine: (options?: ReadonlyEditOptions) => void;
Removes the line at the beginning of the selection if the selection is empty unless the selection spans multiple lines in which case all lines are removed.
method deleteSelectedText
deleteSelectedText: (options?: ReadonlyEditOptions) => void;
Removes only the selected text.
method deleteToBeginningOfLine
deleteToBeginningOfLine: (options?: ReadonlyEditOptions) => void;
Removes from the beginning of the line which the selection begins on all the way through to the end of the selection.
method deleteToBeginningOfSubword
deleteToBeginningOfSubword: (options?: ReadonlyEditOptions) => void;
Removes the selection or all characters from the start of the selection to the end of the current word if nothing is selected.
method deleteToBeginningOfWord
deleteToBeginningOfWord: (options?: ReadonlyEditOptions) => void;
Removes from the start of the selection to the beginning of the current word if the selection is empty otherwise it deletes the selection.
method deleteToEndOfLine
deleteToEndOfLine: (options?: ReadonlyEditOptions) => void;
If the selection is empty, removes all text from the cursor to the end of the line. If the cursor is already at the end of the line, it removes the following newline. If the selection isn't empty, only deletes the contents of the selection.
method deleteToEndOfSubword
deleteToEndOfSubword: (options?: ReadonlyEditOptions) => void;
Removes the selection or all characters from the start of the selection to the end of the current word if nothing is selected.
method deleteToEndOfWord
deleteToEndOfWord: (options?: ReadonlyEditOptions) => void;
Removes the selection or all characters from the start of the selection to the end of the current word if nothing is selected.
method deleteToNextWordBoundary
deleteToNextWordBoundary: (options?: ReadonlyEditOptions) => void;
Removes the selection or, if nothing is selected, then all characters from the start of the selection up to the next word boundary.
method deleteToPreviousWordBoundary
deleteToPreviousWordBoundary: (options?: ReadonlyEditOptions) => void;
Removes the selection or, if nothing is selected, then all characters from the start of the selection back to the previous word boundary.
method expandOverLine
expandOverLine: () => void;
Expands the newest selection to include the entire line on which the cursor currently rests. It also includes the newline character.
method expandOverWord
expandOverWord: () => void;
Expands the newest selection to include the entire word on which the cursors rests.
method fold
fold: () => void;
Creates a fold containing the current selection.
method getBufferRange
getBufferRange: () => Range;
Returns the buffer Range for the selection.
method getBufferRowRange
getBufferRowRange: () => [number, number];
Returns the starting and ending buffer rows the selection is highlighting.
method getScreenRange
getScreenRange: () => Range;
Returns the screen Range for the selection.
method getText
getText: () => string;
Returns the text in the selection.
method indentSelectedRows
indentSelectedRows: (options?: ReadonlyEditOptions) => void;
If the selection spans multiple rows, indent all of them.
method insertText
insertText: ( text: string, options?: TextInsertionOptions & ReadonlyEditOptions) => void;
Replaces text at the current selection.
method intersectsBufferRange
intersectsBufferRange: (bufferRange: RangeLike) => boolean;
Identifies if a selection intersects with a given buffer range.
method intersectsWith
intersectsWith: (otherSelection: Selection) => boolean;
Identifies if a selection intersects with another selection.
method isEmpty
isEmpty: () => boolean;
Determines if the selection contains anything.
method isReversed
isReversed: () => boolean;
Determines if the ending position of a marker is greater than the starting position. This can happen when, for example, you highlight text "up" in a TextBuffer.
method isSingleScreenLine
isSingleScreenLine: () => boolean;
Returns whether the selection is a single line or not.
method joinLines
joinLines: (options?: ReadonlyEditOptions) => void;
Joins the current line with the one below it. Lines will be separated by a single space. If there selection spans more than one line, all the lines are joined together.
method merge
merge: ( otherSelection: Selection, options?: { preserveFolds?: boolean | undefined; autoscroll?: boolean | undefined; }) => void;
Combines the given selection into this selection and then destroys the given selection.
method onDidChangeRange
onDidChangeRange: ( callback: (event: SelectionChangedEvent) => void) => Disposable;
Calls your callback when the selection was moved.
method onDidDestroy
onDidDestroy: (callback: () => void) => Disposable;
Calls your callback when the selection was destroyed.
method outdentSelectedRows
outdentSelectedRows: (options?: ReadonlyEditOptions) => void;
Removes one level of indent from the currently selected rows.
method selectAll
selectAll: () => void;
Selects all the text in the buffer.
method selectDown
selectDown: (rowCount?: number) => void;
Selects all the text one position below the cursor.
method selectLeft
selectLeft: (columnCount?: number) => void;
Selects the text one position left of the cursor.
method selectLine
selectLine: (row: number) => void;
Selects an entire line in the buffer.
method selectRight
selectRight: (columnCount?: number) => void;
Selects the text one position right of the cursor.
method selectToBeginningOfLine
selectToBeginningOfLine: () => void;
Selects all the text from the current cursor position to the beginning of the line.
method selectToBeginningOfNextParagraph
selectToBeginningOfNextParagraph: () => void;
Selects all the text from the current cursor position to the beginning of the next paragraph.
method selectToBeginningOfNextWord
selectToBeginningOfNextWord: () => void;
Selects all the text from the current cursor position to the beginning of the next word.
method selectToBeginningOfPreviousParagraph
selectToBeginningOfPreviousParagraph: () => void;
Selects all the text from the current cursor position to the beginning of the previous paragraph.
method selectToBeginningOfWord
selectToBeginningOfWord: () => void;
Selects all the text from the current cursor position to the beginning of the word.
method selectToBottom
selectToBottom: () => void;
Selects all the text from the current cursor position to the bottom of the buffer.
method selectToBufferPosition
selectToBufferPosition: (position: PointCompatible) => void;
Selects the text from the current cursor position to a given buffer position.
method selectToEndOfBufferLine
selectToEndOfBufferLine: () => void;
Selects all the text from the current cursor position to the end of the buffer line.
method selectToEndOfLine
selectToEndOfLine: () => void;
Selects all the text from the current cursor position to the end of the screen line.
method selectToEndOfWord
selectToEndOfWord: () => void;
Selects all the text from the current cursor position to the end of the word.
method selectToFirstCharacterOfLine
selectToFirstCharacterOfLine: () => void;
Selects all the text from the current cursor position to the first character of the line.
method selectToNextSubwordBoundary
selectToNextSubwordBoundary: () => void;
Selects text to the next subword boundary.
method selectToNextWordBoundary
selectToNextWordBoundary: () => void;
Selects text to the next word boundary.
method selectToPreviousSubwordBoundary
selectToPreviousSubwordBoundary: () => void;
Selects text to the previous subword boundary.
method selectToPreviousWordBoundary
selectToPreviousWordBoundary: () => void;
Selects text to the previous word boundary.
method selectToScreenPosition
selectToScreenPosition: (position: PointCompatible) => void;
Selects the text from the current cursor position to a given screen position.
method selectToTop
selectToTop: () => void;
Selects all the text from the current cursor position to the top of the buffer.
method selectUp
selectUp: (rowCount?: number) => void;
Selects all the text one position above the cursor.
method selectWord
selectWord: () => void;
Modifies the selection to encompass the current word.
method setBufferRange
setBufferRange: ( bufferRange: RangeCompatible, options?: { reversed?: boolean | undefined; preserveFolds?: boolean | undefined; autoscroll?: boolean | undefined; }) => void;
Modifies the buffer Range for the selection.
method setScreenRange
setScreenRange: ( screenRange: RangeCompatible, options?: { preserveFolds?: boolean | undefined; autoscroll?: boolean | undefined; }) => void;
Modifies the screen range for the selection.
method toggleLineComments
toggleLineComments: (options?: ReadonlyEditOptions) => void;
Wraps the selected lines in comments if they aren't currently part of a comment. Removes the comment if they are currently wrapped in a comment.
interface SelectionChangedEvent
interface SelectionChangedEvent {}
property newBufferRange
newBufferRange: Range;
property newScreenRange
newScreenRange: Range;
property oldBufferRange
oldBufferRange: Range;
property oldScreenRange
oldScreenRange: Range;
property selection
selection: Selection;
interface SharedDecorationOptions
interface SharedDecorationOptions {}
property avoidOverflow
avoidOverflow?: boolean | undefined;
Only applicable to decorations of type overlay. Determines whether the decoration adjusts its horizontal or vertical position to remain fully visible when it would otherwise overflow the editor. Defaults to true.
property class
class?: string | undefined;
This CSS class will be applied to the decorated line number, line, highlight, or overlay.
property item
item?: object | undefined;
An HTMLElement or a model Object with a corresponding view registered. Only applicable to the gutter, overlay and block types.
property omitEmptyLastRow
omitEmptyLastRow?: boolean | undefined;
If false, the decoration will be applied to the last row of a non-empty range, even if it ends at column 0. Defaults to true. Only applicable to the gutter, line, and line-number decoration types.
property onlyEmpty
onlyEmpty?: boolean | undefined;
If true, the decoration will only be applied if the associated DisplayMarker is empty. Only applicable to the gutter, line, and line-number types.
property onlyHead
onlyHead?: boolean | undefined;
If true, the decoration will only be applied to the head of the DisplayMarker. Only applicable to the line and line-number types.
property onlyNonEmpty
onlyNonEmpty?: boolean | undefined;
If true, the decoration will only be applied if the associated DisplayMarker is non-empty. Only applicable to the gutter, line, and line-number types.
property order
order?: number | undefined;
Only applicable to decorations of type block. Controls where the view is positioned relative to other block decorations at the same screen row. If unspecified, block decorations render oldest to newest.
property position
position?: 'head' | 'tail' | 'before' | 'after' | undefined;
Only applicable to decorations of type overlay and block. Controls where the view is positioned relative to the TextEditorMarker. Values can be 'head' (the default) or 'tail' for overlay decorations, and 'before' (the default) or 'after' for block decorations.
property style
style?: object | undefined;
An Object containing CSS style properties to apply to the relevant DOM node. Currently this only works with a type of cursor or text.
interface SpawnProcessOptions
interface SpawnProcessOptions {}
property cwd
cwd?: string | undefined;
Current working directory of the child process.
property detached
detached?: boolean | undefined;
Prepare child to run independently of its parent process.
property env
env?: { [key: string]: string } | undefined;
Environment key-value pairs.
property gid
gid?: number | undefined;
Sets the group identity of the process.
property shell
shell?: boolean | string | undefined;
If true, runs command inside of a shell. Uses "/bin/sh" on UNIX, and process.env.ComSpec on Windows. A different shell can be specified as a string.
property stdio
stdio?: string | Array<string | number> | undefined;
The child's stdio configuration.
property uid
uid?: number | undefined;
Sets the user identity of the process.
interface StyleElementObservedEvent
interface StyleElementObservedEvent extends HTMLStyleElement {}
property context
context: string;
property sourcePath
sourcePath: string;
interface StyleManager
interface StyleManager {}
A singleton instance of this class available via atom.styles, which you can use to globally query and observe the set of active style sheets.
method getStyleElements
getStyleElements: () => HTMLStyleElement[];
Get all loaded style elements.
method getUserStyleSheetPath
getUserStyleSheetPath: () => string;
Get the path of the user style sheet in ~/.atom.
method observeStyleElements
observeStyleElements: ( callback: (styleElement: StyleElementObservedEvent) => void) => Disposable;
Invoke callback for all current and future style elements.
method onDidAddStyleElement
onDidAddStyleElement: ( callback: (styleElement: StyleElementObservedEvent) => void) => Disposable;
Invoke callback when a style element is added.
method onDidRemoveStyleElement
onDidRemoveStyleElement: ( callback: (styleElement: HTMLStyleElement) => void) => Disposable;
Invoke callback when a style element is removed.
method onDidUpdateStyleElement
onDidUpdateStyleElement: ( callback: (styleElement: StyleElementObservedEvent) => void) => Disposable;
Invoke callback when an existing style element is updated.
interface TestRunnerParams
interface TestRunnerParams {}
property headless
headless: boolean;
A boolean indicating whether or not the tests are being run from the command line via atom --test.
property logFile
logFile: string;
An optional path to a log file to which test output should be logged.
property testPaths
testPaths: string[];
An array of paths to tests to run. Could be paths to files or directories.
method buildAtomEnvironment
buildAtomEnvironment: (options: BuildEnvironmentOptions) => AtomEnvironment;
A function that can be called to construct an instance of the atom global. No atom global will be explicitly assigned, but you can assign one in your runner if desired.
method buildDefaultApplicationDelegate
buildDefaultApplicationDelegate: () => object;
A function that builds a default instance of the application delegate, suitable to be passed as the applicationDelegate parameter to buildAtomEnvironment.
interface TextBufferFileBackend
interface TextBufferFileBackend {}
method createReadStream
createReadStream: () => ReadStream;
A {Function} that returns a
Readable
stream that can be used to load the file's content.
method createWriteStream
createWriteStream: () => WriteStream;
A {Function} that returns a
Writable
stream that can be used to save content to the file.
method existsSync
existsSync: () => boolean;
A {Function} that returns a {Boolean}, true if the file exists, false otherwise.
method getPath
getPath: () => string;
A {Function} that returns the {String} path to the file.
method onDidChange
onDidChange: (callback: () => void) => Disposable;
A {Function} that invokes its callback argument when the file changes. The method should return a {Disposable} that can be used to prevent further calls to the callback.
method onDidDelete
onDidDelete: (callback: () => void) => Disposable;
A {Function} that invokes its callback argument when the file is deleted. The method should return a {Disposable} that can be used to prevent further calls to the callback.
method onDidRename
onDidRename: (callback: () => void) => Disposable;
A {Function} that invokes its callback argument when the file is renamed. The method should return a {Disposable} that can be used to prevent further calls to the callback.
interface TextChange
interface TextChange {}
interface TextEditOptions
interface TextEditOptions {}
property normalizeLineEndings
normalizeLineEndings?: boolean | undefined;
If true, all line endings will be normalized to match the editor's current mode.
property undo
undo?: 'skip' | undefined;
If skip, skips the undo stack for this operation.
Deprecated
Call groupLastChanges() on the TextBuffer afterward instead.
interface TextEditorComponent
interface TextEditorComponent {}
Undocumented: Rendering component for TextEditor
method pixelPositionForMouseEvent
pixelPositionForMouseEvent: (event: { clientX: number; clientY: number;}) => PixelPosition;
method pixelPositionForScreenPosition
pixelPositionForScreenPosition: (screenPosition: PointLike) => PixelPosition;
Does not clip screenPosition, unlike similar method on TextEditorElement
method screenPositionForMouseEvent
screenPositionForMouseEvent: (event: { clientX: number; clientY: number;}) => Point;
method screenPositionForPixelPosition
screenPositionForPixelPosition: (pos: PixelPosition) => Point;
interface TextEditorElement
interface TextEditorElement extends HTMLElement {}
Undocumented: Custom HTML elemnent for TextEditor, atom-text-editor
method getBaseCharacterWidth
getBaseCharacterWidth: () => number;
Extended: get the width of an
x
character displayed in this element.
method getComponent
getComponent: () => TextEditorComponent;
method getModel
getModel: () => TextEditor;
method getNextUpdatePromise
getNextUpdatePromise: () => Promise<void>;
Extended: Get a promise that resolves the next time the element's DOM is updated in any way.
method getScrollHeight
getScrollHeight: () => number;
method getScrollLeft
getScrollLeft: () => number;
method getScrollTop
getScrollTop: () => number;
method hasFocus
hasFocus: () => boolean;
method onDidAttach
onDidAttach: (callback: () => void) => Disposable;
Called when the editor is attached to the DOM.
method onDidChangeScrollLeft
onDidChangeScrollLeft: (callback: (scrollLeft: number) => void) => Disposable;
method onDidChangeScrollTop
onDidChangeScrollTop: (callback: (scrollTop: number) => void) => Disposable;
method onDidDetach
onDidDetach: (callback: () => void) => Disposable;
Called when the editor is detached from the DOM.
method pixelPositionForBufferPosition
pixelPositionForBufferPosition: (bufferPosition: PointLike) => PixelPosition;
Extended: Converts a buffer position to a pixel position.
method pixelPositionForScreenPosition
pixelPositionForScreenPosition: (screenPosition: PointLike) => PixelPosition;
Extended: Converts a screen position to a pixel position.
method scrollToBottom
scrollToBottom: () => void;
Essential: Scrolls the editor to the bottom.
method scrollToTop
scrollToTop: () => void;
Essential: Scrolls the editor to the top.
method setScrollLeft
setScrollLeft: (scrollLeft: number) => void;
method setScrollTop
setScrollTop: (scrollTop: number) => void;
interface TextEditorObservedEvent
interface TextEditorObservedEvent {}
interface TextEditorRegistry
interface TextEditorRegistry {}
Experimental: This global registry tracks registered TextEditors.
method add
add: (editor: TextEditor) => Disposable;
Register a TextEditor.
method clear
clear: () => void;
Remove all editors from the registry.
method clearGrammarOverride
clearGrammarOverride: (editor: TextEditor) => void;
Remove any grammar override that has been set for the given TextEditor.
method getGrammarOverride
getGrammarOverride: (editor: TextEditor) => string | null;
Retrieve the grammar scope name that has been set as a grammar override for the given TextEditor.
method maintainConfig
maintainConfig: (editor: TextEditor) => Disposable;
Keep a TextEditor's configuration in sync with Atom's settings.
method maintainGrammar
maintainGrammar: (editor: TextEditor) => Disposable;
Set a TextEditor's grammar based on its path and content, and continue to update its grammar as gramamrs are added or updated, or the editor's file path changes.
method observe
observe: (callback: (editor: TextEditor) => void) => Disposable;
Invoke the given callback with all the current and future registered TextEditors.
method remove
remove: (editor: TextEditor) => boolean;
Remove the given TextEditor from the registry.
method setGrammarOverride
setGrammarOverride: (editor: TextEditor, scopeName: string) => void;
Force a TextEditor to use a different grammar than the one that would otherwise be selected for it.
interface TextInsertionOptions
interface TextInsertionOptions extends TextEditOptions {}
property autoDecreaseIndent
autoDecreaseIndent?: boolean | undefined;
If true, decreases indent level appropriately (for example, when a closing bracket is inserted).
property autoIndent
autoIndent?: boolean | undefined;
If true, indents all inserted text appropriately.
property autoIndentNewline
autoIndentNewline?: boolean | undefined;
If true, indent newline appropriately.
property preserveTrailingLineIndentation
preserveTrailingLineIndentation?: boolean | undefined;
By default, when pasting multiple lines, Atom attempts to preserve the relative indent level between the first line and trailing lines, even if the indent level of the first line has changed from the copied text. If this option is true, this behavior is suppressed.
property select
select?: boolean | undefined;
If true, selects the newly added text.
interface ThemeManager
interface ThemeManager {}
Handles loading and activating available themes.
method getActiveThemeNames
getActiveThemeNames: () => string[] | undefined;
Returns an Array of strings all the active theme names.
method getActiveThemes
getActiveThemes: () => Package[] | undefined;
Returns an Array of all the active themes.
method getEnabledThemeNames
getEnabledThemeNames: () => string[];
Get the enabled theme names from the config.
method getLoadedThemeNames
getLoadedThemeNames: () => string[] | undefined;
Returns an Array of strings of all the loaded theme names.
method getLoadedThemes
getLoadedThemes: () => Package[] | undefined;
Returns an Array of all the loaded themes.
method onDidChangeActiveThemes
onDidChangeActiveThemes: (callback: () => void) => Disposable;
Invoke callback when style sheet changes associated with updating the list of active themes have completed.
interface TimingMarker
interface TimingMarker {}
interface TokenizeLineResult
interface TokenizeLineResult {}
Result returned by
Grammar.tokenizeLine
.
property line
line: string;
The string of text that was tokenized.
property ruleStack
ruleStack: GrammarRule[];
An array of rules representing the tokenized state at the end of the line. These should be passed back into this method when tokenizing the next line in the file.
property tags
tags: Array<number | string>;
An array of integer scope ids and strings. Positive ids indicate the beginning of a scope, and negative tags indicate the end. To resolve ids to scope names, call GrammarRegistry::scopeForId with the absolute value of the id.
property tokens
tokens: GrammarToken[];
This is a dynamic property. Invoking it will incur additional overhead, but will automatically translate the
tags
into token objects withvalue
andscopes
properties.
interface Tooltip
interface Tooltip {}
This tooltip class is derived from Bootstrap 3, but modified to not require jQuery, which is an expensive dependency we want to eliminate.
property element
readonly element: HTMLElement;
property enabled
readonly enabled: boolean;
property hoverState
readonly hoverState: 'in' | 'out' | null;
property options
readonly options: TooltipOptions;
property timeout
readonly timeout: number;
method disable
disable: () => void;
method enable
enable: () => void;
method getArrowElement
getArrowElement: () => HTMLElement;
method getTitle
getTitle: () => string;
method getTooltipElement
getTooltipElement: () => HTMLElement;
method recalculatePosition
recalculatePosition: () => void;
method toggle
toggle: () => void;
method toggleEnabled
toggleEnabled: () => void;
interface TooltipManager
interface TooltipManager {}
Associates tooltips with HTML elements or selectors.
method add
add: ( target: HTMLElement | JQueryCompatible, options: | { item?: object | undefined } | ({ title?: string | (() => string) | undefined; html?: boolean | undefined; keyBindingCommand?: string | undefined; keyBindingTarget?: HTMLElement | undefined; } & { class?: string | undefined; placement?: | TooltipPlacement | (() => TooltipPlacement) | undefined; trigger?: 'click' | 'hover' | 'focus' | 'manual' | undefined; delay?: { show: number; hide: number } | undefined; })) => Disposable;
Add a tooltip to the given element.
method findTooltips
findTooltips: (target: HTMLElement) => Tooltip[];
Find the tooltips that have been applied to the given element.
interface TooltipOptions
interface TooltipOptions {}
The options for a Bootstrap 3 Tooltip class, which Atom uses a variant of.
property animation
animation?: boolean | undefined;
Apply a CSS fade transition to the tooltip.
property container
container?: string | HTMLElement | false | undefined;
Appends the tooltip to a specific element.
property delay
delay?: number | { show: number; hide: number } | undefined;
Delay showing and hiding the tooltip (ms) - does not apply to manual trigger type.
property html
html?: boolean | undefined;
Allow HTML in the tooltip.
property placement
placement?: 'top' | 'bottom' | 'left' | 'right' | 'auto' | undefined;
How to position the tooltip.
property selector
selector?: string | undefined;
If a selector is provided, tooltip objects will be delegated to the specified targets.
property template
template?: string | undefined;
Base HTML to use when creating the tooltip.
property title
title?: string | HTMLElement | (() => string) | undefined;
Default title value if title attribute isn't present. If a function is given, it will be called with its this reference set to the element that the tooltip is attached to.
property trigger
trigger?: string | undefined;
How tooltip is triggered - click | hover | focus | manual. You may pass multiple triggers; separate them with a space.
interface ViewRegistry
interface ViewRegistry {}
ViewRegistry handles the association between model and view types in Atom. We call this association a View Provider. As in, for a given model, this class can provide a view via ::getView, as long as the model/view association was registered via ::addViewProvider.
method addViewProvider
addViewProvider: { (createView: (model: object) => HTMLElement | undefined): Disposable; <T>( modelConstructor: new (...args: any[]) => T, createView: (instance: T) => HTMLElement ): Disposable;};
Add a provider that will be used to construct views in the workspace's view layer based on model objects in its model layer.
method getView
getView: { (obj: TextEditor): TextEditorElement; (obj: object): HTMLElement };
Get the view associated with an object in the workspace.
interface WindowLoadSettings
interface WindowLoadSettings {}
property appVersion
readonly appVersion: string;
property atomHome
readonly atomHome: string;
property devMode
readonly devMode: boolean;
property env
readonly env?: { [key: string]: string | undefined } | undefined;
property profileStartup
readonly profileStartup?: boolean | undefined;
property resourcePath
readonly resourcePath: string;
property safeMode
readonly safeMode: boolean;
interface Workspace
interface Workspace {}
Represents the state of the user interface for the entire window.
method activateNextPane
activateNextPane: () => boolean;
Make the next pane active.
method activatePreviousPane
activatePreviousPane: () => boolean;
Make the previous pane active.
method addBottomPanel
addBottomPanel: <T>(options: { item: T; visible?: boolean | undefined; priority?: number | undefined;}) => Panel<T>;
Adds a panel item to the bottom of the editor window.
method addFooterPanel
addFooterPanel: <T>(options: { item: T; visible?: boolean | undefined; priority?: number | undefined;}) => Panel<T>;
Adds a panel item to the footer.
method addHeaderPanel
addHeaderPanel: <T>(options: { item: T; visible?: boolean | undefined; priority?: number | undefined;}) => Panel<T>;
Adds a panel item to the header.
method addLeftPanel
addLeftPanel: <T>(options: { item: T; visible?: boolean | undefined; priority?: number | undefined;}) => Panel<T>;
Adds a panel item to the left of the editor window.
method addModalPanel
addModalPanel: <T>(options: { item: T; visible?: boolean | undefined; priority?: number | undefined; autoFocus?: boolean | FocusableHTMLElement | undefined;}) => Panel<T>;
Adds a panel item as a modal dialog.
method addOpener
addOpener: ( opener: ( uri: string, options?: WorkspaceOpenOptions ) => ViewModel | undefined) => Disposable;
Register an opener for a URI.
method addRightPanel
addRightPanel: <T>(options: { item: T; visible?: boolean | undefined; priority?: number | undefined;}) => Panel<T>;
Adds a panel item to the right of the editor window.
method addTopPanel
addTopPanel: <T>(options: { item: T; visible?: boolean | undefined; priority?: number | undefined;}) => Panel<T>;
Adds a panel item to the top of the editor window above the tabs.
method buildTextEditor
buildTextEditor: (params: object) => TextEditor;
Create a new text editor.
method createItemForURI
createItemForURI: (uri: string) => Promise<object | TextEditor>;
Creates a new item that corresponds to the provided URI. If no URI is given, or no registered opener can open the URI, a new empty TextEditor will be created.
method getActivePane
getActivePane: () => Pane;
Get the active Pane.
method getActivePaneContainer
getActivePaneContainer: () => Dock | WorkspaceCenter;
Get the most recently focused pane container.
method getActivePaneItem
getActivePaneItem: () => object;
Get the active Pane's active item.
method getActiveTextEditor
getActiveTextEditor: () => TextEditor | undefined;
Get the workspace center's active item if it is a TextEditor.
method getBottomDock
getBottomDock: () => Dock;
Get the Dock below the editor window.
method getBottomPanels
getBottomPanels: () => Panel[];
Get an Array of all the panel items at the bottom of the editor window.
method getCenter
getCenter: () => WorkspaceCenter;
Get the WorkspaceCenter at the center of the editor window.
method getFooterPanels
getFooterPanels: () => Panel[];
Get an Array of all the panel items in the footer.
method getHeaderPanels
getHeaderPanels: () => Panel[];
Get an Array of all the panel items in the header.
method getLeftDock
getLeftDock: () => Dock;
Get the Dock to the left of the editor window.
method getLeftPanels
getLeftPanels: () => Panel[];
Get an Array of all the panel items to the left of the editor window.
method getModalPanels
getModalPanels: () => Panel[];
Get an Array of all the modal panel items.
method getPaneContainers
getPaneContainers: () => [WorkspaceCenter, Dock, Dock, Dock];
Returns all Pane containers.
method getPaneItems
getPaneItems: () => object[];
Get all pane items in the workspace.
method getPanes
getPanes: () => Pane[];
Get all panes in the workspace.
method getRightDock
getRightDock: () => Dock;
Get the Dock to the right of the editor window.
method getRightPanels
getRightPanels: () => Panel[];
Get an Array of all the panel items to the right of the editor window.
method getTextEditors
getTextEditors: () => TextEditor[];
Get all text editors in the workspace.
method getTopPanels
getTopPanels: () => Panel[];
Get an Array of all the panel items at the top of the editor window.
method hide
hide: (itemOrURI: object | string) => boolean;
Search the workspace for items matching the given URI and hide them. Returns a boolean indicating whether any items were found (and hidden).
method isTextEditor
isTextEditor: (object: object) => object is TextEditor;
Returns a boolean that is true if object is a TextEditor.
method observeActivePane
observeActivePane: (callback: (pane: Pane) => void) => Disposable;
Invoke the given callback with the current active pane and when the active pane changes.
method observeActivePaneItem
observeActivePaneItem: (callback: (item: object) => void) => Disposable;
Invoke the given callback with the current active pane item and with all future active pane items in the workspace.
method observeActiveTextEditor
observeActiveTextEditor: (callback: (editor?: TextEditor) => void) => Disposable;
Invoke the given callback with the current active text editor (if any), with all future active text editors, and when there is no longer an active text editor.
method observePaneItems
observePaneItems: (callback: (item: object) => void) => Disposable;
Invoke the given callback with all current and future panes items in the workspace.
method observePanes
observePanes: (callback: (pane: Pane) => void) => Disposable;
Invoke the given callback with all current and future panes in the workspace.
method observeTextEditors
observeTextEditors: (callback: (editor: TextEditor) => void) => Disposable;
Invoke the given callback with all current and future text editors in the workspace.
method onDidAddPane
onDidAddPane: (callback: (event: { pane: Pane }) => void) => Disposable;
Invoke the given callback when a pane is added to the workspace.
method onDidAddPaneItem
onDidAddPaneItem: ( callback: (event: PaneItemObservedEvent) => void) => Disposable;
Invoke the given callback when a pane item is added to the workspace.
method onDidAddTextEditor
onDidAddTextEditor: ( callback: (event: TextEditorObservedEvent) => void) => Disposable;
Invoke the given callback when a text editor is added to the workspace.
method onDidChangeActivePane
onDidChangeActivePane: (callback: (pane: Pane) => void) => Disposable;
Invoke the given callback when the active pane changes.
method onDidChangeActivePaneItem
onDidChangeActivePaneItem: (callback: (item: object) => void) => Disposable;
Invoke the given callback when the active pane item changes.
method onDidChangeActiveTextEditor
onDidChangeActiveTextEditor: ( callback: (editor?: TextEditor) => void) => Disposable;
Invoke the given callback when a text editor becomes the active text editor and when there is no longer an active text editor.
method onDidDestroyPane
onDidDestroyPane: (callback: (event: { pane: Pane }) => void) => Disposable;
Invoke the given callback when a pane is destroyed in the workspace.
method onDidDestroyPaneItem
onDidDestroyPaneItem: ( callback: (event: PaneItemObservedEvent) => void) => Disposable;
Invoke the given callback when a pane item is destroyed.
method onDidOpen
onDidOpen: (callback: (event: PaneItemOpenedEvent) => void) => Disposable;
Invoke the given callback whenever an item is opened. Unlike ::onDidAddPaneItem, observers will be notified for items that are already present in the workspace when they are reopened.
method onDidStopChangingActivePaneItem
onDidStopChangingActivePaneItem: ( callback: (item: object) => void) => Disposable;
Invoke the given callback when the active pane item stops changing.
method onWillDestroyPane
onWillDestroyPane: (callback: (event: { pane: Pane }) => void) => Disposable;
Invoke the given callback before a pane is destroyed in the workspace.
method onWillDestroyPaneItem
onWillDestroyPaneItem: ( callback: (event: PaneItemObservedEvent) => void | Promise<void>) => Disposable;
Invoke the given callback when a pane item is about to be destroyed, before the user is prompted to save it.
Parameter callback
The function to be called before pane items are destroyed. If this function returns a Promise, then the item will not be destroyed until the promise resolves.
method open
open: { (uri: string, options?: WorkspaceOpenOptions): Promise<object>; <T extends ViewModel = ViewModel>( item: T, options?: WorkspaceOpenOptions ): Promise<T>; (): Promise<TextEditor>;};
Opens the given URI in Atom asynchronously. If the URI is already open, the existing item for that URI will be activated. If no URI is given, or no registered opener can open the URI, a new empty TextEditor will be created.
Opens the given item in Atom asynchronously. If the item is already open, the existing item will be activated. If no item is given, a new empty TextEditor will be created.
method paneContainerForItem
paneContainerForItem: (item: object) => Dock | WorkspaceCenter | undefined;
Get the first pane container that contains the given item.
method paneContainerForURI
paneContainerForURI: (uri: string) => Dock | WorkspaceCenter | undefined;
Get the first pane container that contains an item with the given URI.
method paneForItem
paneForItem: (item: object) => Pane | undefined;
Get the Pane containing the given item.
method paneForURI
paneForURI: (uri: string) => Pane | undefined;
Get the first Pane with an item for the given URI.
method panelForItem
panelForItem: <T>(item: T) => Panel<T> | null;
Returns the Panel associated with the given item or null when the item has no panel.
method reopenItem
reopenItem: () => Promise<object | undefined>;
Asynchronously reopens the last-closed item's URI if it hasn't already been reopened.
method replace
replace: ( regex: RegExp, replacementText: string, filePaths: readonly string[], iterator: (result: { filePath: string | undefined; replacements: number; }) => void) => Promise<void>;
Performs a replace across all the specified files in the project.
method scan
scan: { ( regex: RegExp, iterator: (result: ScandalResult) => void ): CancellablePromise<string | null>; ( regex: RegExp, options: WorkspaceScanOptions, iterator: (result: ScandalResult) => void ): CancellablePromise<string>;};
Performs a search across all files in the workspace.
method toggle
toggle: (itemOrURI: object | string) => Promise<void>;
Search the workspace for items matching the given URI. If any are found, hide them. Otherwise, open the URL. Returns a Promise that resolves when the item is shown or hidden.
interface WorkspaceCenter
interface WorkspaceCenter {}
The central container for the editor window capable of holding items.
method activateNextPane
activateNextPane: () => void;
Make the next pane active.
method activatePreviousPane
activatePreviousPane: () => void;
Make the previous pane active.
method destroyActivePane
destroyActivePane: () => void;
Destroy (close) the active pane.
method getActivePane
getActivePane: () => Pane;
Get the active Pane.
method getActivePaneItem
getActivePaneItem: () => object | undefined;
Get the active Pane's active item.
method getActiveTextEditor
getActiveTextEditor: () => TextEditor | undefined;
Get the active item if it is an TextEditor.
method getPaneItems
getPaneItems: () => object[];
Get all pane items in the workspace center.
method getPanes
getPanes: () => Pane[];
Get all panes in the workspace center.
method getTextEditors
getTextEditors: () => TextEditor[];
Get all text editors in the workspace center.
method observeActivePane
observeActivePane: (callback: (pane: Pane) => void) => Disposable;
Invoke the given callback with the current active pane and when the active pane changes.
method observeActivePaneItem
observeActivePaneItem: (callback: (item: object) => void) => Disposable;
Invoke the given callback with the current active pane item and with all future active pane items in the workspace center.
method observePaneItems
observePaneItems: (callback: (item: object) => void) => Disposable;
Invoke the given callback with all current and future panes items in the workspace center.
method observePanes
observePanes: (callback: (pane: Pane) => void) => Disposable;
Invoke the given callback with all current and future panes in the workspace center.
method observeTextEditors
observeTextEditors: (callback: (editor: TextEditor) => void) => Disposable;
Invoke the given callback with all current and future text editors in the workspace center.
method onDidAddPane
onDidAddPane: (callback: (event: { pane: Pane }) => void) => Disposable;
Invoke the given callback when a pane is added to the workspace center.
method onDidAddPaneItem
onDidAddPaneItem: ( callback: (event: PaneItemObservedEvent) => void) => Disposable;
Invoke the given callback when a pane item is added to the workspace center.
method onDidAddTextEditor
onDidAddTextEditor: ( callback: (event: TextEditorObservedEvent) => void) => Disposable;
Invoke the given callback when a text editor is added to the workspace center.
method onDidChangeActivePane
onDidChangeActivePane: (callback: (pane: Pane) => void) => Disposable;
Invoke the given callback when the active pane changes.
method onDidChangeActivePaneItem
onDidChangeActivePaneItem: (callback: (item: object) => void) => Disposable;
Invoke the given callback when the active pane item changes.
method onDidDestroyPane
onDidDestroyPane: (callback: (event: { pane: Pane }) => void) => Disposable;
Invoke the given callback when a pane is destroyed in the workspace center.
method onDidDestroyPaneItem
onDidDestroyPaneItem: ( callback: (event: PaneItemObservedEvent) => void) => Disposable;
Invoke the given callback when a pane item is destroyed.
method onDidStopChangingActivePaneItem
onDidStopChangingActivePaneItem: ( callback: (item: object) => void) => Disposable;
Invoke the given callback when the active pane item stops changing.
method onWillDestroyPane
onWillDestroyPane: (callback: (event: { pane: Pane }) => void) => Disposable;
Invoke the given callback before a pane is destroyed in the workspace center.
method onWillDestroyPaneItem
onWillDestroyPaneItem: ( callback: (event: PaneItemObservedEvent) => void | Promise<void>) => Disposable;
Invoke the given callback when a pane item is about to be destroyed, before the user is prompted to save it.
Parameter callback
The function to be called before pane items are destroyed. If this function returns a Promise, then the item will not be destroyed until the promise resolves.
method paneForItem
paneForItem: (item: object) => Pane | undefined;
Retrieve the Pane associated with the given item.
method paneForURI
paneForURI: (uri: string) => Pane | undefined;
Retrieve the Pane associated with the given URI.
method saveAll
saveAll: () => void;
Save all pane items.
interface WorkspaceOpenOptions
interface WorkspaceOpenOptions {}
property activateItem
activateItem?: boolean | undefined;
A boolean indicating whether to call Pane::activateItem on containing pane. Defaults to true.
property activatePane
activatePane?: boolean | undefined;
A boolean indicating whether to call Pane::activate on containing pane. Defaults to true.
property initialColumn
initialColumn?: number | undefined;
A number indicating which column to move the cursor to initially. Defaults to 0.
property initialLine
initialLine?: number | undefined;
A number indicating which row to move the cursor to initially. Defaults to 0.
property location
location?: 'left' | 'right' | 'bottom' | 'center' | undefined;
A String containing the name of the location in which this item should be opened. If omitted, Atom will fall back to the last location in which a user has placed an item with the same URI or, if this is a new URI, the default location specified by the item. NOTE: This option should almost always be omitted to honor user preference.
property pending
pending?: boolean | undefined;
A Boolean indicating whether or not the item should be opened in a pending state. Existing pending items in a pane are replaced with new pending items when they are opened.
property searchAllPanes
searchAllPanes?: boolean | undefined;
A boolean. If true, the workspace will attempt to activate an existing item for the given URI on any pane. If false, only the active pane will be searched for an existing item for the same URI. Defaults to false.
property split
split?: 'left' | 'right' | 'up' | 'down' | undefined;
Either 'left', 'right', 'up' or 'down'. If 'left', the item will be opened in leftmost pane of the current active pane's row. If 'right', the item will be opened in the rightmost pane of the current active pane's row. If only one pane exists in the row, a new pane will be created. If 'up', the item will be opened in topmost pane of the current active pane's column. If 'down', the item will be opened in the bottommost pane of the current active pane's column. If only one pane exists in the column, a new pane will be created.
interface WorkspaceScanOptions
interface WorkspaceScanOptions {}
property leadingContextLineCount
leadingContextLineCount?: number | undefined;
The number of lines before the matched line to include in the results object.
property paths
paths?: readonly string[] | undefined;
An array of glob patterns to search within.
property trailingContextLineCount
trailingContextLineCount?: number | undefined;
The number of lines after the matched line to include in the results object.
method onPathsSearched
onPathsSearched: (pathsSearched: number) => void;
A function to be periodically called with the number of paths searched.
Type Aliases
type CommandRegistryListener
type CommandRegistryListener<TargetType extends EventTarget> = | { didDispatch(event: CommandEvent<TargetType>): void | Promise<void>; displayName?: string | undefined; description?: string | undefined; hiddenInCommandPalette?: boolean | undefined; } | ((event: CommandEvent<TargetType>) => void | Promise<void>);
type ContextMenuOptions
type ContextMenuOptions = ContextMenuItemOptions | { type: 'separator' };
type FileEncoding
type FileEncoding = | 'iso88596' // Arabic (ISO 8859-6) | 'windows1256' // Arabic (Windows 1256) | 'iso88594' // Baltic (ISO 8859-4) | 'windows1257' // Baltic (Windows 1257) | 'iso885914' // Celtic (ISO 8859-14) | 'iso88592' // Central European (ISO 8859-2) | 'windows1250' // Central European (Windows 1250) | 'gb18030' // Chinese (GB18030) | 'gbk' // Chinese (GBK) | 'cp950' // Traditional Chinese (Big5) | 'big5hkscs' // Traditional Chinese (Big5-HKSCS) | 'cp866' // Cyrillic (CP 866) | 'iso88595' // Cyrillic (ISO 8859-5) | 'koi8r' // Cyrillic (KOI8-R) | 'koi8u' // Cyrillic (KOI8-U) | 'windows1251' // Cyrillic (Windows 1251) | 'cp437' // DOS (CP 437) | 'cp850' // DOS (CP 850) | 'iso885913' // Estonian (ISO 8859-13) | 'iso88597' // Greek (ISO 8859-7) | 'windows1253' // Greek (Windows 1253) | 'iso88598' // Hebrew (ISO 8859-8) | 'windows1255' // Hebrew (Windows 1255) | 'cp932' // Japanese (CP 932) | 'eucjp' // Japanese (EUC-JP) | 'shiftjis' // Japanese (Shift JIS) | 'euckr' // Korean (EUC-KR) | 'iso885910' // Nordic (ISO 8859-10) | 'iso885916' // Romanian (ISO 8859-16) | 'iso88599' // Turkish (ISO 8859-9) | 'windows1254' // Turkish (Windows 1254) | 'utf8' // Unicode (UTF-8) | 'utf16le' // Unicode (UTF-16 LE) | 'utf16be' // Unicode (UTF-16 BE) | 'windows1258' // Vietnamese (Windows 1258) | 'iso88591' // Western (ISO 8859-1) | 'iso88593' // Western (ISO 8859-3) | 'iso885915' // Western (ISO 8859-15) | 'macroman' // Western (Mac Roman) | 'windows1252';
type FilesystemChange
type FilesystemChange = FilesystemChangeBasic | FilesystemChangeRename;
type FilesystemChangeEvent
type FilesystemChangeEvent = FilesystemChange[];
type FocusableHTMLElement
type FocusableHTMLElement = HTMLElement | string | { (): HTMLElement };
The type used by the
focus-trap
library to target a specific DOM node.A DOM node, a selector string (which will be passed to
document.querySelector()
to find the DOM node), or a function that returns a DOM node.
type PointCompatible
type PointCompatible = PointLike | [number, number];
The types usable when constructing a point via the Point::fromObject method.
type RangeCompatible
type RangeCompatible = | RangeLike | [PointLike, PointLike] | [PointLike, [number, number]] | [[number, number], PointLike] | [[number, number], [number, number]];
The types usable when constructing a range via the Range::fromObject method.
type TestRunner
type TestRunner = (params: TestRunnerParams) => Promise<number>;
An interface which all custom test runners should implement.
type TooltipPlacement
type TooltipPlacement = | 'top' | 'bottom' | 'left' | 'right' | 'auto' | 'auto top' | 'auto bottom' | 'auto left' | 'auto right';
Namespaces
namespace global
namespace global {}
variable atom
const atom: AtomEnvironment;
interface HTMLElementTagNameMap
interface HTMLElementTagNameMap {}
property "atom-text-editor"
'atom-text-editor': TextEditorElement;
Package Files (57)
- dependencies/event-kit/index.d.ts
- dependencies/first-mate/src/grammar.d.ts
- dependencies/pathwatcher/src/directory.d.ts
- dependencies/pathwatcher/src/file.d.ts
- dependencies/text-buffer/src/display-marker-layer.d.ts
- dependencies/text-buffer/src/display-marker.d.ts
- dependencies/text-buffer/src/helpers.d.ts
- dependencies/text-buffer/src/marker-layer.d.ts
- dependencies/text-buffer/src/marker.d.ts
- dependencies/text-buffer/src/point.d.ts
- dependencies/text-buffer/src/range.d.ts
- dependencies/text-buffer/src/text-buffer.d.ts
- index.d.ts
- src/atom-environment.d.ts
- src/buffered-node-process.d.ts
- src/buffered-process.d.ts
- src/clipboard.d.ts
- src/color.d.ts
- src/command-registry.d.ts
- src/config-schema.d.ts
- src/config.d.ts
- src/context-menu-manager.d.ts
- src/cursor.d.ts
- src/decoration.d.ts
- src/deserializer-manager.d.ts
- src/dock.d.ts
- src/get-window-load-settings.d.ts
- src/git-repository.d.ts
- src/grammar-registry.d.ts
- src/gutter.d.ts
- src/history-manager.d.ts
- src/keymap-extensions.d.ts
- src/layer-decoration.d.ts
- src/menu-manager.d.ts
- src/notification-manager.d.ts
- src/notification.d.ts
- src/other-types.d.ts
- src/package-manager.d.ts
- src/package.d.ts
- src/pane.d.ts
- src/panel.d.ts
- src/path-watcher.d.ts
- src/project.d.ts
- src/scope-descriptor.d.ts
- src/selection.d.ts
- src/style-manager.d.ts
- src/task.d.ts
- src/text-editor-component.d.ts
- src/text-editor-element.d.ts
- src/text-editor-registry.d.ts
- src/text-editor.d.ts
- src/theme-manager.d.ts
- src/tooltip-manager.d.ts
- src/tooltip.d.ts
- src/view-registry.d.ts
- src/workspace-center.d.ts
- src/workspace.d.ts
Dependencies (1)
Dev Dependencies (0)
No dev dependencies.
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/atom
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/atom)
- HTML<a href="https://www.jsdocs.io/package/@types/atom"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 17427 ms. - Missing or incorrect documentation? Open an issue for this package.