Trying to do better but it's hard
This commit is contained in:
@ -42,6 +42,7 @@
|
||||
const lineNumbersCompartment = new Compartment();
|
||||
const lineWrappingCompartment = new Compartment();
|
||||
const vimCompartment = new Compartment();
|
||||
const languageCompartment = new Compartment();
|
||||
|
||||
function handleExecute() {
|
||||
if (!editorView) return;
|
||||
@ -111,11 +112,13 @@
|
||||
|
||||
const initSettings = $editorSettings;
|
||||
|
||||
const fileType = mode === 'livecoding' ? 'orc' : 'csd';
|
||||
|
||||
editorView = new EditorView({
|
||||
doc: value,
|
||||
extensions: [
|
||||
...baseExtensions,
|
||||
csoundMode({ fileType: 'csd' }),
|
||||
languageCompartment.of(csoundMode({ fileType })),
|
||||
oneDark,
|
||||
evaluateKeymap,
|
||||
flashField(),
|
||||
@ -154,6 +157,15 @@
|
||||
editorView.dom.style.fontFamily = settings.fontFamily;
|
||||
});
|
||||
|
||||
$effect(() => {
|
||||
if (!editorView) return;
|
||||
|
||||
const fileType = mode === 'livecoding' ? 'orc' : 'csd';
|
||||
editorView.dispatch({
|
||||
effects: languageCompartment.reconfigure(csoundMode({ fileType }))
|
||||
});
|
||||
});
|
||||
|
||||
onDestroy(() => {
|
||||
if (editorView) {
|
||||
editorView.destroy();
|
||||
|
||||
Reference in New Issue
Block a user