Beginner having trouble with syntax highlighting JSON

Hi, I’m just starting out with CodeMirror 6, trying to get a simple demo working of syntax highlighting of a JSON document.

This is what I have for my main code file (TypeScript), running in an otherwise empty HTML document:

import { basicSetup } from "codemirror";
import { EditorState } from "@codemirror/state";
import { EditorView } from "@codemirror/view";
import { json } from "@codemirror/lang-json";

function main(): void {
  let startState = EditorState.create({
    doc: JSON.stringify({array: [1, 2, 3, 4, 5], object: {bool: true, str: 'one two three four five'}, nothing: null}, null, 2),
    extensions: [
      basicSetup,
      json(),
    ],
  });
  
  let view = new EditorView({
    state: startState,
    parent: document.body,
  });
}

window.addEventListener('DOMContentLoaded', main, {once:true});

From what I have read, it seemed like this should be enough to get syntax highlighting via basicSetup, but currently the document remains unstyled. When the caret is over a curly brace or square bracket it does highlight the corresponding partner, though.

There’s no error recorded in the dev console. Any clues where am I going wrong?

Thanks!

OK, looks like I had @codemirror/language at version 6.0.0 rather than the latest revision for some reason, which was apparently incompatible with some other component in such a way that the syntax highlighting was failing without error.