03 / Reference

Lumine API reference

Explore the classes and methods you can use to extend Lumine.

Version 1.0.0 · 74 classes · 2 objects · 1621 documented members

Public API

Environmentsrc/environment.js:95

Lumine global for dealing with packages, themes, menus, and the window.

An instance of this class is always available as the lumine global.

Properties33

Public API

ApplicationServicesrc/application-service.js:12

Main-process application services exposed as serializable values.

Application Information8

PublicL28#

PublicL42#

PublicL54#

PublicL66#

PublicL78#

PublicL92#

PublicL105#

PublicL117#

Application Lifecycle2

PublicL133#

PublicL274#

System Integration4

PublicL160#

PublicL177#

PublicL190#

PublicL261#

Printing1

PublicL213#

Protocol Handling2

PublicL230#

PublicL245#

Extended API

BufferedNodeProcesssrc/buffered-node-process.js:19

Extends BufferedProcess

Like BufferedProcess, but accepts a Node script as the command to run.

Full description

This is necessary on Windows since it doesn’t support shebang #! lines.

Examples#

  const {BufferedNodeProcess} = require('lumine')

Methods1

ExtendedL31#

Construction1

PublicL56#

Extended API

BufferedProcesssrc/buffered-process.js:25

A wrapper which provides standard error/output line buffering for Node’s ChildProcess.

Full description

Examples#

const {BufferedProcess} = require('lumine')

const command = 'ps'
const args = ['-ef']
const stdout = (output) => console.log(output)
const exit = (code) => console.log(`ps -ef exited with ${code}`)
const process = new BufferedProcess({command, args, stdout, exit})

Construction1

PublicL51#

Event Subscription1

PublicL125#

Process Control1

PublicL235#

Extended API

Clipboardsrc/clipboard.js:39

Represents the clipboard used for copying and pasting in Lumine.

Full description

An instance of this class is always available as the lumine.clipboard global.

This class owns what the clipboard holds, not what a paste does with it. To intercept a paste before the editor inserts it as text — to handle an image, say — register a provider with PasteProviderRegistry through lumine.pasteProviders.

It is also the only supported route to the native clipboard from a package: Electron exposes its Promise-based clipboard only in the main process, so every programmatic read and write here crosses the process boundary (see src/clipboard-bridge.js). Native ClipboardEvents use a synchronous DataTransfer-backed adapter for the duration of the event.

Examples#

await lumine.clipboard.write('hello')

console.log(await lumine.clipboard.read()) // 'hello'

Reading and Writing Text3

PublicL83#

PublicL326#

PublicL438#

Native Data2

asyncPublicL249#

asyncPublicL275#

Find Pasteboard2

PublicL343#

PublicL355#

Images2

PublicL374#

PublicL387#

Primary Selection2

PublicL403#

PublicL416#

Essential API

Colorsrc/color.js:11

A simple color class returned from Config#get when the value at the key path is of type ‘color’.

Methods3

EssentialL21#

EssentialL111#

EssentialL125#

Public API

CommandRegistrysrc/command-registry.js:54

Associates listener functions with commands in a context-sensitive way using CSS selectors. You can access a global instance of this class via lumine.commands, and commands registered there will be presented in the command palette.

Full description

The global command registry facilitates a style of event handling known as event delegation that was popularized by jQuery. Lumine commands are expressed as custom DOM events that can be invoked on the currently focused element via a key binding or manually via the command palette. Rather than binding listeners for command events directly to DOM nodes, you instead register command event listeners globally on lumine.commands and constrain them to specific kinds of elements with CSS selectors.

Command names must follow the namespace:action pattern, where namespace will typically be the name of your package, and action describes the behavior of your command. If either part consists of multiple words, these must be separated by hyphens. E.g. awesome-package:turn-it-up-to-eleven. All words should be lowercased.

As the event bubbles upward through the DOM, all registered event listeners with matching selectors are invoked in order of specificity. In the event of a specificity tie, the most recently registered listener is invoked first. This mirrors the “cascade” semantics of CSS. Event listeners are invoked in the context of the current DOM node, meaning this always points at event.currentTarget. As is normally the case with DOM events, stopPropagation and stopImmediatePropagation can be used to terminate the bubbling process and prevent invocation of additional listeners.

Example#

Here is a command that inserts the current date in an editor:

lumine.commands.add('lumine-text-editor', {
  'user:insert-date'(event) {
    const editor = this.getModel()
    editor.insertText(new Date().toLocaleString())
  }
})

Registering Commands1

PublicL153#

Accessing Commands5

PublicL275#

PublicL329#

ExperimentalL373#

ExperimentalL445#

ExperimentalL482#

Dispatching Commands1

PublicL543#

Event Subscription4

PublicL563#

PublicL577#

PublicL594#

PublicL609#

Essential API

CompositeDisposablelib/composite-disposable.js:31

An object that aggregates multiple Disposable instances into a single disposable, so they can all be disposed as a group.

Full description

These are very useful when subscribing to multiple events.

Examples#

const { CompositeDisposable } = require("lumine");

class Something {
  constructor() {
    this.disposables = new CompositeDisposable();
    const editor = lumine.workspace.getActiveTextEditor();
    this.disposables.add(editor.onDidChange(() => {}));
    this.disposables.add(editor.onDidChangePath(() => {}));
  }

  destroy() {
    this.disposables.dispose();
  }
}

Construction and Destruction2

PublicL44#

PublicL62#

Managing Disposables4

PublicL104#

PublicL122#

Essential API

Configsrc/config.js:435

Used to access all of Lumine’s configuration details.

Full description

An instance of this class is always available as the lumine.config global.

Getting and setting config settings.#

// Note that with no value set, ::get returns the setting's default value.
lumine.config.get('my-package.myKey') // -> 'defaultValue'

lumine.config.set('my-package.myKey', 'value')
lumine.config.get('my-package.myKey') // -> 'value'

// Change only this window until it reloads, without saving to config.json.
lumine.config.set('my-package.myKey', 'temporary', { local: true })
lumine.config.unset('my-package.myKey', { local: true })

You may want to watch for changes. Use #observe to catch changes to the setting.

lumine.config.set('my-package.myKey', 'value')
lumine.config.observe('my-package.myKey', (newValue) => {
  // `observe` calls immediately and every time the value is changed
  console.log('My configuration changed:', newValue)
})

If you want a notification only when the value changes, use #onDidChange.

lumine.config.onDidChange('my-package.myKey', ({ newValue, oldValue }) => {
  console.log('My configuration changed:', newValue, oldValue)
})

Value Coercion#

Config settings each have a type specified by way of a schema. For example we might want an integer setting that only allows integers greater than 0:

// When no value has been set, `::get` returns the setting's default value
lumine.config.get('my-package.anInt') // -> 12

// The string will be coerced to the integer 123
lumine.config.set('my-package.anInt', '123')
lumine.config.get('my-package.anInt') // -> 123

// The string will be coerced to an integer, but it must be greater than 0, so is set to 1
lumine.config.set('my-package.anInt', '-20')
lumine.config.get('my-package.anInt') // -> 1

Defining settings for your package#

Declare a configSchema in your package’s package.json:

{
  "name": "my-package",
  "configSchema": {
    "someInt": {
      "title": "Some Int",
      "description": "How many of the thing to do.",
      "type": "integer",
      "minimum": 1,
      "default": 23
    }
  }
}

The schema is read before the package activates, so its settings appear in the settings view and its defaults apply whether or not the package has been loaded yet. Export a config object from the package’s main module only when the schema cannot be written down ahead of time and has to be built at runtime.

See the package tutorial for more info.

Config Schemas#

We use json schema which allows you to define your value’s default, the type it should be, etc. Every example below is the value of the configSchema key. A simple one, providing an enableThing and a thingVolume:

{
  "enableThing": {
    "type": "boolean",
    "default": false
  },
  "thingVolume": {
    "type": "integer",
    "minimum": 1,
    "maximum": 11,
    "default": 5
  }
}

The type keyword allows for type coercion and validation. If a thingVolume is set to a string '10', it will be coerced into an integer.

lumine.config.set('my-package.thingVolume', '10')
lumine.config.get('my-package.thingVolume') // -> 10

// It respects the min / max
lumine.config.set('my-package.thingVolume', '400')
lumine.config.get('my-package.thingVolume') // -> 11

// If it cannot be coerced, the value will not be set
lumine.config.set('my-package.thingVolume', 'cats')
lumine.config.get('my-package.thingVolume') // -> 11

Supported Types#

The type keyword can be a string with any one of the following. You can also chain them by specifying multiple in an array. For example

{
  "someSetting": {
    "type": ["boolean", "integer"],
    "default": 5
  }
}
lumine.config.set('my-package.someSetting', 'true')
lumine.config.get('my-package.someSetting') // -> true

lumine.config.set('my-package.someSetting', '12')
lumine.config.get('my-package.someSetting') // -> 12
string#

Values must be a string.

{
  "someSetting": {
    "type": "string",
    "default": "hello"
  }
}
integer#

Values will be coerced into integer. Supports the (optional) minimum and maximum keys.

{
  "someSetting": {
    "type": "integer",
    "minimum": 1,
    "maximum": 11,
    "default": 5
  }
}
number#

Values will be coerced into a number, including real numbers. Supports the (optional) minimum and maximum keys.

{
  "someSetting": {
    "type": "number",
    "minimum": 1.5,
    "maximum": 11.5,
    "default": 5.3
  }
}
boolean#

Values will be coerced into a Boolean. 'true' and 'false' will be coerced into a boolean. Numbers, arrays, objects, and anything else will not be coerced.

{
  "someSetting": {
    "type": "boolean",
    "default": false
  }
}
array#

Value must be an Array. The types of the values can be specified by a subschema in the items key. An item that does not conform to that subschema is dropped rather than rejecting the whole array. Supports the (optional) minItems and maxItems keys, which bound the length of the array that survives; a value outside those bounds is rejected and the setting keeps its previous value.

{
  "someSetting": {
    "type": "array",
    "items": {
      "type": "integer",
      "minimum": 1.5,
      "maximum": 11.5
    },
    "minItems": 1,
    "maxItems": 3,
    "default": [1, 2, 3]
  }
}
color#

Values will be coerced into a Color with red, green, blue, and alpha properties that all have numeric values. red, green, blue will be in the range 0 to 255 and value will be in the range 0 to 1. Values can be any valid CSS color format such as #abc, #abcdef, white, rgb(50, 100, 150), and rgba(25, 75, 125, .75).

{
  "someSetting": {
    "type": "color",
    "default": "white"
  }
}
object / Grouping other types#

A config setting with the type object allows grouping a set of config settings. The group will be visually separated and has its own group headline. The sub options must be listed under a properties key.

{
  "someSetting": {
    "type": "object",
    "properties": {
      "myChildIntOption": {
        "type": "integer",
        "minimum": 1.5,
        "maximum": 11.5
      }
    }
  }
}

Other Supported Keys#

enum#

All types support an enum key, which lets you specify all the values the setting can take. enum may be an array of allowed values (of the specified type), or an array of objects with value and description properties, where the value is an allowed value, and the description is a descriptive string used in the settings view.

In this example, the setting must be one of the 4 integers:

{
  "someSetting": {
    "type": "integer",
    "enum": [2, 4, 6, 8],
    "default": 4
  }
}

