diff --git a/src/app/editor.ts b/src/app/editor.ts index 5762659..45a8512 100644 --- a/src/app/editor.ts +++ b/src/app/editor.ts @@ -38,13 +38,6 @@ const fixedHeightEditor = EditorView.theme({ ".cm-scroller": { overflow: "auto scroll" }, }); -const testTheme = EditorView.theme({ - "&": { - width: "600px", - resize: "horizontal", - }, -}); - export class Editor { view: EditorView; file: OpenFile; @@ -97,14 +90,11 @@ export class Editor { // lintKeymap, ], }); - const language = LanguageDescription.matchFilename( - languages, - file.filePath.val, - ) + LanguageDescription.matchFilename(languages, file.filePath.val) ?.load() .then((Lang) => { - let eff = StateEffect.appendConfig.of(Lang); - let tr = this.view.dispatch({ effects: [eff] }); + const eff = StateEffect.appendConfig.of(Lang); + this.view.dispatch({ effects: [eff] }); }); } diff --git a/src/app/filestate.ts b/src/app/filestate.ts index 1c726e8..5b91fda 100644 --- a/src/app/filestate.ts +++ b/src/app/filestate.ts @@ -8,8 +8,7 @@ import { } from "@codemirror/state"; import { history } from "@codemirror/commands"; import { Editor } from "./editor"; -import { State } from "vanjs-core"; -import van from "vanjs-core"; +import van, { State } from "vanjs-core"; const openFiles: { [path: string]: OpenFile } = {}; @@ -75,16 +74,16 @@ export class OpenFile { } dispatch(trs: TransactionSpec, origin?: Editor) { - let transaction = this.rootState.val.update(trs); + const transaction = this.rootState.val.update(trs); this.rootState.val = transaction.state; if (origin) { const es = this.editors.filter((e) => e !== origin); es.forEach((e) => e.dispatch(e.view.state.update(trs), true)); } else { this.editors.forEach((e) => { - let changes = transaction.changes; - let userEvent = transaction.annotation(Transaction.userEvent); - let annotations = userEvent + const changes = transaction.changes; + const userEvent = transaction.annotation(Transaction.userEvent); + const annotations = userEvent ? [Transaction.userEvent.of(userEvent)] : []; e.dispatch(e.view.state.update({ changes, annotations }), true);