Fix a bunch of lints

This commit is contained in:
Quinten Kock 2025-11-10 03:10:29 +01:00
parent 0ede7607c8
commit e84a5192c5
2 changed files with 8 additions and 19 deletions

View File

@ -38,13 +38,6 @@ const fixedHeightEditor = EditorView.theme({
".cm-scroller": { overflow: "auto scroll" }, ".cm-scroller": { overflow: "auto scroll" },
}); });
const testTheme = EditorView.theme({
"&": {
width: "600px",
resize: "horizontal",
},
});
export class Editor { export class Editor {
view: EditorView; view: EditorView;
file: OpenFile; file: OpenFile;
@ -97,14 +90,11 @@ export class Editor {
// lintKeymap, // lintKeymap,
], ],
}); });
const language = LanguageDescription.matchFilename( LanguageDescription.matchFilename(languages, file.filePath.val)
languages,
file.filePath.val,
)
?.load() ?.load()
.then((Lang) => { .then((Lang) => {
let eff = StateEffect.appendConfig.of(Lang); const eff = StateEffect.appendConfig.of(Lang);
let tr = this.view.dispatch({ effects: [eff] }); this.view.dispatch({ effects: [eff] });
}); });
} }

View File

@ -8,8 +8,7 @@ import {
} from "@codemirror/state"; } from "@codemirror/state";
import { history } from "@codemirror/commands"; import { history } from "@codemirror/commands";
import { Editor } from "./editor"; import { Editor } from "./editor";
import { State } from "vanjs-core"; import van, { State } from "vanjs-core";
import van from "vanjs-core";
const openFiles: { [path: string]: OpenFile } = {}; const openFiles: { [path: string]: OpenFile } = {};
@ -75,16 +74,16 @@ export class OpenFile {
} }
dispatch(trs: TransactionSpec, origin?: Editor) { dispatch(trs: TransactionSpec, origin?: Editor) {
let transaction = this.rootState.val.update(trs); const transaction = this.rootState.val.update(trs);
this.rootState.val = transaction.state; this.rootState.val = transaction.state;
if (origin) { if (origin) {
const es = this.editors.filter((e) => e !== origin); const es = this.editors.filter((e) => e !== origin);
es.forEach((e) => e.dispatch(e.view.state.update(trs), true)); es.forEach((e) => e.dispatch(e.view.state.update(trs), true));
} else { } else {
this.editors.forEach((e) => { this.editors.forEach((e) => {
let changes = transaction.changes; const changes = transaction.changes;
let userEvent = transaction.annotation(Transaction.userEvent); const userEvent = transaction.annotation(Transaction.userEvent);
let annotations = userEvent const annotations = userEvent
? [Transaction.userEvent.of(userEvent)] ? [Transaction.userEvent.of(userEvent)]
: []; : [];
e.dispatch(e.view.state.update({ changes, annotations }), true); e.dispatch(e.view.state.update({ changes, annotations }), true);