# Release 0.20.0

**URL:** https://discuss.codemirror.net/t/release-0-20-0/4302
**Category:** v6
**Created:** [April 20, 2022, 3:15pm UTC](https://discuss.codemirror.net/t/release-0-20-0/4302 "2022-04-20T15:15:15Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![marijn](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/marijn/32/136_2.png) [@marijn](https://discuss.codemirror.net/u/marijn)
#### Post date: [April 20, 2022, 3:15pm UTC](https://discuss.codemirror.net/t/release-0-20-0/4302/1 "2022-04-20T15:15:16Z")

</div>

I have just tagged a 0.20.0 release for all the @codemirror packages (and 0.16.0 for the @lezer packages). These introduce some package restructuring and a few minor breaking changes (listed below). I will tag 6.0 with this interface in a few weeks, if no significant issues are encountered.

To update your codebase, these are the things you’ll want to look at:

- If you were still using `Prec.fallback`/`Prec.override`/`Prec.extend`, you must move to the [new names](https://codemirror.net/6/docs/ref/#state.Prec).

- The old height querying system on the view (`blockAtHeight`, `visualLineAtHeight`, `viewportLines`, `visualLineAt`) has been replaced with a simpler system where all y offsets are relative to the document top (see [here](https://codemirror.net/6/docs/ref/#view.EditorView.elementAtHeight)).

- The scroll control effects and method (`scrollPosIntoView`, `scrollTo`, and `centerOn`) are now replaced by the more general [`scrollIntoView`](https://codemirror.net/6/docs/ref/#view.EditorView%5EscrollIntoView) effect.

- Plugin fields no longer exist, and providing decorations from a view plugin now happens by providing a function to the [`EditorView.decorations`](https://codemirror.net/6/docs/ref/#view.EditorView%5Edecorations) facet. Same for atomic ranges and scroll margins — you must use a facet for them now.

- The exports from the @codemirror/text and @codemirror/rangeset packages have been moved into @codemirror/state, and the old packages are no longer available.

- The exports from the @codemirror/tooltip, gutter, panel, and rectangular-selection packages have been moved into @codemirror/view.

- The exports from @codemirror/matchbrackets, @codemirror/stream-parser, and @codemirror/fold have been moved into @codemirror/language.

- The exports from @codemirror/comment and @codemirror/history have been moved into @codemirror/commands. `commentKeymap` has been merged into `defaultKeymap`.

- The @codemirror/closebrackets package has been merged into @codemirror/autocomplete.

- The @codemirror/highlight package has been split between @codemirror/language (the editor-specific parts) and @lezer/highlight (a new package containing the generic syntax-highlighting functionality). Lezer parser packages are now expected to provide highlighting information.

- `HighlightStyles` objects no longer directly act as editor extensions, but have to be wrapped with the `syntaxHighlighting` function first.

- `Language` objects no longer export a `topNode` property, and if you want to use per-language highlighting you should pass the entire `Language` object to the [`scope`](https://codemirror.net/6/docs/ref/#language.HighlightStyle%5Edefine%5Eoptions.scope) option instead.

- In completion results, the rather confusing `span` property has been renamed to [`validFor`](https://codemirror.net/6/docs/ref/#autocomplete.CompletionResult.validFor) (and may be a function, not just a regexp).

- If you’re using [`iterate`](https://lezer.codemirror.net/docs/ref/#common.Tree.iterate) on syntax trees, the signature of the `enter`/`leave` functions was simplified in a breaking way.

The less granular module structure should make setting up your editor a bit more straightforward, and the changes to the highlighting logic make it a lot easier to do syntax highlighting based on Lezer parsers without pulling in a bunch of irrelevant editor code.

---

<div class="post-metadata">

### Author: ![JuneKelly](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/junekelly/32/2017_2.png) [@JuneKelly](https://discuss.codemirror.net/u/JuneKelly)
#### Post date: [April 21, 2022, 12:44pm UTC](https://discuss.codemirror.net/t/release-0-20-0/4302/2 "2022-04-21T12:44:50Z")

</div>

This looks great!

We (at Overleaf) have been using `classHighlightStyle` ([CodeMirror 6 Reference Manual](https://codemirror.net/6/docs/ref/#highlight.classHighlightStyle)) to bridge some of our color schemes, as a temporary measure. It looks like this function has been removed in this migration (at least, I can’t find it in the `language` or `lezer/class` repositories on github). Is this removal intentional? Or am I just looking in the wrong place?

---

<div class="post-metadata">

### Author: ![marijn](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/marijn/32/136_2.png) [@marijn](https://discuss.codemirror.net/u/marijn)
#### Post date: [April 21, 2022, 1:04pm UTC](https://discuss.codemirror.net/t/release-0-20-0/4302/3 "2022-04-21T13:04:02Z")

</div>

It still exists in [@lezer/highlight](https://lezer.codemirror.net/docs/ref/#highlight.classHighlighter). But note that the prefix changed from `cmt-` to `tok-` (since it’s no longer part of CodeMirror, and the cm part no longer made much sense).

---

<div class="post-metadata">

### Author: ![wardellbagby](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/wardellbagby/32/1022_2.png) [@wardellbagby](https://discuss.codemirror.net/u/wardellbagby)
#### Post date: [April 24, 2022, 5:49pm UTC](https://discuss.codemirror.net/t/release-0-20-0/4302/4 "2022-04-24T17:49:59Z")

</div>

Wait, did I read you right there? Are you saying that CodeMirror 6 might officially release in a few weeks?? That’s amazing!

---

<div class="post-metadata">

### Author: ![crystalfp](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/crystalfp/32/249_2.png) [@crystalfp](https://discuss.codemirror.net/u/crystalfp)
#### Post date: [April 25, 2022, 5:29am UTC](https://discuss.codemirror.net/t/release-0-20-0/4302/5 "2022-04-25T05:29:33Z")

</div>

Almost there in the move to 0.20. The last problem I have is with highlighting that seems ignored.

```
    import {defaultHighlightStyle, HighlightStyle} from "@codemirror/language";
    import {tags} from "@lezer/highlight";

    const myHighlightStyle = HighlightStyle.define([
        {tag: tags.keyword, color: "#FC6"},
        {tag: tags.comment, color: "#16A004", fontStyle: "italic"},
        {tag: tags.strong, color: "#66D9EF", fontStyle: "bold"},
        ...
    ]);
    state: EditorState.create({
            extensions: [
                markdown(),
                syntaxHighlighting(myHighlightStyle),
                syntaxHighlighting(defaultHighlightStyle),
                ...
             ])

```

If I write in the editor ` **word** ` it is not rendered as per my style, and the following error appears (from `@codemirror/view index.js` line 1744) :

```auto
CodeMirror plugin crashed: TypeError: tags3 is not iterable
    at HighlightStyle.style (index.js:227:29)
    at highlightTags (index.js:244:33)
    at HighlightBuilder.highlightRange (index.js:294:30)
    at highlightTree (index.js:262:13)
    at TreeHighlighter.buildDeco (index.js:1582:13)
    at TreeHighlighter.update (index.js:1574:37)
    at PluginInstance.update (index.js:1830:32)
    at EditorView.updatePlugins (index.js:6151:29)
    at EditorView.update (index.js:6066:22)
    at EditorView._dispatch (index.js:5956:59)

```

Thanks for your patience!  
mario

---

<div class="post-metadata">

### Author: ![marijn](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/marijn/32/136_2.png) [@marijn](https://discuss.codemirror.net/u/marijn)
#### Post date: [April 25, 2022, 6:16am UTC](https://discuss.codemirror.net/t/release-0-20-0/4302/6 "2022-04-25T06:16:34Z")

</div>

Did you upgrade @codemirror/lang-markdown to 0.20.0?

---

<div class="post-metadata">

### Author: ![crystalfp](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/crystalfp/32/249_2.png) [@crystalfp](https://discuss.codemirror.net/u/crystalfp)
#### Post date: [April 25, 2022, 6:19am UTC](https://discuss.codemirror.net/t/release-0-20-0/4302/7 "2022-04-25T06:19:37Z")

</div>

Yes. lang-markdown is 0.20.0  
Same problem with yaml (using StreamLanguage and “@codemirror/legacy-modes” 0.20.0)

---

<div class="post-metadata">

### Author: ![marijn](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/marijn/32/136_2.png) [@marijn](https://discuss.codemirror.net/u/marijn)
#### Post date: [April 25, 2022, 6:54am UTC](https://discuss.codemirror.net/t/release-0-20-0/4302/8 "2022-04-25T06:54:56Z")

</div>

Check `npm ls --all`, and if that doesn’t show the problem, please open a separate topic with more details.

---

<div class="post-metadata">

### Author: ![voraciousdev](https://discuss.codemirror.net/user_avatar/discuss.codemirror.net/voraciousdev/32/949_2.png) [@voraciousdev](https://discuss.codemirror.net/u/voraciousdev)
#### Post date: [May 4, 2022, 3:14am UTC](https://discuss.codemirror.net/t/release-0-20-0/4302/9 "2022-05-04T03:14:02Z")

</div>

Almost all of these changes affected my project, but I just ran through the upgrade process without any issues. Thanks so much for this migration guide!
