[resolved] Switch language with no language at start


At start I have no language and I want to set one dynamically.
Test case:

const langHolder = new Compartment()
let state = EditorState.create({
	doc: '',
	extensions: [

const view = new EditorView({state, parent: document.querySelector("#editor")})

setTimeout(() => {
	view.dispatch({effects: langHolder.reconfigure(css())})
}, 100)


Uncaught TypeError: Cannot read property 'parser' of null
    at init (index.js:436)
    at StateField.create (index.js:1062)
    at Array.<anonymous> (index.js:1077)
    at ensureAddr (index.js:1302)
    at new EditorState (index.js:1814)
    at EditorState.applyTransaction (index.js:1868)
    at Transaction.get state [as state] (index.js:1541)
    at EditorView.update (index.js:5333)
    at EditorView._dispatch (index.js:5260)
    at EditorView.dispatch (index.js:5314)

If the state is initialized with langHolder.of(javascript()), it’s ok, no exception is thrown and css has replaced the js language.

How can I initialize my Compartment without any Language ?
Is there a text/plain language somewhere (I don’t find one) ?

thank you for your attention.

See also this thread . That was a bug whose fix hadn’t been released yet. I’ve tagged @codemirror/state 0.18.7 — upgrading to that should help.

It’s perfect, thanks a lot.