Package-level declarations

Types

Link copied to clipboard
data class ActiveSnippet(val fields: List<SnippetField>, val fieldIndex: Int)

Tracks the currently active snippet insertion — the list of tab-stop fields and the index of the field the cursor is at.

Link copied to clipboard
data class CloseBracketsConfig(val brackets: String = "()[]{}''", val before: String = ")]}:;>")

Configuration for close-brackets behavior.

Link copied to clipboard
data class Completion(val label: String, val displayLabel: String? = null, val detail: String? = null, val info: String? = null, val type: String? = null, val boost: Int = 0, val apply: String? = null, val applyFn: (CompletionApplyContext) -> Unit? = null, val section: CompletionSection? = null)

A single completion option.

Link copied to clipboard
data class CompletionApplyContext(val session: EditorSession, val completion: Completion, val from: DocPos, val to: DocPos)

Context passed to Completion.applyFn when a completion is accepted.

Link copied to clipboard
data class CompletionConfig(val activateOnTyping: Boolean = true, val selectOnOpen: Boolean = true, val closeOnBlur: Boolean = true, val maxRenderedOptions: Int = 100, val icons: Boolean = true, val defaultKeymap: Boolean = true, val override: List<CompletionSource>? = null)

Configuration for the autocompletion extension.

Link copied to clipboard
class CompletionContext(val state: EditorState, val pos: DocPos, val explicit: Boolean)

Context passed to completion sources.

Link copied to clipboard
data class CompletionResult(val from: DocPos, val to: DocPos? = null, val options: List<Completion>, val validFor: Regex? = null, val filter: Boolean = true)

The result of a completion source query.

Link copied to clipboard
data class CompletionSection(val name: String, val rank: Int = 0)

A named section for grouping completions.

Link copied to clipboard

A function that provides completions for a given context.

Link copied to clipboard

Standard completion type indicators. Use value as the Completion.type string, or pass the enum directly to Completion via CompletionType.value.

Link copied to clipboard
data class MatchBeforeResult(val from: DocPos, val to: DocPos, val text: String)
Link copied to clipboard
data class SnippetField(val name: String, val from: DocPos, val to: DocPos)

A named field within an active snippet, spanning from to to in the document.

Link copied to clipboard

A suspend function that provides completions for a given context.

Properties

Link copied to clipboard

Accept the currently selected completion.

Link copied to clipboard

Clear the active snippet.

Link copied to clipboard

Keymap for close-brackets: Backspace deletes bracket pair.

Link copied to clipboard

Close the completion list.

Link copied to clipboard

A completion source that provides all words in the document.

Link copied to clipboard

Background color for the completion popup.

Link copied to clipboard

Facet for completion configuration.

Link copied to clipboard

Text color for completion detail/info text.

Link copied to clipboard

Text color for completion type icons.

Link copied to clipboard

Default autocompletion keymap bindings.

Link copied to clipboard

Background color for the selected completion item.

Link copied to clipboard

Text color for completion labels.

Link copied to clipboard

Delete bracket pair command: when cursor is between a pair, delete both.

Link copied to clipboard

Move to the next snippet field, or clear the snippet if at the last field.

Link copied to clipboard

Transaction annotation that tags a transaction where a completion was accepted. Extensions can read this to react to completion events.

Link copied to clipboard

Move to the previous snippet field.

Link copied to clipboard

Effect to set the selected completion index.

Link copied to clipboard

Background color for the active snippet field.

Link copied to clipboard

Background color for inactive snippet fields.

Link copied to clipboard

Default keymap for snippet field navigation: Tab, Shift-Tab, and Escape.

Link copied to clipboard

State field that holds the currently active snippet, or null when no snippet is active.

Link copied to clipboard

Explicitly start completion (Ctrl-Space).

Functions

Link copied to clipboard

Wrap a SuspendCompletionSource into a CompletionSource that runs the suspend function in a blocking context.

Wrap a SuspendCompletionSource into a CompletionSource that runs the suspend function in a blocking context.

Wrap a SuspendCompletionSource into a CompletionSource that runs the suspend function in a blocking context.

Wrap a SuspendCompletionSource into a CompletionSource that runs the suspend function in a blocking context.

Link copied to clipboard
fun autocompletion(config: CompletionConfig = CompletionConfig()): Extension

Create the autocompletion extension.

Link copied to clipboard
fun closeBrackets(config: CloseBracketsConfig = CloseBracketsConfig()): Extension

Extension that auto-closes brackets and quotes.

Link copied to clipboard

Create a completion source from a static list.

Link copied to clipboard

Get the completion status: "active" if completions are shown, null otherwise.

Link copied to clipboard

Get the current list of filtered completions.

Link copied to clipboard

Whether there is a next snippet field to navigate to.

Link copied to clipboard

Whether there is a previous snippet field to navigate to.

Link copied to clipboard

Wrap a CompletionSource so it only activates when the cursor is inside one of the given syntax node types.

Link copied to clipboard

Wrap a CompletionSource so it only activates when the cursor is NOT inside one of the given syntax node types.

Link copied to clipboard

Programmatic bracket insertion.

Link copied to clipboard

Insert completion text into the document (utility for custom apply functions).

Link copied to clipboard
fun moveCompletionSelection(forward: Boolean, by: String = "option"): (EditorSession) -> Boolean

Move the completion selection.

Link copied to clipboard

Get the currently selected completion.

Link copied to clipboard

Get the index of the currently selected completion.

Link copied to clipboard

Parse a snippet template and return a function that, when called, applies the snippet at the given range in the editor.

Link copied to clipboard
fun snippetCompletion(template: String, completion: Completion): Completion

Create a Completion that, when accepted, inserts a snippet.

Link copied to clipboard

Returns an extension that enables snippet support: the snippet state field, decoration highlights for active fields, and the Tab/Shift-Tab/Escape keymap for navigating between fields.