In this example, the setting must be either ‘foo’ or ‘bar’, which are presented using the provided descriptions in the settings pane:

{
  "someSetting": {
    "type": "string",
    "enum": [
      { "value": "foo", "description": "Foo mode. You want this." },
      { "value": "bar", "description": "Bar mode. Nobody wants that!" }
    ],
    "default": "foo"
  }
}

If you only have a few elements, you can display your enum as a list of radio buttons in the settings view rather than a select list. To do so, specify radio: true as a sibling property to the enum array.

{
  "someSetting": {
    "type": "string",
    "enum": [
      { "value": "foo", "description": "Foo mode. You want this." },
      { "value": "bar", "description": "Bar mode. Nobody wants that!" }
    ],
    "radio": true,
    "default": "foo"
  }
}

Usage:

lumine.config.set('my-package.someSetting', '2')
lumine.config.get('my-package.someSetting') // -> 2

// a value outside the enum is rejected, and the setting keeps what it had
lumine.config.set('my-package.someSetting', '3')
lumine.config.get('my-package.someSetting') // -> 2

// a value inside it is coerced to the declared type and set
lumine.config.set('my-package.someSetting', '4')
lumine.config.get('my-package.someSetting') // -> 4
title and description#

The settings view will use the title and description keys to display your config setting in a readable way. By default the settings view humanizes your config key, so someSetting becomes Some Setting. In some cases, this is confusing for users, and a more descriptive title is useful.

Descriptions will be displayed below the title in the settings view.

For a group of config settings the humanized key or the title and the description are used for the group headline.

{
  "someSetting": {
    "title": "Setting Magnitude",
    "description": "This will affect the blah and the other blah",
    "type": "integer",
    "default": 4
  }
}

Note: You should strive to be so clear in your naming of the setting that you do not need to specify a title or description!

