codemirror library
Native Dart/Flutter port of CodeMirror 6.
This library provides a high-performance code editor built from scratch in Dart, following the architecture of CodeMirror 6 but using idiomatic Flutter patterns.
Architecture
The editor is built on three main layers:
- Text - Immutable B-tree based document storage with O(log n) operations
- State - Immutable editor state with transaction-based updates
- View - Flutter widgets for rendering and input handling
Usage
import 'package:codemirror/codemirror.dart';
// Create initial state
final state = EditorState.create(
doc: 'Hello, World!',
extensions: [
// Add extensions here
],
);
// Use in widget
EditorView(
state: state,
onUpdate: (update) {
// Handle state updates
},
)
Classes
- ActiveLineBackground
- A widget that paints active line background highlights.
- ActiveResult
- ActiveSource
-
Annotation<
T> - Annotations are tagged values that are used to add metadata to transactions in an extensible way.
-
AnnotationType<
T> - Marker that identifies a type of Annotation.
- BidiSpan
- Represents a contiguous range of text that has a single direction.
- BlockInfo
- Information about a line or block of lines in the document.
- BracketMatchingConfig
- Configuration options for bracket matching.
- ChangeByRangeResult
- Result of EditorState.changeByRange.
- ChangeDesc
- A change description is a variant of ChangeSet that doesn't store the inserted text. As such, it can't be applied, but is cheaper to store and manipulate.
- ChangedRange
- Represents a range that changed in the document.
- ChangeSet
- A change set represents a group of modifications to a document.
- ChangeSpec
- Represents a single change specification.
- ChildCursor
- Cursor for efficiently iterating through children of a content view.
- ChildPos
- Result of finding a child position.
- CloseBracketConfig
- Configuration for bracket closing behavior.
- Compartment
- Extension compartments can be used to make a configuration dynamic.
- Completion
- CompletionConfig
- CompletionContext
- CompletionDialog
- CompletionResult
- CompletionSection
- CompletionState
- ContentBounds
- Bounds of content within a view.
- ContentView
- Base class for nodes in the document view tree.
- CursorPainter
- Paints cursors with blinking support.
- Decoration
- A decoration provides information on how to draw or style a piece of content.
- DefinitionLocation
- Represents a location that can be navigated to.
- DefinitionResult
- Result returned by a definition source.
- Diagnostic
- Describes a problem or hint for a piece of code.
- DiagnosticAction
- An action associated with a diagnostic.
- DiagnosticTooltip
- A lean VSCode-style diagnostic tooltip.
- DocInput
- Lezer-style Input object for a Text document.
- DocSlot
- Represents a dependency on the document content.
- DocumentFormattingConfig
- Internal configuration for document formatting.
- DocumentFormattingOptions
- Configuration options for document formatting.
- DocumentHighlight
- A highlighted range in the document.
- DocumentHighlightConfig
- Internal configuration for document highlight.
- DocumentHighlightOptions
- Configuration options for document highlight.
- DocumentHighlightResult
- Result returned by a document highlight source.
- DocumentHighlightState
- The current document highlight state.
- DocView
- The root view for document content.
- EditorRect
- A simple rectangle with left, right, top, bottom bounds.
- EditorSelection
- An editor selection holds one or more selection ranges.
- EditorState
- The editor state class is a persistent (immutable) data structure.
- EditorStateConfig
- Options passed when creating an editor state.
- EditorTheme
- Widget that provides editor theme data to descendants.
- EditorThemeData
- Theme data for the code editor.
- EditorView
- A code editor widget.
- EditorViewConfig
- Configuration for creating an EditorView.
- EditorViewState
- State for EditorView.
- Extension
- Extension values can be provided when creating a state to attach various kinds of configuration and behavior information.
- ExtensionList
- A list of extensions.
-
Facet<
Input, Output> - A facet is a labeled value that is associated with an editor state.
-
FacetConfig<
Input, Output> - Configuration options for defining a facet.
-
FacetReader<
Output> -
A facet reader can be used to fetch the value of a facet, through
EditorState.facetor as a dependency in Facet.compute, but not to define new values for the facet. - FindReferencesConfig
- Internal configuration for a references source.
- FindReferencesOptions
- Configuration options for find-references.
- FoldConfig
- Configuration for code folding.
- FoldGutterConfig
- Configuration for the fold gutter.
- FormatEdit
- A single text edit returned by a formatter.
- FormatResult
- Result returned by a format source.
- GotoDeclarationConfig
- Internal configuration for a declaration source.
- GotoDefinitionConfig
- Internal configuration for a definition source.
- GotoDefinitionOptions
- Configuration options for go-to-definition.
- GotoImplementationConfig
- Internal configuration for an implementation source.
- GotoTypeDefinitionConfig
- Internal configuration for a type definition source.
- GutterConfig
- Configuration options for a gutter.
- GutterMarker
- A gutter marker represents a bit of information attached to a line in a specific gutter.
- GutterScrollMargins
- Scroll margins record for gutter offsets.
- GuttersView
- Widget that renders all gutters.
- GutterView
- Widget that renders a single gutter.
- GutterWidthInfo
- Information about gutter widths for scroll margin calculation.
- HeightOracle
- Oracle for estimating line heights.
- HighlightingTextEditingController
- A TextEditingController that applies syntax highlighting.
- HighlightSelectionMatchesConfig
- Options for highlightSelectionMatches.
- HighlightStyle
- A highlight style associates CSS styles with highlighting tags.
- HighlightTheme
- Theme that maps CSS class names to Flutter TextStyles.
- HistoryConfig
- Configuration for the history extension.
- HoverTooltip
- Describes a hover tooltip to be shown.
- HoverTooltipConfig
- Internal configuration for a hover tooltip source.
- HoverTooltipContainer
- Widget that displays a single tooltip.
- HoverTooltipDetector
- Widget that detects hover events and triggers hover tooltips.
- HoverTooltipOptions
- Configuration options for hover tooltips.
- HoverTooltipWidget
- Widget for displaying hover tooltip content.
- IndentContext
- Indentation contexts are used when calling indentService functions.
- IndentContextOptions
- Options for creating an IndentContext.
- InputState
- Manages input state for the editor.
- Isolate
- An isolated bidirectional range.
- JavaScriptConfig
- Configuration for the JavaScript language.
- KeyBinding
- Key bindings associate key names with Command-style functions.
- Language
- A language object manages parsing and per-language metadata.
- LanguageDescription
- Language descriptions are used to store metadata about languages and to dynamically load them.
- LanguageState
- Internal state for tracking language parsing.
- LanguageSupport
- This class bundles a Language with an optional set of supporting extensions.
- Line
- Describes a line in the document.
- LineCursor
- Cursor that iterates lines without line breaks.
- LineDecoration
- A decoration that adds attributes to an entire line.
- LineDecorationSpec
- Configuration for creating a line decoration.
- LineNumberConfig
- Configuration for the line number gutter.
- LineView
- A view representing a single line of text.
- LintConfig
- Configuration options for linting.
- LintGutterConfig
- Configuration for the lint gutter.
- LintGutterMarker
- Gutter marker for lint diagnostics.
- LintState
- Internal state for lint decorations and panel.
- LRLanguage
- A subclass of Language for use with Lezer LR parsers.
- LspPosition
- A position in a text document expressed as line and character offset.
- LspRange
- A range in a text document expressed as start and end positions.
- MarkDecoration
- A decoration that styles a range of text.
- MarkDecorationSpec
- Configuration for creating a mark decoration.
- MarkView
- A view representing styled (marked) content.
- MatchResult
- The result returned from matchBrackets.
- MeasuredHeights
- Heights measured from rendered document content.
- MouseSelection
- Manages an active mouse selection gesture.
- MouseSelectionStyle
- Interface for custom mouse selection behavior.
- NumberMarker
- A marker that displays a line number.
- OnTypeFormattingOptions
- Configuration options for on-type formatting.
- Panel
- Object that describes an active panel.
- PanelConfig
- Configuration for the panel system.
- PanelContainer
- Widget that manages and displays panels.
- PanelTheme
- Theme configuration for panels.
- PanelThemeProvider
- InheritedWidget to provide panel theme down the tree.
- PanelView
- Widget that wraps editor content with top and bottom panel containers.
- ParameterInfo
- Information about a single parameter in a signature.
- ParseContext
- A parse context provided to parsers working on the editor content.
- PartialTextCursor
- Partial cursor for iterating a range of text.
- PluginValue
- Base class for view plugin values.
- PointDecoration
- A decoration that places a widget at a position or replaces content.
- PortalOverflow
- Strategy for handling overflow when portal exceeds viewport bounds.
- PortalSpacing
- Calculates spacing between a widget and its portal based on their anchors.
- Prec
- By default extensions are registered in the order they are found in the flattened form of nested array that was provided.
- PrepareRenameResult
- Result returned by a rename preparation request.
-
Range<
T extends RangeValue> - A range associates a value with a range of positions.
-
RangeComparator<
T extends RangeValue> - Collection of methods used when comparing range sets.
-
RangeCursor<
T extends RangeValue> -
A range cursor is an object that moves to the next range every
time you call
nexton it. -
RangeSet<
T extends RangeValue> - A range set stores a collection of Ranges in a way that makes them efficient to map and update. This is an immutable data structure.
-
RangeSetBuilder<
T extends RangeValue> - A range set builder helps build up a RangeSet directly.
-
RangeSetUpdate<
T extends RangeValue> - Options for updating a range set.
- RangeValue
- Each range is associated with a value, which must inherit from this class.
- RawTextCursor
- Raw cursor for iterating through text.
- RectangleMarker
- A marker representing a rectangle at a specific position.
- ReferencesResult
- Result returned by a references source.
- RegExpCursor
- A search cursor for regular expression patterns.
- RegExpCursorOptions
- Options for creating a RegExpCursor.
- RenameConfig
- Internal configuration for rename symbol.
- RenameLocation
- A location where a symbol should be renamed.
- RenameOptions
- Configuration options for rename symbol.
- RenameResult
- Result returned by a rename request.
- ReplaceDecorationSpec
- Configuration for creating a replace decoration.
- ScrollTarget
- A target position to scroll to.
- SearchConfig
- Configuration options for the search extension.
- SearchCursor
- A search cursor provides an iterator over text matches in a document.
- SearchPanel
- Default search panel implementation.
- SearchQuery
- A search query defining what to search for.
- SelectedDiagnostic
- Represents a selected diagnostic with its current position.
- SelectionConfig
- Configuration for selection and cursor rendering.
- SelectionLayer
- A widget that renders the selection layer.
- SelectionLayerController
- Controller for the selection layer.
- SelectionPainter
- Paints selection backgrounds.
- SelectionRange
- A single selection range.
- SelectionSlot
- Represents a dependency on the selection.
- SemanticToken
- A decoded semantic token with position and type information.
- SemanticTokenModifiers
- Standard LSP token modifiers.
- SemanticTokensClient
- Interface for LSP semantic token requests.
- SemanticTokensConfig
- Configuration for the semantic tokens extension.
- SemanticTokensDeltaResult
- Result of a semantic tokens delta request.
- SemanticTokensEdit
- An edit to apply to semantic token data.
- SemanticTokensLegend
- The legend describing token types and modifiers.
- SemanticTokensPlugin
- View plugin that manages semantic token requests.
- SemanticTokensResult
- Result of a semantic tokens request.
- SemanticTokensTheme
- Configuration for mapping semantic tokens to decorations.
- SemanticTokenTypes
- Standard LSP token types.
- SignatureHelpConfig
- Internal configuration for a signature help source.
- SignatureHelpOptions
- Configuration options for signature help.
- SignatureInfo
- Information about a function signature.
- SignatureResult
- Result returned by a signature help source.
- SimplePanel
- A simple panel implementation using a builder function.
-
SimplePluginValue<
T> - A simple plugin value wrapper.
-
Slot<
T> - A slot that can provide values to the state.
- SlotStatus
- Status of a slot during resolution.
-
SpanIterator<
T extends RangeValue> - Methods used when iterating over the spans created by a set of ranges.
-
StateEffect<
Value> - State effects can be used to represent additional effects associated with a Transaction.
-
StateEffectType<
Value> - Representation of a type of state effect.
-
StateField<
Value> - Fields can store additional information in an editor state, and keep it in sync with the rest of the state.
-
StateFieldConfig<
Value> - Configuration for defining a state field.
- Sublanguage
- Some languages need to return different language data for some parts of their tree. Sublanguages, registered by adding a node prop to the language's top syntax node, provide a mechanism to do this.
- Text
- The data structure for documents.
- TextIterator
- A text iterator iterates over a sequence of strings.
- TextLeaf
- Leaf node storing an array of line strings.
- TextNode
- Branch node providing tree structure for the Text type.
- TextView
- A view representing a span of plain text.
- TooltipConfig
- Configuration for the tooltip system.
- TooltipContainer
- Widget that manages and positions tooltips.
- TooltipPositioning
- Configuration for tooltip positioning.
- TooltipRect
- A rectangle representing available space.
- TooltipView
- Describes the visual representation of a tooltip.
- Transaction
- Changes to the editor state are grouped into transactions.
- TransactionSpec
-
Describes a Transaction when calling
EditorState.update. - TreeHighlighter
- View plugin that applies syntax highlighting decorations.
- TreeIndentContext
- Objects of this type provide context information and helper methods to indentation functions registered on syntax nodes.
- UpdateFlag
- Bit flags indicating what changed in an update.
- ViewFlag
- Bit flags for tracking the dirty status of a view node.
- ViewOnlyExtension
- Marker interface for extensions that are view-only.
-
ViewPlugin<
V extends PluginValue> - A view plugin specification.
-
ViewPluginSpec<
V> - Configuration options for a view plugin.
- Viewport
- Represents a viewport range in the document.
- ViewState
- Manages viewport, scroll position, and height calculations.
- ViewUpdate
- An update to the editor view.
- VirtualDocument
- A virtual document that wraps visible content with hidden prefix/suffix.
- VP
- Constants for viewport management.
- WidgetDecorationSpec
- Configuration for creating a widget decoration.
- WidgetType
- Base class for widget decorations.
- WidgetView
- A view representing an embedded widget.
Enums
- BlockType
- The different types of blocks that can occur in an editor view.
- CharCategory
- The categories produced by a character categorizer.
- DefinitionKind
- The kind of definition lookup.
- Direction
- Text direction for bidirectional text support.
- GutterSide
- Which side of the content the gutter appears on.
- HighlightKind
- The kind of document highlight.
- MapMode
- Distinguishes different ways in which positions can be mapped.
- Severity
- The severity level of a diagnostic.
- SublanguageType
- Type of sublanguage data handling.
Mixins
- ExtensionProvider
- Mixin for objects that provide an extension.
Extensions
- AlignmentExtensions on Alignment
- LspPositionConversions on String
- Utilities for converting between offsets and positions.
Constants
- abstract_ → const int
- accessor → const int
- ambientDeclaration → const int
- argList → const int
- arrayExpression → const int
- arrayPattern → const int
- arrowFunction → const int
- as_ → const int
- asserts → const int
- assignmentExpression → const int
- async → const int
- await_ → const int
- awaitExpression → const int
- binaryExpression → const int
- block → const int
- blockComment → const int
- booleanLiteral → const int
- break_ → const int
- case_ → const int
- catch_ → const int
- class_ → const int
- classBody → const int
- classDeclaration → const int
- classExpression → const int
- const_ → const int
- continue_ → const int
- darkEditorTheme → const EditorThemeData
- Default dark theme - GitHub Dark style.
- debugger_ → const int
- declare → const int
- decorator → const int
- default_ → const int
- defaultSemanticTokensTheme → const SemanticTokensTheme
- Default theme for semantic tokens.
- defer → const int
- delete_ → const int
- dialectJsx → const int
- dialectTs → const int
- divide → const int
- do_ → const int
-
docSlot
→ const Slot<
void> - Document dependency marker for use in Facet.compute.
- else_ → const int
- emptyAttrs → const Attrs
- Empty attributes constant.
- enum_ → const int
- enumDeclaration → const int
- escape → const int
- export_ → const int
- exportDeclaration → const int
- exportGroup → const int
- extends_ → const int
- finally_ → const int
- for_ → const int
- forInSpec → const int
- forOfSpec → const int
- forSpec → const int
- from_ → const int
- function_ → const int
- functionDeclaration → const int
- functionExpression → const int
- get_ → const int
- global → const int
- hashbang → const int
- if_ → const int
- implements_ → const int
- import_ → const int
- importDeclaration → const int
- importGroup → const int
- in_ → const int
- incdec → const int
- incdecPrefix → const int
- indexedType → const int
- indexSignature → const int
- infer → const int
- insertSemi → const int
- instanceof_ → const int
- interface_ → const int
- interfaceDeclaration → const int
- interpolationEnd → const int
- interpolationStart → const int
- intersectionOp → const int
- is_ → const int
- jsxAttributeValue → const int
- jsxCloseTag → const int
- jsxElement → const int
- jsxEndTag → const int
- jsxEscape → const int
- jsxFragmentTag → const int
- jsxIdentifier → const int
- jsxLowerIdentifier → const int
- jsxMemberExpression → const int
- jsxNamespacedName → const int
- jsxOpenTag → const int
- jsxSelfCloseEndTag → const int
- jsxSelfClosingTag → const int
- jsxStartCloseTag → const int
- jsxStartTag → const int
- jsxText → const int
- keyof → const int
- label → const int
- lessThan → const int
- let_ → const int
- lightEditorTheme → const EditorThemeData
- Default light theme - GitHub Light style.
- lineComment → const int
- memberExpression → const int
- methodDeclaration → const int
- methodType → const int
-
modifierKeyCodes
→ const List<
int> - Modifier key codes that shouldn't clear prefixes.
- module → const int
- namespace → const int
- namespaceDeclaration → const int
- new_ → const int
- newline → const int
-
noChildren
→ const List<
ContentView> - An empty list of content views.
- noSemi → const int
- noSemiType → const int
- null_ → const int
- number → const int
- objectPattern → const int
- objectType → const int
- of_ → const int
- optional → const int
- out_ → const int
- override_ → const int
- paramList → const int
- paramTypeList → const int
- parenthesizedExpression → const int
- patternProperty → const int
- privacy → const int
- privatePropertyDefinition → const int
- privatePropertyName → const int
- property → const int
- propertyDeclaration → const int
- propertyDefinition → const int
- propertyName → const int
- propertyType → const int
- questionDot → const int
- questionOp → const int
- readonly → const int
- regExp → const int
- return_ → const int
- satisfies → const int
- script → const int
-
selectionSlot
→ const Slot<
void> - Selection dependency marker for use in Facet.compute.
- sequenceExpression → const int
- set_ → const int
- singleClassItem → const int
- singleExpression → const int
- spaces → const int
- star → const int
- static_ → const int
- staticBlock → const int
- string_ → const int
- super_ → const int
- switch_ → const int
- templateEscape → const int
- templateExpr → const int
- templateString → const int
- templateType → const int
- templateTypeContent → const int
- this_ → const int
- throw_ → const int
- try_ → const int
- tsAngleOpen → const int
- type_ → const int
- typeAliasDeclaration → const int
- typeAnnotation → const int
- typeArgList → const int
- typeDefinition → const int
- typeName → const int
- typeof_ → const int
- typeParamList → const int
- typePredicate → const int
- unaryExpression → const int
- unionOp → const int
- unique → const int
- using_ → const int
- var_ → const int
- variableDeclaration → const int
- variableDefinition → const int
- variableName → const int
- void_ → const int
- while_ → const int
- with_ → const int
- yield_ → const int
- yieldExpression → const int
Properties
-
activeGutters
→ Facet<
ResolvedGutterConfig, List< ResolvedGutterConfig> > -
Facet for active gutters.
final
-
allDefinitionKeymap
→ List<
KeyBinding> -
Combined keymap for all definition-related navigation.
final
-
allowMultipleSelections
→ Facet<
bool, bool> -
A facet that, when enabled, causes the editor to allow multiple
ranges to be selected.
final
-
applyRenameEffect
→ StateEffectType<
({List< RenameLocation> locations, String newName})> -
Get the apply rename effect type for use in EditorView.
no setter
-
atomicRanges
→ Facet<
RangeSet< RangeValue> Function(dynamic view), List<RangeSet< >RangeValue> Function(dynamic view)> -
Facet for defining atomic ranges that cursor movement should skip.
final
-
bracketMatchingHandle
→ NodeProp<
SyntaxNode? Function(SyntaxNode node)> -
When larger syntax nodes, such as HTML tags, are marked as
opening/closing, it can be a bit messy to treat the whole node as
a matchable bracket.
final
-
cancelRenameEffect
→ StateEffectType<
void> -
Get the cancel rename effect type for use in EditorView.
no setter
- celParser → LRParserImpl
-
The CEL parser.
final
-
changeFilter
→ Facet<
dynamic Function(Transaction tr), List< dynamic Function(Transaction tr)> > -
Facet used to register change filters, which are called for each
transaction (unless explicitly disabled), and can suppress part of
the transaction's changes.
final
-
clearHighlightsEffect
→ StateEffectType<
void> -
Get the clear highlights effect type.
no setter
-
clickAddsSelectionRange
→ Facet<
bool Function(PointerDownEvent), List< bool Function(PointerDownEvent)> > -
Facet that controls whether clicking on the editor adds to the selection
(when multiple selections are allowed).
final
-
clipboardInputFilter
→ Facet<
String Function(String, EditorState), List< String Function(String, EditorState)> > -
Facet for clipboard input filtering.
final
-
clipboardOutputFilter
→ Facet<
String Function(String, EditorState), List< String Function(String, EditorState)> > -
Facet for clipboard output filtering.
final
-
closeBracketsKeymap
→ List<
KeyBinding> -
Close-brackets related key bindings.
final
-
closeHoverTooltips
→ StateEffect<
void> -
Transaction effect that closes all hover tooltips.
final
-
completionKeymap
→ List<
KeyBinding> -
final
- completionKeymapExt → Extension
-
final
-
completionPlugin
→ ViewPlugin<
CompletionPluginValue> -
no setter
-
completionState
→ StateField<
CompletionState> -
final
-
contentAttributes
→ Facet<
Map< String, String> , Map<String, String> > -
Facet for content attributes on the editor.
final
- darkHighlightStyle → HighlightStyle
-
A highlight style for dark themes.
final
-
darkTheme
→ Facet<
bool, bool> -
Facet indicating whether the editor should use dark theme styling.
final
-
decorationsFacet
→ Facet<
DecorationSource, List< DecorationSource> > -
Facet for providing decorations to the editor view.
final
- defaultCategorizer → CharCategorizer
-
Default character categorizer with no extra word characters.
final
- defaultHighlightStyle → HighlightStyle
-
A default highlight style (works well with light themes).
final
-
defaultKeymap
→ List<
KeyBinding> -
Default keymap with additional editing commands.
final
- defaultSplit → RegExp
-
Default regex for splitting text into lines.
final
-
dismissSignatureEffect
→ StateEffectType<
void> -
Get the dismiss signature effect type for use in EditorView.
no setter
-
documentFormattingFacet
→ Facet<
DocumentFormattingConfig, List< DocumentFormattingConfig> > -
Facet for collecting document formatting configurations.
final
-
documentFormattingKeymap
→ List<
KeyBinding> -
Default keymap for document formatting.
final
-
documentHighlightFacet
→ Facet<
DocumentHighlightConfig, List< DocumentHighlightConfig> > -
Facet for collecting document highlight configurations.
final
-
dragMovesSelection
→ Facet<
bool Function(PointerDownEvent), List< bool Function(PointerDownEvent)> > -
Facet that controls whether dragging moves or copies the selection.
final
-
editorTheme
→ Facet<
EditorThemeData, EditorThemeData> -
Facet for the editor theme data.
final
-
emacsStyleKeymap
→ List<
KeyBinding> -
Emacs-style keybindings available on macOS by default.
final
-
exceptionSink
→ Facet<
void Function(Object error), List< void Function(Object error)> > -
Facet for exception handlers.
final
-
findReferencesFacet
→ Facet<
FindReferencesConfig, List< FindReferencesConfig> > -
Facet for collecting find-references configurations.
final
-
findReferencesKeymap
→ List<
KeyBinding> -
Default keymap for find-references.
final
-
focusChangeEffect
→ Facet<
StateEffect? Function(EditorState, bool), List< StateEffect? Function(EditorState, bool)> > -
Facet for focus change effects.
final
-
foldEffect
→ StateEffectType<
FoldRange> -
State effect that can be attached to a transaction to fold the
given range.
final
-
foldKeymap
→ List<
KeyBinding> -
Default fold-related key bindings.
final
-
foldNodeProp
→ NodeProp<
({int from, int to})? Function(SyntaxNode node, EditorState state)> -
This node prop is used to associate folding information with syntax
node types.
final
-
foldService
→ Facet<
({int from, int to})? Function(EditorState state, int lineStart, int lineEnd), List< ({int from, int to})? Function(EditorState state, int lineStart, int lineEnd)> > -
A facet that registers a code folding service.
final
-
foldState
↔ StateField<
RangeSet< Decoration> > -
The state field that stores the folded ranges (as a decoration set).
latefinal
-
formatDocumentEffect
→ StateEffectType<
void> -
Get the format document effect type for use in EditorView.
no setter
-
formatRangeEffect
→ StateEffectType<
({int from, int to})> -
Get the format range effect type for use in EditorView.
no setter
-
gotoDeclarationFacet
→ Facet<
GotoDeclarationConfig, List< GotoDeclarationConfig> > -
Facet for collecting go-to-declaration configurations.
final
-
gotoDefinitionFacet
→ Facet<
GotoDefinitionConfig, List< GotoDefinitionConfig> > -
Facet for collecting go-to-definition configurations.
final
-
gotoDefinitionKeymap
→ List<
KeyBinding> -
Default keymap for go-to-definition.
final
-
gotoImplementationFacet
→ Facet<
GotoImplementationConfig, List< GotoImplementationConfig> > -
Facet for collecting go-to-implementation configurations.
final
-
gotoImplementationKeymap
→ List<
KeyBinding> -
Default keymap for go-to-implementation.
final
-
gotoTypeDefinitionFacet
→ Facet<
GotoTypeDefinitionConfig, List< GotoTypeDefinitionConfig> > -
Facet for collecting go-to-type-definition configurations.
final
-
gotoTypeDefinitionKeymap
→ List<
KeyBinding> -
Default keymap for go-to-type-definition.
final
-
gutterLineClass
→ Facet<
RangeSet< GutterMarker> , List<RangeSet< >GutterMarker> > -
Facet used to add a class to all gutter elements for a given line.
final
-
gutterScrollMargins
→ Facet<
GutterScrollMargins? Function(GutterWidthInfo info), List< GutterScrollMargins? Function(GutterWidthInfo info)> > -
Facet for providing scroll margins from various sources.
final
-
gutterWidgetClass
→ Facet<
GutterMarker? Function(EditorState state, WidgetType widget, BlockInfo block), List< GutterMarker? Function(EditorState state, WidgetType widget, BlockInfo block)> > -
Facet used to add a class to all gutter elements next to a widget.
final
-
highlightStateField
→ StateField<
DocumentHighlightState> -
Get the highlight state field.
no setter
-
historyField
→ StateField<
_HistoryState> -
The state field that stores history data.
final
-
historyKeymap
→ List<
KeyBinding> -
Default key bindings for the undo history.
final
-
hoverTooltipFacet
→ Facet<
HoverTooltipConfig, List< HoverTooltipConfig> > -
Facet for collecting hover tooltip configurations.
final
-
indentNodeProp
→ NodeProp<
int? Function(TreeIndentContext)> -
A syntax tree node prop used to associate indentation strategies
with node types.
final
-
indentService
→ Facet<
int? Function(IndentContext context, int pos), List< int? Function(IndentContext context, int pos)> > -
Facet that defines a way to provide a function that computes the
appropriate indentation depth, as a column number (see indentString),
at the start of a given line.
final
-
indentUnit
→ Facet<
String, String> -
Facet for the indentation unit (string of spaces or a tab).
final
- indentWithTab → KeyBinding
-
Tab/Shift-Tab for indentation.
final
-
initField
↔ Facet<
FieldInit, List< FieldInit> > -
A late-initialized facet for field initialization overrides.
latefinal
-
inputHandler
→ Facet<
InputHandler, List< InputHandler> > -
Facet for input handlers.
final
-
invertedEffects
→ Facet<
List< StateEffect> Function(Transaction), List<List< >StateEffect> Function(Transaction)> -
This facet provides a way to register functions that, given a
transaction, provide a set of effects that the history should
store when inverting the transaction.
final
-
isFocusChangeType
→ AnnotationType<
bool> -
Annotation type for focus change markers.
final
-
isolateHistory
→ AnnotationType<
String> -
Transaction annotation that will prevent that transaction from
being combined with other transactions in the undo history.
final
- jsParser → LRParserImpl
-
The JavaScript parser.
final
- jsxAutoCloseTags → Extension
-
Extension that will automatically insert close tags when a
>or/is typed in JSX context.final -
keymap
→ Facet<
List< KeyBinding> , List<List< >KeyBinding> > -
Facet used for registering keymaps.
final
-
language
→ Facet<
Language, Language?> -
The facet used to associate a language with an editor state.
no setter
-
languageData
→ Facet<
List< Map< Function(EditorState state, int pos, int side), List<String, dynamic> >List< >Map< Function(EditorState state, int pos, int side)>String, dynamic> > -
Facet for language data providers.
final
-
languageDataProp
→ NodeProp<
Facet< Map< >String, dynamic> , List<Map< >String, dynamic> > -
Node prop stored in a parser's top syntax node to provide the
facet that stores language-specific data for that language.
final
-
lineNumberMarkers
→ Facet<
RangeSet< GutterMarker> , List<RangeSet< >GutterMarker> > -
Facet used to provide markers to the line number gutter.
final
-
lineNumberWidgetMarker
→ Facet<
GutterMarker? Function(EditorState state, WidgetType widget, BlockInfo block), List< GutterMarker? Function(EditorState state, WidgetType widget, BlockInfo block)> > -
Facet used to create markers in the line number gutter next to widgets.
final
-
lineSeparator
→ Facet<
String, String?> -
Facet for the line separator.
final
-
mouseSelectionStyle
→ Facet<
MouseSelectionStyle? Function(dynamic view, PointerDownEvent), List< MouseSelectionStyle? Function(dynamic view, PointerDownEvent)> > -
Facet for custom mouse selection style handlers.
final
- movedOver ↔ String
-
Track what text was moved over for debugging.
getter/setter pair
-
nativeSelectionHidden
→ Facet<
bool, bool> -
Facet that indicates whether native selection should be hidden.
final
- nextSnippetField → bool Function(({void Function(Transaction) dispatch, EditorState state}))
-
final
-
outerDecorationsFacet
→ Facet<
DecorationSource, List< DecorationSource> > -
Facet for outer decorations (higher precedence, for things like lint markers).
final
-
pickedCompletion
→ AnnotationType<
Completion> -
final
- prevSnippetField → bool Function(({void Function(Transaction) dispatch, EditorState state}))
-
final
-
readOnly
→ Facet<
bool, bool> -
This facet controls the value of the
EditorState.readOnlygetter.final -
renameFacet
→ Facet<
RenameConfig, List< RenameConfig> > -
Facet for collecting rename configurations.
final
-
renameKeymap
→ List<
KeyBinding> -
Default keymap for rename symbol.
final
-
searchConfigFacet
→ Facet<
SearchConfig, SearchConfig> -
Facet for search configuration.
final
- searchExtensions → Extension
-
Core search extensions.
final
-
searchKeymap
→ List<
KeyBinding> -
Default search keybindings.
no setter
-
searchState
→ StateField<
_SearchState> -
State field tracking search state.
final
-
selectionConfig
→ Facet<
SelectionConfig, SelectionConfig> -
Facet for selection configuration.
final
-
semanticTokensField
→ StateField<
SemanticTokensState> -
State field for storing semantic tokens.
final
-
setDiagnosticsEffect
→ StateEffectType<
List< Diagnostic> > -
State effect that updates the set of active diagnostics.
final
-
setHighlightsEffect
→ StateEffectType<
List< DocumentHighlight> > -
Get the set highlights effect type.
no setter
-
setSearchQuery
→ StateEffectType<
SearchQuery> -
State effect to update the search query.
final
-
setSelectedEffect
→ StateEffectType<
int> -
final
-
setSemanticTokens
→ StateEffectType<
SemanticTokensState> -
State effect to update semantic tokens.
final
-
showActiveLine
→ Facet<
bool, bool> -
Facet that enables active line highlighting.
final
-
showPanel
→ Facet<
PanelConstructor?, List< PanelConstructor?> > -
Opening a panel is done by providing a constructor function for the panel
through this facet. (The panel is closed again when its constructor is
no longer provided.) Values of
nullare ignored.final -
showTooltip
→ Facet<
HoverTooltip?, List< HoverTooltip?> > -
Facet to which an extension can add a value to show a tooltip.
final
-
signatureHelpFacet
→ Facet<
SignatureHelpConfig, List< SignatureHelpConfig> > -
Facet for collecting signature help configurations.
final
-
signatureHelpKeymap
→ List<
KeyBinding> -
Default keymap for signature help.
final
-
snippetKeymap
→ Facet<
List< KeyBinding> , List<KeyBinding> > -
no setter
-
standardKeymap
→ List<
KeyBinding> -
Standard platform keybindings.
final
-
sublanguageProp
→ NodeProp<
List< Sublanguage> > -
Node prop used to register sublanguages. Should be added to
the top level node type for the language.
final
-
theme
→ Facet<
String, String> -
Facet for additional theme class names.
final
-
transactionExtender
→ Facet<
TransactionSpec? Function(Transaction tr), List< TransactionSpec? Function(Transaction tr)> > -
This is a more limited form of transactionFilter, which can only add
annotations and effects.
final
-
transactionFilter
→ Facet<
dynamic Function(Transaction tr), List< dynamic Function(Transaction tr)> > -
Facet used to register a hook that gets a chance to update or replace
transaction specs before they are applied.
final
-
treeHighlighter
→ ViewPlugin<
TreeHighlighter> -
The tree highlighter plugin.
final
-
triggerDeclarationEffect
→ StateEffectType<
int> -
Get the trigger declaration effect type for use in EditorView.
no setter
-
triggerDefinitionEffect
→ StateEffectType<
int> -
Get the trigger definition effect type for use in EditorView.
no setter
-
triggerImplementationEffect
→ StateEffectType<
int> -
Get the trigger implementation effect type for use in EditorView.
no setter
-
triggerReferencesEffect
→ StateEffectType<
int> -
Get the trigger references effect type for use in EditorView.
no setter
-
triggerRenameEffect
→ StateEffectType<
int> -
Get the trigger rename effect type for use in EditorView.
no setter
-
triggerSignatureEffect
→ StateEffectType<
int> -
Get the trigger signature effect type for use in EditorView.
no setter
-
triggerTypeDefinitionEffect
→ StateEffectType<
int> -
Get the trigger type definition effect type for use in EditorView.
no setter
-
unfoldEffect
→ StateEffectType<
FoldRange> -
State effect that unfolds the given range (if it was folded).
final
-
viewPlugin
→ Facet<
ViewPlugin< PluginValue> , List<ViewPlugin< >PluginValue> > -
Facet for registering view plugins.
final
Functions
-
acceptCompletion(
EditorViewState view) → bool -
addClass(
String classes, String className) → String - Add a class to a class string if not already present.
-
addRange(
int from, int to, List< int> ranges, [int margin = 0]) → void - Add a range to a list of ranges, merging overlapping ones.
-
allDefinitionKeymapExt(
) → Extension - Extension that adds keymaps for all definition-related navigation.
-
applyCompletion(
EditorViewState view, Option option) → bool -
applyFormatEdits(
EditorState state, FormatResult result, {bool preserveCursor = true}) → TransactionSpec - Apply format edits to create a transaction spec.
-
applyRenameEdits(
EditorState state, List< RenameLocation> locations, String newName) → TransactionSpec - Apply rename edits to create a transaction spec.
-
applySemanticTokensEdits(
List< int> data, List<SemanticTokensEdit> edits) → List<int> - Apply delta edits to existing token data.
-
attrsEq(
Attrs? a, Attrs? b, [String? ignore]) → bool - Compare two attribute maps for equality.
-
autocompletion(
[CompletionConfig config = const CompletionConfig()]) → Extension -
autoDirection(
String text, int from, int to) → Direction - Determine the direction of text from its first strong character.
-
bracketMatching(
[BracketMatchingConfig config = const BracketMatchingConfig()]) → Extension - Create an extension that enables bracket matching.
-
byGroup(
EditorState state, int pos, String start) → bool Function(String) - Create a function that checks if a character belongs to the same group as the starting character.
-
calculateTooltipPosition(
{required Size viewSize, required Offset childOffset, required Size childSize, required Size portalSize, TooltipPositioning config = TooltipPositioning.below}) → Offset - Calculate the position for a tooltip relative to an anchor.
-
cel(
) → LanguageSupport - Get the CEL language support.
-
checkOnTypeFormatting(
EditorState state, int pos, String char) → Future< TransactionSpec?> - Check if on-type formatting should trigger for a character.
-
checkSelection(
EditorSelection selection, int docLength) → void - Check that a selection is valid for a document of the given length.
-
clearDocumentHighlights(
) → TransactionSpec - Create a transaction spec that clears document highlights.
-
clearSnippet(
({void Function(Transaction) dispatch, EditorState state}) target) → bool -
closeBrackets(
) → Extension - Extension to enable bracket-closing behavior.
-
closeCompletion(
EditorViewState view) → bool -
closeSearchPanel(
EditorViewState view) → bool - Close the search panel.
-
codeFolding(
[FoldConfig? config]) → Extension - Create an extension that configures code folding.
-
codePointAt(
String str, int pos) → int - Get the code point at the given position in a string.
-
codePointSize(
int code) → int - Returns 1 for BMP code points, 2 for supplementary plane code points.
-
combineAttrs(
Attrs source, Attrs target) → Attrs - Combine source attributes into target, merging class and style values.
-
completeAnyWord(
CompletionContext context) → CompletionResult? -
completeFromList(
List< Object> list) → CompletionSource -
completionStatus(
EditorState state) → String? -
computeOrder(
String line, Direction direction, [List< Isolate> isolates = const []]) → List<BidiSpan> - Compute the bidi order for a line of text.
-
continuedIndent(
{RegExp? except, int units = 1}) → int? Function(TreeIndentContext) - Creates an indentation strategy that, by default, indents continued lines one unit more than the node's base indentation.
-
copiedRange(
EditorState state) → ({bool linewise, List< SelectionRange> ranges, String text}) - Get text and ranges for a copy/cut operation.
-
copyLineDown(
StateCommandTarget target) → bool - Copy selected lines down (keeping selection in the original lines).
-
copyLineUp(
StateCommandTarget target) → bool - Copy selected lines up (keeping selection in the original lines).
-
countColumn(
String string, int tabSize, [int? to]) → int - Count the column position at the given offset into the string.
-
createMarkdownTooltip(
{required int pos, required String content, int? end, bool above = false}) → HoverTooltip - Creates a markdown hover tooltip.
-
createTextTooltip(
{required int pos, required String content, int? end, bool above = false}) → HoverTooltip - Creates a simple text hover tooltip.
-
currentCompletions(
EditorState state) → List< Completion> -
cursorCharBackward(
StateCommandTarget target) → bool - Move the selection one character backward (in logical order).
-
cursorCharForward(
StateCommandTarget target) → bool - Move the selection one character forward (in logical order).
-
cursorCharLeft(
StateCommandTarget target) → bool - Move the selection one character to the left.
-
cursorCharRight(
StateCommandTarget target) → bool - Move the selection one character to the right.
-
cursorDocEnd(
StateCommandTarget target) → bool - Move the selection to the end of the document.
-
cursorDocStart(
StateCommandTarget target) → bool - Move the selection to the start of the document.
-
cursorGroupBackward(
StateCommandTarget target) → bool - Move the selection one group backward.
-
cursorGroupForward(
StateCommandTarget target) → bool - Move the selection one group forward.
-
cursorGroupLeft(
StateCommandTarget target) → bool - Move the selection one group to the left.
-
cursorGroupRight(
StateCommandTarget target) → bool - Move the selection one group to the right.
-
cursorLineBoundaryBackward(
StateCommandTarget target) → bool - Move the selection to the previous line boundary.
-
cursorLineBoundaryForward(
StateCommandTarget target) → bool - Move the selection to the next line boundary.
-
cursorLineDown(
StateCommandTarget target) → bool - Move the selection one line down.
-
cursorLineEnd(
StateCommandTarget target) → bool - Move the selection to the end of the line.
-
cursorLineStart(
StateCommandTarget target) → bool - Move the selection to the start of the line.
-
cursorLineUp(
StateCommandTarget target) → bool - Move the selection one line up.
-
customTheme(
EditorThemeData themeData) → Extension - Create an extension with custom theme data.
-
decodeSemanticTokens(
List< int> data, SemanticTokensLegend legend, Text doc) → List<SemanticToken> - Decode LSP semantic token data into SemanticToken objects.
-
defineLanguageFacet(
[Map< String, dynamic> ? baseData]) → Facet<Map< String, dynamic> , List<Map< >String, dynamic> > - Helper function to define a facet (to be added to the top syntax node(s) for a language via languageDataProp), that will be used to associate language data with the language.
-
deleteBracketPair(
dynamic view) → bool - Command that implements deleting a pair of matching brackets when the cursor is between them.
-
deleteCharBackward(
StateCommandTarget target) → bool - Delete the selection or character before the cursor.
-
deleteCharForward(
StateCommandTarget target) → bool - Delete the selection or character after the cursor.
-
deleteGroupBackward(
StateCommandTarget target) → bool - Delete the selection or group before the cursor.
-
deleteGroupForward(
StateCommandTarget target) → bool - Delete the selection or group after the cursor.
-
deleteLine(
StateCommandTarget target) → bool - Delete selected lines.
-
deleteLineBoundaryBackward(
StateCommandTarget target) → bool - Delete to line boundary backward.
-
deleteLineBoundaryForward(
StateCommandTarget target) → bool - Delete to line boundary forward.
-
deleteToLineEnd(
StateCommandTarget target) → bool - Delete to the end of the line.
-
deleteToLineStart(
StateCommandTarget target) → bool - Delete to the start of the line.
-
deleteTrailingWhitespace(
StateCommandTarget target) → bool - Delete all whitespace directly before line ends.
-
delimitedIndent(
{required String closing, bool align = true, int units = 1}) → int? Function(TreeIndentContext) - An indentation strategy for delimited (usually bracketed) nodes.
-
detectActiveParameter(
String text, int triggerPos, int cursorPos) → int - Simple heuristic to detect the active parameter index.
-
diagnosticCount(
EditorState state) → int - Returns the number of active lint diagnostics in the given state.
-
diagnosticsAtPos(
EditorState state, int pos) → List< Diagnostic> - Get diagnostics at a specific position.
-
dismissSignatureHelpCommand(
dynamic target) → bool - Command to dismiss signature help.
-
documentFormatting(
DocumentFormatSource source, [DocumentFormattingOptions options = const DocumentFormattingOptions()]) → Extension - Set up document formatting support.
-
documentFormattingKeymapExt(
) → Extension - Extension that adds the default formatting keymap.
-
documentHighlight(
DocumentHighlightSource source, [DocumentHighlightOptions options = const DocumentHighlightOptions()]) → Extension - Set up document highlight support.
-
doCut(
dynamic view) → void - Handle cut operation.
-
doPaste(
dynamic view, String input) → void - Handle paste operation.
-
drawSelection(
[SelectionConfig config = const SelectionConfig()]) → Extension - Extension that enables custom selection rendering.
-
enableDarkTheme(
[bool enabled = true]) → Extension - Create an extension that sets the editor to dark mode.
-
ensureDocumentHighlightInitialized(
) → void - Ensure document highlight module is initialized.
-
ensureFoldInitialized(
) → void - Ensure fold module is initialized.
-
ensureLanguageInitialized(
) → void - Ensure language module is initialized.
-
ensureLintInitialized(
) → void - Ensure lint module is initialized.
-
ensureSnippetInitialized(
) → void -
ensureStateInitialized(
) → void - Ensure state module is initialized.
-
ensureSyntaxTree(
EditorState state, int upto, [int timeout = 50]) → Tree? -
Try to get a parse tree that spans at least up to
upto. -
filterClipboardInput(
EditorState state, String text) → String - Filter clipboard text through registered filters.
-
filterClipboardOutput(
EditorState state, String text) → String - Filter clipboard output through registered filters.
-
findClusterBreak(
String str, int pos, [bool forward = true]) → int -
Returns the next grapheme cluster break after (not equal to)
pos, ifforwardis true, or before otherwise. -
findColumn(
String string, int col, int tabSize, {bool strict = false}) → int - Find the offset that corresponds to the given column position.
-
findNext(
EditorViewState view) → bool - Open the search panel if it isn't already open, and move to the next match.
-
findPrevious(
EditorViewState view) → bool - Move to the previous match.
-
findReferences(
ReferencesSource source, [FindReferencesOptions options = const FindReferencesOptions()]) → Extension - Set up find-references support.
-
findReferencesCommand(
dynamic target) → bool - Command to find references at the current cursor position.
-
findReferencesKeymapExt(
) → Extension - Extension that adds the default find-references keymap.
-
flatIndent(
TreeIndentContext context) → int? - An indentation strategy that aligns a node's content to its base indentation.
-
focusChangeTransaction(
EditorState state, bool focus) → Transaction? - Create a focus change transaction if needed.
-
foldable(
EditorState state, int lineStart, int lineEnd) → ({int from, int to})? - Check whether the given line is foldable.
-
foldAll(
StateCommandTarget target) → bool - Fold all top-level foldable ranges.
-
foldCode(
StateCommandTarget target) → bool - Fold the lines that are selected, if possible.
-
foldedRanges(
EditorState state) → RangeSet< Decoration> - Get a range set containing the folded ranges in the given state.
-
foldGutter(
[FoldGutterConfig config = const FoldGutterConfig()]) → Extension - Create an extension that registers a fold gutter, which shows a fold status indicator before foldable lines (which can be clicked to fold or unfold the line).
-
foldInside(
SyntaxNode node) → ({int from, int to})? - Fold function that folds everything but the first and the last child of a syntax node.
-
forceLinting(
EditorViewState view) → void - Forces any linters configured to run when the editor is idle to run right away.
-
forceParsing(
EditorViewState view, [int? upto, int timeout = 100]) → bool - Move parsing forward, and update the editor state afterwards to reflect the new tree.
-
forEachDiagnostic(
EditorState state, void f(Diagnostic d, int from, int to)) → void -
Iterate over the marked diagnostics for the given editor state,
calling
ffor each of them. -
formatDocument(
EditorState state) → Future< TransactionSpec?> - Utility to format and apply in one step.
-
formatDocumentCommand(
dynamic target) → bool - Command to format the entire document.
-
formatRange(
EditorState state, int from, int to) → Future< TransactionSpec?> - Utility to format a range and apply in one step.
-
formatSelectionCommand(
dynamic target) → bool - Command to format the current selection.
-
fromCodePoint(
int code) → String - Convert a Unicode code point to a string.
-
generateSemanticTokensCss(
{String prefix = 'cm-semantic-', bool dark = false}) → String - Generate CSS for semantic token highlighting.
-
getEditorTheme(
EditorState state) → EditorThemeData - Get the effective theme for an editor state.
-
getGutterScrollMargins(
EditorState state, GutterWidthInfo info) → GutterScrollMargins - Calculate combined scroll margins from all gutter sources.
-
getHighlighters(
EditorState state) → List< Highlighter> ? - Get the active highlighters for a state.
-
getIndentation(
Object context, int pos) → int? - Get the indentation, as a column number, at the given position.
-
getIndentUnit(
EditorState state) → int - Get the indent unit size (number of columns).
-
getPanel(
EditorState state, PanelConstructor constructor) → Panel? - Get the active panel created by the given constructor, if any.
-
getSearchQuery(
EditorState state) → SearchQuery - Get the current search query from the state.
-
getSelectionConfig(
EditorState state) → SelectionConfig - Get the selection configuration from state.
-
getSemanticTokens(
EditorState state) → List< SemanticToken> - Get the semantic tokens for the current state.
-
getTooltip(
EditorState state, HoverTooltip tooltip) → TooltipView? - Get the active tooltip view for a given tooltip, if available.
-
gotoDeclaration(
DeclarationSource source, [GotoDefinitionOptions options = const GotoDefinitionOptions()]) → Extension - Set up go-to-declaration support.
-
goToDeclarationCommand(
dynamic target) → bool - Command to go to declaration at the current cursor position.
-
gotoDefinition(
DefinitionSource source, [GotoDefinitionOptions options = const GotoDefinitionOptions()]) → Extension - Set up go-to-definition support.
-
goToDefinitionCommand(
dynamic target) → bool - Command to go to definition at the current cursor position.
-
gotoDefinitionKeymapExt(
) → Extension - Extension that adds the default go-to-definition keymap.
-
gotoImplementation(
ImplementationSource source, [GotoDefinitionOptions options = const GotoDefinitionOptions()]) → Extension - Set up go-to-implementation support.
-
goToImplementationCommand(
dynamic target) → bool - Command to go to implementation at the current cursor position.
-
gotoImplementationKeymapExt(
) → Extension - Extension that adds the default go-to-implementation keymap.
-
gotoLine(
EditorViewState view) → bool - Command that shows a dialog asking for a line number.
-
gotoTypeDefinition(
TypeDefinitionSource source, [GotoDefinitionOptions options = const GotoDefinitionOptions()]) → Extension - Set up go-to-type-definition support.
-
goToTypeDefinitionCommand(
dynamic target) → bool - Command to go to type definition at the current cursor position.
-
gotoTypeDefinitionKeymapExt(
) → Extension - Extension that adds the default go-to-type-definition keymap.
-
groupAt(
EditorState state, int pos, [int bias = 1]) → SelectionRange - Get a selection range covering the word/group at the given position.
-
gutter(
GutterConfig config) → Extension - Define an editor gutter.
-
gutters(
{bool fixed = true}) → Extension - The gutter-drawing extension is automatically enabled when you add a gutter, but you can use this function to explicitly configure it.
-
hasClass(
String classes, String className) → bool - Check if a class string contains a specific class.
-
hasHoverTooltips(
EditorState state) → bool - Returns true if any hover tooltips are currently active.
-
hasNextSnippetField(
EditorState state) → bool -
hasPrevSnippetField(
EditorState state) → bool -
hasRtlText(
String text) → bool - Check if a string contains any RTL characters.
-
highlightActiveLine(
) → Extension - Mark lines that have a cursor on them with a background highlight.
-
highlightActiveLineGutter(
) → Extension -
Returns an extension that adds a
cm-activeLineGutterclass to all gutter elements on the active line (line with cursor). -
highlightingFor(
EditorState state, List< Tag> tags, [NodeType? scope]) → String? - Returns the CSS classes (if any) that the highlighters active in the state would assign to the given style tags and (optional) language scope.
-
highlightSelectionMatches(
[HighlightSelectionMatchesConfig? options]) → Extension - Highlight text that matches the current selection.
-
history(
[HistoryConfig config = const HistoryConfig()]) → Extension - Create a history extension with the given configuration.
-
hoverTooltip(
HoverTooltipSource source, [HoverTooltipOptions options = const HoverTooltipOptions()]) → Extension - Set up a hover tooltip, which shows up when the pointer hovers over ranges of text.
-
ifIn(
List< String> nodes, CompletionSource source) → CompletionSource -
ifNotIn(
List< String> nodes, CompletionSource source) → CompletionSource -
indentLess(
StateCommandTarget target) → bool - Remove a unit of indentation from all selected lines.
-
indentMore(
StateCommandTarget target) → bool - Add a unit of indentation to all selected lines.
-
indentOnInput(
) → Extension - Enables reindentation on input.
-
indentRange(
EditorState state, int from, int to) → ChangeSet - Create a change set that auto-indents all lines touched by the given document range.
-
indentString(
EditorState state, int cols) → String - Create an indentation string for the given number of columns.
-
insertBlankLine(
StateCommandTarget target) → bool - Create a blank, indented line below the current line.
-
insertBracket(
EditorState state, String bracket) → Transaction? - Implements the extension's behavior on text insertion.
-
insertCompletionText(
EditorState state, String text, int from, int to) → TransactionSpec -
insertNewline(
StateCommandTarget target) → bool - Replace the selection with a newline.
-
insertNewlineAndIndent(
StateCommandTarget target) → bool - Replace the selection with a newline and compute smart indentation.
-
insertNewlineKeepIndent(
StateCommandTarget target) → bool - Replace the selection with a newline and keep the same indentation.
-
insertTab(
StateCommandTarget target) → bool - Insert a tab character or indent the selection.
-
isFocusChange(
bool value) → Annotation< bool> - Create an annotation indicating a focus change.
-
isolatesEq(
List< Isolate> a, List<Isolate> b) → bool - Check if two lists of isolates are equal.
-
isWithinFunctionCall(
String text, int triggerPos, int cursorPos) → bool - Check if the cursor is still within a function call.
-
javascript(
[JavaScriptConfig config = const JavaScriptConfig()]) → LanguageSupport - Get the JavaScript language with optional configuration.
-
joinClasses(
Set< String> classes) → String - Join a set of class names into a class string.
-
jsxLanguage(
) → LanguageSupport - Convenience alias for JSX.
-
keymapOf(
List< KeyBinding> bindings) → Extension - Create a keymap extension from a list of key bindings.
-
lineNumbers(
[LineNumberConfig config = const LineNumberConfig()]) → Extension - Create a line number gutter extension.
-
linter(
LintSource? source, [LintConfig config = const LintConfig()]) → Extension - Given a diagnostic source, this function returns an extension that enables linting with that source. It will be called whenever the editor is idle (after its content changed).
-
lintGutter(
[LintGutterConfig config = const LintGutterConfig()]) → Extension - Returns an extension that installs a gutter showing markers for each line that has diagnostics, which can be hovered over to see the diagnostics.
-
logException(
EditorState state, Object error, [String? context]) → void - Log an exception (public API).
-
makeCategorizer(
String wordChars) → CharCategorizer - Create a character categorizer with custom word characters.
-
matchBrackets(
EditorState state, int pos, int dir, [BracketMatchingConfig config = const BracketMatchingConfig()]) → MatchResult? -
Find the matching bracket for the token at
pos, scanning directiondir. -
mergeClasses(
String a, String b) → String - Merge two class strings, deduplicating.
-
modifiers(
String name, KeyEvent event, [bool includeShift = true]) → String - Add modifier prefixes to a key name based on the keyboard state.
-
moveByChar(
EditorState state, SelectionRange start, bool forward, {bool Function(String) by(String)?}) → SelectionRange - Move the cursor by one character.
-
moveCompletionSelection(
bool forward, [String by = 'option']) → Command -
moveLineDown(
StateCommandTarget target) → bool - Move selected lines down.
-
moveLineUp(
StateCommandTarget target) → bool - Move selected lines up.
-
moveToLineBoundary(
EditorState state, SelectionRange start, bool forward, {bool includeWrap = false}) → SelectionRange - Move to the start or end of a line.
-
moveVertically(
EditorState state, SelectionRange start, bool forward, {int? distance, int? goalColumn}) → SelectionRange - Move vertically by one line.
-
moveVisually(
Line line, List< BidiSpan> order, Direction dir, SelectionRange start, bool forward) → SelectionRange? - Move visually (not logically) through text.
-
nextDiagnostic(
StateCommandTarget target) → bool - Move the selection to the next diagnostic.
-
normalizeKeyName(
String name, [String platform = 'key']) → String - Normalize a key name to a canonical form.
-
onTypeFormatting(
OnTypeFormatSource source, [OnTypeFormattingOptions options = const OnTypeFormattingOptions()]) → Extension - Set up on-type formatting support.
-
openSearchPanel(
EditorViewState view) → bool - Open the search panel.
-
panels(
[PanelConfig? config]) → Extension - Configures the panel-managing extension.
-
parseClasses(
String classes) → Set< String> - Parse a class string into a set of class names.
-
placeholder(
Object content) → Extension - Extension that enables a placeholder—a piece of example content to show when the editor is empty.
-
positionHoverTooltip(
{required Size viewSize, required Offset anchorGlobal, required double lineHeight, required Size portalSize, double spacing = 8.0, EdgeInsets viewInsets = const EdgeInsets.all(8.0)}) → Offset - Simplified positioning for hover tooltips.
-
previousDiagnostic(
StateCommandTarget target) → bool - Move the selection to the previous diagnostic.
-
rangeFormatting(
RangeFormatSource source, [DocumentFormattingOptions options = const DocumentFormattingOptions()]) → Extension - Set up range formatting support.
-
redo(
CommandTarget target) → bool - Redo a group of history events.
-
redoDepth(
EditorState state) → int - Get the depth of redoable events.
-
redoSelection(
CommandTarget target) → bool - Redo a change or selection change.
-
removeClass(
String classes, String className) → String - Remove a class from a class string.
-
renameKeymapExt(
) → Extension - Extension that adds the default rename keymap.
-
renameSymbol(
RenameSource source, [RenameOptions options = const RenameOptions()]) → Extension - Set up rename symbol support.
-
renameSymbolCommand(
dynamic target) → bool - Command to trigger rename at the current cursor position.
-
replaceAll(
EditorViewState view) → bool - Replace all matches with the replacement text.
-
replaceNext(
EditorViewState view) → bool - Replace the current match with the replacement text.
-
runScopeHandlers(
dynamic view, KeyEvent event, String scope) → bool - Run the key handlers registered for a given scope.
-
search(
[SearchConfig? config]) → Extension - Add search functionality to the editor.
-
searchPanelOpen(
EditorState state) → bool - Check if the search panel is open.
-
selectAll(
StateCommandTarget target) → bool - Select the entire document.
-
selectCharBackward(
StateCommandTarget target) → bool - Extend selection one character backward.
-
selectCharForward(
StateCommandTarget target) → bool - Extend selection one character forward.
-
selectCharLeft(
StateCommandTarget target) → bool - Extend selection one character to the left.
-
selectCharRight(
StateCommandTarget target) → bool - Extend selection one character to the right.
-
selectDocEnd(
StateCommandTarget target) → bool - Extend selection to document end.
-
selectDocStart(
StateCommandTarget target) → bool - Extend selection to document start.
-
selectedCompletion(
EditorState state) → Completion? -
selectedCompletionIndex(
EditorState state) → int? -
selectGroupBackward(
StateCommandTarget target) → bool - Extend selection one group backward.
-
selectGroupForward(
StateCommandTarget target) → bool - Extend selection one group forward.
-
selectGroupLeft(
StateCommandTarget target) → bool - Extend selection one group to the left.
-
selectGroupRight(
StateCommandTarget target) → bool - Extend selection one group to the right.
-
selectLine(
StateCommandTarget target) → bool - Expand selection to cover entire lines.
-
selectLineBoundaryBackward(
StateCommandTarget target) → bool - Extend selection to the previous line boundary.
-
selectLineBoundaryForward(
StateCommandTarget target) → bool - Extend selection to the next line boundary.
-
selectLineDown(
StateCommandTarget target) → bool - Extend selection one line down.
-
selectLineEnd(
StateCommandTarget target) → bool - Extend selection to line end.
-
selectLineStart(
StateCommandTarget target) → bool - Extend selection to line start.
-
selectLineUp(
StateCommandTarget target) → bool - Extend selection one line up.
-
selectMatches(
EditorViewState view) → bool - Select all instances of the search query.
-
selectNextOccurrence(
EditorState state, void dispatch(dynamic)) → bool - Select the next occurrence of the current selection.
-
selectSelectionMatches(
EditorState state, void dispatch(Transaction)) → bool - Select all instances of the currently selected text.
-
semanticTokens(
SemanticTokensConfig config) → Extension - Create an extension that enables LSP semantic tokens highlighting.
-
setDiagnostics(
EditorState state, List< Diagnostic> diagnostics) → TransactionSpec - Returns a transaction spec which updates the current set of diagnostics, and enables the lint extension if it wasn't already active.
-
setDocumentHighlights(
List< DocumentHighlight> highlights) → TransactionSpec - Create a transaction spec that sets document highlights.
-
setSelectedCompletion(
int index) → StateEffect< int> -
signatureHelp(
SignatureSource source, [SignatureHelpOptions options = const SignatureHelpOptions()]) → Extension - Set up signature help support.
-
signatureHelpKeymapExt(
) → Extension - Extension that adds the default signature help keymap.
-
simplifySelection(
StateCommandTarget target) → bool - Simplify the current selection.
-
skipAtomicRanges(
List< RangeSet< atoms, int pos, int bias) → intRangeValue> > -
Skip atomic ranges starting from
posin the given direction. -
skipAtoms(
dynamic view, SelectionRange oldPos, SelectionRange pos) → SelectionRange - Skip atomic ranges for a single position movement.
-
skipAtomsForSelection(
List< RangeSet< atoms, EditorSelection sel) → EditorSelectionRangeValue> > - Adjust a selection to skip atomic ranges.
-
snippet(
String template) → SnippetApplyFn -
snippetCompletion(
String template, String label, {String? detail, String? info}) → ({SnippetApplyFn apply, String? detail, String? info, String label}) -
splitLine(
StateCommandTarget target) → bool - Split line at cursor, leaving cursor on line before break.
-
startCompletion(
EditorViewState view) → bool -
syntaxHighlighting(
Highlighter highlighter, {bool fallback = false}) → Extension - Wrap a highlighter in an editor extension that uses it to apply syntax highlighting to the editor content.
-
syntaxParserRunning(
EditorViewState view) → bool - Tells you whether the language parser is planning to do more parsing work (in a requestIdleCallback pseudo-thread) or has stopped running, either because it parsed the entire document, because it spent too much time and was cut off, or because there is no language parser enabled.
-
syntaxTree(
EditorState state) → Tree - Get the syntax tree for a state, which is the current (possibly incomplete) parse tree of the active language, or the empty tree if there is no language available.
-
syntaxTreeAvailable(
EditorState state, [int? upto]) → bool - Queries whether there is a full syntax tree available up to the given document position.
-
toggleClass(
String classes, String className) → String - Toggle a class in a class string.
-
toggleFold(
StateCommandTarget target) → bool - Toggle folding at cursors.
-
tokensToDecorations(
List< SemanticToken> tokens, {SemanticTokensTheme theme = defaultSemanticTokensTheme}) → RangeSet<Decoration> - Convert semantic tokens to CodeMirror decorations.
-
tooltips(
[TooltipConfig? config]) → Extension - Creates an extension that configures tooltip behavior.
-
transposeChars(
StateCommandTarget target) → bool - Transpose (swap) the characters before and after the cursor.
-
triggerSignatureHelpCommand(
dynamic target) → bool - Command to trigger signature help at the current cursor position.
-
trivialOrder(
int length) → List< BidiSpan> - Create a trivial (all LTR) order for the given length.
-
typescriptLanguage(
) → LanguageSupport - Convenience alias for TypeScript.
-
undo(
CommandTarget target) → bool - Undo a single group of history events.
-
undoDepth(
EditorState state) → int - Get the depth of undoable events.
-
undoSelection(
CommandTarget target) → bool - Undo a change or selection change.
-
unfoldAll(
StateCommandTarget target) → bool - Unfold all folded code.
-
unfoldCode(
StateCommandTarget target) → bool - Unfold folded ranges on selected lines.
-
validRegExp(
String source) → bool - Check if a regular expression source is valid.
Typedefs
-
Attrs
= Map<
String, String> - Map of attribute name to value.
- CharCategorizer = CharCategory Function(String char)
- A function that categorizes a character (grapheme cluster).
- Command = bool Function(dynamic view)
- A command is a function that takes an EditorView and returns whether it was able to perform some action.
- CommandTarget = ({void Function(Transaction) dispatch, EditorState state})
- Command target interface for history commands.
-
CompletionSource
= FutureOr<
CompletionResult?> Function(CompletionContext context) -
DeclarationSource
= FutureOr<
DefinitionResult?> Function(EditorState state, int pos) - The type of function that provides declarations for positions.
-
DecorationSet
= RangeSet<
Decoration> - A decoration set is a collection of decorated ranges.
- DecorationSource = Object
- A decoration set or a function that returns one.
- Callback for navigating to a definition.
-
DefinitionSource
= FutureOr<
DefinitionResult?> Function(EditorState state, int pos) - The type of function that provides definitions for positions.
-
DiagnosticFilter
= List<
Diagnostic> Function(List<Diagnostic> diagnostics, EditorState state) - Type for functions that filter diagnostics.
-
DocumentFormatSource
= FutureOr<
FormatResult?> Function(EditorState state) - The type of function that formats a document.
-
DocumentHighlightSource
= FutureOr<
DocumentHighlightResult?> Function(EditorState state, int pos) - The type of function that provides document highlights.
- EditorStateRef = Object
- FoldRange = ({int from, int to})
- A document range for folding operations.
- GutterEventHandler = bool Function(BuildContext context, BlockInfo line, Offset localPosition)
- Type for gutter event handlers.
-
GutterEventHandlers
= Map<
String, GutterEventHandler> - Map of event types to handlers.
-
HoverTooltipSource
= FutureOr<
HoverTooltip?> Function(EditorState state, int pos, int side) - The type of function that can be used as a hover tooltip source.
-
ImplementationSource
= FutureOr<
DefinitionResult?> Function(EditorState state, int pos) - The type of function that provides implementations for positions.
- InputHandler = bool Function(dynamic view, int from, int to, String text)
- Input handler signature.
-
LintSource
= FutureOr<
List< Function(EditorViewState view)Diagnostic> > - The type of a function that produces diagnostics.
-
OnTypeFormatSource
= FutureOr<
FormatResult?> Function(EditorState state, int pos, String char) - The type of function that formats on typing specific characters.
- PanelConstructor = Panel Function(EditorState state)
- A function that creates a panel.
- PortalChildRect = ({Alignment anchor, Offset offset, Size size})
- A child/anchor widget's rectangle for positioning calculations.
- PortalRect = ({Alignment anchor, Offset offset, Size size})
- A portal/tooltip's rectangle for positioning calculations.
-
PrepareRenameSource
= FutureOr<
PrepareRenameResult?> Function(EditorState state, int pos) - The type of function that prepares a rename operation.
-
RangeFormatSource
= FutureOr<
FormatResult?> Function(EditorState state, int from, int to) - The type of function that formats a range of the document.
- ReferencesDisplay = void Function(ReferencesResult result, EditorState state, int originPos)
- Callback for displaying references.
-
ReferencesSource
= FutureOr<
ReferencesResult?> Function(EditorState state, int pos) - The type of function that provides references for positions.
-
RenameSource
= FutureOr<
RenameResult?> Function(EditorState state, int pos, String newName) - The type of function that performs a rename operation.
-
SignatureSource
= FutureOr<
SignatureResult?> Function(EditorState state, int pos) - The type of function that provides signature help.
-
SignatureUpdater
= FutureOr<
SignatureResult?> Function(EditorState state, SignatureResult result, int cursorPos) - Callback for updating the active parameter as the cursor moves.
- StateCommand = bool Function(StateCommandTarget)
- A state command - operates on state without needing view information.
- StateCommandTarget = ({void Function(Transaction) dispatch, EditorState state})
- A command target provides access to state and dispatch function.
-
StateEffectMapFn<
Value> = Value? Function(Value value, ChangeDesc mapping) - Specification for how to map StateEffect values through position changes.
- Tooltip = HoverTooltip
- Describes a tooltip to be shown (e.g., for autocomplete).
-
TypeDefinitionSource
= FutureOr<
DefinitionResult?> Function(EditorState state, int pos) - The type of function that provides type definitions for positions.
- ViewCommand = bool Function(ViewCommandTarget)
- A view command - may need view information for visual operations.
- ViewCommandTarget = ({void Function(Transaction) dispatch, EditorState state, dynamic view})
- A view-aware command target.
-
WorkspaceRenameHandler
= Future<
bool> Function(Map<String, List< edits, String newName)RenameLocation> > - Callback for handling workspace (cross-file) renames.