I want to switch the codemirror6 theme, now I do it like this:
if (projConf.confYype == ProjConfType.Theme) {
const currentTheme = themeMap.get(projConf.confValue);
if (currentTheme) {
if (!activeEditorView) return;
var theme = new Compartment;
activeEditorView.dispatch({
effects: theme.reconfigure(currentTheme)
});
}
}
first I stored the theme in a map<string,theme>, and get the theme by name, set the theme into the editorView. But the codemirror6 theme did not changed, am I missing something? I am inspired from this question https://discuss.codemirror.net/t/how-to-change-editor-theme-dinamically/4173/5 from codemirror6 community.