Descriptions allow a subset of Markdown formatting. Specifically, you may use the following in configuration setting descriptions:

  • bold - **bold**
  • italics - *italics*
  • links - [links](https://lumine-code.github.io)
  • code spans - `code spans`
  • line breaks - line breaks<br/>
  • strikethrough - ~~strikethrough~~
order#

The settings view displays your settings in the order the schema declares them, so arranging the schema is all this normally takes.

An explicit order key still takes precedence where one is present, but prefer not to use it: a setting without order sorts after every setting that has one, so adding order to part of a schema reorders the rest of it too.

Manipulating values outside your configuration schema#

It is possible to manipulate(get, set, observe etc) values that do not appear in your configuration schema. For example, if the config schema of the package ‘some-package’ is

{
  "someSetting": {
    "type": "boolean",
    "default": false
  }
}

You can still do the following

const otherSetting = lumine.config.get('some-package.otherSetting')
lumine.config.set('some-package.stillAnotherSetting', otherSetting * 5)

In other words, if a function asks for a key-path, that path doesn’t have to be described in the config schema for the package or any package. However, as highlighted in the best practices section, you are advised against doing the above.

Best practices#

  • Don’t depend on (or write to) configuration keys outside of your keypath.

Config Subscription2

EssentialL550#

EssentialL595#

Managing Settings8

EssentialL687#

ExtendedL728#

EssentialL807#

EssentialL874#

ExtendedL940#

ExtendedL1157#

ExtendedL1254#

ExtendedL1293#

Extended API

ContextMenuManagersrc/context-menu-manager.js:57

Provides a registry for commands that you’d like to appear in the context menu.

Full description

An instance of this class is always available as the lumine.contextMenu global.

Context Menu Object Format#

{
  "lumine-workspace": [
    { "label": "Help", "command": "application:open-documentation" }
  ],
  "lumine-text-editor": [
    {
      "label": "History",
      "submenu": [
        { "label": "Undo", "command": "core:undo" },
        { "label": "Redo", "command": "core:redo" }
      ]
    }
  ]
}

A package declares its context menu in a file under menus/, with the structure above under a context-menu key:

{
  "context-menu": {
    "lumine-workspace": [
      { "label": "Help", "command": "application:open-documentation" }
    ]
  }
}

The format for use in #add is the same minus the context-menu key. See #add for more information.

Methods2

PublicL162#

PublicL337#

Extended API

Cursorsrc/cursor.js:16

The Cursor class represents the little blinking line identifying where text can be inserted.

Cursors belong to TextEditors and have some metadata attached in the form of a DisplayMarker.

Event Subscription2

PublicL50#

PublicL63#

Managing Cursor Position11

PublicL82#

PublicL96#

PublicL111#

PublicL125#

PublicL137#

PublicL149#

PublicL160#

PublicL172#

PublicL184#

PublicL196#

PublicL208#

Cursor Position Details9

PublicL238#

PublicL259#

PublicL284#

PublicL314#

PublicL330#

PublicL343#

PublicL355#

PublicL372#

Moving the Cursor21

PublicL391#

PublicL420#

PublicL449#

PublicL481#

PublicL517#

PublicL527#

PublicL539#

PublicL549#

PublicL562#

PublicL595#

PublicL605#

PublicL615#

PublicL625#

PublicL636#

PublicL647#

PublicL658#

PublicL669#

PublicL681#

PublicL694#

PublicL712#

PublicL723#

Local Positions and Ranges9

PublicL742#

PublicL778#

PublicL814#

PublicL858#

PublicL888#

PublicL924#

PublicL948#

PublicL962#

PublicL974#

Comparison1

PublicL996#

Selections1

PublicL1014#

Word Matching2

PublicL1028#

PublicL1047#

Essential API

Decorationsrc/decoration.js:47

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.

Full description

Decoration objects are not meant to be created directly, but created with TextEditor#decorateMarker. eg.

const range = editor.getSelectedBufferRange() // any range you like
const marker = editor.markBufferRange(range)
const decoration = editor.decorateMarker(marker, { type: 'line', class: 'my-line-class' })

Best practice for destroying the decoration is by destroying the DisplayMarker.

marker.destroy()

You should only use Decoration#destroy when you still need or do not own the marker.

Lifecycle1

EssentialL104#

Event Subscription2

EssentialL136#

EssentialL149#

Decoration Details3

EssentialL164#

EssentialL176#

PublicL189#

Properties2

EssentialL205#

EssentialL224#

Public API

DefaultDirectoryProvidersrc/default-directory-provider.js:37

Turns a project URI into a Directory, for local paths.

This is the provider Project falls back to when no package claims a URI. A package supplies its own by providing the project.directory-provider service; the methods below are the shape that contract expects.

Resolving Directories2

PublicL48#

PublicL98#

Path Normalization1

PublicL112#

Extended API

DeserializerManagersrc/deserializer-manager.js:36

Manages the deserializers used for serialized state

Full description

An instance of this class is always available as the lumine.deserializers global.

Examples#

class MyPackageView {
  static deserialize(state) {
    return new MyPackageView(state)
  }

  constructor(state) {
    this.state = state
  }

  serialize() {
    return { deserializer: 'MyPackageView', ...this.state }
  }
}

lumine.deserializers.add(MyPackageView)

Serialized state has to carry the deserializer key: it is the name #deserialize looks the class up by, and state without it is dropped with a warning rather than restored.

Methods2

PublicL52#

PublicL97#

Essential API

DisplayMarkersrc/display-marker.js:51

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.

Full description

DisplayMarker Creation#

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

Head and Tail#

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

Validity#

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

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

See TextBuffer#markRange for usage.

Lifecycle2

EssentialL72#

EssentialL121#

Event Subscription2

EssentialL155#

EssentialL190#

Marker Details6

EssentialL213#

EssentialL225#

EssentialL237#

EssentialL249#

EssentialL263#

ExtendedL602#

Properties2

EssentialL276#

EssentialL291#

Range Queries1

EssentialL305#

Comparison2

EssentialL322#

EssentialL335#

Marker Ranges18

EssentialL354#

EssentialL370#

EssentialL390#

EssentialL407#

ExtendedL419#

ExtendedL434#

ExtendedL448#

ExtendedL467#

ExtendedL479#

ExtendedL494#

ExtendedL508#

ExtendedL527#

EssentialL559#

EssentialL589#

ExtendedL615#

ExtendedL628#

Experimental API

DisplayMarkerLayersrc/display-marker-layer.js:13

A container for a related set of markers at the DisplayLayer level. Wraps an underlying MarkerLayer on the TextBuffer.

Lifecycle3

EssentialL43#

PublicL70#

EssentialL89#

Range Tracking2

ExperimentalL106#

ExperimentalL118#

Event Subscription3

PublicL135#

PublicL159#

PublicL179#

Marker Creation4

PublicL210#

PublicL229#

PublicL248#

PublicL265#

Querying4

EssentialL284#

EssentialL306#

PublicL318#

PublicL358#

Essential API

Disposablelib/disposable.js:8

A handle to a resource that can be disposed. For example, Emitter#on returns disposables representing subscriptions.

Methods1

PublicL18#

Construction and Destruction2

PublicL35#

PublicL50#

Extended API

Docksrc/dock.js:25

A container at the edges of the editor window capable of holding items. You should not create a Dock directly. Instead, access one of the three docks of the workspace via Workspace#getLeftDock, Workspace#getRightDock, and Workspace#getBottomDock or add an item to a dock via Workspace#open.

Activation1

ExtendedL142#

Visibility4

ExtendedL153#

ExtendedL169#

ExtendedL185#

ExtendedL204#

Event Subscription16

EssentialL591#

EssentialL605#

EssentialL621#

EssentialL640#

EssentialL661#

EssentialL676#

ExtendedL691#

ExtendedL707#

ExtendedL722#

ExtendedL737#

ExtendedL751#

ExtendedL766#

ExtendedL783#

ExtendedL801#

ExtendedL818#

ExtendedL832#

Pane Items2

EssentialL848#

EssentialL860#

Panes4

ExtendedL885#

ExtendedL907#

ExtendedL917#

Public API

EditorWindowsrc/editor-window.js:13

A presentation window belonging to one workspace. Documents and packages belong to the workspace; this object owns the window’s presentation lifetime.

Window Information5

PublicL58#

PublicL69#

PublicL80#

PublicL91#

PublicL442#

DOM Access3

PublicL104#

PublicL115#

PublicL144#

Frame Messaging1

ExtendedL130#

Panels4

PublicL160#

PublicL172#

PublicL185#

ExtendedL199#

Lifecycle1

PublicL242#

Event Subscription8

PublicL257#

PublicL271#

PublicL284#

PublicL296#

PublicL308#

PublicL320#

PublicL332#

PublicL344#

Window Geometry1

PublicL362#

Native Presentation2

PublicL379#

PublicL392#

Dialogs3

PublicL406#

PublicL418#

PublicL430#

Window Management6

PublicL455#

PublicL466#

PublicL477#

PublicL488#

PublicL499#

PublicL510#

Essential API

Emitterlib/emitter.js:36

Utility class to be used when implementing event-based APIs that allows handlers registered via Emitter#on to be invoked with calls to Emitter#emit. Instances of this class are intended to be used internally by classes that expose an event-based API.

Full description

For example:

class User {
  constructor() {
    this.emitter = new Emitter();
  }

  onDidChangeName(callback) {
    return this.emitter.on("did-change-name", callback);
  }

  setName(name) {
    if (name !== this.name) {
      this.name = name;
      this.emitter.emit("did-change-name", name);
    }

    return this.name;
  }
}

Construction and Destruction3

PublicL79#

PublicL90#

PublicL105#

Event Subscription3

PublicL130#

PublicL179#

PublicL210#

Event Emission1

PublicL253#

Public API

FileWatchHandlesrc/file-watch-client.js:14

A disposable observation of a fixed filesystem path. External renames do not change its path. Register callbacks immediately, then await ready.

Observation State3

PublicL39#

PublicL51#

PublicL63#

Event Subscription3

PublicL83#

PublicL96#

PublicL109#

Lifecycle1

PublicL165#

Extended API

GitRepositorysrc/git-repository.js:162

Represents the underlying git operations performed by Lumine.

Full description

This class shouldn’t be instantiated directly but instead by accessing the lumine.repositories and calling getRepositories() or getForPath(). It is independent from project roots and may represent containing or nested repos.

Examples#

Logging the URL of the origin remote#

const git = lumine.repositories.getRepositories()[0]
console.log(git.getOriginURL())

Requiring in packages#

const { GitRepository } = require('lumine')

Construction and Destruction3

asyncPublicL177#

PublicL257#

PublicL301#

Operations1

PublicL314#

Event Subscription4

PublicL333#

PublicL402#

PublicL428#

PublicL454#

Repository Details8

PublicL478#

PublicL490#

PublicL506#

PublicL518#

PublicL571#

PublicL679#

PublicL1985#

asyncPublicL2004#

References13

PublicL642#

PublicL658#

PublicL693#

PublicL715#

PublicL789#

PublicL805#

PublicL825#

PublicL844#

PublicL1634#

asyncPublicL1649#

PublicL1678#

PublicL1942#

PublicL1963#

Git Configuration2

asyncPublicL741#

PublicL759#

Reading Status10

PublicL894#

PublicL908#

PublicL923#

PublicL938#

PublicL956#

asyncPublicL972#

PublicL1000#

PublicL1569#

PublicL1584#

PublicL1603#

Retrieving Diffs2

asyncPublicL1709#

PublicL2073#

Reading History3

asyncPublicL1786#

asyncPublicL1838#

asyncPublicL2034#

Reading File Contents3

PublicL1871#

PublicL1897#

PublicL1921#

Checking Out2

asyncPublicL2129#

asyncPublicL2151#

Extended API

GrammarRegistrysrc/grammar-registry.js:29

This class holds the grammars used for tokenizing.

An instance of this class is always available as the lumine.grammars global.

Language Modes6

ExtendedL108#

ExtendedL197#

ExtendedL233#

ExtendedL292#

ExtendedL335#

ExtendedL349#

Grammar Selection3

ExtendedL455#

asyncExtendedL473#

ExtendedL596#

Event Subscription4

ExtendedL798#

ExtendedL813#

ExperimentalL831#

ExtendedL891#

Language Injections1

PublicL922#

Loading Grammars4

ExtendedL1204#

ExtendedL1221#

ExtendedL1239#

ExtendedL1262#

Grammars1

ExtendedL1285#

Extended API

Guttersrc/gutter.js:13

Represents a gutter within a TextEditor.

See TextEditor#addGutter for information on creating a gutter.

Lifecycle1

EssentialL41#

Event Subscription2

EssentialL65#

EssentialL78#

Visibility3

EssentialL93#

EssentialL108#

EssentialL124#

Decorations1

EssentialL147#

Extended API

HistoryManagersrc/history-manager.js:13

History manager for remembering which projects have been opened.

An instance of this class is always available as the lumine.history global.

The project history is used to populate recent project lists.

Recent Projects2

PublicL68#

PublicL83#

Event Subscription1

PublicL97#

Essential API

IconRegistrysrc/icon-registry.js:384

The single source of every icon the editor renders — file-type icons, the semantic names pane items return from getIconName(), and LSP symbol kinds.

Full description

Providers form a priority chain. Each is asked in turn, and returning null means “not mine, ask the next one”; core’s octicon mapping is the always present provider at the bottom, so every target resolves. Returning Icon.none() is not the same as null — it stops the chain with “no icon here”.

An instance of this class is always available as the lumine.icons global.

Icon Providers1

EssentialL554#

Resolving Icons1

EssentialL633#

Rendering Icons1

EssentialL847#

Cache Invalidation1

ExtendedL1007#

Icon Overrides2

ExtendedL1227#

ExtendedL1239#

Event Subscription1

ExtendedL1274#

Experimental API

InputDialogsrc/input-dialog.js:61

Detached query-dialog model with a mini editor and optional custom DOM content.

Full description

InputDialog owns query state, messages, sources, commands and actions without any list semantics. SelectList extends it with items, filtering, and selection. The model creates its renderer only when #getElement is first called and never inserts that element into the DOM. Use Workspace#addInputDialog when the dialog needs a modal host.

The dialog shows one message at a time, from three sources in precedence order: loadingMessage (work in flight), then status (an episodic overlay — a validation failure, a warning, a confirmation), then infoMessage (the resting line: a prompt, a help text, a stat line). The overlay never destroys the resting line, so clearing a status restores it with nothing to save and put back.

Custom DOM can be hosted through headerElement (above the query editor) and contentElement (below the messages).

Query processing is limited to 65536 UTF-16 units by default. Set maxQueryLength from 1 to 1048576 for a different protocol budget. Oversized drafts remain intact; sources and actions resume after the query fits again.

The query is the dialog’s own state. A modal host decides when a new session resets it, preserves it across modal-flow steps, and restores a previous session on request.

DOM Access1

ExperimentalL203#

Lifecycle2

ExperimentalL216#

ExperimentalL394#

Actions9

ExperimentalL279#

ExperimentalL656#

ExperimentalL672#

ExperimentalL700#

ExperimentalL727#

ExperimentalL748#

ExperimentalL793#

ExperimentalL918#

ExperimentalL1087#

Event Subscription5

ExperimentalL332#

ExperimentalL347#

ExperimentalL359#

ExperimentalL970#

ExperimentalL992#

Query11

ExperimentalL371#

ExperimentalL1253#

ExperimentalL1265#

ExperimentalL1611#

ExperimentalL1626#

ExperimentalL1647#

ExperimentalL1658#

ExperimentalL1669#

ExperimentalL1680#

ExperimentalL1691#

ExperimentalL1704#

Asynchronous Sources4

ExperimentalL454#

ExperimentalL475#

ExperimentalL493#

ExperimentalL504#

Configuration1

ExperimentalL1118#

Messages8

ExperimentalL1150#

ExperimentalL1166#

ExperimentalL1177#

ExperimentalL1188#

ExperimentalL1200#

ExperimentalL1211#

ExperimentalL1226#

ExperimentalL1240#

Custom Content4

ExperimentalL1278#

ExperimentalL1290#

ExperimentalL1301#

ExperimentalL1313#

Experimental API

InputDialogHostsrc/input-dialog-host.js:24

Hosts a detached InputDialog model in a lazily-created modal panel. The host owns visibility, focus, modal-flow state and session lifecycle; the complete dialog model remains available through #getModel.

Model and Panel2

ExperimentalL90#

ExperimentalL102#

Visibility5

ExperimentalL157#

ExperimentalL183#

ExperimentalL205#

ExperimentalL217#

ExperimentalL236#

Lifecycle2

ExperimentalL248#

ExperimentalL452#

Focus and Query2

ExperimentalL261#

ExperimentalL273#

Actions1

asyncExperimentalL288#

Event Subscription6

ExperimentalL331#

ExperimentalL346#

ExperimentalL361#

ExperimentalL376#

ExperimentalL392#

ExperimentalL407#

Extended API

KeymapManagersrc/keymap-manager.js:94

Allows commands to be associated with keystrokes in a context-sensitive way. You can access a global instance of this object via lumine.keymaps.

Full description

Key bindings are plain JavaScript objects containing CSS selectors as their top level keys, then keystroke patterns mapped to commands.

{
  ".workspace": {
    "ctrl-l": "package:do-something",
    "ctrl-z": "package:do-something-else"
  },
  ".mini.editor": {
    "enter": "core:confirm"
  }
}

When a keystroke sequence matches a binding in a given context, a custom DOM event with a type based on the command is dispatched on the target of the keyboard event.

To match a keystroke sequence, the keymap starts at the target element for the keyboard event. It looks for key bindings associated with selectors that match the target element. If multiple match, the most specific is selected. If there is a tie in specificity, the most recently added binding wins. If no bindings are found for the events target, the search is repeated again for the target’s parent node and so on recursively until a binding is found or we traverse off the top of the document.

When a binding is found, its command event is always dispatched on the original target of the keyboard event, even if the matching element is higher up in the DOM. In addition, .preventDefault() is called on the keyboard event to prevent the browser from taking action. .preventDefault is only called if a matching binding is found.

Command event objects have a non-standard method called .abortKeyBinding(). If your command handler is invoked but you programmatically determine that no action can be taken and you want to allow other bindings to be matched, call .abortKeyBinding() on the event object. An example of where this is useful is binding snippet expansion to tab. If snippets:expand is invoked when the cursor does not follow a valid snippet prefix, we abort the binding and allow tab to be handled by the default handler, which inserts whitespace.

Multi-keystroke bindings are possible. If a sequence of one or more keystrokes partially matches a multi-keystroke binding, the keymap enters a pending state. The pending state is terminated on the next keystroke, or after #getPartialMatchTimeout milliseconds has elapsed. When the pending state is terminated via a timeout or a keystroke that leads to no matches, the longest ambiguous bindings that caused the pending state are temporarily disabled and the previous keystrokes are replayed. If there is ambiguity again during the replay, the next longest bindings are disabled and the keystrokes are replayed again.

Class Methods1

PublicL126#

Construction and Destruction3

PublicL147#

PublicL169#

PublicL189#

Event Subscription4

PublicL218#

PublicL236#

PublicL253#

PublicL293#

Adding and Removing Bindings2

ExtendedL315#

PublicL381#

Accessing Bindings2

PublicL425#

PublicL441#

Managing Keymap Files2

PublicL489#

PublicL530#

Managing Keyboard Events6

PublicL644#

PublicL930#

ExtendedL948#

PublicL988#

PublicL1009#

ExtendedL1025#

Essential API

LayerDecorationsrc/layer-decoration.js:14

Represents a decoration that applies to every marker on a given layer. Created via TextEditor#decorateMarkerLayer.

Lifecycle2

EssentialL36#

EssentialL54#

Properties3

EssentialL78#

EssentialL91#

EssentialL109#

Extended API

Markersrc/marker.js:41

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.

Full description

Create markers with TextBuffer#markRange, TextBuffer#markPosition, or the corresponding MarkerLayer methods rather than constructing them directly. For screen coordinates and editor decorations, use DisplayMarker instead.

Head and Tail#

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

Validity#

Markers are considered valid when they are first created. Depending on the invalidation strategy you choose, certain changes to the buffer can cause a marker to become invalid, for example if the text surrounding the marker is deleted. See TextBuffer#markRange for invalidation strategies.

Event Subscription2

PublicL112#

PublicL145#

Marker Ranges10

PublicL174#

PublicL190#

PublicL210#

PublicL227#

PublicL262#

PublicL280#

PublicL312#

PublicL324#

PublicL337#

PublicL355#

Marker Details6

PublicL377#

PublicL389#

PublicL401#

PublicL413#

PublicL425#

PublicL464#

Comparison2

PublicL443#

PublicL570#

Properties2

PublicL480#

PublicL494#

Lifecycle2

PublicL514#

PublicL532#

Range Queries3

PublicL588#

PublicL601#

PublicL614#

Experimental API

MarkerLayersrc/marker-layer.js:23

A container for a related set of markers.

Lifecycle4

PublicL99#

PublicL121#

PublicL146#

PublicL171#

Querying4

PublicL192#

PublicL205#

PublicL218#

PublicL248#

Marker Layer Details1

PublicL340#

Range Tracking2

ExperimentalL368#

ExperimentalL384#

Marker Creation2

PublicL406#

PublicL424#

Event Subscription3

PublicL456#

PublicL478#

PublicL493#

Essential API

Matchersrc/fuzzy-matcher.js:59

A reusable candidate set returned by fuzzyMatcher.setCandidates. Query it with #match, or replace its candidates with #setCandidates. The ignoreDiacritics flag is fixed when the matcher is created.

Matching2

EssentialL96#

ExtendedL122#

Candidate Sets1

EssentialL139#

Extended API

MenuManagersrc/menu-manager.js:78

Full description

Public API

Notificationsrc/notification.js:10

A notification to the user containing a message and type.

Event Subscription2

PublicL46#

PublicL59#

Methods3

PublicL79#

PublicL91#

ExtendedL118#

Public API

NotificationManagersrc/notification-manager.js:14

A notification manager used to create Notifications to be shown to the user.

An instance of this class is always available as the lumine.notifications global.

Events3

PublicL34#

PublicL47#

PublicL60#

Adding Notifications6

PublicL88#

PublicL120#

PublicL144#

PublicL168#

PublicL193#

PublicL218#

Requesting Attention1

PublicL239#

Getting Notifications1

Managing Notifications1

PublicL269#

Extended API

Packagesrc/package.js:42

Loads and activates a package’s main module and resources such as stylesheets, keymaps, grammar, editor properties, and menus.

Event Subscription1

EssentialL87#

Native Module Compatibility3

ExtendedL1343#

ExtendedL1364#

ExtendedL1387#

Extended API

PackageManagersrc/package-manager.js:79

Package manager for coordinating the lifecycle of Lumine packages.

Full description

An instance of this class is always available as the lumine.packages global.

Packages can be loaded, activated, and deactivated, and unloaded:

  • Loading a package reads and parses the package’s metadata and resources such as keymaps, menus, stylesheets, etc.
  • Activating a package registers the loaded resources and calls activate() on the package’s main module.
  • Deactivating a package unregisters the package’s resources and calls deactivate() on the package’s main module.
  • Unloading a package removes it completely from the package manager.

Packages can be enabled/disabled via the core.disabledPackages config settings and also by calling enablePackage()/disablePackage().

Event Subscription7

PublicL197#

PublicL210#

ExtendedL223#

PublicL245#

PublicL259#

PublicL273#

PublicL287#

Package System Data1

PublicL303#

General Package Data2

PublicL320#

PublicL382#

Enabling and Disabling Packages3

asyncPublicL399#

asyncPublicL420#

PublicL441#

Accessing Active Packages3

PublicL485#

PublicL499#

Package Lifecycle9

PublicL514#

PublicL552#

PublicL613#

ExtendedL627#

ExtendedL1026#

PublicL1425#

PublicL1636#

PublicL1668#

asyncPublicL1981#

Accessing Loaded Packages3

PublicL587#

PublicL600#

Accessing Available Packages6

PublicL643#

PublicL655#

PublicL667#

PublicL688#

PublicL704#

PublicL720#

Services1

asyncPublicL1585#

Extended API

Panesrc/pane.js:33

A container for presenting content in the center of the workspace. Panes can contain multiple items, one of which is active at a given time. The view corresponding to the active item is displayed in the interface. In the default configuration, tabs are also displayed for each item.

Full description

Each pane may also contain one pending item. When a pending item is added to a pane, it will replace the currently pending item, if any, instead of simply being added. In the default configuration, the text in the tab for pending items is shown in italics.

Event Subscription16

PublicL249#

PublicL264#

PublicL281#

PublicL294#

PublicL307#

PublicL322#

PublicL351#

PublicL366#

PublicL383#

PublicL399#

PublicL414#

PublicL431#

PublicL445#

PublicL463#

PublicL478#

PublicL495#

Items24

PublicL538#

PublicL550#

PublicL629#

PublicL639#

PublicL655#

PublicL673#

PublicL684#

PublicL699#

PublicL718#

PublicL731#

PublicL745#

PublicL757#

PublicL774#

PublicL804#

PublicL937#

PublicL972#

PublicL1056#

PublicL1076#

PublicL1198#

asyncPublicL1222#

PublicL1287#

PublicL1297#

PublicL1576#

PublicL1595#

Activation3

ExtendedL580#

PublicL1618#

PublicL1629#

Saving Items5

PublicL1421#

PublicL1436#

PublicL1451#

asyncPublicL1518#

asyncPublicL1553#

Lifecycle2

PublicL1657#

PublicL1695#

Splitting4

PublicL1714#

PublicL1729#

PublicL1744#

PublicL1759#

Public API

PaneContainersrc/pane-container.js:13

Pane Container Details1

PublicL59#

Pane Presentation2

ExtendedL260#

ExtendedL301#

Text Editors2

PublicL336#

PublicL348#

Event Subscription2

PublicL361#

PublicL374#

Extended API

PaneItemTransferScopesrc/pane-item-transfer-service.js:418

A disposable group of transfers owned by a package or core operation.

Transfer Sessions2

ExtendedL441#

ExtendedL531#

Drop Operations3

ExtendedL550#

asyncExtendedL606#

asyncExtendedL885#

Construction and Destruction1

ExtendedL914#

Extended API

PaneItemTransferServicesrc/pane-item-transfer-service.js:27

Moves exact pane items locally and stages their content before committing a move between windows. Scopes tie transfers to their caller’s lifecycle.

Construction and Destruction1

ExtendedL46#

Extended API

Panelsrc/panel.js:13

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.

Examples: status-bar and search-panel both use panels.

Construction and Destruction1

PublicL50#

Event Subscription2

PublicL83#

PublicL107#

Panel Details2

PublicL133#

PublicL152#

Visibility3

PublicL169#

PublicL180#

PublicL198#

Experimental API

PasteProviderRegistrysrc/paste-provider-registry.js:46

Lets a package claim a paste before the editor turns the clipboard into text.

Full description

An instance of this class is always available as the lumine.pasteProviders global.

This is a dispatch table, not a second clipboard. Clipboard owns what the clipboard holds; this owns who gets first refusal on putting it somewhere. The two are deliberately separate, because a provider is chosen by the paste’s target — a text editor, a tree-view directory — and that is workspace vocabulary the clipboard has no business knowing.

Providers are offered the paste highest priority first, and equal priorities keep registration order. The first one to resolve to true claims it and no later provider is consulted; when none does, the caller falls back to its own behavior — inserting text, in the editor’s case. A paste that sets skipPasteProviders in its options skips the registry outright, which is how editor:paste-without-reformatting guarantees it pastes raw text.

A provider may return a Promise, but it must copy everything it needs from a native paste ClipboardEvent before its first asynchronous step because clipboardData is readable only for the duration of that event.

Examples#

Take over pasting an image, and leave every other paste alone:

lumine.pasteProviders.add({
  handlePaste({ target, clipboardData }) {
    if (target.type !== 'text-editor') return false
    const image = imageFrom(clipboardData)
    if (!image) return false
    saveAndInsert(image, target.editor) // may finish asynchronously
    return true
  }
}, { priority: 100 })

Methods2

ExperimentalL73#

ExperimentalL118#

Public API

Pointsrc/point.js:20

Represents a point in a buffer in row/column coordinates.

Full description

Every public method that takes a point also accepts a point-compatible Array. This means a 2-element array containing Numbers representing the row and column. So the following are equivalent:

new Point(1, 2)
[1, 2] // Point-compatible Array

Constants2

#.ZERO:Point

The shared frozen point at row zero and column zero.

#.INFINITY:Point

The shared frozen point with an infinite row and column.

Construction3

PublicL57#

PublicL145#

PublicL158#

Comparison8

PublicL86#

PublicL106#

PublicL281#

PublicL307#

PublicL324#

PublicL337#

PublicL350#

PublicL363#

Validation1

PublicL126#

Operations4

PublicL171#

PublicL187#

PublicL201#

PublicL231#

Conversion3

PublicL403#

PublicL415#

PublicL427#

Extended API

Projectsrc/project.js:22

Represents a project that’s opened in Lumine.

An instance of this class is always available as the lumine.project global.

Event Subscription7

ExtendedL329#

PublicL348#

PublicL363#

PublicL378#

ExtendedL428#

PublicL442#

PublicL1052#

Accessing Git Repositories2

PublicL459#

PublicL479#

Managing Paths8

PublicL520#

PublicL541#

PublicL629#

PublicL732#

PublicL797#

PublicL831#

PublicL877#

PublicL921#

Managing Project State1

asyncPublicL612#

Filesystem Watching1

ExtendedL781#

File Indexing8

PublicL948#

PublicL985#

PublicL1085#

PublicL1102#

PublicL1122#

PublicL1136#

PublicL1151#

PublicL1174#

Public API

Rangesrc/range.js:32

Represents a region in a buffer in row/column coordinates.

Full description

Every public method that takes a range also accepts a range-compatible Array. This means a 2-element array containing Points or point-compatible arrays. So the following are equivalent:

Examples#

new Range(new Point(0, 1), new Point(2, 3))
new Range([0, 1], [2, 3])
[[0, 1], [2, 3]] // Range-compatible array

Construction4

PublicL47#

PublicL112#

PublicL157#

PublicL188#

Serialization and Deserialization2

PublicL136#

PublicL217#

Operations5

PublicL201#

PublicL286#

PublicL301#

PublicL319#

PublicL338#

Range Details4

PublicL233#

PublicL245#

PublicL257#

PublicL269#

Comparison3

PublicL355#

PublicL374#

PublicL391#

Range Queries5

PublicL408#

PublicL430#

PublicL445#

PublicL463#

PublicL477#

Conversion1

PublicL511#

Public API

RepositoryRegistrysrc/repository-registry.js:284

Every Git repository this window knows about, available as lumine.repositories.

Full description

Project roots are where repositories are discovered and what keeps them alive, but a repository’s identity is independent of them: one root can hold several repositories, one repository can span several roots, and a file opened from outside every root still resolves to the repository that contains it.

Finding a repository#

#getForPath answers from what is already known and never touches the filesystem, which is what a renderer wants. #resolveForPath may discover and register a repository that was not known yet, at the cost of being asynchronous:

const repository = lumine.repositories.getForPath(editor.getPath())
if (repository) console.log(repository.getShortHead())

Following the one the user is in#

#observeActiveRepository tracks the repository behind the active pane item, so a status bar or a panel does not have to work it out itself:

lumine.repositories.observeActiveRepository(({ repository, workingDirectory }) => {
  // repository is null when the active item belongs to none
})

Operations#

The registry performs no Git work of its own. A package provides an implementation through #addOperationProvider, and everything under “Operations” and “Running Git” below is routed to whichever provider claims the capability. Ask #canPerformOperation before offering an action, since a window with no provider installed can answer nothing.

Active Repository7

EssentialL441#

PublicL463#

PublicL479#

PublicL495#

EssentialL512#

PublicL530#

asyncPublicL564#

Accessing Repositories3

ExtendedL890#

ExtendedL921#

Event Subscription10

EssentialL939#

PublicL953#

PublicL969#

PublicL985#

ExtendedL1016#

ExtendedL1030#

ExtendedL1047#

ExtendedL1061#

ExtendedL1074#

ExtendedL1088#

Resolving Paths5

EssentialL1112#

PublicL1141#

PublicL1168#

PublicL1183#

asyncPublicL1218#

Managing Repositories4

PublicL1454#

asyncPublicL1883#

PublicL1924#

asyncPublicL2095#

Operations8

asyncExtendedL1482#

PublicL1543#

PublicL1556#

EssentialL1574#

PublicL1587#

PublicL1610#

PublicL1763#

PublicL1779#

Creating Repositories4

PublicL1629#

PublicL1642#

PublicL1695#

PublicL1710#

Running Git2

PublicL1658#

asyncExtendedL1677#

Public API

RuntimeServicesrc/runtime-service.js:7

Renderer-runtime readiness and unhandled-error events.

Event Subscription2

ExtendedL23#

ExtendedL36#

Shell Environment2

ExtendedL50#

ExtendedL65#

Extended API

ScopeDescriptorsrc/scope-descriptor.js:25

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.

Full description

Methods that take a ScopeDescriptor will also accept an Array of String scope names e.g. ['.source.js'].

You can use ScopeDescriptors to get language-specific config settings via Config#get.

You should not need to create a ScopeDescriptor directly.

See the scopes and scope descriptor guide for more information.

Construction1

PublicL49#

Scope Details1

PublicL68#

Public API

ScrollbarManagersrc/scrollbar-manager.js:18

Shared scrollbar presentation and local geometry for document and package views. Access this namespace through lumine.scrollbars.

DOM Surfaces1

PublicL68#

Geometry3

PublicL82#

PublicL148#

PublicL166#

Isolated Documents1

PublicL269#

Public API

SecretStoresrc/secret-store.js:36

Somewhere to keep an access token, available as lumine.secrets.

Full description

For the sensitive strings a package must remember between sessions — a forge token, an API key, a password. Never lumine.config: everything in there is written to disk in plain text and shown in the settings view.

Keys are opaque strings and values are strings. Namespace your own keys, by convention with the package name:

await lumine.secrets.set('github.token', token)
const token = await lumine.secrets.get('github.token')

Storage#

Values are encrypted with the operating system’s own facility — DPAPI on Windows, the Keychain on macOS, libsecret or kwallet on Linux — and kept as base64 in one file under the config directory.

Where the OS offers no encryption, typically a headless Linux box with no keyring, the store keeps values in memory for the session only and warns the user once. It never writes a secret to disk in the clear. A package should therefore expect #get to return null for something it stored in an earlier session, and ask again rather than fail.

Encryption1

asyncExtendedL87#

Storing Secrets3

asyncEssentialL195#

asyncEssentialL246#

asyncPublicL282#

Event Subscription1

PublicL311#

Extended API

Selectionsrc/selection.js:41

Represents a selection in the TextEditor.

Event Subscription2

ExtendedL88#

ExtendedL101#

Managing the Selection Range5

PublicL117#

PublicL130#

PublicL142#

PublicL160#

PublicL183#

Selection Details6

PublicL218#

PublicL229#

PublicL241#

PublicL253#

PublicL266#

PublicL288#

Modifying the Selection Range28

PublicL306#

PublicL325#

PublicL360#

PublicL372#

PublicL384#

PublicL396#

PublicL408#

PublicL419#

PublicL430#

PublicL440#

PublicL451#

PublicL462#

PublicL473#

PublicL484#

PublicL495#

PublicL506#

PublicL517#

PublicL527#

PublicL537#

PublicL547#

PublicL557#

PublicL568#

PublicL579#

PublicL590#

PublicL606#

PublicL626#

PublicL644#

PublicL676#

Modifying the Selected Text22

PublicL734#

PublicL838#

PublicL855#

PublicL872#

PublicL888#

PublicL904#

PublicL924#

PublicL942#

PublicL964#

PublicL980#

PublicL996#

PublicL1011#

PublicL1029#

PublicL1064#

PublicL1131#

PublicL1163#

PublicL1181#

PublicL1203#

PublicL1226#

PublicL1249#

PublicL1276#

PublicL1422#

Folds1

PublicL1334#

Managing Multiple Selections3

PublicL1444#

PublicL1479#

PublicL1518#

Comparison1

PublicL1549#

Experimental API

SelectListsrc/select-list.js:82

Extends InputDialog

Detached fuzzy-searchable select-list model. Extends InputDialog with items, filtering, selection and list rendering. Call InputDialog#getElement to lazily create its unmounted surface, or use Workspace#addSelectList to give it a modal host.

Full description

Hosted lists support keep-open mode by default. Set supportsKeepOpen: false for a surface that must finish after one choice. Individual terminal actions in a repeatable list declare disposition complete.

A flat items source may also supply overflowSections, an alternative grouping of exactly the same items. It applies only while the unfiltered list actually overflows its viewport; shorter lists retain their natural order without section separators. Pass null to remove this alternative.

Built-in fuzzy search uses a dedicated Chromium worker per list by default, regardless of list size. It prepares text, scores, sorts and traces the first page. Set search.worker: false for a list known to always be small; this path prepares candidates on demand and matches synchronously.

Set search.prepareOnIdle: true to prepare the worker’s candidates before a query when getFilterText is pure. This option applies only to workers. Source replacement and destruction cancel pending preparation.

While the worker filters, the previous rows remain visible and selection and actions cannot confirm a stale match. A spinner replaces the action affordance after 250 ms of continuous filtering; superseding a query does not restart that delay. Source loading retains its separate loading message. All matches are published together, and setQuery() resolves after rendering. New input, source changes and destruction cancel obsolete requests.

Query sources, custom matchers and custom filters retain their own execution contract. Custom sort callbacks still run on the UI thread after worker ranking. Pure score modifiers run there in yielding batches; only numeric scores cross back to the worker. There is no global backend setting.

A recents adapter’s save(ids, change) receives the operation’s intent: {type: 'record'|'remove'|'clear'|'limit'|'replace', id?, limit}. Apply it to the latest stored IDs with updateRecentItemIds inside a scoped state’s mutate() callback. Returning the committed IDs synchronizes a successful no-op too; returning nothing remains valid for other adapters. Set adapter.serializesWrites: true when the adapter owns write ordering. Core then invokes save immediately, letting scoped state capture the current project before a rebind. Other adapters retain core’s serial save queue. Project adapters notify onDidChange on a project rebind even when the IDs are equal. Use the scoped state’s observe() subscription, skipping its initial callback, so a pending save cannot project into a different project.

Destroy this model with the inherited InputDialog#destroy; calling the inherited InputDialog#confirm delegates to #confirmSelection.

Actions3

ExperimentalL348#

ExperimentalL360#

ExperimentalL373#

Event Subscription6

ExperimentalL406#

ExperimentalL1300#

ExperimentalL1320#

ExperimentalL2584#

ExperimentalL2631#

ExperimentalL2645#

Query1

ExperimentalL779#

Asynchronous Sources1

ExperimentalL796#

Items8

ExperimentalL1213#

ExperimentalL1228#

ExperimentalL1272#

ExperimentalL1334#

ExperimentalL1348#

ExperimentalL1360#

ExperimentalL1376#

ExperimentalL1395#

Filtering4

ExperimentalL1240#

ExperimentalL1284#

ExperimentalL2001#

ExperimentalL2018#

Pagination5

ExperimentalL1261#

asyncExperimentalL1911#

ExperimentalL2410#

ExperimentalL2421#

ExperimentalL2432#

Selection11

ExperimentalL2058#

ExperimentalL2069#

ExperimentalL2080#

ExperimentalL2171#

ExperimentalL2184#

ExperimentalL2214#

ExperimentalL2225#

ExperimentalL2254#

ExperimentalL2268#

ExperimentalL2312#

ExperimentalL2338#

Scrolling4

ExperimentalL2354#

ExperimentalL2366#

ExperimentalL2378#

ExperimentalL2395#

Recent Items8

ExperimentalL2451#

ExperimentalL2465#

ExperimentalL2494#

ExperimentalL2506#

ExperimentalL2525#

ExperimentalL2538#

ExperimentalL2553#

ExperimentalL2568#

Confirmation1

ExperimentalL2598#

Experimental API

SelectListHostsrc/select-list-host.js:13

Extends InputDialogHost

Modal host for a detached SelectList model. It inherits the complete visibility, focus, modal-flow and session lifecycle of InputDialogHost while narrowing #getModel to SelectList.

Model and Panel1

ExperimentalL52#

Public API

ServiceHubsrc/service-hub.js:154

Methods4

PublicL176#

PublicL242#

PublicL332#

PublicL348#

Public API

ShellServicesrc/shell-service.js:9

Operating-system shell integrations.

File Operations3

PublicL25#

PublicL38#

PublicL55#

Application Launching1

PublicL75#

External URLs1

PublicL94#

Extended API

StorageScopesrc/package-storage.js:283

Package-owned JSON values in one persistent scope. Package lifecycle hooks receive these handles as context.globalState and context.workspaceState. Global values are shared by every window and project in the profile. Workspace values follow the set of project roots; an empty workspace uses the persistent window identity. Existing workspace handles and observers follow scope changes. Values are detached JSON data. Writes become visible after their durable transaction commits, before the returned promise resolves.

Full description

Methods6

ExtendedL307#

ExtendedL319#

ExtendedL333#

ExtendedL353#

ExtendedL385#

ExtendedL406#

Extended API

StyleManagersrc/style-manager.js:16

A singleton instance of this class available via lumine.styles, which you can use to globally query and observe the set of active style sheets. The StyleManager doesn’t add any style elements to the DOM on its own, but is instead subscribed to by individual <lumine-styles> elements, which clone and attach style elements in different contexts.

Event Subscription4

ExtendedL43#

ExtendedL63#

ExtendedL77#

ExtendedL93#

Reading Style Elements1

ExtendedL108#

Paths1

ExtendedL218#

Extended API

Tasksrc/task.js:46

Run a node script in a separate process.

Full description

Used by fuzzy file search and find-and-replace in project.

For a real-world example, see the replace-handler.

Examples#

In your package code:

const {Task} = require('lumine');

let task = Task.once('/path/to/task-file.js', parameter1, parameter2, function() {
  console.log('task has finished');
});

task.on('some-event-from-the-task', (data) => {
  console.log(data.someString); // prints 'yep this is it'
});

In '/path/to/task-file.js':

module.exports = function(parameter1, parameter2) {
  // Indicates that this task will be async.
  // Call the `callback` to finish the task
  const callback = this.async();
  emit('some-event-from-the-task', {
    someString: 'yep this is it'
  });
  return callback();
};

Construction2

PublicL61#

PublicL84#

Task Execution3

PublicL155#

PublicL243#

PublicL263#

Messaging1

PublicL185#

Event Subscription1

PublicL220#

Extended API

TextBuffersrc/text-buffer.js:198

A mutable text container with undo/redo support and the ability to annotate logical regions in the text.

Full description

Observing Changes#

You can observe changes in a TextBuffer using methods like #onDidChange, #onDidStopChanging, and #getChangesSinceCheckpoint. These methods report aggregated buffer updates as arrays of change objects containing the following fields: oldRange, newRange, oldText, and newText. The oldText, newText, and newRange fields are self-explanatory, but the interpretation of oldRange is more nuanced:

The reported oldRange is the range of the replaced text in the original contents of the buffer irrespective of the spatial impact of any other reported change. So, for example, if you wanted to apply all the changes made in a transaction to a clone of the observed buffer, the easiest approach would be to apply the changes in reverse:

buffer1.onDidChange(({changes}) => {
  for (const {oldRange, newText} of changes.reverse()) {
    buffer2.setTextInRange(oldRange, newText)
  }
})

If you needed to apply the changes in the forwards order, you would need to incorporate the impact of preceding changes into the range passed to #setTextInRange, as follows:

buffer1.onDidChange(({changes}) => {
  for (const {oldRange, newRange, newText} of changes) {
    const rangeToReplace = Range(
      newRange.start,
      newRange.start.traverse(oldRange.getExtent())
    )
    buffer2.setTextInRange(rangeToReplace, newText)
  }
})

Construction5

PublicL218#

PublicL306#

PublicL335#

ExperimentalL358#

asyncPublicL372#

Serialization1

ExtendedL496#

Event Subscription17

PublicL581#

PublicL604#

PublicL628#

PublicL640#

PublicL667#

PublicL680#

PublicL706#

PublicL720#

PublicL734#

PublicL748#

PublicL761#

PublicL776#

PublicL790#

PublicL804#

PublicL817#

PublicL834#

ExperimentalL4196#

Configuration1

PublicL848#

File Details7

PublicL868#

PublicL880#

PublicL892#

ExperimentalL949#

PublicL1005#

PublicL1030#

PublicL1050#

Reading Text19

PublicL1076#

PublicL1089#

ExtendedL1106#

ExtendedL1138#

ExtendedL1154#

ExtendedL1172#

ExtendedL1184#

PublicL1219#

PublicL1236#

PublicL1248#

PublicL1261#

PublicL1275#

PublicL1288#

ExperimentalL1300#

PublicL1314#

PublicL1327#

PublicL1344#

PublicL1362#

ExtendedL1380#

Mutating Text11

PublicL1402#

ExtendedL1416#

PublicL1449#

PublicL1546#

ExtendedL1603#

asyncExperimentalL1701#

PublicL2131#

PublicL2147#

PublicL2364#

PublicL2377#

PublicL2394#

Markers9

PublicL2445#

PublicL2460#

PublicL2475#

PublicL2495#

PublicL2512#

PublicL2524#

PublicL2537#

PublicL2563#

PublicL2575#

History11

PublicL2646#

PublicL2664#

PublicL2721#

PublicL2839#

PublicL2849#

ExtendedL2860#

PublicL2876#

PublicL2899#

PublicL2932#

PublicL2950#

PublicL2973#

Searching and Replacing20

PublicL3012#

PublicL3044#

PublicL3079#

PublicL3148#

PublicL3170#

ExperimentalL3262#

asyncExperimentalL3283#

asyncExperimentalL3298#

ExperimentalL3399#

ExperimentalL3412#

ExperimentalL3426#

ExperimentalL3439#

ExperimentalL3453#

ExperimentalL3466#

ExperimentalL3480#

ExperimentalL3493#

ExperimentalL3507#

ExperimentalL3527#

ExperimentalL3556#

ExperimentalL3572#

Searching1

ExtendedL3601#

Buffer Range Details12

PublicL3633#

PublicL3645#

PublicL3657#

PublicL3670#

PublicL3681#

PublicL3693#

PublicL3707#

PublicL3729#

PublicL3745#

PublicL3761#

PublicL3809#

Buffer Operations7

PublicL3853#

PublicL3868#

PublicL3895#

PublicL3936#

PublicL3954#

asyncPublicL4094#

ExperimentalL5027#

Language Modes2

ExperimentalL4138#

ExperimentalL4165#

Lifecycle2

EssentialL4552#

EssentialL4599#

Essential API

TextEditorsrc/text-editor.js:154

This class represents all essential editing state for a single TextBuffer, including cursor and selection positions, folds, and soft wraps. If you’re manipulating the state of an editor, use this class.

Full description

A single TextBuffer can belong to multiple editors. For example, if the same file is open in two different panes, Lumine creates a separate editor for each pane. If the buffer is manipulated the changes are reflected in both editors, but each maintains its own cursor position, folded lines, etc.

Accessing TextEditor Instances#

The easiest way to get hold of TextEditor objects is by registering a callback with ::observeTextEditors on the lumine.workspace global. Your callback will then be called with all current editor instances and also when any editor is created in the future.

lumine.workspace.observeTextEditors(editor => {
  editor.insertText('Hello World')
})

Buffer vs. Screen Coordinates#

Because editors support folds and soft-wrapping, the lines on screen don’t always match the lines in the buffer. For example, a long line that soft wraps twice renders as three lines on screen, but only represents one line in the buffer. Similarly, if rows 5-10 are folded, then row 6 on screen corresponds to row 11 in the buffer.

Your choice of coordinates systems will depend on what you’re trying to achieve. For example, if you’re writing a command that jumps the cursor up or down by 10 lines, you’ll want to use screen coordinates because the user probably wants to skip lines on screen. However, if you’re writing a package that jumps between method definitions, you’ll want to work in buffer coordinates.

When in doubt, just default to buffer coordinates, then experiment with soft wraps and folds to ensure your code interacts with them correctly.

View State2

ExtendedL1012#

ExtendedL1037#

Lifecycle2

EssentialL1157#

EssentialL1192#

Event Subscription32

EssentialL1209#

EssentialL1222#

EssentialL1247#

EssentialL1262#

EssentialL1284#

EssentialL1305#

ExtendedL1318#

ExtendedL1334#

ExtendedL1349#

ExtendedL1362#

ExtendedL1378#

ExtendedL1394#

ExtendedL1409#

ExtendedL1425#

ExtendedL1445#

ExperimentalL1465#

EssentialL1500#

EssentialL1513#

ExtendedL1528#

ExtendedL1543#

ExtendedL1557#

ExtendedL1572#

ExtendedL1587#

ExtendedL1601#

ExtendedL1616#

ExtendedL1630#

ExtendedL1644#

ExtendedL1665#

PublicL1782#

EssentialL1825#

EssentialL1839#

EssentialL1853#

Editing Behavior2

EssentialL1755#

EssentialL1769#

Buffer1

File Details6

EssentialL1906#

EssentialL1925#

EssentialL2023#

ExtendedL2045#

ExtendedL2131#

EssentialL2143#

Reading Text11

EssentialL2156#

EssentialL2277#

EssentialL2290#

EssentialL2302#

EssentialL2314#

EssentialL2330#

EssentialL2342#

EssentialL2355#

EssentialL2368#

ExtendedL2437#

EssentialL2523#

File Operations5

EssentialL2173#

EssentialL2189#

PublicL2209#

PublicL2222#

PublicL2237#

Mutating Text25

EssentialL2542#

EssentialL2561#

EssentialL2577#

EssentialL2739#

EssentialL2753#

EssentialL2768#

ExtendedL2786#

ExtendedL3290#

ExtendedL3315#

ExtendedL3336#

ExtendedL3352#

ExtendedL3420#

ExtendedL3455#

ExtendedL3481#

ExtendedL3507#

ExtendedL3557#

ExtendedL3572#

ExtendedL3587#

ExtendedL3603#

ExtendedL3619#

ExtendedL3635#

ExtendedL3652#

ExtendedL3670#

ExtendedL3729#

ExtendedL3743#

History8

EssentialL3807#

EssentialL3825#

ExtendedL3853#

ExperimentalL3881#

ExtendedL3901#

ExtendedL3934#

ExtendedL3951#

Coordinates9

EssentialL3975#

EssentialL3991#

EssentialL4005#

EssentialL4021#

ExtendedL4059#

ExtendedL4086#

ExtendedL4100#

ExtendedL4129#

ExtendedL4144#

Decorations8

EssentialL4220#

EssentialL4236#

ExtendedL4256#

ExtendedL4288#

ExtendedL4301#

ExtendedL4314#

ExtendedL4327#

ExtendedL4340#

Markers11

EssentialL4364#

EssentialL4384#

EssentialL4401#

EssentialL4419#

EssentialL4442#

ExtendedL4456#

ExtendedL4480#

EssentialL4501#

EssentialL4514#

Cursors34

EssentialL4546#

EssentialL4558#

EssentialL4575#

EssentialL4588#

EssentialL4604#

EssentialL4616#

EssentialL4633#

EssentialL4649#

EssentialL4670#

EssentialL4687#

EssentialL4699#

EssentialL4711#

EssentialL4723#

EssentialL4737#

EssentialL4749#

EssentialL4759#

EssentialL4771#

EssentialL4781#

EssentialL4791#

EssentialL4801#

EssentialL4811#

ExtendedL4825#

ExtendedL4837#

ExtendedL4847#

ExtendedL4857#

ExtendedL4867#

ExtendedL4877#

ExtendedL4887#

ExtendedL4897#

ExtendedL4907#

ExtendedL4919#

ExtendedL4933#

ExtendedL4944#

ExtendedL4958#

Selections43

EssentialL5024#

EssentialL5037#

EssentialL5051#

EssentialL5067#

EssentialL5083#

EssentialL5111#

EssentialL5125#

EssentialL5140#

EssentialL5158#

EssentialL5191#

EssentialL5221#

EssentialL5236#

EssentialL5257#

EssentialL5279#

EssentialL5295#

EssentialL5311#

EssentialL5327#

EssentialL5340#

EssentialL5353#

EssentialL5365#

EssentialL5378#

EssentialL5393#

EssentialL5406#

EssentialL5419#

EssentialL5432#

ExtendedL5445#

ExtendedL5460#

EssentialL5472#

EssentialL5482#

ExtendedL5492#

ExtendedL5507#

ExtendedL5520#

ExtendedL5533#

ExtendedL5546#

ExtendedL5561#

ExtendedL5574#

ExtendedL5694#

ExtendedL5744#

ExtendedL5758#

ExtendedL5779#

Searching and Replacing3

EssentialL6083#

EssentialL6109#

EssentialL6130#

Tab Behavior7

EssentialL6146#

EssentialL6158#

EssentialL6173#

EssentialL6185#

EssentialL6197#

ExtendedL6225#

ExtendedL6262#

Soft Wrap Behavior6

EssentialL6287#

EssentialL6321#

ExtendedL6358#

ExtendedL6370#

EssentialL6386#

EssentialL6467#

Overtype Behavior4

EssentialL6404#

EssentialL6417#

EssentialL6434#

ExtendedL6450#

Indentation6

EssentialL6507#

EssentialL6531#

ExtendedL6570#

ExtendedL6590#

ExtendedL6612#

ExtendedL6641#

Grammars6

ExtendedL6847#

ExtendedL6866#

ExtendedL6877#

ExperimentalL6900#

ExtendedL6920#

Managing Syntax Scopes9

EssentialL7009#

EssentialL7030#

asyncExtendedL7047#

ExtendedL7062#

EssentialL7133#

ExtendedL7321#

ExtendedL7339#

ExtendedL7353#

PublicL9549#

Syntax Trees3

ExtendedL7164#

ExtendedL7192#

asyncExperimentalL7279#

Grammar Queries2

ExtendedL7212#

asyncExtendedL7242#

Clipboard Operations5

EssentialL7409#

EssentialL7436#

EssentialL7462#

EssentialL7726#

EssentialL7748#

Folds15

ExtendedL7774#

EssentialL7789#

EssentialL7820#

EssentialL7841#

EssentialL7942#

ExtendedL7955#

ExtendedL7967#

ExtendedL7989#

ExtendedL8005#

ExtendedL8032#

ExtendedL8058#

ExtendedL8070#

ExtendedL8124#

ExtendedL8137#

ExtendedL8154#

Gutters3

EssentialL8218#

EssentialL8230#

EssentialL8247#

Scrolling5

EssentialL8265#

EssentialL8275#

EssentialL8289#

EssentialL8306#

ExtendedL8322#

Configuration14

ExperimentalL8384#

ExperimentalL8396#

ExperimentalL8408#

EssentialL8424#

ExperimentalL8438#

ExperimentalL8450#

ExperimentalL8465#

ExperimentalL8480#

ExperimentalL8494#

ExperimentalL8508#

ExperimentalL8521#

ExperimentalL8533#

ExperimentalL8546#

ExperimentalL8560#

Rendering3

EssentialL8623#

EssentialL8650#

EssentialL8663#

Editor Rendering1

ExtendedL8786#

Language Mode Delegated Methods5

ExtendedL8872#

ExperimentalL8893#

ExtendedL8944#

ExtendedL9115#

asyncExtendedL9613#

Essential API

TextEditorElementsrc/text-editor-element.js:11

The custom DOM element displaying a TextEditor. Retrieve it with TextEditor#getElement and access its model with #getModel.

Rendering3

ExtendedL99#

ExtendedL193#

ExtendedL220#

Model1

EssentialL113#

Scrolling3

EssentialL296#

EssentialL306#

ExperimentalL486#

Coordinates4

ExtendedL333#

ExtendedL352#

ExtendedL371#

ExtendedL390#

Decorations1

ExperimentalL464#

Public API

TextEditorRegistrysrc/text-editor-registry.js:47

The global registry of text editors that participate in the window, available as lumine.textEditors.

Full description

Workspace owns pane items. This registry additionally reaches editor surfaces embedded in package interfaces, such as search fields, notebook cells, prompts, and previews. Registration is explicit because constructing a detached editor does not by itself make that editor part of the window.

Registering the same editor more than once with the same role creates another lease on one logical registration. Observers see the editor only when the first lease is acquired and see it removed only after the last lease is disposed. Registering one editor under conflicting roles is an error.

Roles#

  • "document" — a standalone document, normally a workspace pane item.
  • "fragment" — an editable part of a composite document, such as a notebook cell.
  • "input" — an editor-backed form control, search field, or prompt.
  • "viewer" — a rendered or read-only surface that must not become a document-content source.
const editor = lumine.workspace.buildTextEditor({ mini: true })
const registration = lumine.textEditors.add(editor, { role: 'input' })
// Release the lease when the surface goes away. Destroying the editor also
// releases every outstanding lease.
registration.dispose()

Registration1

EssentialL73#

Querying2

PublicL147#

PublicL159#

Event Subscription2

EssentialL177#

PublicL191#

Extended API

ThemeManagersrc/theme-manager.js:94

Handles loading and activating available themes.

An instance of this class is always available as the lumine.themes global.

CSS Variables1

EssentialL144#

Event Subscription3

EssentialL160#

EssentialL196#

PublicL209#

Theme Packs5

PublicL236#

PublicL275#

PublicL288#

PublicL310#

PublicL322#

Accessing Loaded Themes2

PublicL347#

PublicL359#

Accessing Active Themes2

PublicL375#

PublicL387#

Managing Enabled Themes1

PublicL450#

Appearance1

PublicL968#

Essential API

TooltipManagersrc/tooltip-manager.js:71

Associates tooltips with HTML elements.

Full description

You can get the TooltipManager via lumine.tooltips.

Examples#

The essence of displaying a tooltip

// display it
const disposable = lumine.tooltips.add(div, {title: 'This is a tooltip'})

// remove it
disposable.dispose()

In practice there are usually multiple tooltips. So we add them to a CompositeDisposable

const {CompositeDisposable} = require('lumine')
const subscriptions = new CompositeDisposable()

const div1 = document.createElement('div')
const div2 = document.createElement('div')
subscriptions.add(lumine.tooltips.add(div1, {title: 'This is a tooltip'}))
subscriptions.add(lumine.tooltips.add(div2, {title: 'Another tooltip'}))

// remove them all
subscriptions.dispose()

You can display a key binding in the tooltip as well with the keyBindingCommand option.

disposable = lumine.tooltips.add(this.caseOptionButton, {
  title: 'Match Case',
  keyBindingCommand: 'search-panel:toggle-case-option',
  keyBindingTarget: this.findEditor.element
})

To display several tooltip entries together, use addComposite.

disposable = lumine.tooltips.addComposite(this.modeIndicator, [
  {title: 'Column selection'},
  {
    title: 'Toggle sticky mode',
    keyBindingExtra: 'LMB',
    keyBindingCommand: 'column-selection:sticky'
  },
  {
    title: 'Toggle picker mode',
    keyBindingExtra: 'RMB',
    keyBindingCommand: 'column-selection:picker'
  }
])

Methods3

EssentialL161#

EssentialL183#

ExtendedL307#

Extended API

TreeSitterGrammarsrc/tree-sitter-grammar.js:51

This class holds an instance of a Tree-sitter grammar.

Grammar Details1

ExtendedL205#

Language Loading2

ExtendedL249#

asyncExtendedL287#

Queries3

ExtendedL579#

asyncExtendedL661#

ExtendedL680#

Event Subscription5

ExtendedL795#

ExtendedL810#

ExtendedL828#

ExtendedL843#

ExtendedL858#

Language Injections1

ExtendedL954#

Extended API

URIHandlerRegistrysrc/uri-handler-registry.js:71

Associates listener functions with URIs from outside the application.

Full description

An instance of this class is always available as the lumine.uriHandlers global.

The global URI handler registry maps URIs to listener functions. URIs are mapped based on the hostname of the URI; the format is lumine://package/command?args. The “core” package name is reserved for URIs handled by Lumine Core (it is not possible to register a package with the name “core”).

Because URI handling can be triggered from outside the application (e.g. from the user’s browser), package authors should take great care to ensure that malicious activities cannot be performed by an attacker. A good rule to follow is that URI handlers should not take action on behalf of the user. For example, clicking a link to open a pane item that prompts the user to install a package is okay; automatically installing the package right away is not.

Packages can register their desire to handle URIs via a special key in their package.json called “uriHandler”. The value of this key should be an object that contains, at minimum, a key named “method”. This is the name of the method on your package object that Lumine will call when it receives a URI your package is responsible for handling. It will pass the parsed URI as the first argument (an object with the same shape as the output of Node’s legacy url.parse(uri, true), including a query object) and the raw URI string as the second argument.

URI handlers are registered by the package’s synchronous bootstrap. The package is therefore already active when a URI is delivered; expensive handler work may still be loaded lazily by the package itself.

If your package specifies a deprecated urlMain property, you cannot register URI handlers via the uriHandler key.

Example#

Here is a sample package that will be activated and have its handleURI method called when a URI beginning with lumine://my-package is triggered:

package.json:

{
  "name": "my-package",
  "main": "./lib/my-package.js",
  "uriHandler": { "method": "handleURI" }
}

lib/my-package.js

module.exports = {
  activate: function() {
    // code to activate your package
  },

  handleURI(parsedUri, rawUri) {
    // parse and handle uri
  }
}

Essential API

ViewRegistrysrc/view-registry.js:33

ViewRegistry handles the association between model and view types in Lumine. 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

Full description

If you’re adding your own kind of pane item, a good strategy for all but the simplest items is to separate the model and the view. The model handles application logic and is the primary point of API interaction. The view just handles presentation.

Note: Models can be any object, but must implement a getTitle() function if they are to be displayed in a Pane

View providers inform the workspace how your model objects should be presented in the DOM. A view provider must always return a DOM node, which makes HTML 5 custom elements an ideal tool for implementing views in Lumine.

You can access the ViewRegistry object via lumine.views.

Window Participants1

PublicL83#

Views2

EssentialL235#

EssentialL293#

Public API

WindowContributionRegistrysrc/window-contribution-registry.js:10

Owns window-local instances of service contributions. A registration targets the main window by default; all-window registrations include future windows.

Registering Contributions2

PublicL57#

PublicL72#

Lifecycle1

PublicL164#

Public API

WindowServicesrc/window-service.js:13

Operations on the Lumine window hosting the current renderer.

BrowserWindow objects never cross the process boundary. State is returned as plain objects and every operation which reaches the main process is async.

Window Information1

PublicL29#

Event Subscription8

ExtendedL43#

PublicL601#

PublicL617#

PublicL630#

PublicL643#

PublicL656#

PublicL669#

PublicL682#

Startup4

ExtendedL57#

ExtendedL147#

PublicL159#

PublicL171#

Native Presentation2

ExtendedL73#

PublicL512#

Window Modes5

PublicL86#

PublicL97#

PublicL108#

ExtendedL119#

ExtendedL133#

Window State4

PublicL185#

PublicL363#

PublicL375#

PublicL387#

Window Geometry6

PublicL199#

PublicL213#

PublicL225#

PublicL239#

PublicL251#

PublicL496#

Window Management10

PublicL265#

PublicL277#

PublicL289#

PublicL301#

PublicL313#

PublicL325#

PublicL337#

PublicL349#

PublicL402#

asyncPublicL414#

Dialogs4

PublicL428#

PublicL441#

PublicL454#

EssentialL469#

Downloads1

PublicL483#

Developer Tools4

asyncPublicL526#

asyncPublicL539#

asyncPublicL552#

PublicL566#

Window Messaging1

PublicL582#

Essential API

Workspacesrc/workspace.js:375

Manages the shared workspace and its presentation windows. An instance of this class is available via the lumine.workspace global.

Full description

Interact with this object to open files, be notified of current and future editors, and manipulate panes. To add panels, use Workspace#addTopPanel and friends.

Workspace Items#

The term “item” refers to anything that can be displayed in a pane within the workspace, either in the WorkspaceCenter or in one of the three Docks. The workspace expects items to conform to the following interface:

Required Methods#

getTitle()#

Returns a String containing the title of the item to display on its associated tab.

Optional Methods#

copy({signal})#

Returns a fresh live item or a Promise for one, with an independent detached view root. If omitted, copy and split-copy operations silently resolve to null without changing panes, focus or preview state. Focus and move, including split-move, remain available. Views may share their underlying document, but own their subscriptions, selection and viewport. Honor the AbortSignal before publishing a copy and release abandoned resources. Serialization and URI openers are not substitutes for this copy contract. Copy factories capture document and view state before awaiting initialization. Retargeting items emit onDidChangeURI after every document publication, even if its URI returns to an earlier value. Moving and copying promote previews only after committing and invoke terminatePendingState() to cancel pending reuse.

canCopy()#

Returns a Boolean to restrict an item’s copy capability. Returning false silently skips copy and split-copy without notifications or changes to panes, focus or preview state. If omitted, a callable copy() method enables copying. Returning true does not enable copying when the item has no copy() method.

getSingletonKey()#

Returns a namespaced non-empty String to allow one item per logical resource in this workspace. A constant key identifies a workspace tool; a resource key permits separate result sets. Omit it or return null when uniqueness is not required. Resource uniqueness is independent of copy capability. Changing a singleton key emits onDidChangeSingletonKey, or onDidChangeURI when the key follows the URI. Reopening a key activates its existing item.

getPaneItemRevision()#

Returns a monotonic document revision so asynchronous copies detect document replacement with an unchanged URI. Omit it when the item does not retarget its document, or use onDidChangeURI when its URI always changes with the document.

Presentation window lifecycle#

didAttachToWindow({window, document}) synchronously binds presentation-only listeners after first mounting or DOM adoption. Use that document and its defaultView for UI, while retaining workspace-owned models and resources.

prepareWindowChange({sourceWindow, targetWindow}) may asynchronously capture state that DOM adoption cannot retain, such as an iframe’s browsing context. Its returned state is passed to didChangeWindow({...context, state}) after movement. Rollback invokes that method with reversed windows and rollback: true; a preparation cancelled before movement invokes cancelWindowChange({...context, state}). A returned state may implement dispose() to release temporary resources after commit or rollback. These methods preserve the live document, terminal or kernel; they do not reopen an item through its URI. Layout mutations in participating windows remain locked while their presentation operation is pending.

getPaneItemDocument() may return a shared document object used by independent views. Close batches confirm that document once, passing lastView to shouldPromptToSave. Text editors use their buffer as the document identity.

getElement()#

If your item already is a DOM element, you do not need to implement this method. Otherwise it should return the element you want to display to represent this item.

destroy()#

Destroys the item. This will be called when the item is removed from its parent pane.

onDidDestroy(callback)#

Called by the workspace so it can be notified when the item is destroyed. Must return a Disposable.

serialize()#

Serialize the state of the item. Must return an object that can be passed to JSON.stringify. The state should include a field called deserializer, which names a deserializer declared in your package.json. This method is invoked on items when serializing the workspace so they can be restored to the same location later.

getURI()#

Returns the URI associated with the item.

onDidChangeURI(callback)#

Notifies the workspace when the item begins representing a different URI. Emit after committing the new document, and return a Disposable. The workspace publishes Workspace#onDidChangePaneItemURI for consumers whose context depends on the document rather than the item identity.

getLongTitle()#

Returns a String containing a longer version of the title to display in places like the window title or on tabs their short titles are ambiguous.

onDidChangeTitle(callback)#

Called by the workspace so it can be notified when the item’s title changes. Must return a Disposable.

getIconName()#

Return a String with the semantic name of an icon. The icon registry resolves that name to a descriptor, so an icon provider may render it as classes, an image, SVG, or a letter.

onDidChangeIcon(callback)#

Called by the icon binding so it can be notified when the item’s icon changes. Must return a Disposable.

getDefaultLocation()#

Tells the workspace where your item should be opened in absence of a user override. Items can appear in the center or in a dock on the left, right, or bottom of the workspace.

Returns a String with one of the following values: 'center', 'left', 'right', 'bottom'. If this method is not defined, 'center' is the default.

getAllowedLocations()#

Tells the workspace where this item can be moved. Returns an Array of one or more of the following values: 'center', 'left', 'right', or 'bottom'. If this method is not defined, the item is allowed only in the location returned by getDefaultLocation(), or in 'center' when that method is not defined either.

getDefaultVisibility()#

Declares the initial visibility of a dock item registered with Workspace#addDefaultDockItem. Returns "visible" to show it in a new layout, or "project-or-empty" to show it when opening a project (including a project with files) or starting without requested documents. Opening only files does not show a "project-or-empty" item. An absent method, undefined, false or "manual" leaves opening to the user.

Saved dock layouts take precedence, including hidden docks and closed items. Defaults never take focus or replace an existing dock item. They run once during initial startup, not after later file openings or package activation. Explicit Workspace#open calls do not consult this method.

isPersistentDockItem()#

Tells the workspace that this item should survive restoring a saved workspace layout into the current window. Persistent items are carried over to the restored layout instead of being destroyed along with the previous one. Unlike permanent dock items, the user can still close them at any time.

isPermanentDockItem()#

Tells the workspace whether or not this item can be closed by the user by clicking an x on its tab. Use of this feature is discouraged unless there’s a very good reason not to allow users to close your item. Items can be made permanent only when they are contained in docks. Center pane items can always be removed. Note that it is currently still possible to close dock items via the Close Pane option in the context menu and via Lumine APIs, so you should still be prepared to handle your dock items being destroyed by the user even if you implement this method.

save()#

Saves the item.

saveAs(path)#

Saves the item to the specified path.

getPath()#

Returns the local path associated with this item. This is only used to set the initial location of the “save as” dialog.

getFileState()#

Returns one mutually exclusive state string: "unmodified" when the document matches its saved base, "modified" when it has local changes, "conflicted" when it has diverged from its backing file, or "removed" when its backing file no longer exists.

onDidChangeFileState(callback)#

Called by the workspace so it can be notified when the item’s file state changes. The callback receives the new state. Must return a Disposable.

getPreferredHeight()#

If this item is displayed in the bottom Dock, called by the workspace when initially displaying the dock to set its height. Once the dock has been resized by the user, their height will override this value.

Returns a Number.

getPreferredWidth()#

If this item is displayed in the left or right Dock, called by the workspace when initially displaying the dock to set its width. Once the dock has been resized by the user, their width will override this value.

Returns a Number.

onDidTerminatePendingState(callback)#

If the workspace is configured to use pending pane items, the workspace will subscribe to this method to terminate the pending state of the item. Must return a Disposable.

shouldPromptToSave()#

This method indicates whether Lumine should prompt the user to save this item when the user closes or reloads the window. Returns a boolean.

Windows9

PublicL566#

PublicL578#

PublicL592#

PublicL702#

PublicL715#

asyncPublicL788#

asyncPublicL864#

asyncPublicL900#

asyncPublicL930#

Event Subscription25

PublicL689#

EssentialL2252#

EssentialL2270#

PublicL2287#

EssentialL2331#

EssentialL2352#

EssentialL2367#

EssentialL2382#

EssentialL2399#

ExtendedL2416#

ExtendedL2431#

ExtendedL2448#

ExtendedL2463#

EssentialL2485#

ExtendedL2500#

ExtendedL2518#

ExtendedL2536#

ExtendedL2553#

ExtendedL2569#

ExtendedL2584#

ExtendedL2603#

ExtendedL2623#

ExtendedL2642#

ExtendedL2662#

ExtendedL3799#

Command Context1

PublicL740#

File Operations2

PublicL1027#

PublicL1042#

Dock Items1

ExtendedL1294#

Layout3

asyncExtendedL1619#

ExtendedL4829#

ExtendedL4858#

Opening10

asyncEssentialL2705#

EssentialL3185#

EssentialL3239#

asyncPublicL3381#

PublicL3813#

PublicL3856#

ExtendedL3886#

ExtendedL3930#

ExtendedL4026#

asyncExtendedL4132#

Text Editors8

PublicL3580#

ExtendedL3594#

EssentialL4215#

EssentialL4245#

EssentialL4268#

EssentialL4292#

ExtendedL4315#

ExtendedL4345#

Dialogs4

EssentialL3638#

EssentialL3673#

EssentialL3701#

EssentialL3725#

Modal Flow3

EssentialL3758#

EssentialL3772#

EssentialL3784#

Pane Items8

EssentialL4190#

EssentialL4202#

ExtendedL4388#

ExtendedL4409#

ExtendedL4436#

asyncExtendedL4526#

ExtendedL4540#

ExtendedL4650#

Panes9

ExtendedL4464#

ExtendedL4478#

ExtendedL4509#

ExtendedL4550#

ExtendedL4560#

ExtendedL4602#

ExtendedL4620#

Pane Locations6

ExtendedL4575#

ExtendedL4589#

EssentialL4763#

EssentialL4774#

EssentialL4785#

EssentialL4796#

Panels15

EssentialL4874#

EssentialL4890#

EssentialL4901#

EssentialL4917#

EssentialL4928#

EssentialL4944#

EssentialL4955#

EssentialL4971#

EssentialL4982#

EssentialL4998#

EssentialL5009#

EssentialL5025#

EssentialL5036#

EssentialL5057#

EssentialL5071#

Searching and Replacing2

PublicL5135#

asyncPublicL5401#

Essential API

WorkspaceCentersrc/workspace-center.js:14

Aggregates the document panes presented by all windows of one workspace.

Pane Containers1

PublicL94#

Event Subscription16

PublicL107#

EssentialL180#

EssentialL198#

EssentialL218#

EssentialL239#

EssentialL254#

ExtendedL271#

ExtendedL287#

ExtendedL303#

ExtendedL318#

ExtendedL333#

ExtendedL348#

ExtendedL367#

ExtendedL385#

ExtendedL408#

ExtendedL426#

Pane Items4

EssentialL446#

EssentialL458#

EssentialL470#

Panes4

ExtendedL514#

ExtendedL536#

ExtendedL546#

Extended API

WorkspaceDropManagersrc/workspace-drop-manager.js:31

Routes workspace drag-and-drop through one capture lifecycle. Providers own source semantics; targets own surface-specific context and visuals.

Providers and Targets2

ExtendedL165#

ExtendedL196#

Drag Sessions4

ExtendedL222#

ExtendedL243#

asyncExtendedL339#

asyncExtendedL356#

Data Transfer3

ExtendedL477#

ExtendedL491#

ExtendedL505#

Essential API · Object

fuzzyMatchersrc/fuzzy-matcher.js:157

lumine.tools.fuzzyMatcher

Fuzzy matching utilities used by symbol lists, file search and the command palette. Available as lumine.tools.fuzzyMatcher.

Use .setCandidates to create a reusable Matcher for an array of candidates. .match and .score match one candidate without creating a matcher yourself.

Candidate Sets1

EssentialL183#

Matching2

EssentialL200#

EssentialL219#

Public API · Object

Iconsrc/icon-descriptor.js:61

require('lumine').Icon

Factories and helpers for the frozen icon descriptors consumed by IconRegistry. Available as require('lumine').Icon.

Full description

A descriptor contains a render discriminator (classes, image, svg, letter or none), a frozen classes array, and nullable source, svg, viewBox, letter, color, title and providerId fields. Always use these factories: a plain object with the same fields is not a descriptor.

Providers return a descriptor when they claim an icon, .none when they intentionally suppress one, and null to let the next provider answer.

Construction5

PublicL78#

PublicL96#

PublicL115#

PublicL138#

PublicL153#

Descriptor Helpers3

PublicL168#

PublicL183#

PublicL215#

Public API

Functions

Public functions with their callable access paths.

Functions9

Link copied