← Guides

Migrating from Aardink 0.7 to 0.8

0.8 lets the editor understand the document’s structure and lets hosts draw on it: document symbols, decorations, an overview ruler, occurrence highlights, linked editing, links, colour decorators, folding markers, keybindings as data, and zoom. AARDINK_ROADMAP.md §6 has the plan, §14 the API ledger and §14.1 what was built where it differs.

Almost all of it is additive, and every new option is off by default, so an upgrade looks and behaves as 0.7 did. Source breaks in two places:

Every data class and composable that gained a parameter (EditorOptions, FoldRange, EditorTheme, CodeEditorLayout, the web’s option and message classes) changed its binary signature: recompile against 0.8. Calls by name or by position keep compiling.

Dependencies

implementation("com.aardarch:aardink:0.8.0")
implementation("com.aardarch:aardink-languages:0.8.0")

On the web: pnpm add @aardarch/aardink-web@^0.8.0.

FoldRange

0.70.8
FoldRange(startLine, endLine, placeholder)FoldRange(startLine, endLine, placeholder, kind: FoldKind? = null)
val (start, end, placeholder) = rangeThe same; a fourth component, kind, follows

A folding provider written for 0.7 compiles unchanged. Set kind to FoldKind.Comment, Imports or Region when a range is one of those.

EditorCommand

0.8 adds GoToSymbol, ExpandSelection, ShrinkSelection, ShowColorPicker, Fold, Unfold, JoinLines, SortLines, UpperCase, LowerCase, TrimTrailingWhitespace, JumpToBracket, CursorUndo, SkipOccurrence, ChangeAllOccurrences, CursorsAtLineEnds, ScrollLines, AddLineComment, RemoveLineComment, BlockComment, InsertLineBelow, InsertLineAbove, SelectLine, ZoomIn, ZoomOut, ZoomReset and ScrollTo.

// 0.7: compiled without an else
val label = when (command) {
    EditorCommand.Undo -> "Undo"
    // ... every 0.7 member ...
}

// 0.8
val label = when (command) {
    EditorCommand.Undo -> "Undo"
    // ... the members you name ...
    else -> command.toString()
}

LanguageService

New members, each with a default, so a 0.7 service compiles and behaves as before: documentSymbols, documentHighlights, selectionRanges, linkedEditingRanges, documentLinks, documentColors and colorPresentations. CompositeLanguageService merges them (see its KDoc).

Keys

The keys that run public commands are now data, EditorKeyBindings.Default, which EditorOptions.keyBindings overrides. The bindings themselves are those of 0.7, plus the new ones in the changelog. Two behaviours changed:

Changed behaviour

Worth adopting

Source: docs/MIGRATION_0.8.mdat v0.8.0.