@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

Interfaces

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.

      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.

      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 the endRow, 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 e