Package-level declarations

Types

Link copied to clipboard
data class Change(val fromA: Int, val toA: Int, val fromB: Int, val toB: Int)

A single changed range between two documents, spanning fromA..toA in document A and fromB..toB in document B.

Link copied to clipboard
class Chunk(val changes: List<Change>, val fromA: DocPos, val toA: DocPos, val fromB: DocPos, val toB: DocPos, val precise: Boolean = true)

A chunk describes a range of lines which have changed content in them. Either side (a/b) may either be empty (when its to is equal to its from), or points at a range starting at the start of the first changed line, to 1 past the end of the last changed line.

Link copied to clipboard
data class ChunkResult(val chunks: List<Chunk>, val side: MergeSide?)

Result of getChunks.

Link copied to clipboard
data class CollapseConfig(val margin: Int = 3, val minSize: Int = 4)

Configuration for collapsing unchanged text.

Link copied to clipboard
data class DiffConfig(val scanLimit: Int, val timeout: Long = 0, val override: (String, String) -> List<Change>? = null)

Configuration for the diff algorithm.

Link copied to clipboard

Color definitions for merge view decorations.

Link copied to clipboard
data class MergeConfigValue(val sibling: () -> EditorSession? = null, val highlightChanges: Boolean = true, val markGutter: Boolean = true, val syntaxHighlightDeletions: Boolean = true, val syntaxHighlightDeletionsMaxLength: Int = 3000, val mergeControls: Boolean = true, val overrideChunk: (EditorState, Chunk, RangeSetBuilder<Decoration>, RangeSetBuilder<GutterMarker>?) -> Boolean? = null, val side: MergeSide = MergeSide.B)

Internal merge configuration.

Link copied to clipboard

Which side of a merge this editor represents.

Link copied to clipboard
class MergeView(config: MergeViewConfig)

A merge view manages two editors side-by-side, highlighting the difference between them.

Link copied to clipboard
data class MergeViewConfig(val a: EditorStateConfig, val b: EditorStateConfig, val orientation: Orientation = Orientation.A_B, val revertControls: RevertDirection? = null, val highlightChanges: Boolean = true, val gutter: Boolean = true, val collapseUnchanged: CollapseConfig? = null, val diffConfig: DiffConfig = defaultDiffConfig)

Configuration for a side-by-side merge view.

Link copied to clipboard

Orientation of the two editors.

Link copied to clipboard
data class OriginalDocUpdate(val doc: Text, val changes: ChangeSet)

Data class for original doc update effects.

Link copied to clipboard

Direction for revert controls.

Link copied to clipboard
data class UnifiedMergeConfig(val original: Text, val highlightChanges: Boolean = true, val gutter: Boolean = true, val syntaxHighlightDeletions: Boolean = true, val allowInlineDiffs: Boolean = false, val syntaxHighlightDeletionsMaxLength: Int = 3000, val mergeControls: Boolean = true, val diffConfig: DiffConfig = defaultDiffConfig, val collapseUnchanged: CollapseConfig? = null)

Configuration for a unified merge view.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Move the selection to the next changed chunk.

Link copied to clipboard

Move the selection to the previous changed chunk.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

A state effect that expands the section of collapsed unchanged code starting at the given position.

Link copied to clipboard

The state effect used to signal changes in the original doc in a unified merge view.

Functions

Link copied to clipboard
fun acceptChunk(view: EditorSession, pos: DocPos? = null): Boolean

In a unified merge view, accept the chunk under the given position or the cursor. This chunk will no longer be highlighted unless it is edited again.

Link copied to clipboard
fun collapseUnchanged(margin: Int = 3, minSize: Int = 4): Extension

Collapse unchanged sections in a merge view.

Link copied to clipboard
fun diff(a: String, b: String, config: DiffConfig = DiffConfig()): List<Change>

Compute the difference between two strings.

Link copied to clipboard

Get the changed chunks for the merge view that this editor is part of, plus the side it is on if it is part of a MergeView.

Link copied to clipboard

Get the original document from a unified merge editor's state.

Link copied to clipboard

Create an effect that updates the original document being compared against.

Link copied to clipboard
fun presentableDiff(a: String, b: String, config: DiffConfig = DiffConfig()): List<Change>

Compute the difference between the given strings, and clean up the resulting diff for presentation to users by dropping short unchanged ranges, and aligning changes to word boundaries when appropriate.

Link copied to clipboard
fun rejectChunk(view: EditorSession, pos: DocPos? = null): Boolean

In a unified merge view, reject the chunk under the given position or the cursor. Reverts that range to the content it has in the original document.

Link copied to clipboard

Create an extension that causes the editor to display changes between its content and the given original document. Changed chunks will be highlighted, with uneditable widgets displaying the original text displayed above the new text.