Hello,
I’m building a simple code editor in browser with file tree support. so basically I’ve a single dom element (BTW I’m using VueJS). the page starts with the below defined view
let view = new EditorView({
doc: primaryFile.content,
extensions: Extensions,
parent: editor.value, // vue reference to a div element
})
which works as expected and every thing is perfect
but on any file click, I run the below code to change the state of the view
let state = EditorState.create({
doc: file.content,
extensions: Extensions
})
view.setState(state)
so on state change the syntax highlight gets broken
my extensions are
import {basicSetup} from "codemirror"
import {php} from "@codemirror/lang-php";
import {oneDarkTheme} from '@codemirror/theme-one-dark'
const Extensions = [
oneDarkTheme,
basicSetup,
php(),
]