Fix a crash in StreamLanguage
when the input range is entirely before the editor viewport.
Fix an issue where a StreamLanguage
could get confused when trying to reuse existing parse data when the parsed range changed.
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.
Fix a TypeScript error when using HighlightStyle
with the exactOptionalPropertyTypes
typechecking option enabled.
Make delimitedIndent
align to spaces after the opening token.
Fix an infinite loop that could occur when enabling bidiIsolates
in documents with both bidirectional text and very long lines.
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.
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.
Fix an issue in StreamLanguage
where it ran out of node type ids if you repeatedly redefined a language with the same token table.
Allow StreamParser
tokens get multiple highlighting tags.
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.
Make getIndentation
return null, rather than 0, when there is no syntax tree available.
The new preparePlaceholder
option to codeFolding
makes it possible to display contextual information in a folded range placeholder widget.
The new baseIndentFor
method in TreeIndentContext
can be used to find the base indentation for an arbitrary node.
Export DocInput
class for feeding editor documents to a Lezer parser.
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.
Make indentation for stream languages more reliable by having StringStream.indentation
return overridden indentations from the indent context.
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.
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).
Fix a bug that caused ensureSyntaxTree
to return incomplete trees when using a viewport-aware parser like StreamLanguage
.
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.
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.
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.
Fix a bug that prevented bracket matching to recognize plain brackets inside a language parsed as an overlay.
The indentRange
function provides an easy way to programatically auto-indent a range of the document.
The foldState
field is now public, and can be used to serialize and deserialize the fold state.
The foldingChanged
option to foldGutter
can now be used to trigger a recomputation of the fold markers.
List style-mod as a dependency.
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
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.
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.
Autocompletion may now also trigger automatic indentation on input.
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.
Fix an issue that could cause indentation logic to use the wrong line content when indenting multiple lines at once.
Fix an issue where the parse worker could incorrectly stop working when the parse tree has skipped gaps in it.
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.
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.
LanguageDescription.of
now takes an optional already-loaded extension.
Fix an issue where a parse that skipped content with skipUntilInView
would in some cases not be restarted when the range came into view.
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.
Fix incorrect versions for @lezer dependencies.
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 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.
Fix an issue where asynchronous re-parsing (with dynamically loaded languages) sometimes failed to fully happen.
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.)
Fix an issue where nested parsers could see past the end of the nested region.
Update dependencies to 0.18.
The Language
constructor takes an additional argument that provides the top node type.
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.
This package now exports a foldInside
helper function, a fold function that should work for most delimited node types.
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.
The package now also exports a CommonJS module.
Fix a bug where changing the editor configuration wouldn't update the language parser used.
First numbered release.