From d9584e754390671a5a91e4c3040ed9c3b0a59f59 Mon Sep 17 00:00:00 2001 From: Quinten Kock Date: Sun, 30 Nov 2025 02:49:23 +0100 Subject: [PATCH] Fix types and formatting --- src/app/editor.ts | 6 ++++-- src/app/editorgrid.ts | 11 ++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/app/editor.ts b/src/app/editor.ts index 1464543..012e135 100644 --- a/src/app/editor.ts +++ b/src/app/editor.ts @@ -149,7 +149,9 @@ export class Editor implements Displayable { // lintKeymap, ], }); - this.view.dom.addEventListener("focusin", () => this.view.dom.scrollIntoView({ behavior: "smooth", })); + this.view.dom.addEventListener("focusin", () => + this.view.dom.scrollIntoView({ behavior: "smooth" }), + ); van.derive(() => { LanguageDescription.matchFilename(languages, file.filePath.val) @@ -175,7 +177,7 @@ export class Editor implements Displayable { } focus() { - this.view.dom.scrollIntoView({ behavior: "smooth", }); + this.view.dom.scrollIntoView({ behavior: "smooth" }); this.view.focus(); } diff --git a/src/app/editorgrid.ts b/src/app/editorgrid.ts index 3e440d9..eeadc20 100644 --- a/src/app/editorgrid.ts +++ b/src/app/editorgrid.ts @@ -29,7 +29,7 @@ const EditorWrapper = ( const list = editors[currentTab.val] || []; // Find nearest non-empty neighbor (scan left then right) - let neighborState: State | null = null; + let neighborState: Displayable | null = null; for (let i = k - 1; i >= 0; i--) { const c = list[i]; if (c) { @@ -40,7 +40,7 @@ const EditorWrapper = ( if (!neighborState) { for (let i = k + 1; i < list.length; i++) { const c = list[i]; - if (c && c.val) { + if (c) { neighborState = c; break; } @@ -70,7 +70,8 @@ const EditorWrapper = ( ); }; -const editors = vanX.reactive([[]]); +// give type to editors +const editors: Displayable[][] = vanX.reactive([[]]); const currentTab = van.state(0); export function addEditor(file: OpenFile) { @@ -79,8 +80,8 @@ export function addEditor(file: OpenFile) { editor.focus(); } -export function addTab(file?: OpenFile) { - editors.push(file ? [file] : []); +export function addTab() { + editors.push([]); } export function addTerminal() {