Changelog
Version history and release notes of the core packages.
Bug fixes
Fix a crash in MatchDecorator when updating matches at the end of the document.
Bug fixes
Make selection rectangles verticaly align precisely, rather than introducing a slight overlap.
Fix an issue in MatchDecorator
that caused it to fully rebuild its decorations on normal edits.
New features
View updates now have a viewportMoved
flag that is only true when a viewport change originated from something other than mapping the viewport over a document change.
Bug fixes
Fix an issue where indentation for a stream language would fail to work when the parse covered only part of the document, far from the start.
Make sure the inner mode gets a chance to indent when indenting right at the end of a nested language section.
Bug fixes
Align the behavior of snippet completions with text completions in that they overwrite the selected text.
New features
RangeSet.compare
now supports a boundChange
callback that is called when there's a change in the way ranges are split.
Bug fixes
Fix an issue where mark decorations that got merged or split weren't properly redrawn.
Avoid spurious focus events by not updating the DOM selection when the editor is unfocused but focusable.
Disable writingsuggestions
for the editable element, to opt out of Safari's new intelligence completions (which mess up in the editor).
Bug fixes
Fix an issue on Chrome where typing at the end of the document would insert a character after the cursor.
Bug fixes
Work around another crash caused by incorrect composition positions reported by EditContext
.
Stop disabling custom cursors on Safari version 11.4 and up, which support caret-color
.
Fix an issue where a tooltip with wrapped content could, in some circumstances, fail to find a stable position due to a cyclic dependency between its width and its position.
Bug fixes
Fix a crash in StreamLanguage
when the input range is entirely before the editor viewport.
Bug fixes
Don't create overlapping decorations when diagnostics overlap.
Fix an issue where block widgets could cause the lint gutter to show diagnostics multiple times.
Bug fixes
Fix an issue where a StreamLanguage
could get confused when trying to reuse existing parse data when the parsed range changed.
Bug fixes
Join adjacent tokens of the same type into a single token in .
Call stream language indent functions even when the language is used as a nested parser.
Fix a crash in StreamParser
when a parse was resumed with different input ranges.
Bug fixes
Fix a bug that put the selection in the wrong place after running replaceNext
with a regexp query that could match strings of different length.
New features
Tooltips can now use the clip
option to control whether they are hidden when outside the visible editor content.
Bug fixes
Fix an issue that prevented tooltips in the lint gutter from being displayed.
Bug fixes
Make sure positions covered by a gutter or a panel aren't treated as visible for the purpose of displaying tooltips.
Properly include the tooltip arrow height when checking whether a tooltip fits in its preferred above/below position.
Fix an issue with compositions on Chrome inserting their content in the wrong position when another document change came in during composition.
Bug fixes
Backspacing to the start of the completed range will no longer close the completion tooltip when it was triggered implicitly by typing the character before that range.
Bug fixes
Fix the default cursor color for dark themes, which was way too dark.
Bug fixes
Fix an issue where findNext
and findPrevious
would do nothing when the only match in the document was partially selected.
Fix an infinite loop in SearchCursor
when the normalizer function deletes characters.
Bug fixes
Don't immediately show synchronously updated completions when there are some sources that still need to return.
Bug fixes
Change toggleBlockCommentByLine
to not affect lines with the selection end right at their start.
Bug fixes
Bind Shift-Enter to the same command as Enter in the default keymap, so that it doesn't do nothing when on an EditContext-supporting browser.
New features
Add commands for by-string-index cursor motion that ignores text direction.
Bug fixes
Avoid a stack overflow that could happen when updating a line with a lot of text tokens.
Improve the way enormously long (non-wrapped) lines are displayed by making sure they stay shorter than the maximal pixel size the browser's CSS engine can handle.
Bug fixes
Fix an issue where the dots past the wrapping point were displayed incorrectly when using highlightWhitespace
with a wrapped sequence of spaces.
Improve performance of documents displaying lots of highlighted spaces by using a CSS background instead of pseudo-element.
New features
placeholder
now allows a function that constructs the placedholder DOM to be passed in, and uses cloneNode
when a raw element is passed in, to prevent adding the same element to multiple editors.
Bug fixes
Show lint markers for code replaced by a block widget.
When multiple linters are installed, start displaying results from ones that return quickly even if others are slow to return.
Bug fixes
Fix a TypeScript error when using HighlightStyle
with the exactOptionalPropertyTypes
typechecking option enabled.
Make delimitedIndent
align to spaces after the opening token.
Bug fixes
Fix an issue causing selectParentSyntax
to not select syntax that is a direct child of the top node.
Make selectParentSyntax
return false when it doesn't change the selection.
Bug fixes
Fix an issue where insertCompletionText
would get confused about the length of the inserted text when it contained CRLF line breaks, and create an invalid selection.
Add Alt-Backtick as additional binding on macOS, where IME can take over Ctrl-Space.
Bug fixes
Fix a bug in the undo history that would cause it to incorrectly track inverted effects when adding multiple edits to a single history event.
Bug fixes
Work around odd behavior in Chrome's newly supported caretPositionFromPoint
method, which could cause CodeMirror to crash with a null dereference.
Bug fixes
Make it easier to move the pointer over a hover tooltip with an arrow by not closing the tooltip when the pointer is moving over the gap for the arrow.
New features
The new EditorView.clipboardInputFilter
and clipboardOutputFilter
facets allow you to register filter functions that change text taken from or sent to the clipboard.
Bug fixes
Fix a bug where the editor could draw way too big a viewport when not managing its own scrollbar.
New features
The new gutterWidgetClass
facet makes it possible to add a class to gutter elements next to widgets.
Bug fixes
Avoid the editor's geometry measurements becoming incorrect when fonts finish loading by scheduling a measure on document.fonts.ready
.
Avoid an issue where Chrome would incorrectly scroll the window when deleting lines in the editor.
Fix an issue where in some layouts editor content would be drawn on top of panel elements.
Fix an issue where coordsAtPos
would return null when querying a position in a block widget.
New features
The new lineNumberWidgetMarker
facet makes it possible to insert markers into the line number gutter for widgets.
Bug fixes
Make spell check corrections work again on EditContext
-enabled Chrome versions.
New features
The value returned by hoverTooltip
now has an active
property providing the state field used to store the open tooltips.
Bug fixes
Style the info element so that newlines are preserved, to make it easier to display multi-line info from a string source.
New features
When registering an abort
handler for a completion query, you can now use the onDocChange
option to indicate that your query should be aborted as soon as the document changes while it is running.
Bug fixes
Fix a crash on old Safari browsers that don't support MediaQueryList.addEventListener
.
Fix an issue where EditorView.viewportLineBlocks
(and thus other things like the gutter) might be out of date after some kinds of decoration changes.
Bug fixes
Fix an issue that caused typing into an editor marked read-only to cause document changes when using EditContext
.
Associate a cursor created by clicking above the end of the text on a wrap point with the line before it.
New features
The package now exports the type of hover tooltip sources as HoverTooltipSource
.
Bug fixes
Fix an issue where the editor got confused about the position of inserted text when using Chrome's EditContext
and canceling transactions for typed text.
Bug fixes
Fix a bug that broke drag scrolling along one axis when the innermost scrollable element around the editor was only scrollable along the other axis.
Work around a memory leak in Chrome's EditContext implementation.
Bug fixes
Fix a bug where EditContext-based editing could corrupt the document in some situations.
Bug fixes
Fix an issue where completions weren't properly reset when starting a new completion through activateOnCompletion
.
New features
CompletionContext
objects now have a view
property that holds the editor view when the query context has a view available.
Bug fixes
Fix an issue causing the IME interface to appear in the wrong spot on Chrome Windows.
Bug fixes
Only use EditContext
on Chrome versions that support passing it an inverted selection range.
Fix an issue that prevented non-inclusive block widgets from having their updateDOM
method called when changed.
Re-enable EditContext
use on Chrome 126 and up.
Bug fixes
Avoid adding an aria-autocomplete
attribute to the editor when there are no active sources active.
Bug fixes
Make lint markers non-inclusive again, since having them that way causes more issues than it solves.
Bug fixes
Disable EditContext
by default again, to work around a regression where Chrome's implementation doesn't support inverted selections.
Make sure EditorView.editable
is respected when EditContext
is used.
Bug fixes
Fix an issue where long lines broken up by block widgets were sometimes only partially rendered.
New features
The editor will now, when available (which is only on Chrome for the foreseeable future) use the EditContext
API to capture text input.
New features
The new setTabFocusMode
method can be used to control whether the editor disables key bindings for Tab and Shift-Tab.
Bug fixes
Fix an issue where commands with an optional second argument would get the keyboard event in that argument when called from a keymap.
Fix an issue that could cause the cursor to be rendered on the wrong side of a zero-length block widget.
Fix an issue where drawSelection
got confused by block widgets in line-wrapped editors in some situations.
Don't hide the native selection in widgets that have focus.
Make sure that clicking an unfocusable editor still remove focus from any other focused elements.
Fix a crash when loading the package in a non-browser environment.
Stop mouse selection when the user types.
New features
The new toggleTabFocusMode
and temporarilySetTabFocusMode
commands provide control over the view's tab-focus mode.
The default keymap now binds Ctrl-m (Shift-Alt-m on macOS) to toggleTabFocusMode
.
Bug fixes
Fix an infinite loop that could occur when enabling bidiIsolates
in documents with both bidirectional text and very long lines.
Bug fixes
Allow backslash-escaped closing braces inside snippet field names/content.
Bug fixes
Fix a bug where multiple backslashes before a brace in a snippet were all removed.
New features
The new autoPanel
option can be used to make the panel automatically appear when diagnostics are added and close when no diagnostics are left.
Bug fixes
Don't perform an additional superfluous timed lint run after forceLinting
has been called.
New features
The renderMessage
function is now called with the editor view as first argument.
New features
The new hideOn
configuration option can be used to control in what circumstances lint tooltips get hidden by state changes.
New features
The insertNewlineKeepIndent
command inserts a newline along with the same indentation as the line before.
Bug fixes
Fix an issue where deleteLine
sometimes leaves the cursor on the wrong line.
New features
The new deleteCharBackwardStrict
command just deletes a character, without further smart behavior around indentation.
Bug fixes
Properly specify the dependency on @codemirror/legacy-modes version 6.4.
Bug fixes
Fix an issue where dispatching an update to an editor before it measured itself for the first time could cause the scroll position to incorrectly move.
Fix a crash when multiple tooltips with arrows are shown.
New features
The new activateOnCompletion
option allows autocompletion to be configured to chain completion activation for some types of completions.
Bug fixes
Improve behavior of scrollPastEnd
in a scaled editor.
When available, use Selection.getComposedRanges
on Safari to find the selection inside a shadow DOM.
Remove the workaround that avoided inappropriate styling on composed text after a decoration again, since it breaks the stock Android virtual keyboard.
Bug fixes
Use the new full Go language mode for Go code.
New features
Include data for legacy Pug mode.
Bug fixes
Fix the editor getting stuck in composition when Safari fails to fire a compositionend event for a dead key composition.
Fix an issue where, with IME systems that kept the cursor at the start of the composed text, the editor misidentified the target node and disrupted composition.
Fix a bug where in a line-wrapped editor, with some content, the initial scroll position would be off from the top of the document.
Bug fixes
Avoid the editor getting confused when iOS autocorrects on pressing Enter and does the correction and the break insertion in two different events.
Fix the pasting of copied URIs in iOS.
Fix a bug where a scaled editor could keep performing unnecessary updates due to tiny differences in geometry values returned by the browser.
Fix a bug where, on iOS with a physical keyboard, the modifiers for some keys weren't being passed to the keymaps.
Work around the fact that Mobile Safari makes DOM changes before firing a key event when typing ctrl-d on an external keyboard.
Fix an issue where some commands didn't properly scroll the cursor into view on Mobile Safari.
Re-measure the document when print settings are changed on Chrome.
New features
The EditorView.scrollHandler
facet can be used to override or extend the behavior of the editor when things are scrolled into view.
New features
The new filterStrict
option can be used to turn off fuzzy matching of completions.
New features
Completion results can now define a map
method that can be used to adjust position-dependent information for document changes.
Bug fixes
Fix accidental non-optional field in layer config objects.
Bug fixes
Properly recognize Android GBoard enter presses that strip a space at the end of the line as enter.
Fix a bug that caused the gutter to have the wrong height when the editor was scaled after construction.
When starting a composition after a non-inclusive mark decoration, temporarily insert a widget that prevents the composed text from inheriting that mark's styles.
Make sure the selection is repositioned when a transaction changes decorations without changing the document.
New features
View plugins can now provide a docViewUpdate
method that is called whenever the document view is updated.
Layers now take a updateOnDocUpdate
option that controls whether they are automatically updated when the document view changes.
New features
Completions may now provide 'commit characters' that, when typed, commit the completion before inserting the character.
Bug fixes
Fix an issue that caused widgets at the end of a mark decoration to be rendered in their own separate mark DOM element.
Bug fixes
Fix a crash that happens when hover tooltips are active during changes, introduced in 6.24.0.
Bug fixes
Fix an issue that broke context-menu select-all on Chrome when the viewport didn't cover the whole document.
Make sure tooltips are ordered by extension precedence in the DOM.
New features
Hover tooltip sources may now return multiple tooltips.
Bug fixes
Include .mts and .cts as TypeScript file extensions.
Bug fixes
Make highlightSelectionMatches
include whitespace in the selection in its matches.
Fix a bug that caused SearchCursor
to return invalid ranges when matching astral chars that the the normalizer normalized to single-code-unit chars.
Bug fixes
Fix an issue where, when a lot of code is visible in the initial editor, the bottom bit of code is shown without highlighting for one frame.
Bug fixes
Make lint mark decorations inclusive, so that they are applied even if the marked content is replaced by a widget decoration.
New features
linter
can now be called with null as source to only provide a configuration.
markerFilter
and tooltipFilter
function now get passed the current editor state.
Bug fixes
Fix a bug that caused Tooltip.above
to not take effect for tooltips that were already present when the tooltip plugin is initialized.
Automatically reposition tooltips when their size changes.
Bug fixes
Include .kts as an extension for Kotlin.
Use @codemirror/lang-yaml instead of the legacy mode for YAML content.
New features
Add an entry for Liquid templates.
Bug fixes
Make sure snippet completions also set userEvent
to input.complete
.
Fix a crash when the editor lost focus during an update and autocompletion was active.
Fix a crash when using a snippet that has only one field, but multiple instances of that field.
New features
The new activateOnTypingDelay
option allows control over the debounce time before the completions are queried when the user types.
Bug fixes
When multiple ranges in a single range set overlap, put the smaller ones inside the bigger ones, so that overlapping decorations don't break up each other's elements when coming from the same source.
New features
Selection and selection range eq
methods now support an optional argument that makes them also compare by cursor associativity.
The RangeSet.join
function can be used to join multiple range sets together.
Bug fixes
Work around odd iOS Safari behavior when doing select all.
Fix a composition interruption when an widget is inserted next to the cursor.
Fix a crash in bidirectional cursor motion.
Simplify visual motion through bidirectional text, fix several corner cases where it would work badly.
Fix a bug that broke some bidi isolates not on the first line of the document.
New features
EditorView.bidiIsolatedRanges
now supports automatically determining the direction of the range if not provided by the decoration.
EditorView.visualLineSide
can be used to find the visual end or start of a line with bidirectional text.
The new EditorView.outerDecorations
facet can be used to provide decorations that should always be at the bottom of the precedence stack.
New features
The new bidiIsolates
extension can be used to wrap syntactic elements where this is appropriate in an element that isolates their text direction, avoiding weird ordering of neutral characters on direction boundaries.
Bug fixes
Fix an issue causing cursor motion commands to not dispatch a transaction when the change only affects cursor associativity.
Bug fixes
Fix a bug that could cause tooltips to be unnecessarily be positioned absolutely.
Make sure that, when an editor creates tooltips immediately on initialization, the editor is attached to the document when their mount
callback is called.
Bug fixes
Fix an issue in the bidirectional motion that could cause the cursor to get stuck in a loop when a zero-width non-joiner char was placed on a direction boundary.
Fix a bug that corrupts the editor's internal view tree data structure on some types of edits, putting the editor in a broken state.
Bug fixes
Fix an issue where Text.slice
and Text.replace
could return objects with incorrect length
when the given from
/to
values were out of range for the text.
Bug fixes
Fix a regression that caused deleteCharBackward
to sometimes delete a large chunk of text.
Bug fixes
Make sure transactions cannot add multiple selections when allowMultipleSelections
is false.
Fix a bug that caused Text.iterLines
to not return empty lines at the end of the iterated ranges.
Bug fixes
Call widget destroy
methods when the entire editor is destroyed or reset.
Work around an issue on Safari on macOS Sonoma that made the native cursor visible even when drawSelection
is enabled.
Fix an issue where, on some browsers, the screenreader announced text ended up in the printed document.
Fix a bug where a hover tooltip could stick around even though the pointer was no longer on the editor when it was moved out over the tooltip.
Fix an issue where hover tooltips could close when moving the mouse onto them due to mouse position rounding issues.
Bug fixes
Fix an issue in StreamLanguage
where it ran out of node type ids if you repeatedly redefined a language with the same token table.
Bug fixes
When undoing, store the selection after the undone change with the redo event, so that redoing restores it.
deleteCharBackward
will no longer delete variant selector characters as separate characters.
Bug fixes
Fix a bug that caused codes like \n
to be unescaped in strings inserted via replace placeholders like $&
.
Use the keybinding Mod-Alt-g for gotoLine
to the search keymap, to make it usable for people whose keyboard layout uses Alt/Option-g to type some character.
Bug fixes
Fix a bug that caused typing over closed brackets after pressing enter to still not work in many situations.
Bug fixes
Fix an issue that would prevent typing over closed brackets after starting a new line with enter.
New features
Additional elements rendered in completion options with addToOptions
are now given access to the editor view.
Bug fixes
Exceptions raised by update listeners are now routed to the configured exception sink, if any.
Fix an issue where passing large scroll margins to scrollIntoView
would cause the measure loop to fail to terminate.
Widgets that are draggable (and allow drag events through in their ignoreEvent
implementation) can now use the editor's built-in drag/drop behavior.
New features
The new scrollTo
option to EditorView
allows an initial scroll position to be provided.
The new EditorView.scrollSnapshot
method returns an effect that can be used to reset to a previous scroll position.
Bug fixes
Support the offset
, getCoords
, overlap
, and resize
properties on hover tooltips, as long as they aren't given conflicting values when there are multiple active hover tooltips.
Fix a bug that caused tooltips in the default configuration to be positioned incorrectly on Chrome when the editor was transformed.
Bug fixes
Allow StreamParser
tokens get multiple highlighting tags.
Bug fixes
Give the tag property on FacetReader
the type of the output type parameter to force TypeScript to infer the proper type when converting from Facet
to FacetReader
.
Bug fixes
Fix a bug that caused updateSyncTime
to always delay the initial population of the tooltip.
New features
The new FacetReader
type provides a way to export a read-only handle to a Facet
.
Bug fixes
Fix a bug where picking a selection with the mouse could use the wrong completion if the completion list was updated after being opened.
New features
The new autocompletion configuration option updateSyncTime
allows control over how long fast sources are held back waiting for slower completion sources.
Bug fixes
Fix an issue that caused coordsForChar
to return the wrong rectangle for characters after a line wrap in Safari.
Make the context menu work when clicking below the content in a fixed-height editor.
Tooltips that have been put below/above their target position because there is no room on their default side now stay there on further updates.
Bug fixes
Fix a bug in completeAnyWord
that could cause it to generate invalid regular expressions and crash.
Bug fixes
Fix a regression that broke dragging text from inside the editor.
Bug fixes
Fix a bug that could corrupt the DOM view for specific changes involving newlines and mark decorations.
Bug fixes
Fix a bug that could cause zero-length widgets at the start of a line to be left in the view even after they were removed.
New features
RectangleMarker
's dimension properties are now public.
Bug fixes
Make it possible for selectParentSyntax
to jump out of or into a syntax tree overlay.
Make Cmd-Backspace and Cmd-Delete on macOS delete to the next line wrap point, not the start/end of the line.
New features
The new deleteLineBoundaryForward
and deleteLineBoundaryBackward
commands delete to the start/end of the line or the next line wrapping point.
Bug fixes
Fix an issue in the way the DOM selection is being read that could break backspacing of widgets on Android.
Fix a bug where the editor could incorrectly computate its transform scale when it was small.
Bug fixes
Fix a crash in plugin event handlers after dynamic reconfiguration.
Fix an issue where, on Chrome, tooltips would no longer use fixed positioning.
Bug fixes
Fix an issue that caused repositionTooltips
to crash when it was called on an editor without tooltips.
Fix an issue that caused the tooltip system to leave empty nodes in the DOM when an editor using the parent
option to tooltips
is destroyed.
Fix a bug that regression mouse interaction with the area of a fixed-size editor that isn't covered by the content.
Fix some issues with the way moveVertically
behaved for positions on line wrap points.
Fix a bug that could cause the document DOM to be incorrectly updated on some types of viewport changes.
New features
The new getDrawSelectionConfig
function returns the drawSelection
configuration for a given state.
Bug fixes
Indentation now works a lot better in mixed-language documents that interleave the languages in a complex way.
Code folding is now able to pick the right foldable syntax node when the line end falls in a mixed-parsing language that doesn't match the target node.
Bug fixes
Fix a bug that caused whole-word search to incorrectly check for word boundaries in some circumstances.
Bug fixes
Make sure the drop cursor is properly cleaned up even when another extension handles the drop event.
Fix a crash related to non-inclusive replacing block decorations.
New features
The new EditorView.domEventObservers
(and the corresponding option to view plugins) allows you to register functions that are always called for an event, regardless of whether other handlers handled it.
Bug fixes
The gotoLine
dialog is now populated with the current line number when you open it.
Bug fixes
Make sure the cursor is scrolled into view after inserting completion text.
Make sure scrolling completions into view doesn't get confused when the tooltip is scaled.
Bug fixes
Make sure scrolling diagnostic into view in the panel works when the editor is scaled.
Bug fixes
Fix an issue where the configuration process raised an error when multiple instances of the collab
extensions were added.
Bug fixes
Fix an issue where the editor duplicated text when the browser moved content into the focused text node on composition.
Make sure widgetMarker
is called for gutters on lines covered by a block replace decoration.
Fix an issue where the cursor could be shown in a position that doesn't allow a cursor when the selection is in a block widget.
New features
The new EditorView.scaleX
and scaleY
properties return the CSS-transformed scale of the editor (or 1 when not scaled).
The editor now supports being scaled with CSS.
Bug fixes
Don't close the hover tooltip when the pointer moves over empty space caused by line breaks within the hovered range.
Fix a bug where on Chrome Android, if a virtual keyboard was slow to apply a change, the editor could end up dropping it.
Work around an issue where line-wise copy/cut didn't work in Firefox because the browser wasn't firing those events when nothing was selected.
Fix a crash triggered by the way some Android IME systems update the DOM.
Fix a bug that caused replacing a word by an emoji on Chrome Android to be treated as a backspace press.
Bug fixes
Fix a bug that broke hover tooltips when hovering over a widget.
New features
The new EditorView.cspNonce
facet can be used to provide a Content Security Policy nonce for the library's generated CSS.
The new EditorView.bidiIsolatedRanges
can be used to inform the editor about ranges styled as Unicode bidirection isolates, so that it can compute the character order correctly.
EditorView.dispatch
now also accepts an array of transactions to be applied together in a single view update.
The new dispatchTransactions
option to new EditorView
now replaces the old (deprecated but still supported) dispatch
option in a way that allows multiple transactions to be applied in one update.
Input handlers are now passed an additional argument that they can use to retrieve the default transaction that would be applied for the insertion.
Bug fixes
Make insertNewlineAndIndent
properly count indentation for tabs when copying over the previous line's indentation.
The various sub-word motion commands will now use Intl.Segmenter
, when available, to stop at CJK language word boundaries.
Fix a bug in insertNewlineAndIndent
that would delete text between brackets if it had no corresponding AST node.
Bug fixes
Don't use the very lowest precedence for match highlighting decorations.
Bug fixes
Fix a crash that could occur when a view was reconfigured in a way that removed the lint extension.
New features
The new rebaseUpdates
function can be used by a collaborative editing server to accept updates even if they apply to an old document version.
receiveUpdates
is now able to handle updates that were rebased by the server.
Bug fixes
Make getIndentation
return null, rather than 0, when there is no syntax tree available.
New features
The new preparePlaceholder
option to codeFolding
makes it possible to display contextual information in a folded range placeholder widget.
Bug fixes
Make gotoLine
prefer to scroll the target line to the middle of the view.
Fix an issue in SearchCursor
where character normalization could produce nonsensical matches.
Bug fixes
Fix an issue that made the gutter not stick in place when the editor was in a right-to-left context.
New features
The new EditorView.coordsForChar
method returns the client rectangle for a given character in the editor.
Bug fixes
Fix another crash regression for compositions before line breaks.
Bug fixes
Fix the check that made sure compositions are dropped when the selection is moved.
Bug fixes
Fix a regression that could cause the composition content to be drawn incorrectly.
New features
Completions may now provide a displayLabel
property that overrides the way they are displayed in the completion list.
Bug fixes
Fix dragging a selection from inside the current selection on macOS.
Fix an issue that could cause the scroll position to jump wildly
Don't try to scroll fixed-positioned elements into view by scrolling their parent elements.
Fix a bug that caused the cursor to be hidden when showing a placeholder that consisted of the empty string.
Resolve some issues where composition could incorrectly affect nearby replaced content.
New features
Key bindings can now set a stopPropagation
field to cause the view to stop the key event propagation when it considers the event handled.
Bug fixes
Fix an issue where scrolling up through line-wrapped text would sometimes cause the scroll position to pop down.
Fix an issue where clicking wouldn't focus the editor on Firefox when it was in an iframe and already the active element of the frame.
Fix a bug that could cause compositions to be disrupted because their surrounding DOM was repurposed for some other piece of content.
Fix a bug where adding content to the editor could inappropriately move the scroll position.
Extend detection of Enter presses on Android to beforeInput
events with an "insertLineBreak"
type.
New features
Diagnostics can now use "hint"
as a severity level.
Diagnostics can now set a markClass
property to add an additional CSS class to the text marked by the diagnostic.
Bug fixes
When dragging text inside the editor, look at the state of Ctrl (or Alt on macOS) at the time of the drop, not the start of drag, to determine whether to move or copy the text.
Fix an issue where having a bunch of padding on lines could cause vertical cursor motion and posAtCoords
to jump over lines.
New features
Block widget decorations can now be given an inlineOrder
option to make them appear in the same ordering as surrounding inline widgets.
Bug fixes
acceptCompletion
now returns false (allowing other handlers to take effect) when the completion popup is open but disabled.
New features
A new previousDiagnostic
command can be used to move back through the active diagnostics.
Bug fixes
Fix an issue in scroll position stabilization for changes above the visible, where Chrome already does this natively and we ended up compensating twice.
Bug fixes
Fix a bug where the cursor would in some circumstances be drawn on the wrong side of an inline widget.
Fix an issue where scrollPastEnd
could cause the scroll position of editors that weren't in view to be changed unnecessarily.
New features
The new baseIndentFor
method in TreeIndentContext
can be used to find the base indentation for an arbitrary node.
New features
The result of Completion.info
may now include a destroy
method that will be called when the tooltip is removed.
Bug fixes
Forbid widget decoration side values bigger than 10000, to prevent them from breaking range ordering invariants.
Fix a bug where differences between widgets' estimated and actual heights could cause the editor to inappropriately move the scroll position.
Avoid another situation in which composition that inserts line breaks could corrupt the editor DOM.
New features
Inline widgets may now introduce line breaks, if they report this through the WidgetType.lineBreaks
property.
New features
The new regexp
option to search
can be used to control whether queries have the regexp flag on by default.
Bug fixes
Make sure lint gutter tooltips are properly closed when the content of their line changes.
Bug fixes
Fix an issue that could cause RangeSet.compare
to miss changes in the set of active ranges around a point range.
New features
Export DocInput
class for feeding editor documents to a Lezer parser.
Bug fixes
Remove an accidentally included console.log
.
New features
EditorViewConfig.dispatch
is now passed the view object as a second argument.
Bug fixes
Make sure pointer selection respects EditorView.atomicRanges
.
Preserve DOM widgets when their decoration type changes but they otherwise stay in the same place.
Fix a bug in drawSelection
that could lead to invisible or incorrect selections for a blank line below a block widget.
Bug fixes
Fix a bug where the crosshairCursor
extension could, when non-native key events were fired, trigger disruptive and needless view updates.
Fix an Android issue where backspacing at the front of a line with widget decorations could replace those decorations with their text content.
Respect scroll margins when scrolling the target of drag-selection into view.
Validate selection offsets reported by the browser, to work around Safari giving us invalid values in some cases.
Bug fixes
Fix a bug that cause incorrect ordering of completions when some results covered input text and others didn't.
New features
The new hasNextSnippetField
and hasPrevSnippetField
functions can be used to figure out if the snippet-field-motion commands apply to a given state.
Bug fixes
Don't preserve the DOM around a composition that spans multiple lines.
New features
Gutters now support a widgetMarker
option that can be used to add markers next to block widgets.
Bug fixes
The by-subword motion commands now properly treat dashes, underscores, and similar as subword separators.
Bug fixes
Fix a bug that made the editor use the completion's original position, rather than its current position, when changes happened in the document while a result was active.
Bug fixes
Limit cursor height in front of custom placeholder DOM elements.
Bug fixes
Use @codemirror/lang-less for Less files.
Bug fixes
Fix a bug in insertCompletionText
that caused it to replace the wrong range when a result set's to
fell after the cursor.
New features
Functions returned by snippet
can now be called without a completion object.
Bug fixes
Fix a crash in drawSelection
when a measured position falls on a position that doesn't have corresponding screen coordinates.
Work around unhelpful interaction observer behavior that could cause the editor to not notice it was visible.
Give the cursor next to a line-wrapped placeholder a single-line height.
Make sure drop events below the editable element in a fixed-height editor get handled properly.
New features
Widget decorations can now define custom coordsAtPos
methods to control the way the editor computes screen positions at or in the widget.
Bug fixes
The findNext
and findPrevious
commands now select the search field text if that field is focused.
New features
The scrollToMatch
callback option now receives the editor view as a second parameter.
Bug fixes
Fix an issue where, when escape was pressed followed by a key that the editor handled, followed by tab, the tab would still move focus.
Fix an issue where, in some circumstances, the editor would ignore text changes at the end of a composition.
Allow inline widgets to be updated to a different length via updateDOM
.
New features
Use the @codemirror/lang-sass package for .sass and .scss files.
Bug fixes
Block commenting the selection no longer includes indentation on the first line.
Bug fixes
Avoid disrupting the composition in specific cases where Safari invasively changes the DOM structure in the middle of a composition.
Fix a bug that prevented destroy
being called on hover tooltips.
Fix a bug where the editor could take focus when content changes required it to restore the DOM selection.
Fix height layout corruption caused by a division by zero.
Make sure styles targeting the editor's focus status are specific enough to not cause them to apply to editors nested inside another focused editor. This will require themes to adjust their selection background styles to match the new specificity.
Bug fixes
Associate Gemfile and Rakefile files with Ruby.
Bug fixes
Keep completions open when interaction with an info tooltip moves focus out of the editor.
Bug fixes
When closeBrackets
skips a bracket, it now generates a change that overwrites the bracket.
Replace the entire selected range when picking a completion with a non-cursor selection active.
New features
Completions can now provide a section
field that is used to group them into sections.
The new positionInfo
option can be used to provide custom logic for positioning the info tooltips.
Bug fixes
The linter
function now eagerly includes all lint-related extensions, rather than appending them to the configuration as-needed, so that turning off linting by clearing the compartment that contains it works properly.
Bug fixes
Make the editor scroll while dragging a selection near its sides, even if the cursor isn't outside the scrollable element.
Fix a bug that interrupted composition after widgets in some circumstances on Firefox.
Make sure the last change in a composition has its user event set to input.type.compose
, even if the compositionend
event fires before the changes are applied.
Make it possible to remove additional selection ranges by clicking on them with ctrl/cmd held, even if they aren't cursors.
Keep widget buffers between widgets and compositions, since removing them confuses IME on macOS Firefox.
Fix a bug where, for DOM changes that put the selection in the middle of the changed range, the editor incorrectly set its selection state.
Fix a bug where coordsAtPos
could return a coordinates before the line break when querying a line-wrapped position with a positive side
.
New features
Include support for Vue.
Include support for Angular templates.
Bug fixes
Work around a Firefox issue that caused coordsAtPos
to return rectangles with the full line height on empty lines.
Opening a context menu by clicking below the content element but inside the editor now properly shows the browser's menu for editable elements.
Fix an issue that broke composition (especially of Chinese IME) after widget decorations.
Fix an issue that would cause the cursor to jump around during compositions inside nested mark decorations.
New features
The new scrollToMatch
search option allows you to adjust the way the editor scrolls search matches into view.
Bug fixes
Fix a bug where line commenting got confused when commenting a range that crossed language boundaries.
Bug fixes
Work around a Firefox CSS bug that caused cursors to stop blinking in a scrolled editor.
Fix an issue in drawSelection
where the selection extended into the editor's padding.
Fix pasting of links copied from iOS share sheet.
New features
The new needsRefresh
option to linter
makes it possible to cause linting to be recalculated for non-document state changes.
Bug fixes
Improve the way posAtCoords
picks the side of a widget to return by comparing the coordinates the center of the widget.
Fix an issue where transactions created for the focusChangeEffect
facet were sometimes not dispatched.
Bug fixes
Fix a bug where the apply method created by snippet
didn't add a pickedCompletion
annotation to the transactions it created.
Bug fixes
Fix an issue where inaccurate estimated vertical positions could cause the viewport to not converge in line-wrapped editors.
Don't suppress double-space to period conversion when autocorrect is enabled.
Make sure the measuring code notices when the scaling of the editor is changed, and does a full measure in that case.
New features
The new EditorView.focusChangeEffect
facet can be used to dispatch a state effect when the editor is focused or blurred.
Bug fixes
Keep cursor position stable in cursorPageUp
/cursorPageDown
when there are panels or other scroll margins active.
Make sure toggleComment
doesn't get thrown off by local language nesting, by fetching the language data for the start of the selection line.
Bug fixes
Give lint action buttons a pointer cursor style.
Fix a bug that caused diagnostic action callbacks to be called twice when their button was clicked.
Bug fixes
Don't consider node names in trees that aren't the same language as the one at the completion position in ifIn
and ifNotIn
.
Make sure completions that exactly match the input get a higher score than those that don't (so that even if the latter has a score boost, it ends up lower in the list).
New features
Syntax-driven language data queries now support sublanguages, which make it possible to return different data for specific parts of the tree produced by a single language.
Bug fixes
Fix an issue where tooltips that have their height reduced have their height flicker when scrolling or otherwise interacting with the editor.
Bug fixes
Fix a regression that caused clicking on the scrollbar to move the selection.
Fix an issue where focus or blur event handlers that dispatched editor transactions could corrupt the mouse selection state.
Fix a CSS regression that prevented the drop cursor from being positioned properly.
New features
WidgetType.updateDOM
is now passed the editor view object.
Bug fixes
Make indentation for stream languages more reliable by having StringStream.indentation
return overridden indentations from the indent context.
New features
The toggleFold
command folds or unfolds depending on whether there's an existing folded range on the current line.
indentUnit
now accepts any (repeated) whitespace character, not just spaces and tabs.
New features
The new joinToEvent
history configuration option allows you to provide custom logic that determines whether a new transaction is added to an existing history event.
Bug fixes
Fix a bug in posAtCoords
that could cause incorrect results for positions to the left of a wrapped line.
New features
The bracketMatchingHandle
node prop can now be used to limit bracket matching behavior for larger nodes to a single subnode (for example the tag name of an HTML tag).
Bug fixes
Fix a regression where the cursor didn't restart its blink cycle when moving it with the pointer.
Even without a key
property, measure request objects that are already scheduled will not be scheduled again by requestMeasure
.
Fix an issue where keymaps incorrectly interpreted key events that used Ctrl+Alt modifiers to simulate AltGr on Windows.
Fix a bug where line decorations with a different class
property would be treated as equal.
Fix a bug that caused drawSelection
to not notice when it was reconfigured.
Fix a crash in the gutter extension caused by sharing of mutable arrays.
Fix a regression that caused touch selection on mobile platforms to not work in an uneditable editor.
Fix a bug where DOM events on the boundary between lines could get assigned to the wrong line.
New features
EditorSelection.range
now accepts an optional 4th argument to specify the bidi level of the range's head position.
Bug fixes
Preserve selection bidi level when extending the selection, to prevent shift-selection from getting stuck in some kinds of bidirectional text.
Bug fixes
Fix a bug that caused ensureSyntaxTree
to return incomplete trees when using a viewport-aware parser like StreamLanguage
.
Bug fixes
Fix an issue where the extension would sometimes try to draw a disabled dialog at an outdated position, leading to plugin crashes.
New features
A tooltipClass
option to autocompletion can now be used to add additional CSS classes to the completion tooltip.
Bug fixes
Make the editor properly scroll when moving the pointer out of it during drag selection.
Fix a regression where clicking below the content element in an editor with its own height didn't focus the editor.
Bug fixes
Make the editor notice widget height changes to automatically adjust its height information.
Fix an issue where widget buffers could be incorrectly omitted after empty lines.
Fix an issue in content redrawing that could cause coordsAtPos
to return incorrect results.
New features
The static RectangleMarker.forRange
method exposes the logic used by the editor to draw rectangles covering a selection range.
Layers can now provide a destroy
function to be called when the layer is removed.
The new highlightWhitespace
extension makes spaces and tabs in the editor visible.
The highlightTrailingWhitespace
extension can be used to make trailing whitespace stand out.
New features
The layer
function can now be used to define extensions that draw DOM elements over or below the document text.
Tooltips that are bigger than the available vertical space for them will now have their height set so that they don't stick out of the window. The new resize
property on TooltipView
can be used to opt out of this behavior.
Bug fixes
Fix an issue where completion lists could end up being higher than the tooltip they were in.
Bug fixes
Set an explicit box-sizing
style on completion icons so CSS resets don't mess them up.
Allow closing braces in templates to be escaped with a backslash.
Bug fixes
Fix a bug that caused the openStart
value passed to span iterators to be incorrect around widgets in some circumstances.
Bug fixes
Fix a bug that caused marked unnecessary splitting of mark decoration DOM elements in some cases.
Bug fixes
Fix a regression that could cause the completion dialog to stick around when it should be hidden.
New features
The new forEachDiagnostic
function can be used to iterate over the diagnostics in an editor state.
Bug fixes
Fix an issue where key bindings were activated for the wrong key in some situations with non-US keyboards.
New features
A tooltip's positioned
callback is now passed the available space for tooltips.
Bug fixes
Make syntax-based folding include syntax nodes that start right at the end of a line as potential fold targets.
Fix the indentService
protocol to allow a distinction between declining to handle the indentation and returning null to indicate the line has no definite indentation.
Bug fixes
Fix a bug that hid the search dialog's close button when the editor was read-only.
Bug fixes
Fix a regression where transactions for picking a completion (without custom apply
method) no longer had the pickedCompletion
annotation.
Reduce flickering for completion sources without validFor
info by temporarily showing a disabled tooltip while the completion updates.
Make sure completion info tooltips are kept within the space provided by the tooltipSpace
option.
Bug fixes
Avoid unnecessary calls to computed facet getters when a state is reconfigured but no dependencies of the computed facet change.
Fix an infinite loop in RangeSet.eq
when the to
parameter isn't given.
Bug fixes
Typing into a read-only editor no longer moves the cursor.
Fix an issue where hover tooltips were closed when the mouse was moved over them if they had a custom parent element.
Fix an issue where the editor could end up displaying incorrect height measurements (typically after initializing).
Bug fixes
Fix an issue where coordinates next to replaced widgets were returned incorrectly, causing the cursor to be drawn in the wrong place.
Update the crosshairCursor
state on every mousemove event.
Avoid an issue in the way that the editor enforces cursor associativity that could cause the cursor to get stuck on single-character wrapped lines.
New features
HighlightStyle
objects now have a specs
property holding the tag styles that were used to define them.
Language
objects now have a name
field holding the language name.
Bug fixes
Avoid an issue where scrollPastEnd
makes a single-line editor have a vertical scrollbar.
Work around a Chrome bug where it inserts a newline when you press space at the start of a wrapped line.
Align rectangularSelection
's behavior with other popular editors by making it create cursors at the end of lines that are too short to touch the rectangle.
Fix an issue where coordinates on mark decoration boundaries were sometimes taken from the wrong side of the position.
Prevent scrolling artifacts caused by attempts to scroll stuff into view when the editor isn't being displayed.
New features
TooltipView
objects can now provide a destroy
method to be called when the tooltip is removed.
Bug fixes
When literal
is off, \n, \r, and \t escapes are now also supported in replacement text.
Make sure search dialog inputs don't get treated as form fields when the editor is created inside a form.
Fix a bug in RegExpCursor
that would cause it to stop matching in the middle of a line when its current match position was equal to the length of the line.
Bug fixes
Fix a bug that caused deletion commands on non-empty ranges to incorrectly return false and do nothing, causing the editor to fall back to native behavior.
Bug fixes
Fix a crash when trying to scroll something into view in an editor that wasn't in the visible DOM.
Fix an issue where coordsAtPos
returned the coordinates on the wrong side of a widget decoration wrapped in a mark decoration.
Fix an issue where content on long wrapped lines could fail to properly scroll into view.
Fix an issue where DOM change reading on Chrome Android could get confused when a transaction came in right after a beforeinput event for backspace, enter, or delete.
Bug fixes
Reduce the amount of wrap-point jittering when scrolling through a very long wrapped line.
Fix an issue where scrolling to content that wasn't currently drawn due to being on a very long line would often fail to scroll to the right position.
Suppress double-space-adds-period behavior on Chrome Mac when it behaves weirdly next to widget.
New features
Key binding objects with an any
property will now add handlers that are called for any key, within the ordering of the keybindings.
Bug fixes
Make sure the selection endpoints are moved out of atomic ranges when applying a deletion command to a non-empty selection.
Bug fixes
By-word search queries will now skip any result that had word characters both before and after a match boundary.
Bug fixes
Don't override double/triple tap behavior on touch screen devices, so that the mobile selection menu pops up properly.
Fix an issue where updating the selection could crash on Safari when the editor was hidden.
New features
Close bracket configuration now supports a stringPrefixes
property that can be used to allow autoclosing of prefixed strings.
Bug fixes
Fix an issue where, when multiple transaction extenders took effect, only the highest-precedence one was actually included in the transaction.
Bug fixes
Highlight the active line even when there is a selection. Prevent the active line background from obscuring the selection backdrop.
Fix an issue where elements with negative margins would confuse the editor's scrolling-into-view logic.
Fix scrolling to a specific position in an editor that has not been in view yet.
New features
Autocompletion now takes an interactionDelay
option that can be used to control the delay between the time where completion opens and the time where commands like acceptCompletion
affect it.
Bug fixes
Fix a bug where cursor motion, when starting from a non-empty selection range, could get stuck on atomic ranges in some circumstances.
Avoid triggering Chrome Android's text-duplication issue when a period is typed in the middle of a word.
Bug fixes
Fix a bug that prevented transactions produced by deleteBracketPair
from being marked as deletion user events.
Improve positioning of completion info tooltips so they are less likely to stick out of the screen on small displays.
Bug fixes
Don't reset the selection for selection change events that were suppressed by a node view.
Bug fixes
Don't use the global document
variable to track focus, since that doesn't work in another window/frame.
Fix an issue where key handlers that didn't return true were sometimes called twice for the same keypress.
Avoid editing glitches when using deletion keys like ctrl-d on iOS.
Properly treat characters from the 'Arabic Presentation Forms-A' Unicode block as right-to-left.
Work around a Firefox bug that inserts text at the wrong point for specific cross-line selections.
New features
A new wholeWord
search query flag can be used to limit matches to whole words.
SearchCursor
and RegExpCursor
now support a test
parameter that can be used to ignore certain matches.
Bug fixes
Prevent native behavior on Ctrl/Cmd-ArrowLeft/ArrowRight bindings, so that browsers with odd bidi behavior won't do the wrong thing at start/end of line.
Cmd-ArrowLeft/Right on macOS now moves the cursor in the direction of the arrow even in right-to-left content.
New features
The new cursorLineBoundaryLeft
/Right
and selectLineBoundaryLeft
/Right
commands allow directional motion to line boundaries.
Bug fixes
Fix an infinite loop when the match position of a RegExpCursor
ended up in the middle of an UTF16 surrogate pair.
New features
The literal
search option can now be set to make literal queries the default.
The new searchPanelOpen
function can be used to find out whether the search panel is open for a given state.
Bug fixes
Fix a bug where posAtCoords
would return the wrong results for positions to the right of wrapped lines.
New features
The new EditorView.setRoot
method can be used when an editor view is moved to a new document or shadow root.
Bug fixes
Make selection-restoration on focus more reliable.
Bug fixes
Fix a bug in range set span iteration that would cause decorations to be inappropriately split in some situations.
Bug fixes
Fix a bug where a document that contains only non-printing characters would lead to bogus text measurements (and, from those, to crashing).
Make sure differences between estimated and actual block heights don't cause visible scroll glitches.
Bug fixes
Fix an issue where double tapping enter to confirm IME input and insert a newline on iOS would sometimes insert two newlines.
Fix an issue on iOS where a composition could get aborted if the editor scrolled on backspace.
Bug fixes
Make highlightSpecialChars
replace directional isolate characters by default.
The editor will now try to suppress browsers' native behavior of resetting the selection in the editable content when the editable element is focused (programmatically, with tab, etc).
Fix a CSS issue that made it possible, when the gutters were wide enough, for them to overlap with the content.
Bug fixes
findNext
and findPrevious
will now return to the current result (and scroll it into view) if no other matches are found.
Bug fixes
Fix a bug where bracketMatching
would incorrectly match nested brackets in syntax trees that put multiple pairs of brackets in the same parent node.
Fix a bug that could cause indentRange
to loop infinitely.
New features
MatchDecorator
now supports a decorate
option that can be used to customize the way decorations are added for each match.
New features
You can now provide a compareCompletions
option to autocompletion to influence the way completions with the same match score are sorted.
The selectOnOpen
option to autocompletion can be used to require explicitly selecting a completion option before acceptCompletion
does anything.
Bug fixes
Fix a problem where posAtCoords
could incorrectly return the start of the next line when querying positions between lines.
Fix an issue where registering a high-precedence keymap made keymap handling take precedence over other keydown event handlers.
Ctrl/Cmd-clicking can now remove ranges from a multi-range selection.
Bug fixes
Remove a leftover console.log
in bracket closing code.
Bug fixes
Fix a bug that caused closeBrackets
to not close quotes when at the end of a syntactic construct that starts with a similar quote.
Bug fixes
Refine change mapping to preserve insertions made by concurrent changes.
New features
The enables
option to Facet.define
may now take a function, which will be called with the facet value to create the extensions.
Bug fixes
Fix a bug that prevented bracket matching to recognize plain brackets inside a language parsed as an overlay.
New features
The indentRange
function provides an easy way to programatically auto-indent a range of the document.
Bug fixes
Announce to the screen reader when the selection is deleted.
Also bind Ctrl-Shift-z to redo on Linux.
Bug fixes
Work around limitations in tree-shaking software that prevented basicSetup
from being removed when unused.
Bug fixes
Fix a CSS issue that broke horizontal scroll width stabilization.
Fix a bug where defaultLineHeight
could get an incorrect value in very narrow editors.
New features
The foldState
field is now public, and can be used to serialize and deserialize the fold state.
Bug fixes
Fix a problem that caused effects' map
methods to be called with an incorrect change set when filtering changes.
Bug fixes
Avoid DOM selection corruption when the editor doesn't have focus but has selection and updates its content.
Fall back to dispatching by key code when a key event produces a non-ASCII character (so that Cyrillic and Arabic keyboards can still use bindings specified with Latin characters).
New features
Add a LanguageDescription
for Sass.
Bug fixes
Declare package dependencies as peer dependencies as an attempt to avoid duplicated package issues.
Bug fixes
Support escaping ${
or #{
in snippets.
Breaking changes
Update dependencies to 6.0.0
New features
The new static EditorView.findFromDOM
method can be used to retrieve an editor instance from its DOM structure.
Instead of passing a constructed state to the EditorView
constructor, it is now also possible to inline the configuration options to the state in the view config object.
New features
The foldingChanged
option to foldGutter
can now be used to trigger a recomputation of the fold markers.
Bug fixes
Fix a bug where by-page selection commands sometimes moved one line too far.
Bug fixes
Don't crash when a custom search panel doesn't have a field named 'search'.
Make sure replacements are announced to screen readers.
Bug fixes
Scroll the cursor into view when inserting a snippet.
Breaking changes
Update dependencies to 6.0.0
Breaking changes
Update dependencies to 6.0.0
Breaking changes
Update dependencies to 6.0.0
Breaking changes
Change the package name from @codemirror/example-setup
to just codemirror
.
The package no longer exports EditorState
(since that is no longer necessary to set up a basic editor).
New features
The new minimalSetup
export provides a minimal set of editor extensions.
New features
EditorView.phrase
now accepts additional arguments, which it will interpolate into the phrase in the place of $
markers.
Bug fixes
Fix an issue on Chrome Android where the DOM could fail to display the actual document after backspace.
Avoid an issue on Chrome Android where DOM changes were sometimes inappropriately replace by a backspace key effect due to spurious beforeinput events.
Fix a problem where the content element's width didn't cover the width of the actual content.
Work around a bug in Chrome 102 which caused wheel scrolling of the editor to be interrupted every few lines.
Bug fixes
Add an aria-label to the completion listbox.
Fix a regression that caused transactions generated for completion to not have a userEvent
annotation.
New features
Diagnostic objects may now have a renderMessage
method to render their message to the DOM.
New features
The package now exports an insertCompletionText
helper that implements the default behavior for applying a completion.
Bug fixes
Make sure the editor re-measures itself when its attributes are updated.
Bug fixes
List style-mod as a dependency.
Bug fixes
Fix an issue where gutter elements without any markers in them would not get the cm-gutterElement
class assigned.
Fix an issue where DOM event handlers registered by plugins were retained indefinitely, even after the editor was reconfigured.
Bug fixes
Make sure all
styles in the CSS generated for a HighlightStyle
have a lower precedence than the other rules defined for the style. Use a shorthand property
New features
The new closeOnBlur
option determines whether the completion tooltip is closed when the editor loses focus.
CompletionResult
objects with filter: false
may now have a getMatch
property that determines the matched range in the options.
Bug fixes
Prevent Mac-style behavior of inserting a period when the user inserts two spaces.
Fix an issue where the editor would sometimes not restore the DOM selection when refocused with a selection identical to the one it held when it lost focus.
New features
The package now exports the LintSource
function type.
The new markerFilter
and tooltipFilter
options to linter
and lintGutter
allow more control over which diagnostics are visible and which have tooltips.
Bug fixes
Fix a bug where the input handling could crash on repeated (or held) backspace presses on Chrome Android.
New features
The new hideOn
option to hoverTooltip
allows more fine-grained control over when the tooltip should hide.
New features
It is now possible to disable backslash escapes in search queries with the literal
option.
Bug fixes
Hide lint tooltips when the document is changed.
Breaking changes
The deprecated precedence names fallback
, extend
, and override
were removed from the library.
Bug fixes
Fix a bug where, if an extension value occurs multiple times, its lowest, rather than highest precedence is used.
Fix an issue where facets with computed inputs would unneccesarily have their outputs recreated on state reconfiguration.
Fix a bug in the order in which new values for state fields and facets were computed, which could cause dynamic facets to hold the wrong value in some situations.
New features
The exports from @codemirror/rangeset now live in this package.
The exports from @codemirror/text now live in this package.
Bug fixes
Remove debug statements that accidentally made it into 0.20.0.
Fix a regression in moveVertically
.
Breaking changes
The deprecated interfaces blockAtHeight
, visualLineAtHeight
, viewportLines
, visualLineAt
, scrollPosIntoView
, scrollTo
, and centerOn
were removed from the library.
All decorations are now provided through EditorView.decorations
, and are part of a single precedence ordering. Decoration sources that need access to the view are provided as functions.
Atomic ranges are now specified through a facet (EditorView.atomicRanges
).
Scroll margins are now specified through a facet (EditorView.scrollMargins
).
Plugin fields no longer exist in the library (and are replaced by facets holding function values).
This package no longer re-exports the Range type from @codemirror/state.
Bug fixes
Fix a bug where zero-length block widgets could cause viewportLineBlocks
to contain overlapping ranges.
New features
The new perLineTextDirection
facet configures whether the editor reads text direction per line, or uses a single direction for the entire editor. EditorView.textDirectionAt
returns the direction around a given position.
rectangularSelection
and crosshairCursor
from @codemirror/rectangular-selection were merged into this package.
This package now exports the tooltip functionality that used to live in @codemirror/tooltip.
The exports from the old @codemirror/panel package are now available from this package.
The exports from the old @codemirror/gutter package are now available from this package.
Breaking changes
HighlightStyle.get
is now called highlightingFor
.
HighlightStyles
no longer function as extensions (to improve tree shaking), and must be wrapped with syntaxHighlighting
to add to an editor configuration.
Language
objects no longer have a topNode
property.
New features
HighlightStyle
and defaultHighlightStyle
from the now-removed @codemirror/highlight package now live in this package.
The new forceParsing
function can be used to run the parser forward on an editor view.
The exports that used to live in @codemirror/matchbrackets are now exported from this package.
The @codemirror/fold package has been merged into this one.
The exports from the old @codemirror/stream-parser package now live in this package.
Breaking changes
There is no longer a separate commentKeymap
. Those bindings are now part of defaultKeymap
.
Bug fixes
Make cursorPageUp
and cursorPageDown
move by window height when the editor is higher than the window.
Make sure the default behavior of Home/End is prevented, since it could produce unexpected results on macOS.
New features
The exports from @codemirror/comment are now available in this package.
The exports from the @codemirror/history package are now available from this package.
Bug fixes
Make the wholeWords
option to highlightSelectionMatches
default to false, as intended.
Breaking changes
CompletionResult.span
has been renamed to validFor
, and may now hold a function as well as a regular expression.
Bug fixes
Remove code that dropped any options beyond the 300th one when matching and sorting option lists.
Completion will now apply to all cursors when there are multiple cursors.
New features
CompletionResult.update
can now be used to implement quick autocompletion updates in a synchronous way.
The @codemirror/closebrackets package was merged into this one.
Breaking changes
Update dependencies to 0.20.0
Breaking changes
Update dependencies to 0.20.0
Breaking changes
Update dependencies to 0.20.0
Breaking changes
Update dependencies to 0.20.0
Bug fixes
Make sure search matches are highlighted when scrolling new content into view.
Bug fixes
Autocompletion may now also trigger automatic indentation on input.
Bug fixes
Fix an issue where DOM syncing could crash when a DOM node was moved from a parent to a child node (via widgets reusing existing nodes).
To avoid interfering with things like a vim mode too much, the editor will now only activate the tab-to-move-focus escape hatch after an escape press that wasn't handled by an event handler.
Make sure the view measures itself before the page is printed.
Tweak types of view plugin defining functions to avoid TypeScript errors when the plugin value doesn't have any of the interface's properties.
Bug fixes
Make sure nodes that end at the end of a partial parse aren't treated as valid fold targets.
Fix an issue where the parser sometimes wouldn't reuse parsing work done in the background on transactions.
New features
Add the extension that shows a crosshair cursor when Alt is held down to the basic setup.
New features
The selectedCompletionIndex
function tells you the position of the currently selected completion.
The new setSelectionCompletion
function creates a state effect that moves the selected completion to a given index.
A completion's info
method may now return null to indicate that no further info is available.
Bug fixes
Make the ARIA attributes added to the editor during autocompletion spec-compliant.
Bug fixes
Fix an issue where block widgets at the start of the viewport could break height computations.
Bug fixes
Fix a bug where hovering over the icons in the lint gutter would sometimes fail to show a tooltip or show the tooltip for another line.
Bug fixes
Fix a bug where block widgets on the edges of viewports could cause the positioning of content to misalign with the gutter and height computations.
Improve cursor height next to widgets.
Fix a bug where mapping positions to screen coordinates could return incorred coordinates during composition.
Bug fixes
Fix an issue that could cause indentation logic to use the wrong line content when indenting multiple lines at once.
New features
The selection-matching extension now accepts a wholeWords
option that makes it only highlight matches that span a whole word. Add SearchQuery.getCursor
The SearchQuery
class now has a getCursor
method that allows external code to create a cursor for the query.
Bug fixes
Make sure the lint gutter tooltips are positioned under their icon, even when the line is wrapped.
Bug fixes
Fix an issue where an outdated marker could stick around on the lint gutter after all diagnostics were removed.
New features
Add a hoverTime
option to the lint gutter. Change default hover time to 300
Bug fixes
Fix an issue where the library failed to call WidgetType.destroy
on the old widget when replacing a widget with a different widget of the same type.
Fix an issue where the editor would compute DOM positions inside composition contexts incorrectly in some cases, causing the selection to be put in the wrong place and needlessly interrupting compositions.
Fix leaking of resize event handlers.
Bug fixes
Fix an issue where the completion tooltip stayed open if it was explicitly opened and the user backspaced past its start.
Stop snippet filling when a change happens across one of the snippet fields' boundaries.
Bug fixes
Fix a crash that occasionally occurred when drag-selecting in a way that scrolled the editor.
New features
The new EditorView.compositionStarted
property indicates whether a composition is starting.
Bug fixes
Mapping a non-empty selection range now always puts any newly inserted text on the sides of the range outside of the mapped version.
Bug fixes
Fix several issues where editing or composition went wrong due to our zero-width space kludge characters ending up in unexpected places.
Make sure the editor re-measures its dimensions whenever its theme changes.
Fix an issue where some keys on Android phones could leave the editor DOM unsynced with the actual document.
Bug fixes
Fix a bug where facet values with computed inputs could incorrectly retain their old value on reconfiguration.
Bug fixes
Fix a bug that caused the search panel to start open when configuring a state with the search()
extension.
Breaking changes
searchConfig
is deprecated in favor of search
(but will exist until next major release).
New features
The new search
function is now used to enable and configure the search extension.
Bug fixes
Avoid recomputing facets on state reconfiguration if that facet's inputs stayed precisely the same.
Selection ranges created with EditorSelection.range
will now have an assoc pointing at their anchor, when non-empty.
Bug fixes
Fix a regression in cursor position determination after making an edit next to a widget.
Bug fixes
Fix an issue where the editor's view of its content height could go out of sync with the DOM when a line-wrapping editor had its width changed, causing wrapping to change.
Fix a bug that caused the editor to draw way too much content when scrolling to a position in an editor (much) taller than the window.
Report an error when a replace decoration from a plugin crosses a line break, rather than silently ignoring it.
Fix an issue where reading DOM changes was broken when lineSeparator
contained more than one character.
Make ordering of replace and mark decorations with the same extent and inclusivness more predictable by giving replace decorations precedence.
Fix a bug where, on Chrome, replacement across line boundaries and next to widgets could cause bogus zero-width characters to appear in the content.
Bug fixes
Make selectNextOccurrence
scroll the newly selected range into view.
Bug fixes
deleteCharBackward
now removes extending characters one at a time, rather than deleting the entire glyph at once.
Alt-v is no longer bound in emacsStyleKeymap
and macOS's standardKeymap
, because macOS doesn't bind it by default and it conflicts with some keyboard layouts.
Bug fixes
Make composition input properly appear at secondary cursors (except when those are in the DOM node with the composition, in which case the browser won't allow us to intervene without aborting the composition).
Fix a bug that cause the editor to get confused about which content was visible after scrolling something into view.
Fix a bug where the dummy elements rendered around widgets could end up in a separate set of wrapping marks, and thus become visible.
EditorView.moveVertically
now preserves the assoc
property of the input range.
Get rid of gaps between selection elements drawn by drawSelection
.
Fix an issue where replacing text next to a widget might leak bogus zero-width spaces into the document.
Avoid browser selection mishandling when a focused view has setState
called by eagerly refocusing it.
Bug fixes
Don't bind Alt-< and Alt-> on macOS by default, since those interfere with some keyboard layouts. Make cursorPageUp/Down scroll the view to keep the cursor in place
cursorPageUp
and cursorPageDown
now scroll the view by the amount that the cursor moved.
Bug fixes
Fix completion navigation with PageUp/Down when the completion tooltip isn't part of the view DOM.
Bug fixes
Fix a bug that caused page up/down to only move the selection by two options in the completion tooltip.
Bug fixes
Make sure the editor signals a geometryChanged
update when its width changes.
New features
EditorView.darkTheme
can now be queried to figure out whether the editor is using a dark theme.
Bug fixes
Fix a bug that caused line decorations with a class
property to suppress all other line decorations for that line.
Fix a bug that caused scroll effects to be corrupted when further updates came in before they were applied.
Fix an issue where, depending on which way a floating point rounding error fell, posAtCoords
(and thus vertical cursor motion) for positions outside of the vertical range of the document might or might not return the start/end of the document.
Bug fixes
Make sure the info tooltip is hidden when the selected option is scrolled out of view.
Fix a bug in the completion ranking that would sometimes give options that match the input by word start chars higher scores than appropriate.
Options are now sorted (ascending) by length when their match score is otherwise identical.
Bug fixes
Fix regression where plugin replacing decorations that span to the end of the line are ignored.
Bug fixes
Fix a crash in posAtCoords
when the position lies in a block widget that is rendered but scrolled out of view.
Adding block decorations from a plugin now raises an error. Replacing decorations that cross lines are ignored, when provided by a plugin.
Fix inverted interpretation of the precise
argument to posAtCoords
.
Bug fixes
The editor will now handle double-taps as if they are double-clicks, rather than letting the browser's native behavior happen (because the latter often does the wrong thing).
Fix an issue where backspacing out a selection on Chrome Android would sometimes only delete the last character due to event order issues.
posAtCoords
, without second argument, will no longer return null for positions below or above the document.
Bug fixes
Fix a bug where content line elements would in some cases lose their cm-line
class.
Breaking changes
EditorView.scrollTo
and EditorView.centerOn
are deprecated in favor of EditorView.scrollIntoView
, and will be removed in the next breaking release.
Bug fixes
Fix an issue that could cause the editor to unnecessarily interfere with composition (especially visible on macOS Chrome).
A composition started with multiple lines selected will no longer be interruptd by the editor.
New features
The new EditorView.scrollIntoView
function allows you to do more fine-grained scrolling.
Breaking changes
The search option matchCase
was renamed to caseSensitive
(the old name will continue to work until the next breaking release).
Bug fixes
openSearchPanel
will now update the search query to the current selection even if the panel was already open.
New features
Client code can now pass a custom search panel creation function in the search configuration.
The getSearchQuery
function and setSearchQuery
effect can now be used to inspect or change the current search query.
Bug fixes
Fix a bug where CodeMirror's own event handers would run even after a user-supplied handler called preventDefault
on an event.
Properly draw selections when negative text-indent is used for soft wrapping.
Fix an issue where viewportLineBlocks
could hold inaccurate height information when the vertical scaling changed.
Fixes drop cursor positioning when the document is scrolled. Force a content measure when the editor comes into view
Fix a bug that could cause the editor to not measure its layout the first time it came into view.
New features
The package now exports a dropCursor
extension that draws a cursor at the current drop position when dragging content over the editor.
Bug fixes
Refine Android key event handling to work properly in a GBoard corner case where pressing Enter fires a bunch of spurious deleteContentBackward events.
Fix a crash in drawSelection
for some kinds of selections.
Prevent a possibility where some content updates causes duplicate text to remain in DOM.
New features
Support a maxLength
option to MatchDecorator
that allows user code to control how far it scans into hidden parts of viewport lines.
New features
The basic setup now includes the dropCursor
extension.
Bug fixes
The standard keymap no longer overrides Shift-Delete, in order to allow the native behavior of that key to happen on platforms that support it.
Bug fixes
Fix a bug that could cause out-of-view editors to get a nonsensical viewport and fail to scroll into view when asked to.
Fix a bug where would return 0 when clicking below the content if the last line was replaced with a block widget decoration.
Fix an issue where clicking at the position of the previous cursor in a blurred editor would cause the selection to reset to the start of the document.
Fix an issue where composition could be interrupted if the browser created a new node inside a mark decoration node.
Bug fixes
Fix an issue where pressing Enter on Chrome Android during composition did not fire key handlers for Enter.
Avoid a Chrome bug where the virtual keyboard closes when pressing backspace after a widget.
Fix an issue where the editor could show a horizontal scroll bar even after all lines that caused it had been deleted or changed.
Bug fixes
Fix a bug that could cause EditorView.plugin
to inappropriately return null
during plugin initialization.
Fix a bug where a block widget without estimatedHeight
at the end of the document could fail to be drawn
New features
Widgets can now define a destroy
method that is called when they are removed from the view.
Bug fixes
Widgets around replaced ranges are now visible when their side does not point towards the replaced range.
A replaced line with a line decoration no longer creates an extra empty line block in the editor.
The scrollPastEnd
extension will now over-reserve space at the bottom of the editor on startup, to prevent restored scroll positions from being clipped.
New features
EditorView.editorAttributes
and contentAttributes
may now hold functions that produce the attributes.
Bug fixes
Fix an issue where the parse worker could incorrectly stop working when the parse tree has skipped gaps in it.
Bug fixes
The search panel will no longer show the replace interface when the editor is read-only.
Bug fixes
Fix a bug where lineBlockAt
, for queries inside the viewport, would always return the first line in the viewport.
Bug fixes
Fix an issue where after some kinds of changes, EditorView.viewportLineBlocks
held an out-of-date set of blocks.
New features
Export EditorView.documentPadding
, with information about the vertical padding of the document.
Bug fixes
Fix an issue where editors with large vertical padding (for example via scrollPastEnd
) could sometimes lose their scroll position on Chrome.
Avoid some unnecessary DOM measuring work by more carefully checking whether it is needed.
New features
The new elementAtHeight
, lineBlockAtHeight
, and lineBlockAt
methods provide a simpler and more efficient replacement for the (now deprecated) blockAtHeight
, visualLineAtHeight
, and visualLineAt
methods.
The editor view now exports a documentTop
getter that gives you the vertical position of the top of the document. All height info is queried and reported relative to this top.
The editor view's new viewportLineBlocks
property provides an array of in-viewport line blocks, and replaces the (now deprecated) viewportLines
method.
Bug fixes
Fix a problem where the DOM update would unnecessarily trigger browser relayouts.
Bug fixes
Fixes an issue where the background parse work would be scheduled too aggressively, degrading responsiveness on a newly-created editor with a large document.
Improve initial highlight for mixed-language editors and limit the amount of parsing done on state creation for faster startup.
Bug fixes
Fix an issue where info tooltips would be visible in an inappropriate position when there was no room to place them properly.
Bug fixes
Add userEvent
annotations to search and replace transactions.
Make sure the editor handles keys bound to findNext
/findPrevious
even when there are no matches, to avoid the browser's search interrupting users.
New features
Add a Symbol.iterator
property to the cursor types, so that they can be used with for
/of
.
Bug fixes
Fix a bug that caused facet compare functions to be called with an invalid value in some situations.
Fix a bug that caused dynamic facet values to be incorrectly kept unchanged when reconfiguration changed one of their dependencies.
Bug fixes
Run a measure cycle when the editor's size spontaneously changes.
Bug fixes
Fix a bug that caused the precedence of editorAttributes
and contentAttributes
to be inverted, making lower-precedence extensions override higher-precedence ones.
New features
The new function syntaxTreeAvailable
can be used to check if a fully-parsed syntax tree is available up to a given document position.
The module now exports syntaxParserRunning
, which tells you whether the background parser is still planning to do more work for a given editor view.
Bug fixes
Give the completion tooltip a minimal width, and show ellipsis when completions overflow the tooltip width.
New features
autocompletion
now accepts an aboveCursor
option to make the completion tooltip show up above the cursor.
Bug fixes
Fix an issue where the editor wasn't aware it was line-wrapping with its own lineWrapping
extension enabled.
Bug fixes
Avoid an issue where stretches of whitespace on line wrap points could cause the cursor to be placed outside of the content.
Bug fixes
Make option deduplication less aggressive, so that options with different type
or apply
fields don't get merged.
New features
LanguageDescription.of
now takes an optional already-loaded extension.
Bug fixes
Fix an issue where parsing a snippet with a field that was labeled only by a number crashed.
Breaking changes
Block replacement decorations now default to inclusive, because non-inclusive block decorations are rarely what you need.
Bug fixes
Fix an issue that caused block widgets to always have a large side value, making it impossible to show them between to replacement decorations.
Fix a crash that could happen after some types of viewport changes, due to a bug in the block widget view data structure.
Bug fixes
Fix a bug that would cause dynamic facet values influenced by a state reconfiguration to not properly recompute.
Bug fixes
Fix a bug where the editor would think it was invisible when the document body was given screen height and scroll behavior.
Fix selection reading inside a shadow root on iOS.
Bug fixes
Make sure info tooltips don't stick out of the bottom of the page.
New features
The package exports a new function selectedCompletion
, which can be used to find out which completion is currently selected.
Transactions created by picking a completion now have an annotation (pickedCompletion
) holding the original completion.
New features
Export a function lintGutter
which returns an extension that installs a gutter marking lines with diagnostics.
The package now exports the effect used to update the diagnostics (setDiagnosticsEffect
).
Bug fixes
Fix an issue where typing into a read-only editor would move the selection.
Fix slowness when backspace is held down on iOS.
Bug fixes
Fix a bug where backspace, enter, and delete would get applied twice on iOS.
Bug fixes
When reconfiguring a state, effects from the reconfiguring transaction can now be seen by newly added state fields.
Bug fixes
Make sure the workaround for the lost virtual keyboard on Chrome Android also works on slower phones. Slight style change in beforeinput handler
Avoid failure cases in viewport-based rendering of very long lines.
New features
The precedence levels (under Prec
) now have more generic names, because their 'meaningful' names were entirely inappropriate in many situations.
Breaking changes
EditorView.scrollPosIntoView
has been deprecated. Use the EditorView.scrollTo
effect instead.
New features
The new EditorView.centerOn
effect can be used to scroll a given range to the center of the view.
Bug fixes
Don't crash when IntersectionObserver
fires its callback without any records. Try to handle some backspace issues on Chrome Android
Using backspace near uneditable widgets on Chrome Android should now be more reliable.
Work around a number of browser bugs by always rendering zero-width spaces around in-content widgets, so that browsers will treat the positions near them as valid cursor positions and not try to run composition across widget boundaries.
Work around bogus composition changes created by Chrome Android after handled backspace presses.
Work around an issue where tapping on an uneditable node in the editor would sometimes fail to show the virtual keyboard on Chrome Android.
Prevent translation services from translating the editor content. Show direction override characters as special chars by default
specialChars
will now, by default, replace direction override chars, to mitigate https://trojansource.codes/ attacks.
New features
The editor view will, if parent
is given but root
is not, derive the root from the parent element.
Line decorations now accept a class
property to directly add DOM classes to the line.
Bug fixes
Don't rely on the platform's highlight colors for the active completion, since those are inconsistent and may not be appropriate for the theme.
Fix incorrect match underline for some kinds of matched completions.
New features
Support Lezer-based PHP and WAST modes.
Bug fixes
Fix an issue where some kinds of reflows in the surrounding document could move unrendered parts of the editor into view without the editor noticing and updating its viewport.
Fix an occasional crash in the selection drawing extension.
Bug fixes
Fix a bug where reconfiguring the lint source didn't restart linting.
Bug fixes
Fix a bug that could, on DOM changes near block widgets, insert superfluous line breaks.
Make interacting with a destroyed editor view do nothing, rather than crash, to avoid tripping people up with pending timeouts and such.
Make sure ViewUpdate.viewportChanged
is true whenever visibleRanges
changes, so that plugins acting only on visible ranges can use it to check when to update.
Fix line-wise cut on empty lines.
New features
Adds an insertBlankLine
command which creates an empty line below the selection, and binds it to Mod-Enter in the default keymap.
Bug fixes
Prevent decorations that cover just a line break from being invisible by showing a widget instead of range for them.
New features
The diagnosticCount
method can now be used to determine whether there are active diagnostics.
Bug fixes
selectNextOccurrence
will now only select partial words if the current main selection hold a partial word.
Explicitly set the button's type to prevent the browser from submitting forms wrapped around the editor.
New features
The editor state now has a readOnly
property with a matching facet to control its value.
Bug fixes
The view is now aware of the new EditorState.readOnly
property, and suppresses events that modify the document when it is true.
Bug fixes
Fix an issue where a parse that skipped content with skipUntilInView
would in some cases not be restarted when the range came into view.
Bug fixes
Make commands that affect the editor's content check state.readOnly
and return false when that is true.
Bug fixes
Remove a console.log
that slipped into the previous release.
New features
The new EditorView.scrollTo
effect can be used to scroll a given range into view.
Bug fixes
Make by-line cursor motion commands move the cursor to the start/end of the document when they hit the first/last line.
Fix a bug where deleteCharForward
/Backward
behaved incorrectly when deleting directly before or after an atomic range.
Bug fixes
Make highlightSelectionMatches
not produce overlapping decorations, since those tend to just get unreadable.
Make sure any existing search text is selected when opening the search panel. Add search config option to not match case when search panel is opened (#4)
New features
The searchConfig
function now takes a matchCase
option that controls whether the search panel starts in case-sensitive mode.
Bug fixes
Fix an issue where lines containing just a widget decoration wrapped in a mark decoration could be displayed with 0 height.
Bug fixes
Improve the sorting of completions by using localeCompare
.
Fix reading of autocompletions in NVDA screen reader.
New features
The new icons
option can be used to turn off icons in the completion list.
The optionClass
option can now be used to add CSS classes to the options in the completion list.
It is now possible to inject additional content into rendered completion options with the addToOptions
configuration option.
Bug fixes
Fix a view corruption that could happen in situations involving overlapping mark decorations.
Bug fixes
Fix an issue where completeAnyWord
would return results when there was no query and explicit
was false.
New features
New commands cursorSubwordForward
, cursorSubwordBackward
, selectSubwordForward
, and selectSubwordBackward
which implement motion by camel case subword.
New features
The package now exports a scrollPastEnd
function, which returns an extension that adds space below the document to allow the last line to be scrolled to the top of the editor.
Bug fixes
Fix a bug where wordAt
never returned a useful result.
Breaking changes
User event strings now work differently—the events emitted by the core packages follow a different system, and hierarchical event tags can be created by separating the words with dots.
New features
languageDataAt
now takes an optional side
argument to specificy which side of the position you're interested in.
It is now possible to add a user event annotation with a direct userEvent
property on a transaction spec.
Transactions now have an isUserEvent
method that can be used to check if it is (a subtype of) some user event type.
Breaking changes
The view now emits new-style user event annotations for the transactions it generates.
Bug fixes
Fix a bug where coordsAtPos
would allow the passed side
argument to override widget sides, producing incorrect cursor positions.
Fix a bug that could cause content lines to be misaligned in certain situations involving widgets at the end of lines.
Fix an issue where, if the browser decided to modify DOM attributes in the content in response to some editing action, the view failed to reset those again.
Bug fixes
Fix a bug that caused indentOnInput
to fire for the wrong kinds of transactions.
Fix a bug that could cause indentOnInput
to apply its changes incorrectly.
Bug fixes
Fix incorrect versions for @lezer dependencies.
Breaking changes
CodeMirror now uses lezer 0.15, which means different package names (scoped with @lezer) and some breaking changes in the library.
EditorParseContext
is now called ParseContext
. It is no longer passed to parsers, but must be retrieved with ParseContext.get
.
IndentContext.lineIndent
now takes a position, not a Line
object, as argument.
LezerLanguage
was renamed to LRLanguage
(because all languages must emit Lezer-style trees, the name was misleading).
Language.parseString
no longer exists. You can just call .parser.parse(...)
instead.
New features
New IndentContext.lineAt
method to access lines in a way that is aware of simulated line breaks.
IndentContext
now provides a simulatedBreak
property through which client code can query whether the context has a simulated line break.
Bug fixes
Fix incorrect versions for @lezer dependencies.
Breaking changes
Change default binding for backspace to deleteCharBackward
, drop deleteCodePointBackward
/Forward
from the library.
defaultTabBinding
was removed.
Bug fixes
Drop Alt-d, Alt-f, and Alt-b bindings from emacsStyleKeymap
(and thus from the default macOS bindings).
deleteCharBackward
and deleteCharForward
now take atomic ranges into account.
New features
Attach more granular user event strings to transactions.
The module exports a new binding indentWithTab
that binds tab and shift-tab to indentMore
and indentLess
.
Bug fixes
Make sure to prevent the native Mod-d behavior so that the editor doesn't lose focus after selecting past the last occurrence.
Bug fixes
Fix incorrect versions for @lezer dependencies.
Breaking changes
Update dependencies to 0.19.0
Breaking changes
Update dependencies to 0.19.0
Breaking changes
Update dependencies to 0.19.0
Breaking changes
Update dependencies to 0.19.0
Breaking changes
Update dependencies to 0.19.0
Bug fixes
Fix a crash in the key handler of the lint panel when no diagnostics are available.
Bug fixes
Fix an issue that caused openLintPanel
to not actually open the panel when ran before the editor had any lint state loaded.
New features
The package now exports a forceLinting
function that forces pending lint queries to run immediately.
Bug fixes
Fix a regression where EditorView.editable.of(false)
didn't disable editing on Webkit-based browsers.
Bug fixes
Fix a bug that caused EditorView.moveVertically
to only move by one line, even when given a custom distance, in some cases.
Hide Safari's native bold/italic/underline controls for the content.
Fix a CSS problem that prevented Safari from breaking words longer than the line in line-wrapping mode.
Avoid a problem where composition would be inappropriately abored on Safari.
Fix drag-selection that scrolls the content by dragging past the visible viewport.
New features
posAtCoords
now has an imprecise mode where it'll return an approximate position even for parts of the document that aren't currently rendered.
New features
Add an ifIn
helper function that constrains a completion source to only fire when in a given syntax node. Add support for unfiltered completions
A completion result can now set a filter: false
property to disable filtering and sorting of completions, when it already did so itself.
Bug fixes
Make drawSelection
behave properly when lines are split by block widgets.
Make sure drawn selections that span a single line break don't leave a gap between the lines.
Bug fixes
Don't treat continued completions when typing after an explicit completion as explicit.
Bug fixes
moveLineDown
will no longer incorrectly grow the selection.
Line-based commands will no longer include lines where a range selection ends right at the start of the line.
Bug fixes
Multiple linter
extensions can now be added to an editor without disrupting each other.
Fix poor layout on lint tooltips due to changes in @codemirror/tooltip.
Bug fixes
Fix a crash that could occur when the document changed during mouse selection.
Fix a bug where composition inside styled content would sometimes be inappropriately aborted by editor DOM updates.
New features
MouseSelectionStyle.update
may now return true to indicate it should be queried for a new selection after the update.
Bug fixes
Adding or reconfiguring completion sources will now cause them to be activated right away if a completion was active.
New features
You can now specify multiple types in Completion.type
by separating them by spaces. Small doc comment tweak for Completion.type
Bug fixes
Fix a bug that would, in very specific circumstances, cause posAtCoords
to go into an infinite loop in Safari.
Fix a bug where some types of IME input on Mobile Safari would drop text.
Bug fixes
Fix an issue where asynchronous re-parsing (with dynamically loaded languages) sometimes failed to fully happen.
Bug fixes
Fix an issue where the DOM selection was sometimes not properly updated when next to a widget.
Invert the order in which overlapping decorations are drawn so that higher-precedence decorations are nested inside lower-precedence ones (and thus override their styling).
Fix a but in posAtCoords
where it would in some situations return -1 instead of null
.
New features
A new plugin field, PluginField.atomicRanges
, can be used to cause cursor motion to skip past some ranges of the document.
New features
Initialize the search query to the current selection, when there is one, when opening the search dialog.
Add a searchConfig
function, supporting an option to put the search panel at the top of the editor.
Bug fixes
Fix too-low dependency on @codemirror/gutter that could cause broken upgrades.
Bug fixes
Fix a bug that would cause the content DOM update to crash in specific circumstances.
Work around an issue where, after some types of changes, Mobile Safari would ignore Enter presses.
Make iOS enter and backspace handling more robust, so that platform bugs are less likely to break those keys in the editor.
Fix a regression where Esc + Tab no longer allowed the user to exit the editor.
New features
You can now drop text files into the editor.
Bug fixes
Fix a bug where the first search command in a new editor wouldn't properly open the panel.
New features
New command selectNextOccurrence
that selects the next occurrence of the selected word (bound to Mod-d in the search keymap).
New features
The basic setup now includes highlightActiveLineGutter
from @codemirror/gutter.
Bug fixes
Work around a Mobile Safari bug where, after backspacing out the last character on a line, Enter didn't work anymore.
Work around a problem in Mobile Safari where you couldn't tap to put the cursor at the end of a line that ended in a widget.
Bug fixes
Fix a regression where using setDiagnostics
when linting hadn't been abled yet ignored the first set of diagnostics.
Bug fixes
Use Ctrl-l, not Alt-l, to bind selectLine
on macOS, to avoid conflicting with special-character-insertion bindings.
Make the macOS Command-ArrowLeft/Right commands behave more like their native versions.
Bug fixes
Fix an issue where state fields might be initialized with a state that they aren't actually part of during reconfiguration.
Bug fixes
Add an attribute to prevent the Grammarly browser extension from messing with the editor content.
Fix more issues around selection handling a Shadow DOM in Safari.
Bug fixes
Fix a bug where some types of updates wouldn't properly cause marks around the changes to be joined in the DOM.
Fix an issue where the content and gutters in a fixed-height editor could be smaller than the editor height.
Fix a crash on Safari when initializing an editor in an unfocused window.
Fix a bug where the editor would incorrectly conclude it was out of view in some types of absolutely positioned parent elements.
Bug fixes
Fix a crash that occurred when determining DOM coordinates in some specific situations.
Fix a crash when a DOM change that ended at a zero-width view element (widget) removed that element from the DOM.
Disable autocorrect and autocapitalize by default, since in most code-editor contexts they get in the way. You can use EditorView.contentAttributes
to override this.
Fix a bug that interfered with native touch selection handling on Android.
Fix an unnecessary DOM update after composition that would disrupt touch selection on Android.
Add a workaround for Safari's broken selection reporting when the editor is in a shadow DOM tree.
Fix select-all from the context menu on Safari.
Bug fixes
Fix a regression where snippet field selection didn't work with @codemirror/state 0.18.6.
Fix a bug where snippet fields with different position numbers were inappropriately merged.
Bug fixes
Fix a crash in Safari when moving the selection during composition.
Bug fixes
Handle selection replacements where the inserted text matches the start/end of the replaced text better.
Fix an issue where the editor would miss scroll events when it was placed in a DOM component slot.
Bug fixes
Newlines in line messages are now shown as line breaks to the user.
New features
You can now pass a delay option to linter
to configure how long it waits before calling the linter.
Bug fixes
Fix a crash when drag-selecting out of the editor with editable turned off.
Backspace and delete now largely work in an editor without a keymap.
Pressing backspace on iOS should now properly update the virtual keyboard's capitalize and autocorrect state.
Prevent random line-wrapping in (non-wrapping) editors on Mobile Safari.
New features
The new EditorState.wordAt
method finds the word at a given position.
Bug fixes
Fix an issue in the compiled output that would break the code when minified with terser.
Bug fixes
Fix an issue in the compiled output that would break the code when minified with terser.
Bug fixes
Also bind Shift-Backspace and Shift-Delete in the default keymap (to do the same thing as the Shift-less binding).
New features
Adds a deleteToLineStart
command.
Adds bindings for Cmd-Delete and Cmd-Backspace on macOS.
Bug fixes
Improve handling of bidi text with brackets (conforming to Unicode 13's bidi algorithm).
Fix the position where drawSelection
displays the cursor on bidi boundaries.
Bug fixes
Fix an issue where the default focus ring gets obscured by the gutters and active line.
Fix an issue where the editor believed Chrome Android didn't support the CSS tab-size
style.
Don't style active lines when there are non-empty selection ranges, so that the active line background doesn't obscure the selection.
Make iOS autocapitalize update properly when you press Enter.
New features
The new Transaction.remote
annotation can be used to mark and recognize transactions created by other actors.
Bug fixes
Add Transaction.remote
annotation to transactions that include remote updates.
Breaking changes
EditorParseContext.getSkippingParser
now replaces EditorParseContext.skippingParser
and allows you to provide a promise that'll cause parsing to start again. (The old property remains available until the next major release.)
Bug fixes
Fix an issue where nested parsers could see past the end of the nested region.
New features
The ChangeDesc
class now has toJSON
and fromJSON
methods.
Breaking changes
The outer DOM element now has class cm-editor
instead of cm-wrap
(cm-wrap
will be present as well until 0.19).
Bug fixes
Improve behavior of posAtCoords
when the position is near text but not in any character's actual box.
Bug fixes
Triple-clicking now selects the line break after the clicked line (if any).
Fix an issue where the drawSelection
plugin would fail to draw the top line of the selection when it started in an empty line.
Fix an issue where, at the end of a specific type of composition on iOS, the editor read the DOM before the browser was done updating it.
Bug fixes
The search interface and cursor will no longer include overlapping matches (aligning with what all other editors are doing).
New features
The package now exports a RegExpCursor
which is a search cursor that matches regular expression patterns.
The search/replace interface now allows the user to use regular expressions.
The SearchCursor
class now has a nextOverlapping
method that includes matches that start inside the previous match.
Basic backslash escapes (\n, \r, \t, and \) are now accepted in string search patterns in the UI.
Bug fixes
Fix an issue where entering an invalid input in the goto-line dialog would submit a form and reload the page.
Bug fixes
Adjust to updated @codemirror/tooltip interface.
Bug fixes
Adjust to current @codemirror/panel and @codemirror/tooltip interfaces.
Bug fixes
Fix unintended ES2020 output (the package contains ES6 code again).
Bug fixes
Fix unintended ES2020 output (the package contains ES6 code again).
Breaking changes
Update
objects now have a clientID
field, and receiveUpdates
no longer takes its ownUpdateCount
argument, to simplify the interface.
Bug fixes
Stop active completion when all sources resolve without producing any matches.
New features
Completion.info
may now return a promise.
New features
The new Compartment.get
method can be used to get the content of a compartment in a given state.
Bug fixes
Fix an issue where, on iOS, some types of IME would cause the composed content to be deleted when confirming a composition.
Breaking changes
tagExtension
and the reconfigure
transaction spec property have been replaced with the concept of configuration compartments and reconfiguration effects (see Compartment
, StateEffect.reconfigure
, and StateEffect.appendConfig
).
Breaking changes
The themeClass
function and ``-style selectors in themes are no longer supported (prefixing with cm-
should be done manually now).
Themes must now use &
(instead of an extra $
) to target the editor wrapper element.
The editor no longer adds cm-light
or cm-dark
classes. Targeting light or dark configurations in base themes should now be done by using a &light
or &dark
top-level selector.
Bug fixes
Work around a Firefox bug where it won't draw the cursor when it is between uneditable elements.
Fix a bug that broke built-in mouse event handling.
Breaking changes
Update dependencies to 0.18.
Breaking changes
The Language
constructor takes an additional argument that provides the top node type.
New features
Language
instances now have a topNode
property giving their top node type.
TreeIndentContext
now has a continue
method that allows an indenter to defer to the indentation of the parent nodes.
Breaking changes
Update dependencies to 0.18.
Breaking changes
Update dependencies to 0.18.
Bug fixes
Only preserve selected option across updates when it isn't the first option.
Bug fixes
Make sure action access keys are discoverable for screen reader users.
Selection in the lint panel should now be properly visible to screen readers.
Breaking changes
Update dependencies to 0.18.
Breaking changes
Update dependencies to 0.18.
Breaking changes
Update dependencies to 0.18.
Bug fixes
Avoid interfering with touch events, to allow native selection behavior.
Fix a bug that broke sub-selectors with multiple &
placeholders in themes.
Bug fixes
Fix vertical cursor motion on Safari with a larger line-height.
Fix incorrect selection drawing (with drawSelection
) when the selection spans to just after a soft wrap point.
Fix an issue where compositions on Safari were inappropriately aborted in some circumstances.
The view will now redraw when the EditorView.phrases
facet changes, to make sure translated text is properly updated.
Bug fixes
Use Alt-l for the default selectLine
binding, because Mod-l already has an important meaning in the browser.
Make deleteGroupBackward
/deleteGroupForward
delete groups of whitespace when bigger than a single space.
Don't change lines that have the end of a range selection directly at their start in indentLess
, indentMore
, and indentSelection
.
Bug fixes
Long words without spaces, when line-wrapping is enabled, are now properly broken.
Fix the horizontal position of selections drawn by drawSelection
in right-to-left editors with a scrollbar.
New features
EditorSelection.map
and SelectionRange.map
now take an optional second argument to indicate which direction to map to.
New features
This package now exports a foldInside
helper function, a fold function that should work for most delimited node types.
Bug fixes
Fix an issue where pasting linewise at the start of a line left the cursor before the inserted content.
Bug fixes
Fix a bug where deleteToLineEnd
would delete the rest of the document when at the end of a line.
Bug fixes
Fix a problem where the DOM selection and the editor state could get out of sync in non-editable mode.
Fix a crash when the editor was hidden on Safari, due to getClientRects
returning an empty list.
Prevent Firefox from making the scrollable element keyboard-focusable.
Bug fixes
Fix an issue where insertNewlineAndIndent
behaved strangely with the cursor between brackets that sat on different lines.
New features
Add an EditorView.announce
state effect that can be used to conveniently provide screen reader announcements.
Bug fixes
Avoid creating very high scroll containers for large documents so that we don't overflow the DOM's fixed-precision numbers.
New features
The new insertTab
command inserts a tab when nothing is selected, and defers to indentMore
otherwise.
The package now exports a defaultTabBinding
object that provides a recommended binding for tab (if you must bind tab).
Bug fixes
Fix a styling issue where the selection had become invisible inside snippet fields (when using drawSelection
).
New features
Snippet fields can now be selected with the pointing device (so that they are usable on touch devices).
Bug fixes
Fix a bug where uppercase completions would be incorrectly matched against the typed input.
Bug fixes
Fix a bug that would create space-filling placeholders with incorrect height when document is very large.
Bug fixes
Parse scheduling has been improved to reduce the likelyhood of the user looking at unparsed code in big documents.
Prevent parser from running too far past the current viewport in huge documents.
Bug fixes
The drawSelection
extension will now reuse cursor DOM nodes when the number of cursors stays the same, allowing some degree of cursor transition animation.
Makes highlighted special characters styleable (``) and fix their default look in dark themes to have appropriate contrast.
New features
Adds a new MatchDecorator
helper class which can be used to easily maintain decorations on content that matches a regular expression.
Bug fixes
Don't bind Cmd-Space on macOS, since that already has a system default binding. Use Ctrl-Space for autocompletion.
Bug fixes
Properly mark dependencies on the packages that are dynamically imported in package.json.
New features
The package now also exports a CommonJS module.
New features
The package now also exports a CommonJS module.
New features
The package now also exports a CommonJS module.
New features
The package now also exports a CommonJS module.
New features
The package now also exports a CommonJS module.
New features
The package now also exports a CommonJS module.
New features
The package now also exports a CommonJS module.
New features
The package now also exports a CommonJS module.
New features
The package now also exports a CommonJS module.
Bug fixes
Putting a theme after the basic setup no longer causes the default highlighter to be used with the theme's editor styling.
New features
The package now also exports a CommonJS module.
Bug fixes
Work around Chrome problem where the native shift-enter behavior inserts two line breaks.
Make bracket closing and bracket pair removing more reliable on Android.
Fix bad cursor position and superfluous change transactions after pressing enter when in a composition on Android.
Fix issue where the wrong character was deleted when backspacing out a character before an identical copy of that character on Android.
Bug fixes
Fix a bug that prevented ViewUpdate.focusChanged
from ever being true.
Bug fixes
Fix a bug where changing the editor configuration wouldn't update the language parser used.
Breaking changes
First numbered release.
Breaking changes
First numbered release.
Breaking changes
First numbered release.
Breaking changes
First numbered release.
Breaking changes
First numbered release.
Breaking changes
First numbered release.
Breaking changes
First numbered release.
Breaking changes
First numbered release.
Breaking changes
First numbered release.
Breaking changes
First numbered release.
@codemirror/next 0.16.0 (2020-12-28)
Breaking changes
hoverTooltip
's callback function now takes a position and a side, rather than a predicate function, to determine whether a tooltip should be shown.
The highlightStyle
function, which defines a highlight style, is now called HighlightStyle.define
.
completeSnippets
no longer exists. Use completeFromList
in combination with snippetCompletion
.
The ...Support
functions that some language packages exported are gone, since it is now possible to get the support extensions directly from the package's main function.
The language
facet now returns an optional single language, not an array anymore.
Languages no longer have getTree
and ensureTree
methods.
keymap
is now a facet, rather than a function, which means you have to use it with keymap.of(...)
.
The markers
option to gutters now takes a view, rather than a state, as argument.
The completionKeymap
array now contains more default bindings.
Removes support for Text.iterLines
.
Line
objects no longer have slice
and findClusterBreak
methods (use text
and the top-level findClusterBreak
function instead).
EditorSelection.primary
is now called EditorSelection.main
.
rectangularSelection
now takes its configuration as an object.
A state field's provide
option works differently. It now takes a function from the field to an extension. Facet.from
has been changed to make it easy to use with this option.
To set an extension's precedence, use the properties of the Prec
object instead of the old precedence
function.
ViewUpdate.prevState
has been renamed to startState
.
The gotoLine
command is now part of the search package.
highlightActiveLine
is now exported from the view package instead of the highlight-selection package.
The highlightSelectionMatches
extension is now part of the search package.
Bug fixes
Fix issue where hoverTooltip
would falsely believe the mouse was outside of the editor when initialized with the pointer already on the editor.
Drop duplicate completions.
New features
Highlight styles are now instances of an exported HighlightStyle
class, which allows you to get at its style module and match it against tags.
The highlight package exports a new function, highlightTree
, which runs the tree highlighter over a Lezer tree and tells you which styling should be applied where.
Language
objects now have a parseString
method that can be used to synchronously parse a string of code in that language.
When configuring an XML schema, it is now possible to provide text to complete into a given element.
Language
objects now have a findRegions
method that tells you where in the document the language occurs.
Language
objects have a new isActiveAt
method that tells you whether the language is active at a given point.
The Markdown package now exports two new commands, insertNewlineContinueMarkup
and deleteMarkupBackward
, to help with editing Markdown.
The new language-data package lists a large number of modes, with some metadata to help locate the one you're interested in.
The language package now exports a LanguageDescription
type that can be used to provide metadata about language packages.
The CSS language package now exports a basic CSS completion source.
Language packages' main interface function now returns an instance of LanguageSupport
which provides access both to support extensions and the main language.
The new top-level ensureSyntaxTree
function in the language package replaces Language.ensureTree
.
Facets can now come with extensions that should be enabled when they are present in a state.
The keys used for snippet field navigation are now configurable through the snippetKeymap
facet.
The autocomplete package now exports a completeAnyWord
function that will gather completions from any words found in the document.
You can now pass defaultKeymap: false
to autocompletion
to prevent it from adding its default completion keymap.
StateField.init
can now be used to provide a custom initial value for a field.
EditorState.toJSON
and fromJSON
now allow you to opt in to serializing state fields.
Line
objects now have a text
property holding their entire content.
The new toggleComment
command will automatically create a line or block comment depending on what syntax the language supports.
The gotoLine
command now allows relative offsets (with +
and -
), percentages (with a %
at the end) and column positions (using :
before the column number)
@codemirror/next 0.15.0 (2020-12-04)
Breaking changes
The highlighting system no longer has the concept of a tag system—rather, all tags now exist in the same space.
Highlighting tags are now represented by objects (with the default tag system under tags
in the highlight package) rather than strings.
Highlighting styles are now registered separately from the actual highlighter plugin. Syntax addons take care of registering the highlighter. Styles are defined with the highlightStyle
function.
The syntax
package no longer exists. Its responsibilities have been taken over by the language
package.
Language and syntax-related functionality that used to live in the state
package (the syntax provider type, props like indentation
and foldable
) has been moved to the language
package.
The stream-syntax
package has been renamed to stream-parser
, and its interface has been changed to make use of the abstractions provided by the language
package.
Providing language data now works differently (the globalLanguageData
facet is gone, replaced by a more general languageData
facet).
EditorState.tree
has been replaced by the syntaxTree
function from the language
package (since the state package no longer knows about Lezer types).
The ...Syntax
exports from language packages have all been renamed to ...Language
for consistency with the library's terminology.
Bug fixes
closeBrackets
will no longer type-over brackets that it did not itself insert.
Selection drawing in wrapped lines is no longer entirely broken.
Fix an issue where autocompletion wouldn't trigger when an IME composition moved the selection before ending.
Fix a bug where the facet dependency tracking got confused when a dynamic facet depended on another facet that didn't exist in the state.
Querying the coordinates (and thus drawing the cursor) before a block widget no longer crashes.
Fix double-height cursor on line wrap points in Safari.
Actually call ignoreEvent
methods on block widgets.
Prevent drawSelection
from also hiding the native selection in block widgets.
A text cursor created with Text.iterLines
now actually respects the skip parameter.
New Features
The language
package now provides most language and parsing related infrastructure. Unlike the old syntax
package, it is parse-technique-agnostic. Some of the interfaces that used to live in state
, such as the facets and types involved in indentation and folding, have also moved there.
The function passed to changeByRange
may now also return effects for each range.
The new State.transactionExtender
facet allows you to register functions that add annotations, effects, or reconfiguration to transactions even when they have disabled regular transaction filters.
The new lang-markdown
package provides Markdown highlighting.
The foldable
function exported from the language package provides an easy way to check whether a given line is foldable.
The getIndentation
utility from the language package should now be used to compute automatic indentation for a line. It returns null, as opposed to -1, to indicate that it has no indentation for a given line.
@codemirror/next 0.14.0 (2020-10-23)
Breaking changes
Lezer and lezer-tree have been upgraded to 0.12, which introduces a few breaking changes.
ChangeDesc.mapPos
now returns null instead of -1 when reporting a deletion.
EditorView.posAtCoords
now returns null, rather than -1, when it fails to find a position.
Bug fixes
Fix an issue where Chrome's shift-enter shortcut confused the editor.
Clicking on the completion list scrollbar no longer selects the first completion.
New features
The lang-json package now exports a jsonParseLinter
function that produces a linter based on JSON.parse
.
@codemirror/next 0.13.1 (2020-10-14)
Bug fixes
Fix an occasional crash on vertical cursor motion through a scrollable editor.
Fix a bug that caused Change.fromJSON
to return invalid change objects in some cases.
Fix a bug where the selection and cursor were drawn in the wrong place in a scrolled editor.
@codemirror/next 0.13.0 (2020-10-01)
Breaking changes
Themes are now specified differently, using plain CSS selectors extended with $
syntax for targeting theme classes. This should make them more flexible.
The style-mod dependency has been upgraded to 3.0, which is a backward-incompatible upgrade.
The multipleSelections
extension is no longer supported. You probably want to use drawSelection
combined with EditorState.allowMultipleSelections.of(true)
.
WidgetType
no longer takes a type parameter. Implementations are now themselves responsible for creating instance variables and implementing an appropriate eq
method.
Drops support for PluginValue.measure
(which was very broken already in the previous release).
Bug fixes
The editor no longer loses focus when picking a completion with the mouse.
Fix a bug that caused completion info tooltips to be positioned off-screen.
New features
There is now an SQL language module.
The autocomplete package now exports an ifNotIn
helper that can turn off completion sources when the cursor is in a given token type.
There is now a lang-xml
package with basic XML support.
ViewUpdate
objects now have a geometryChanged
getter that tells you whether the geometry of the content changed.
The view module now exports a drawSelection
function that creates an extension that overrides the native selection drawing.
Scroll handlers registered view EditorView.domEventHandlers
or view plugins will now be called any time the view or an ancestor of the view is scrolled.
DOM event handlers may now return void, for convenience.
There is now a lang-rust
package.
The view package now exports a placeholder
function that can be used to create a placeholder shown when the editor is empty.
The editor view now has a composing
property indicating whether IME is active.
The autocomplete package now exports acceptCompletion
and moveCompletionSelection
commands.
@codemirror/next 0.12.0 (2020-09-11)
Breaking changes
The way overlapping mark decorations are handled has changed. The editor will now create a separate element for each decoration, and nested them in order of the predecence of the sources that created them (higher precedence wrapping lower precedence, decorations from the state facet wrapping decorations from view plugins).
Registering decorations, event handlers, or other plugin values for a view plugin is now done differently (with an argument to ViewPlugin.define
or ViewPlugin.fromClass
, rather than method calls on the returned value).
Bug fixes
Vertical cursor motion when the selection isn't empty will now properly collapse it to the appropriate side, rather than moving from the selection head.
Fix the activateOnTyping
option to the autocomplete system.
The default backspace binding now deletes by code point, not character.
Tooltips are no longer cut off by scrollable parent elements.
New features
StreamParser
now allows an optional tagSystem
property to use a custom tag system.
Elements created for mark decorations can now span multiple child elements (raw text, or elements created for lower-precedence marks or widgets).
There is now a lang-java package with a Java syntax.
There is now a dedicated syntax tag for boolean literals ("bool").
Add a C++ syntax.
New commands deleteCodePointForward
/Backward
.
The editor view now has an inView
getter that tells you if the editor is in view at all.
View plugins can now provide a measure
method that gets called when the view measures itself.
@codemirror/next 0.11.0 (2020-09-03)
Breaking changes
Autocompletion contexts no longer have a filter
method. Completion sources shouldn't filter anymore, but leave that to the plugin.
The filterDownOn
property on completion results is now called span
.
AutocompleteContext.tokenBefore
now takes a list of token type names, and only returns tokens of those types. (In its previous form, it was too error-prone.)
Snippet specs no longer support a name
property (use detail
instead).
A number of exports from the autocomplete plugin were renamed: autocomplete
to autocompletion
, AutocompleteContext
to CompletionContext
, Autocompleter
to CompletionSource
.
SnippetSpec
objects are now a subclass of Completion
(which mostly means that their keyword
property was renamed to label
).
Bug fixes
Fix issue that could cause crashes or incorrectly mapped selections in the history when making changes with addToHistory
set to false.
Fuzzy completion matching got a lot more clever, and presents results ordered by match quality.
New features
Text copied linewise will now be inserted as lines above the selection when pasted into an empty selection.
The completion list now shows the matched parts of the strings.
The autocomplete package now exports two new functions, completionStatus
and currentCompletions
, that let external code query its state.
A new method matchBefore
on the autocompletion context can now be used to easily find the text matching a given regexp before the cursor.
Completion contexts now have aborted
and addEventListener(abort, ...)
properties to allow asynchronous completion queries to stop doing work when cancelled.
Completions now support a detail
property to add some extra text after their label.
Completions can now have a boost
property to influence the way they are sorted compared to other completions that match the input equally well.
Completions can now have an info
property that provides extra information to be shown next to the completion when it is selected.
ChangeSet
now has a toJSON
method and a static fromJSON
method to serialize to and deserialize from JSON.
@codemirror/next 0.10.0 (2020-08-11)
Breaking changes
LezerSyntax
instances are now created with LezerSyntax.define
instead of new LezerSyntax
.
Transaction and change filters are now passed a full transaction as argument.
The ResolvedTransactionSpec
type is no longer part of the interface.
The reconfigured
property on transactions has been renamed to reconfigure
. Similarly, the scrolledIntoView
property is now called scrollIntoView
.
Editor state objects no longer have an indentWithTabs
property.
Bug fixes
Fix an issue where language data at the end of an unfinished nested grammar at the end of the document would use the outer language instead of the inner.
New features
A LezerSyntax
instance can now specify a dialect to parse.
Transactions now have a newDoc
property that allows you to access the updated document before the new state has been created.
The indentString
property on editor states can be used to compute an indentation string of a given column width.
The view package now exports an indentOnInput
extension that enables automatic reindentation when certain patterns are typed at the start of a line. The basic setup enables this.
When the cursor is between matching brackets, insertNewlineAndIndent
will insert an additional newline after the cursor.
Transaction specs now support a sequential
property, which causes them to be interpreted in the document space as produced by earlier specs.
@codemirror/next 0.9.0 (2020-07-30)
Breaking changes
The backspace behavior in the closebrackets
package is no longer implicitly included in the extension returned by closeBrackets()
.
Bug fixes
Fix a crash when running deleteCharBackward
when the cursor is at the start of the document.
Fix a bug in Line.slice
that would cause it to loop infinitely on long lines.
Make sure the DOM is reset when dispatch
fails to update the view.
Fix an issue where double-clicking on a selection in Chrome would leave you with just a cursor, not a selected word.
New features
Highlighting information for a syntax (as in styleTags
) can now prefix tag names with !
to make them override the styling of any child nodes for that syntax node.
It is now possible, when specifying syntax highlighting information, to write rules for a node that apply only when its parent nodes are of a given type. This uses /
syntax, as in "Declaration/Identifier": "className"
.
Completion items can now specify a type
property that determines the icon shown next to them.
EditorView.inputHandler
can now be used to override the way text input (via the DOM) is handled.
The closebrackets
package now exports its backspace behavior as a command (deleteBracketPair
) and a set of bindings that bind it to backspace as closeBracketsKeymap
.
@codemirror/next 0.8.0 (2020-06-29)
Breaking changes
closeBrackets
is now a function, rather than an extension value.
The keymap, special-chars, and multiple-selections packages have been merged into the view package.
The way tooltips are declared changed somewhat to fix an issue with tooltips that stay active across document changes.
Assigning precedences to extension is now done using a plain precedence
function, rather than a class.
The new state is no longer passed to state field update
functions (it is part of the transaction anyway now).
The start
and end
properties of Line
have been renamed to from
and to
for consistency.
EditorView.lineAt
is now called visualLineAt
. Its second argument now defaults to 0.
EditorView.lineAtHeight
is now called visualLineAtHeight
.
The fillConfig
utility is no longer part of the library (the library depends on Object.assign
now, which provides a standard way to do the same thing).
Completion sources now get all their arguments as properties of the context object.
Language-specific data is now stored in a facet attached to the syntax object, rather than directly in a node prop.
Reconfiguring transactions are now specified in a slightly different way.
Bug fixes
Fix an issue where the selection was unnecessarily moved to the start of the document when clicking on an unfocused editor.
Work around an issue where sometimes the selection would end in the wrong place on Chrome (because the browser reports a different selection from the one it displays.
Fix an issue where disabling the gutter extension would leave its DOM element in the editor.
New features
The EditorView.updateListener
facet can be used to have an external function listening for view updates.
The goto-line package now exports a gotoLineKeymap
extension.
The new basic-setup package pulls together all the core extensions into a single configuration value.
You can now move through completions with PageUp and PageDown
The editor view now has a setState
method to reset its state (again).
The autocomplete package now exports functionality for completing to 'snippets' (longer pieces of text with fields that can be filled in one at a time).
LezerSyntax
instances can now directly specify inherent language data (such as comment syntax).
Language packages now export their supporting extensions (if any) as a separate 'support' value.
Autocompletion can now be configured to ask for case-sensitivity.
Completion results can now specify a filterDownOn
property to allow the list to be cheaply updated as the user continues typing.
The autocomplete package now exports a completeFromList
helper to easily construct a completer from a list of options.
EditorView.dispatch
can now be directly called with transaction specs (rather than always calling view.state.update
to create its argument).
It is now possible to append extensions from transactions.
Transaction filters can now request the full transaction for the (current) transaction spec if they need it.
@codemirror/next 0.7.1 (2020-06-12)
Bug fixes
Fix an issue where using Enter during composition would insert a newline.
Fix a problem where the library ignored platform-specific key bindings when building a keymap.
@codemirror/next 0.7.0 (2020-06-11)
Breaking changes
EditorView.startMouseSelection
has been replaced with the EditorView.mouseSelectionStyle
facet, which works somewhat differently.
The indentUnit
facet now takes a string, rather than a number, and allows a string of tabs to be specified.
The text package no longer exports isExtendingChar
. Use the new cluster break functions instead.
Text direction is now represented as an enum (Direction
from the view package) rather than a string.
Selection ranges should be created with EditorSelection.range
and EditorSelection.cursor
now, rather than directly calling the constructor.
The by-group selection motion commands like moveWordLeft
have been renamed to contain 'group' rather than 'word' (moveGroupLeft
).
EditorView.movePos
has been removed. Use the new cursor motion methods instead.
The keyboard
and pointer
values for Transaction.userEvent
have been renamed keyboardselection
and pointerselection
.
Commands that move the selection are now prefixed with cursor (cursorCharLeft
), and those that extend the selection are prefixed with select (selectGroupForward
).
Key bindings are no longer specified as objects, but as arrays of KeyBinding
specs, one per binding.
Matching delimiters in syntax trees are now registered with NodeProp.openedBy
/closedBy
instead of custom props exported from the syntax module.
The lint package's interface was simplified to automatically enable the required extensions when necessary, rather than requiring them to be enabled when configuring the editor.
Bug fixes
Indentation-related commands will now use tabs to indent when appropriate.
The default key bindings on macOS are now a lot closer to how native editor interfaces behave.
New features
The editor view now has a scrollPosIntoView
method to scroll a given document position into view.
Add a new package rectangular-selection
, which implements rectangle selection on alt-drag.
New indentWithTabs
getter on the editor state, which indicates whether indentation should use tabs.
The commands package now exports indentMore
and indentLess
commands, which unconditionally add/remove indentation on selected lines.
The editor view now has a bidiSpans
method to retrieve the text order for a given line.
The text package now exports nextClusterBreak
and prevClusterBreak
, which can be used to find grapheme cluster breaks in a string.
The new EditorView
methods moveByChar
, moveByGroup
, and moveToLineBoundary
can be used to compute cursor motion (in a bidi-aware way).
The view method moveVertically
can now be used to compute vertical cursor motion.
Line
objects now have a findClusterBreak
method for more convenient by-cluster motion.
New commands movePageUp/Down
, extendPageUp/Down
, deleteGroupForward/Backward
.
The view class now has a lineWrapping
property that indicates whether line wrapping is enabled for the editor.
EditorView.lineWrapping
now holds an extension that enables line wrapping.
Add forward/backward variants of many commands that only support left/right before.
New commands transposeChars
, splitLine
, and deleteToLineEnd
to support macOS's Emacs-style default bindings. New export emacsStyleBaseKeymap
that contains these and other Emacs-style bindings.
New commands moveLineBoundaryForward
, moveLineBoundaryBackward
, extendLineBoundaryForward
, and extendLineBoundaryBackward
.
New commands extendDocStart
and extendDocEnd
.
When copying or cutting without a selection, the editor will copy or cut by line.
When pasting N lines while the selection has N active ranges, the editor will now paste one line into each range.
The new EditorState.lineBreak
property gives you the proper line break string for a state.
New commands moveLineUp/Down
and copyLineUp/Down
, bound to Alt-ArrowUp/Down and Shift-Alt-ArrowUp/Down by default.
New command deleteLine
, bound to Shift-Mod-k by default.
New commands cursorMatchingBracket
and selectMatchingBracket
.
It is now possible to customize the DOM element that editor panels are placed into.
The panel
extension now has a getPanel
accessor to retrieve the panel created by a given constructor function.
New command nextLintDiagnostic
to jump to the next linter message.
The new selectParentSyntax
command selects the syntax node around the selection.
New commands cursor
/selectSyntaxLeft
/Right
to jump over tokens or bracketed syntactic constructs.
New commands foldAll
and unfoldAll
.
The fold package now exports a default keymap foldKeymap
The comment package now exports a commentKeymap
binding.
New command selectLine
.
The new highlightActiveLine
extension can be used to style lines with a cursor on them.
New extension highlightSelectionMatches
, which enables highlighting of text that matches the current selection.
When defining a highlighter, it is now possible to assign a style to multiple tags by separating them by commas in the property name.
New theme package: theme-one-dark.
Key bindings may now involve multiple key strokes (specified as a space-separated string of key names).
Key bindings that include a preventDefault
property will now cause the key event to be stopped even when the bound command(s) return false.
New command: deleteTrailingWhitespace
.
New command selectSelectionMatches
that selects all instances of the currently selected string.
You can now pass a parent
option to a view to append it to the DOM right away.
@codemirror/next 0.6.0 (2020-05-13)
New features
There is now a comment
package with commenting/uncommenting commands.
The new collab
package implements a framework for collaborative editing.
When creating or updating a state, the selection may now be specified as an {anchor, head?}
object literal.
There are new methods toText
and sliceDoc
on the editor state for working with strings.
Some methods that used to be part of Transaction
now have an equivalent on the state object. replaceSelection
moved there. changeByRange
replaces Transaction.forEachRange
. And changes
can be used to build up a changeset.
Breaking changes
The Text
class interface changed to make better use of its own abstraction. replace
takes a Text
instance instead of an array of strings, slice
now returns a Text
, and there's a new append
method.
The representation of changes and change sets has been redone. Instead of storing a sequence of change objects, change sets are now a flat map of the locations in the document that changed.
The way transactions work has changed. They are now immutable objects created with EditorState.update
.
Transaction filtering works differently now. See the changeFilter
and transactionFilter
facets.
What used to be extension groups is now called tagged extensions (using the tagExtension
function).
mapPos
now returns -1 to indicate deletion (when the map mode asks for this).
@codemirror/next 0.5.2 (2020-04-09)
Bug fixes
Fix an issue where external TypeScript builds would try to recompile the library code.
@codemirror/next 0.5.1 (2020-04-08)
Bug fixes
Include the TypeScript declaration files in the npm package.
@codemirror/next 0.5.0 (2020-04-01)
Breaking changes
EditorView.domEventHandlers
is now a function, and the handlers receive their arguments in a different order.
Syntax objects no longer have a languageDataAt
method (this was moved to EditorState
, and changed somewhat).
Completion functions now return a plain list of results, rather than an object.
The interface to EditorState.indentation
changed, taking an IndentContext
object.
Facets provided by a state field are now declared in an option to StateField.define
, instead of in method calls on the field object.
Isolating transactions so that they become their own undo history item is now done with the isolateHistory
annotation.
The packages are no longer available as CommonJS files. To run the code on node.js, you'll need node 13 or pass --experimental-modules
to node 12.
New features
View plugins now have an eventHandlers
method to attach plugin-specific DOM event handlers.
The editor state now has a languageDataAt
that collects values stored under a given property name in the main language data and in object attached for a given document type with the addLanguageData
facet.
It is now possible to provide indentation functions with information about already-reindented lines through an IndentContext
object, making it possible to reindent a region in one go without re-parsing.
Lint sources can now be asynchronous.
The EditorView.editable
facet can now be used to control whether the content is editable.
The selectionFilter
facet can now be used to control selection updates.
The new changeFilter
facet can be used to stop or modify document changes.
Transaction.change
now also accepts an array of changes to apply in one go.
The history module now exports a facet that allows you to create inverted effects from a transaction, which will be stored in the history. (This allows making non-document state un/redoable.)
Transactions can now contains state effects, which can describe state changes for extensions, and be integrated with the undo history.
Transactions now have a mapRef
method to easily create a position mapping from a given intermediate document to the current document.
@codemirror/next 0.4.0 (2020-02-21)
Breaking Changes
Behavior was renamed to Facet
, and works somewhat differently.
The extension
package no longer exists. Extension-related concepts are now part of the state
package.
The view no longer has its own extension system. It is entirely configured by state extensions.
View plugins are specified through a state facet now, and have a simpler interface.
View plugins may no longer create decorations that significantly impact the height of content, to avoid the cyclic dependency between plugin decorations and the viewport.
Themes work differently now, using static CSS classes on DOM elements so that plugins don't have to update their DOM when the editor theme changes.
Highlighting token types now support a numeric suffix, which replaces the old typeN
modifiers.
The interface to syntax extensions and parse trees changed.
The way transaction annotations work was simplified a bit.
Range sets were rewritten and support a somewhat different interface now.
The way decorations are created now separates the creation of the decoration value from the creation of the range to which it should apply.
New features
State facets can provide decorations now.
Reading DOM layout information and similar things is now done with the requestMeasure
method.
Facets now explicitly track which fields and other facets they depend on, so that they are recomputed only when necessary.
Any object that has an extension
property that holds an extension value may now be used as an extension.
Overlong lines that are inside the viewport will now be partially hidden to speed up rendering and interaction.
The editor view now has a textDirection
property telling you whether the main writing direction is left-to-right or right-to-left.
There's now a visibleRanges
property that tells you which part of the viewport is actually going to be drawn, speeding up things like highlighting when there's large amounts of collapsed code in the viewport.
Bug fixes
Fix issue where mouse dragging would create selections with the the anchor and head reversed.
Make code folding behave better when the folded node doesn't start on the same line as the actual fold.
Fix a number of issues that would make parsing big files slow (or even lock up entirely).
@codemirror/next 0.3.0 (2019-11-29)
Breaking changes
Language-wide configuration is no longer stored in per-extension node props, but in a single languageData
object held in a prop defined in the state package. The Syntax
method languageDataAt
is used to read it.
Unique extensions no longer exist. Instead, extensions are deduplicated by identity. Merging configurations for an extension should now be done in a behavior.
Bug fixes
Fix issue where starting with an empty editor would break height estimates.
Fix an issue where widgets at the end of a line could stay around after being deleted in some cases.
Fix rendering of lines that are empty except for a widget.
New features
A plugin's drawMeasured
method may now return true to request another measure/draw cycle.
The editor view now has a requireMeasure
method to schedule a layout check that'll allow plugins to measure and update the DOM.
The state package now re-exports the Text
type.
Add an adaptor for connecting ESLint output to the CodeMirror linter package to the lang-javascript package.
The tooltip
package provides a way to show tooltip over the editor.
The new autocomplete
package implements an autocompletion interface.
The new lint
package integrates linting with the editor by underlining issues and providing a list of problems that you can scroll through.
The lang-javascript
package now exports an esLint
function that can be used to wire up ESLint to the CodeMirror lint integration.
@codemirror/next 0.2.0 (2019-10-28)
Breaking changes
syntaxIndentation
no longer has to be registered separately as an extension. It is now implied when registering a tree syntax.
The configuration passed to gutter
no longer takes direct class names, but a style
option that determines the theme fields used for the gutter.
ViewPlugin
instances are now created with a static create
method, instead of the constructor.
Declaring custom gutters is now done with a Gutter
constructor.
Configuring whether the gutters are fixed is now done with the gutters
extension, rather than per individual gutter.
There is now an additional wrapper element around the editor (EditorView.scrollDOM
), which is the element that should be targeted with overflow
style properties.
EditorView.cssClass
no longer accepts space-separated lists of classes.
Slot
from the extension package has been replaced with Annotation
in the state package. Transaction metadata is now called annotations, and the method names have been updated accordingly.
Command
from state was renamed to StateCommand
, ViewCommand
from view is now called Command
.
Bug fixes
Fix a bug where a behavior's combine
method wasn't called when the behavior was entirely static.
Fix issue that caused nested replaced decorations to be drawn incorrectly.
ViewUpdate.themeChanged
no longer returns the inverse of what it should be returning.
Avoid crash on Firefox when focusing the editor if another form field has focus.
Fixes a bug where changes near replacing decorations would corrupt the editor's view of its height layout.
New features
The new EditorState.foldable
behavior provides a way to register code folding services.
Lezer syntax can now register code folding metadata on tree nodes via foldNodeProp
.
There is now a fold package with code folding commands (which need the codeFolding
extension to be active to work).
EditorView.posFromDOM
can now be used to find the document position of a given DOM position.
Gutters can now be themed.
ViewPlugin
instances can be extended with dynamic behavior using their behavior
and decorations
methods.
Gutters can now be passed a handleDOMEvents
option that allows client code to register event handlers on them.
You can now iterate over a RangeSet
more cheaply with an (internal) iterator using the between
method.
Syntax services now have a docTypeAt
method that gives you the grammar node around the given point (which may be part of a nesting grammar).
The text package now has replacements for codePointAt
and fromCodePoint
.
Added a bracket-closing extension in the closebrackets
package.
Adds a panel package that contains functionality for showing UI panels at the top or bottom of the editor.
The new search package provides search/replace-related functionality.
Themes and EditorView.cssClass
can now target dot-separated more specific versions of a name.
The phrase
method on the editor view can now be used to access translation provided with the EditorView.phrases
behavior.
Widget toDOM
methods are now passed the editor view.
Add EditorView.scrollMargins
behavior, which can be used to make the view scroll past regions at the side of the editor when scrolling something into view.
The keymap package now exports a NormalizedKeymap
class that can be used to build key handlers on other elements.
@codemirror/next 0.1.0 (2019-10-10)
Breaking Changes
First numbered release.