editor_core library
Stable low-level text editing primitives for terminal editors.
This entrypoint exposes the reusable document, cursor/selection, view,
command, history, decoration, language-adapter, and syntax-tree layers
that power the higher-level editor widgets and TUI text areas.
Language-specific builtins (comment tables, indent policy, auto-pairs)
live in code_extensions.dart and are re-exported here for backwards
compatibility; new editors with custom languages or Tree-sitter-backed
tooling should depend on the core adapters directly and skip the builtins
when they want zero bundled languages.
It is intended for editor implementations, language tooling, and advanced
integrations that need lower-level editing surfaces than
package:artisanal_widgets/editors.dart.
Classes
- AppliedFileEdit
- Result of applying one file's edits.
- AsyncSyntaxTreeProvider
- Asynchronous backend interface for incremental syntax trees.
- AsyncSyntaxTreeSession
- Coordinates asynchronous tree builds and rejects stale responses.
-
AsyncTextSyntaxProvider<
State> - Asynchronous syntax provider for parsers that run outside the render loop.
-
AsyncTextSyntaxSession<
State> - Coordinates asynchronous syntax builds and rejects stale responses.
- AttachmentPreview
- Prepared pixel payload (or failure) for one attachment.
- CodeBlockCommentDelimiters
- CodeLanguageProfile
- DisplayNumberAssigner
- Monotonic display-number assigner; reset when the prompt clears.
- EditBuffer
- EditConflict
- Two edits in one file whose ranges overlap.
-
EditHistoryCheckpoint<
Action, State, Marker> -
EditHistoryController<
Action, State, Marker> - EditorCodeAction
- A quick fix, refactor, or source action offered by tooling.
- EditorCodeActionProvider
- Supplies code actions without coupling editor core to LSP or FFI.
- EditorCodeActionRequest
- Context passed to a backend-neutral code-action provider.
- EditorCodeActionSession
- Rejects results superseded by another request or explicit cancellation.
-
EditorCommand<
T> - A stable, discoverable editor operation.
- EditorCommandIds
- Stable IDs for commands shared by editor hosts.
-
EditorCommandPalette<
T> - UI-agnostic state for an editor command palette.
-
EditorCommandRegistry<
T> - Ordered registry of stable editor commands.
- EditorCommentConfig
- Versatile language abstraction for the editor core.
- EditorCompletionItem
- One completion candidate and the edits needed to accept it.
- EditorCompletionProvider
- Backend-neutral source of editor completions.
- EditorCompletionRequest
- Immutable completion request in grapheme/document coordinates.
- EditorCompletionResult
- Result returned by an EditorCompletionProvider.
- EditorCompletionSession
- Coordinates asynchronous completion requests and rejects stale responses.
- EditorCoreConfig
- EditorDocumentSnapshot
- Serializable editor document state supplied to persistence adapters.
- EditorDocumentStore
- Persistence boundary for files, databases, browser storage, or remote APIs.
- EditorIndentContext
- Indent request passed to a language adapter.
- EditorKeyBinding
- Associates a host-normalized key chord with a command.
- EditorKeymap
- Ordered keymap with conflict detection.
- EditorLanguageAdapter
- Adapter that customizes editing behavior per language.
- EditorLanguageRegistry
- Mutable registry mapping language identifiers to adapters.
- EditorPairConfig
- Bracket/pair configuration for a language.
- EditorPersistenceSession
- Coordinates durable saves and recovery while rejecting stale completions.
- EditorSelection
- External editor selection attached to a prompt.
- EditorSelectionPosition
- IDE selection ingestion for prompt composers.
- EditorSelectionRange
- One selected range inside EditorSelection.filePath.
- EditorSortLinesArgument
-
Options supplied to the argument-taking
sortSelectedLinescommand. - EditorState
- EditorSyntaxCapture
- A query capture mapped to a decoration style.
- EditorSyntaxNode
- Pure-Dart syntax-tree DTOs for Tree-sitter-style backends.
- EditorSyntaxTree
- Immutable snapshot of a parsed syntax tree.
- EditorWorkAssessment
- Feature recommendations derived from an EditorWorkBudget.
- EditorWorkBudget
- Configurable limits for features whose cost grows with document size.
- EditorWrapSelectionArgument
-
Delimiters supplied to the argument-taking
wrapSelectioncommand. - FileTextEdit
- Atomic multi-file edit sets for tooling (formatters, refactors, agents).
- FoldRange
- Foldable line range (both ends inclusive, 0-based).
- FoldState
- Collapse state over a fold list.
- InlineElement
- One typed span in a document.
- InlineElementStore
- Owns a document's live elements: ids, hit-testing, and offset tracking.
- MediaAttachment
- One attached media item bound to an inline element id.
- MediaViewerState
- State for a modal media viewer.
- MemoryEditorDocumentStore
- In-memory EditorDocumentStore for tests, examples, and recovery drills.
- ParsedSnippet
- A parsed snippet: expanded text plus tabstops in document coordinates.
- PlaceholderTracker
- Tracks placeholder ranges across document edits.
- SnippetSession
- Ordered tabstop navigation over a ParsedSnippet.
- SnippetTabstop
-
Snippet parsing (
${1:default},$1,$0) with tabstop sessions. - SyntaxTreeEdit
- An incremental edit applied to a previous tree snapshot.
- SyntaxTreeProvider
- Backend interface for incremental syntax trees.
- TextCommandResult
- TextCursorCommandResult
- TextDecorationRange
- TextDiagnosticRange
- TextDocument
- TextDocumentChange
- TextDocumentEditResult
- TextEditResult
- TextExtmark
- TextExtmarkOptions
- TextExtmarkPositionRange
- TextExtmarksController
- TextHighlightRange
- TextHitResult
- TextLineCommandResult
- TextLineDecoration
- TextLineStateSnapshot
- TextOffsetStateSnapshot
- TextPasteChunk
- TextPasteChunkStep
- TextPasteController
- TextPastePlan
- TextPasteReference
- TextPasteReferenceStore
- TextPasteSession
- TextPatternDiagnosticRule
- TextPosition
- TextPositionDiagnosticRange
- TextSearchMatch
- One match in document coordinates.
- TextSearchQuery
- Regex-capable find/replace over a TextDocument.
- TextSearchResult
- Result of findTextSearchMatches.
- TextSearchSession
- Stateful find-next/previous cursor over a match list.
- TextSelection
- TextSelectionRange
- Multi-selection sets for multi-cursor editing flows.
- TextSelectionSet
- Sorted, non-overlapping selection ranges with a primary index.
-
TextSyntaxBuildResult<
State> - TextSyntaxChangeWindow
- TextSyntaxDecorationPatch
- TextSyntaxLineWindow
-
TextSyntaxProvider<
State> -
TextSyntaxSession<
State> -
TextSyntaxSnapshot<
State> - TextUtf8CoordinateIndex
- Reusable UTF-8/grapheme coordinate index for a document snapshot.
- TextUtf8Point
- A zero-based UTF-8 row and byte-column pair.
- TextView
- TextViewLine
- TextViewport
- TextVisualCursorPosition
- TrackedPlaceholderRange
- Tracked placeholder ranges for prompt composers.
-
UndoableCommand<
State> - A command that knows how to apply and undo its own effect on a mutable state.
- UndoCommandJournalEntry
- Journal envelope for one command or transaction.
-
UndoManager<
State> - Undo/redo command journal with optional transactional grouping.
- WorkspaceEdit
- Named file edits applied together.
Enums
- AttachmentPreviewStatus
- Media attachment lifecycle for prompt composers.
- EditorCommandDispatchResult
- Result of dispatching a command through EditorCommandRegistry.
- EditorCompletionKind
- Broad category used to decorate and rank a completion.
- EditorDocumentScale
- Coarse document-size class used to choose bounded editor strategies.
- FoldKind
- Code folding: indent-based ranges plus collapse state.
- MediaAffordance
- What the composer may do with an attachment right now.
- TextDecorationLayerKey
- TextDiagnosticSeverity
- TextPasteMode
Extensions
Constants
-
bracketClosings
→ const Map<
String, String> - Closing brackets understood by the matcher.
-
bracketOpenings
→ const Map<
String, String> - Structural bracket matching over a TextDocument.
-
defaultCodeAutoPairs
→ const Map<
String, String> -
defaultCodeClosingToOpening
→ const Map<
String, String> - inlineElementFileRef → const String
- inlineElementImage → const String
- Typed inline elements (chips) anchored to document ranges.
- inlineElementPaste → const String
- textActiveLineDecorationKey → const String
- textActiveLineDecorationLayerKey → const String
- textActiveLineDecorationLayerPriority → const int
- textActiveLineNumberDecorationKey → const String
- textDefaultDecorationLayerKey → const String
- textDefaultDecorationLayerPriority → const int
- textDefaultExtmarkType → const String
- textDefaultLineDecorationLayerKey → const String
- textDefaultLineDecorationLayerPriority → const int
- textDiagnosticErrorDecorationKey → const String
- textDiagnosticErrorLineDecorationKey → const String
- textDiagnosticErrorLineNumberDecorationKey → const String
- textDiagnosticHintDecorationKey → const String
- textDiagnosticHintLineDecorationKey → const String
- textDiagnosticHintLineNumberDecorationKey → const String
- textDiagnosticInfoDecorationKey → const String
- textDiagnosticInfoLineDecorationKey → const String
- textDiagnosticInfoLineNumberDecorationKey → const String
- textDiagnosticsDecorationLayerKey → const String
- textDiagnosticsDecorationLayerPriority → const int
- textDiagnosticsLineDecorationLayerKey → const String
- textDiagnosticsLineDecorationLayerPriority → const int
- textDiagnosticWarningDecorationKey → const String
- textDiagnosticWarningLineDecorationKey → const String
- textDiagnosticWarningLineNumberDecorationKey → const String
- textSearchActiveMatchDecorationKey → const String
- textSearchDecorationLayerKey → const String
- textSearchDecorationLayerPriority → const int
- textSearchMatchDecorationKey → const String
- textSyntaxDecorationLayerKey → const String
- textSyntaxDecorationLayerPriority → const int
Functions
-
applyFileEdits(
String filePath, String text, List< FileTextEdit> edits) → AppliedFileEdit -
Applies
editstotext, descending by offset. -
applyWorkspaceEdit(
Map< String, String> files, WorkspaceEdit edit) → Map<String, AppliedFileEdit> -
Applies
editto every file infiles(missing files count as empty). -
bracketPairRange(
TextDocument document, int offset) → ({int endOffset, int startOffset})? -
Returns the range covering a bracket pair and everything between the
brackets (end exclusive, one past the closing bracket), or
nullwhen no pair is found atoffset. -
builtinCodeLanguageProfiles(
) → List< CodeLanguageProfile> - Builtin language registrations.
-
codeBlockNewlineSuffix(
{required String beforeCursor, required String afterCursor, required String baseIndent}) → ({int consumedColumns, String text})? -
codeHandleAutoPair(
{required TextDocument document, required TextOffsetStateSnapshot state, required CodeLanguageProfile profile, required String typed}) → TextCommandResult -
codeHandleClosingDelimiterAlignment(
{required TextDocument document, required TextOffsetStateSnapshot state, required CodeLanguageProfile profile, required String typed, required int indentWidth}) → TextCommandResult -
codeHandlePairBackspace(
{required TextDocument document, required TextOffsetStateSnapshot state, required CodeLanguageProfile profile}) → TextCommandResult -
codeInsertIndentedNewline(
{required TextDocument document, required TextOffsetStateSnapshot state, required int indentWidth, String? language}) → TextCommandResult -
codeLeadingIndent(
String line) → String -
codeOutdentedIndent(
String indent, int width) → String -
codeShouldAutoPairSymmetricDelimiter(
String text, int offset, {bool hasSelection = false}) → bool -
codeShouldAutoPairSymmetricDelimiterInDocument(
TextDocument document, int offset, {bool hasSelection = false}) → bool -
codeShouldIncreaseIndentAfter(
String prefix, {String? language}) → bool -
codeShouldIncreaseIndentForAdapter(
String prefix, {EditorLanguageAdapter? adapter}) → bool - Adapter-aware indent check. Prefer this over the string-based overload: pass the resolved EditorLanguageAdapter (builtin, Tree-sitter-backed, or custom) instead of a language name.
-
codeToggleBlockComments(
{required TextDocument document, required TextOffsetStateSnapshot state, required CodeLanguageProfile profile}) → TextCommandResult -
computeIndentFolds(
List< String> lineTexts, {int tabWidth = 4}) → List<FoldRange> -
Computes indent folds over
lineTexts. -
computeTextDocumentChange(
String previousText, String nextText) → TextDocumentChange -
computeTextDocumentChangeForDocuments(
{required TextDocument previousDocument, required TextDocument nextDocument}) → TextDocumentChange -
deleteAfterCursor(
List< String> graphemes, int cursorOffset) → TextEditResult -
deleteBeforeCursor(
List< String> graphemes, int cursorOffset) → TextEditResult -
deleteNext(
List< String> graphemes, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset}) → TextCommandResult -
deleteNextDocumentGrapheme(
TextDocument document, int cursorOffset) → TextDocumentEditResult -
deleteNextGrapheme(
List< String> graphemes, int cursorOffset) → TextEditResult -
deleteNextOrSelection(
List< String> graphemes, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset}) → TextCommandResult -
deletePrevious(
List< String> graphemes, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset}) → TextCommandResult -
deletePreviousDocumentGrapheme(
TextDocument document, int cursorOffset) → TextDocumentEditResult -
deletePreviousGrapheme(
List< String> graphemes, int cursorOffset) → TextEditResult -
deletePreviousOrSelection(
List< String> graphemes, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset}) → TextCommandResult -
deleteSelection(
List< String> graphemes, {int? selectionBaseOffset, int? selectionExtentOffset, required int cursorOffset}) → TextCommandResult -
deleteSurroundingPair(
List< String> graphemes, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset, required Map<String, String> surroundPairs}) → TextCommandResult -
deleteToLineEnd(
List< String> graphemes, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset, required int lineEndOffset}) → TextCommandResult -
deleteToLineStart(
List< String> graphemes, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset, required int lineStartOffset}) → TextCommandResult -
deleteWordBackward(
List< String> graphemes, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset, required GraphemePredicate isWord}) → TextCommandResult -
deleteWordBackwardRange(
List< String> graphemes, int offset, {required GraphemePredicate isWord}) → ({int end, int start}) -
deleteWordBackwardRangeFromReader(
int length, int offset, {required GraphemePredicate isWord, required GraphemeReader graphemeAt}) → ({int end, int start}) -
deleteWordForward(
List< String> graphemes, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset, required GraphemePredicate isWord}) → TextCommandResult -
deleteWordForwardRange(
List< String> graphemes, int offset, {required GraphemePredicate isWord}) → ({int end, int start}) -
deleteWordForwardRangeFromReader(
int length, int offset, {required GraphemePredicate isWord, required GraphemeReader graphemeAt}) → ({int end, int start}) -
duplicateSelectedLinesAbove(
List< String> lines, {required TextPosition cursor, TextPosition? selectionBase, TextPosition? selectionExtent}) → TextLineCommandResult -
duplicateSelectedLinesBelow(
List< String> lines, {required TextPosition cursor, TextPosition? selectionBase, TextPosition? selectionExtent}) → TextLineCommandResult -
editorSelectionKey(
EditorSelection? selection) → String - Stable key for dismiss tracking (dismissed context stays cleared until the selection changes again).
-
editorSelectionRangeLabel(
EditorSelectionRange range) → String? -
Short
#line/#start-endlabel for a range (single-line ranges show just the line). -
expandPlaceholderRanges(
String text, List< TrackedPlaceholderRange> ranges) → String -
Splices each range's TrackedPlaceholderRange.fullText into
text. -
expandSearchReplacementTemplate(
String template, TextSearchMatch match, String matchedText) → String -
Expands
$&(whole match) and$1–$99(groups) intemplate. Unknown references expand to''.$$is an escaped dollar. -
extractPastedFilePaths(
String text) → List< String> - Extracts file-path candidates from pasted or dropped text.
-
filterEditorCompletions(
Iterable< EditorCompletionItem> items, String query) → List<EditorCompletionItem> -
Deterministically filters and sorts
itemsfor a command palette or popup. -
findMatchingBracket(
TextDocument document, int offset) → int? -
Returns the offset of the bracket matching the one at
offset. -
findTextQueryHighlights(
{required TextDocument document, required String query, bool caseSensitive = false}) → List< TextHighlightRange> -
findTextSearchMatches(
TextDocument document, TextSearchQuery query, {int? maxResults}) → TextSearchResult -
Finds
queryindocument. -
formatEditorSelectionContext(
EditorSelection selection) → String -
Builds the context block sent with the prompt for
selection. -
imageChipText(
int displayNumber) → String - Chip text for an attachment. Always path-free: origins appear only in hover/cursor overlays, never in the buffer.
-
insertAtCursor(
List< String> graphemes, int cursorOffset, List<String> inserted) → TextEditResult -
insertAutoPair(
List< String> graphemes, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset, required List<String> opening, required List<String> closing}) → TextCommandResult -
insertIndentedNewline(
List< String> graphemes, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset, required List<String> baseIndent, List<String> additionalIndent = const <String>[], List<String> trailingSuffix = const <String>[], int trailingSuffixReplaceCount = 0}) → TextCommandResult -
insertIntoDocument(
TextDocument document, int cursorOffset, List< String> inserted) → TextDocumentEditResult -
insertTextAtEachSelection(
List< String> graphemes, TextSelectionSet selections, List<String> insertion) → ({List<String> graphemes, TextSelectionSet selections}) -
Inserts
insertiongraphemes at every range inselections(ranges collapse to the insertion end). Applies descending; returns the new graphemes and set. -
insertTextIntoDocument(
TextDocument document, int cursorOffset, String inserted) → TextDocumentEditResult -
isDecodableImageBytes(
List< int> bytes) → bool -
Whether
bytesdecode as an image (magic-byte probe, not extension). -
isImagePath(
String path) → bool - File-path recognition for pasted and dropped paths.
-
lineSnapshotFromEditorState(
EditorState editorState, {required int lineCount, required int lineLength(int line), bool preserveCollapsedSelection = false}) → TextLineStateSnapshot -
lineSnapshotFromOffsets(
TextDocument document, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset}) → TextLineStateSnapshot -
mapSelectionEnds(
TextSelectionSet selections, {required int mapEnd(int activeOffset, TextSelectionRange range), required bool forward, bool extend = false}) → TextSelectionSet -
Moves or extends every range's active edge through
mapEnd. -
mapSelectionRanges(
TextSelectionSet selections, {required TextSelectionRange transform(TextSelectionRange range)}) → TextSelectionSet -
Maps each range through
transformand rebuilds the set. -
mergeTextSyntaxDecorationPatch(
List< TextDecorationRange> previousDecorations, TextSyntaxDecorationPatch patch) → List<TextDecorationRange> -
moveCursorByCharacter(
List< String> graphemes, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset, required bool forward, bool extendSelection = false, bool clearSelection = true, bool preserveCollapsedSelection = false}) → TextCursorCommandResult -
moveCursorByVisualLine(
TextDocument document, EditorState state, TextView view, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset, required int lineDelta, int desiredDisplayColumn = -1, bool extendSelection = false, bool clearSelection = true, bool preserveCollapsedSelection = false}) → TextCursorCommandResult -
moveCursorByWord(
List< String> graphemes, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset, required bool forward, required GraphemePredicate isWord, bool extendSelection = false, bool clearSelection = true, bool preserveCollapsedSelection = false}) → TextCursorCommandResult -
moveCursorToDocumentBoundary(
List< String> graphemes, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset, required bool forward, bool extendSelection = false, bool clearSelection = true, bool preserveCollapsedSelection = false}) → TextCursorCommandResult -
moveCursorToOffset(
{required int textLength, required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset, required int targetOffset, bool extendSelection = false, bool clearSelection = true, bool preserveCollapsedSelection = false}) → TextCursorCommandResult -
moveCursorToVisualLineBoundary(
TextDocument document, EditorState state, TextView view, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset, required bool end, bool extendSelection = false, bool clearSelection = true, bool preserveCollapsedSelection = false}) → TextCursorCommandResult -
moveSelectedLines(
List< String> lines, {required TextPosition cursor, TextPosition? selectionBase, TextPosition? selectionExtent, required int direction}) → TextLineCommandResult -
moveWordBackward(
List< String> graphemes, int offset, {required GraphemePredicate isWord}) → int -
moveWordBackwardFromReader(
int length, int offset, {required GraphemePredicate isWord, required GraphemeReader graphemeAt}) → int -
moveWordForward(
List< String> graphemes, int offset, {required GraphemePredicate isWord}) → int -
moveWordForwardFromReader(
int length, int offset, {required GraphemePredicate isWord, required GraphemeReader graphemeAt}) → int -
nextTextPasteChunk(
{required int totalRunes, required int offset, required int chunkSize}) → TextPasteChunk? -
nextWordRange(
List< String> graphemes, int offset, {required GraphemePredicate isWord}) → ({int end, int start})? -
nextWordRangeFromReader(
int length, int offset, {required GraphemePredicate isWord, required GraphemeReader graphemeAt}) → ({int end, int start})? -
normalizedSelectionRange(
int? baseOffset, int? extentOffset) → ({int end, int start})? -
normalizePromptContent(
String content) → String - Prompt-composer content helpers.
-
normalizeTextDiagnostics(
Iterable< TextDiagnosticRange> diagnostics, {int? maxLength}) → List<TextDiagnosticRange> -
offsetSnapshotFromEditorState(
TextDocument document, EditorState editorState, {required int textLength, bool preserveCollapsedSelection = false}) → TextOffsetStateSnapshot -
parseSnippet(
String source) → ParsedSnippet -
Parses
sourceinto expanded text and tabstops. Never throws: malformed sequences (${x}, unterminated${1:) emit literally. -
partitionImagePaths(
Iterable< String> candidates) → ({List<String> images, List<String> other}) -
Splits
candidatesinto image paths and everything else. -
planTextPaste(
String content, {required bool collapseLargePaste, required int collapsedPasteMinChars, required int collapsedPasteMinLines, required int chunkThresholdRunes}) → TextPastePlan -
previewWorkspaceEdit(
Map< String, String> files, WorkspaceEdit edit, {int contextLines = 3}) → String -
Renders a unified-style dry-run preview of
editagainstfiles. -
previousWordRange(
List< String> graphemes, int offset, {required GraphemePredicate isWord}) → ({int end, int start})? -
previousWordRangeFromReader(
int length, int offset, {required GraphemePredicate isWord, required GraphemeReader graphemeAt}) → ({int end, int start})? -
reconcileExternalRecords<
V> (Map< int, V> records, Set<int> liveIds) → List<V> - Drops sidecar records whose element id is no longer live.
-
registerBuiltinEditorLanguages(
[EditorLanguageRegistry? registry]) → void -
Registers the builtin profiles on
registry(defaults to the shared registry). Safe to call multiple times. -
removeDocumentRange(
TextDocument document, {required int start, required int end, int? cursorOffset}) → TextDocumentEditResult -
removeRange(
List< String> graphemes, {required int start, required int end, int? cursorOffset}) → TextEditResult -
renumberNumberedList(
List< String> lines, {required TextPosition cursor, TextPosition? selectionBase, TextPosition? selectionExtent, int startAt = 1}) → TextLineCommandResult -
replaceDocumentRange(
TextDocument document, {required int start, required int end, List< String> replacement = const <String>[], int? cursorOffset}) → TextDocumentEditResult -
replaceDocumentTextRange(
TextDocument document, {required int start, required int end, String replacement = '', int? cursorOffset}) → TextDocumentEditResult -
replaceRange(
List< String> graphemes, {required int start, required int end, List<String> replacement = const <String>[], int? cursorOffset}) → TextEditResult -
replaceSelectionOrInsert(
List< String> graphemes, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset, List<String> replacement = const <String>[], bool replaceSelection = true}) → TextCommandResult -
replaceTextSearchMatches(
List< String> graphemes, List<TextSearchMatch> matches, List<String> expand(TextSearchMatch match)) → List<String> -
Replaces
matchesingraphemes(e.g.document.flattenWithNewlines()) usingexpandfor each match's replacement graphemes. -
resolveCodeLanguageProfile(
String? language) → CodeLanguageProfile -
resolveEditorSelectionRange(
TextDocument document, EditorSelectionRange range) → ({int endOffset, int startOffset}) - Resolves a wire range to clamped document offsets.
-
resolveExternalEditorExecutable(
Map< String, String> environment, {bool isWindows = false, bool allowFallback = true}) → String? - Resolves the external editor executable from environment variables.
-
resolveMediaAffordance(
{required bool protocolSupported, bool forceTextFallback = false}) → MediaAffordance -
Resolves the affordance from capability probes. Hosts read the real
probes (ultraviolet terminal capabilities);
forceTextFallbackcovers minimal/scrollback-only modes that never paint pixels. -
skipClosingDelimiter(
List< String> graphemes, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset, required List<String> closing, bool clearSelection = false}) → TextCursorCommandResult -
syncEditorStateFromLineSnapshot(
EditorState editorState, TextLineStateSnapshot snapshot, {required int lineCount, required int lineLength(int line)}) → void -
syncEditorStateFromOffsets(
TextDocument document, EditorState editorState, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset}) → void -
syntaxCapturesToRanges(
Iterable< EditorSyntaxCapture> captures) → List<({int endOffset, int priority, int startOffset, String? styleKey})> - Maps EditorSyntaxCaptures to core decoration ranges.
-
syntaxTreeEditsForDocumentChange(
TextDocumentChange change) → List< SyntaxTreeEdit> - Converts a document change into the backend-neutral syntax-tree edit shape.
-
syntaxTreeEditsForReplacement(
{required int startOffset, required int oldEndOffset, required int newEndOffset}) → List< SyntaxTreeEdit> - Computes the SyntaxTreeEdit list for a single replacement.
-
textCapitalizeWords(
String text) → String -
textCleanupWhitespace(
{required List< String> lines, required TextLineStateSnapshot state, bool trimTrailingBlankLines = true}) → TextLineCommandResult -
textCleanupWhitespaceDocument(
{required TextDocument document, required TextLineStateSnapshot state, bool trimTrailingBlankLines = true}) → TextCommandResult -
textCollapsedPasteToken(
{required int lineCount}) → String -
textCountLines(
String text) → int -
textDeleteLines(
{required List< String> lines, required TextLineStateSnapshot state}) → TextLineCommandResult -
textDeleteLinesDocument(
{required TextDocument document, required TextLineStateSnapshot state}) → TextCommandResult -
textDeleteNext(
{required TextDocument document, required TextOffsetStateSnapshot state}) → TextCommandResult -
textDeletePrevious(
{required TextDocument document, required TextOffsetStateSnapshot state}) → TextCommandResult -
textDeleteSelection(
{required TextDocument document, required TextOffsetStateSnapshot state}) → TextCommandResult -
textDeleteToLineEnd(
{required TextDocument document, required TextOffsetStateSnapshot state}) → TextCommandResult -
textDeleteToLineStart(
{required TextDocument document, required TextOffsetStateSnapshot state}) → TextCommandResult -
textDeleteWordBackward(
{required TextDocument document, required TextOffsetStateSnapshot state, GraphemePredicate isWord = _isWordGrapheme}) → TextCommandResult -
textDeleteWordForward(
{required TextDocument document, required TextOffsetStateSnapshot state, GraphemePredicate isWord = _isWordGrapheme}) → TextCommandResult -
textDiagnosticAtOffset(
{required List< TextDiagnosticRange> diagnostics, required int offset}) → TextDiagnosticRange? -
textDiagnosticContainingIndex(
{required List< TextDiagnosticRange> diagnostics, required int offset}) → int? -
textDiagnosticDecorations(
Iterable< TextDiagnosticRange> diagnostics) → List<TextDecorationRange> -
textDiagnosticLineDecorations(
{required String text, required Iterable< TextDiagnosticRange> diagnostics}) → List<TextLineDecoration> -
textDiagnosticLineDecorationsForDocument(
{required TextDocument document, required Iterable< TextDiagnosticRange> diagnostics}) → List<TextLineDecoration> -
textDiagnosticLineMarker(
TextDiagnosticSeverity severity) → String -
textDiagnosticLineNumberStyleKey(
TextDiagnosticSeverity severity) → String -
textDiagnosticLineStyleKey(
TextDiagnosticSeverity severity) → String -
textDiagnosticLocationLabel(
{required String text, required TextDiagnosticRange diagnostic}) → String -
textDiagnosticLocationLabelForDocument(
{required TextDocument document, required TextDiagnosticRange diagnostic}) → String -
textDiagnosticSeverityLabel(
TextDiagnosticSeverity severity) → String -
textDiagnosticsFromPositions(
{required TextDocument document, required Iterable< TextPositionDiagnosticRange> diagnostics}) → List<TextDiagnosticRange> -
textDiagnosticStartPosition(
{required String text, required TextDiagnosticRange diagnostic}) → TextPosition -
textDiagnosticStartPositionForDocument(
{required TextDocument document, required TextDiagnosticRange diagnostic}) → TextPosition -
textDiagnosticStyleKey(
TextDiagnosticSeverity severity) → String -
textDiagnosticSummaryLabel(
{required String text, required TextDiagnosticRange diagnostic}) → String -
textDiagnosticSummaryLabelForDocument(
{required TextDocument document, required TextDiagnosticRange diagnostic}) → String -
textDuplicateSelectedLinesAbove(
{required List< String> lines, required TextLineStateSnapshot state}) → TextLineCommandResult -
textDuplicateSelectedLinesAboveDocument(
{required TextDocument document, required TextLineStateSnapshot state}) → TextCommandResult -
textDuplicateSelectedLinesBelow(
{required List< String> lines, required TextLineStateSnapshot state}) → TextLineCommandResult -
textDuplicateSelectedLinesBelowDocument(
{required TextDocument document, required TextLineStateSnapshot state}) → TextCommandResult -
textExtmarkPositionRange(
TextDocument document, TextExtmark extmark) → TextExtmarkPositionRange -
textIndentLines(
{required List< String> lines, required TextLineStateSnapshot state, int width = 2}) → TextLineCommandResult -
textIndentLinesDocument(
{required TextDocument document, required TextLineStateSnapshot state, int width = 2}) → TextCommandResult -
textInsertGraphemes(
{required TextDocument document, required TextOffsetStateSnapshot state, required List< String> graphemes, bool replaceSelection = true}) → TextCommandResult -
textInsertText(
{required TextDocument document, required TextOffsetStateSnapshot state, required String text, bool replaceSelection = true}) → TextCommandResult -
textJoinLines(
{required List< String> lines, required TextLineStateSnapshot state}) → TextLineCommandResult -
textJoinLinesDocument(
{required TextDocument document, required TextLineStateSnapshot state}) → TextCommandResult -
textMoveByCharacter(
{required TextDocument document, required TextOffsetStateSnapshot state, required bool forward, bool extendSelection = false, bool clearSelection = false}) → TextCursorCommandResult -
textMoveByWord(
{required TextDocument document, required TextOffsetStateSnapshot state, required bool forward, GraphemePredicate isWord = _isWordGrapheme, bool extendSelection = false, bool clearSelection = false}) → TextCursorCommandResult -
textMoveSelectedLines(
{required List< String> lines, required TextLineStateSnapshot state, required int direction}) → TextLineCommandResult -
textMoveSelectedLinesDocument(
{required TextDocument document, required TextLineStateSnapshot state, required int direction}) → TextCommandResult -
textMoveToDocumentBoundary(
{required TextDocument document, required TextOffsetStateSnapshot state, required bool forward, bool extendSelection = false, bool clearSelection = false}) → TextCursorCommandResult -
textOffsetForUtf8ByteOffset(
TextDocument document, int byteOffset) → int - Converts a UTF-8 byte offset from the document start into a grapheme offset.
-
textOffsetForUtf8Point(
TextDocument document, TextUtf8Point point) → int - Converts a UTF-8 parser point into a grapheme offset.
-
textOffsetOnAdjacentVisibleLine(
{required TextDocument document, required int offset, required bool below, int? preferredColumn, TextLineHiddenPredicate? isLineHidden}) → int - Resolves the next visible logical line while retaining a preferred column.
-
textOutdentLines(
{required List< String> lines, required TextLineStateSnapshot state, int width = 2}) → TextLineCommandResult -
textOutdentLinesDocument(
{required TextDocument document, required TextLineStateSnapshot state, int width = 2}) → TextCommandResult -
textPatternDiagnostics(
{required String text, required Iterable< TextPatternDiagnosticRule> rules}) → List<TextPositionDiagnosticRange> -
textPatternDiagnosticsForDocument(
{required TextDocument document, required Iterable< TextPatternDiagnosticRule> rules}) → List<TextPositionDiagnosticRange> -
textPositionForUtf8Point(
TextDocument document, TextUtf8Point point) → TextPosition - Converts a UTF-8 parser point into a grapheme-based document position.
-
textPrepareInsertedGraphemes(
List< int> runes, {required bool multiline, int? maxGraphemes}) → List<String> -
textRenumberNumberedList(
{required List< String> lines, required TextLineStateSnapshot state, int startAt = 1}) → TextLineCommandResult -
textRenumberNumberedListDocument(
{required TextDocument document, required TextLineStateSnapshot state, int startAt = 1}) → TextCommandResult -
textSanitizeRunes(
List< int> runes, {required bool multiline}) → List<int> -
textSanitizeRunesLimited(
List< int> runes, {required bool multiline, required int maxOutputCodepoints}) → List<int> -
textSearchDecorations(
Iterable< TextHighlightRange> matches, {int activeIndex = -1}) → List<TextDecorationRange> -
textSortSelectedLines(
{required List< String> lines, required TextLineStateSnapshot state, bool descending = false, bool caseSensitive = false}) → TextLineCommandResult -
textSortSelectedLinesDocument(
{required TextDocument document, required TextLineStateSnapshot state, bool descending = false, bool caseSensitive = false}) → TextCommandResult -
textSplitLine(
{required TextDocument document, required TextOffsetStateSnapshot state}) → TextCommandResult -
textSyntaxChangeWindow(
{required TextDocument previousDocument, required TextDocument nextDocument, required TextDocumentChange change, int lookBehindLines = 0, int lookAheadLines = 0}) → TextSyntaxChangeWindow -
textToggleChecklistState(
{required List< String> lines, required TextLineStateSnapshot state, String checkedMarker = 'x'}) → TextLineCommandResult -
textToggleChecklistStateDocument(
{required TextDocument document, required TextLineStateSnapshot state, String checkedMarker = 'x'}) → TextCommandResult -
textToggleHeadingPrefix(
{required List< String> lines, required TextLineStateSnapshot state, int level = 1}) → TextLineCommandResult -
textToggleHeadingPrefixDocument(
{required TextDocument document, required TextLineStateSnapshot state, int level = 1}) → TextCommandResult -
textToggleLinePrefix(
{required List< String> lines, required TextLineStateSnapshot state, required String prefix, bool addSpaceWhenNonEmpty = true, bool skipBlankLinesWhenChecking = true}) → TextLineCommandResult -
textToggleLinePrefixDocument(
{required TextDocument document, required TextLineStateSnapshot state, required String prefix, bool addSpaceWhenNonEmpty = true, bool skipBlankLinesWhenChecking = true}) → TextCommandResult -
textToggleNumberedList(
{required List< String> lines, required TextLineStateSnapshot state, int startAt = 1}) → TextLineCommandResult -
textToggleNumberedListDocument(
{required TextDocument document, required TextLineStateSnapshot state, int startAt = 1}) → TextCommandResult -
textTransformSelectionOrLine(
{required TextDocument document, required TextOffsetStateSnapshot state, required String transform(String text)}) → TextCommandResult -
textTransformWordOrAdjacent(
{required TextDocument document, required TextOffsetStateSnapshot state, required String transform(String text)}) → TextCommandResult -
textTransposeBackward(
{required TextDocument document, required TextOffsetStateSnapshot state}) → TextCommandResult -
textUnwrapSelection(
{required TextDocument document, required TextOffsetStateSnapshot state, required Map< String, String> surroundPairs}) → TextCommandResult -
textUtf8ByteOffsetForOffset(
TextDocument document, int offset) → int - Converts a grapheme offset from the document start into a UTF-8 byte offset.
-
textUtf8PointForOffset(
TextDocument document, int offset) → TextUtf8Point - Converts a grapheme offset into a zero-based UTF-8 parser point.
-
textUtf8PointForPosition(
TextDocument document, TextPosition position) → TextUtf8Point - Converts a document position into a zero-based UTF-8 parser point.
-
textWrapSelection(
{required TextDocument document, required TextOffsetStateSnapshot state, required String before, String? after}) → TextCommandResult -
toggleChecklistState(
List< String> lines, {required TextPosition cursor, TextPosition? selectionBase, TextPosition? selectionExtent, String checkedMarker = 'x'}) → TextLineCommandResult -
toggleDelimitedSegment(
List< String> graphemes, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset, required int rangeStartOffset, required int rangeEndOffset, required String startDelimiter, required String endDelimiter}) → TextCommandResult -
toggleHeadingPrefix(
List< String> lines, {required TextPosition cursor, TextPosition? selectionBase, TextPosition? selectionExtent, int level = 1}) → TextLineCommandResult -
toggleLinePrefix(
List< String> lines, {required TextPosition cursor, TextPosition? selectionBase, TextPosition? selectionExtent, required String prefix, bool addSpaceWhenNonEmpty = true, bool skipBlankLinesWhenChecking = true}) → TextLineCommandResult -
toggleNumberedList(
List< String> lines, {required TextPosition cursor, TextPosition? selectionBase, TextPosition? selectionExtent, int startAt = 1}) → TextLineCommandResult -
transformSelectionOrLine(
List< String> graphemes, {required int cursorOffset, required int lineStartOffset, required int lineEndOffset, int? selectionBaseOffset, int? selectionExtentOffset, required String transform(String text)}) → TextCommandResult -
transformWordOrAdjacent(
List< String> graphemes, {required int cursorOffset, required GraphemePredicate isWord, required String transform(String text)}) → TextCommandResult -
unwrapSelection(
List< String> graphemes, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset, required Map<String, String> surroundPairs}) → TextCommandResult -
validateFileEdits(
String filePath, List< FileTextEdit> edits) → List<EditConflict> -
Returns the overlap conflicts in
editsforfilePath(empty = clean). -
wordRangeForTransform(
List< String> graphemes, int offset, {required GraphemePredicate isWord}) → ({int end, int start})? -
wordRangeForTransformFromReader(
int length, int offset, {required GraphemePredicate isWord, required GraphemeReader graphemeAt}) → ({int end, int start})? -
wrapSelection(
List< String> graphemes, {required int cursorOffset, int? selectionBaseOffset, int? selectionExtentOffset, required List<String> before, List<String> ? after}) → TextCommandResult
Typedefs
- EditBufferState = EditorState
- Compatibility alias for cursor/selection editing state.
-
EditHistoryCoalescePredicate<
Action, State, Marker> = bool Function(Action action, {required State currentState, required Action? lastAction, required Marker? lastMarker}) -
EditHistoryMarkerBuilder<
Action, State, Marker> = Marker Function(Action action, State state) -
EditHistoryStateEquals<
State> = bool Function(State a, State b) -
EditorCommandArgumentHandler<
T> = bool Function(T target, Object? argument) - Executes an editor command with a host-supplied argument such as insert text.
-
EditorCommandHandler<
T> = bool Function(T target) -
Executes an editor command against
target. -
EditorCommandPredicate<
T> = bool Function(T target) - Decides whether an editor command is currently available.
- EditorRangeResolver = TextSelectionSet Function(TextDocument document, TextSelectionSet current)
- Produces a new selection set from the document and current selections.
- EditorView = TextView
- Compatibility alias for the viewport/layout primitive over a TextBuffer.
- GraphemePredicate = bool Function(String grapheme)
- GraphemeReader = String? Function(int offset)
- TextBuffer = TextDocument
- Compatibility alias for a reusable text storage surface.
- TextLineHiddenPredicate = bool Function(int line)
- Reports whether a logical document line is hidden from vertical movement.
-
UndoCommandDecoder<
State> = UndoableCommand< State> Function(String type, Map<String, Object?> payload)