From 4e5dd05ec8980e190feae6ee8c1b3a303b225e87 Mon Sep 17 00:00:00 2001 From: Claycuy Date: Fri, 10 Jul 2026 11:01:49 +0800 Subject: [PATCH 1/3] fix: Add missing listener for autoCloseBrackets setting --- src/lib/editorManager.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/lib/editorManager.js b/src/lib/editorManager.js index 3a12f6184..c09075537 100644 --- a/src/lib/editorManager.js +++ b/src/lib/editorManager.js @@ -3459,6 +3459,22 @@ async function EditorManager($header, $body) { applyOptions(["autoRenameTags"]); }); + appSettings.on("update:autoCloseBrackets", function () { + applyOptions(["autoCloseBrackets"]); + }); + + appSettings.on("update:bracketMatching", function () { + applyOptions(["bracketMatching"]); + }); + + appSettings.on("update:highlightActiveLine", function () { + applyOptions(["highlightActiveLine"]); + }); + + appSettings.on("update:highlightSelectionMatches", function () { + applyOptions(["highlightSelectionMatches"]); + }); + appSettings.on("update:scrollPastEnd", function () { applyOptions(["scrollPastEnd"]); }); From 2313d930c0a231a98304dd8980c1091a38724685 Mon Sep 17 00:00:00 2001 From: Claycuy Date: Fri, 10 Jul 2026 11:35:21 +0800 Subject: [PATCH 2/3] feat: Added bracket and highlight Compartment --- src/lib/editorManager.js | 57 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 54 insertions(+), 3 deletions(-) diff --git a/src/lib/editorManager.js b/src/lib/editorManager.js index c09075537..1ff6c4251 100644 --- a/src/lib/editorManager.js +++ b/src/lib/editorManager.js @@ -1,6 +1,13 @@ import sidebarApps from "sidebarApps"; -import { indentUnit, language as languageFacet } from "@codemirror/language"; -import { search } from "@codemirror/search"; +import { + indentUnit, + language as languageFacet, + bracketMatching, + foldGutter, + indentOnInput, + syntaxHighlighting, +} from "@codemirror/language"; +import { search, highlightSelectionMatches } from "@codemirror/search"; import { Compartment, EditorSelection, @@ -19,6 +26,8 @@ import { keymap, lineNumbers, placeholder, + drawSelection, + highlightActiveLine, } from "@codemirror/view"; import { abbreviationTracker, @@ -62,7 +71,7 @@ import { } from "cm/modelist"; import createTouchSelectionMenu from "cm/touchSelectionMenu"; import "cm/supportedModes"; -import { autocompletion } from "@codemirror/autocomplete"; +import { autocompletion, closeBrackets } from "@codemirror/autocomplete"; import { serverCompletionSource } from "@codemirror/lsp-client"; import colorView from "cm/colorView"; import { @@ -937,6 +946,10 @@ async function EditorManager($header, $body) { const tagAutoRenameCompartment = new Compartment(); // Compartment for read-only toggling const readOnlyCompartment = new Compartment(); + // Compartment for brackets + const bracketCompartment = new Compartment(); + // Compartment for highlight + const highlightCompartment = new Compartment(); // Compartment for scrolling past the end of the file const scrollPastEndCompartment = new Compartment(); // Compartment for language mode (allows async loading/reconfigure) @@ -1267,6 +1280,44 @@ async function EditorManager($header, $body) { return enabled ? tagAutoRename() : []; }, }, + { + keys: ["autoCloseBrackets", "bracketMatching"], + compartments: [bracketCompartment], + build() { + const ext = []; + + if (appSettings.value.autoCloseBrackets !== false) { + ext.push(closeBrackets()); + } + + if (appSettings.value.bracketMatching !== false) { + ext.push(bracketMatching()); + } + + return ext; + }, + }, + { + keys: ["highlightActiveLine", "highlightSelectionMatches"], + compartments: [highlightCompartment], + build() { + const ext = []; + + if (appSettings.value.highlightActiveLine !== false) { + ext.push(highlightActiveLine()); + } + + if (appSettings.value.highlightSelectionMatches !== false) { + ext.push( + highlightSelectionMatches({ + minSelectionLength: 1, + }), + ); + } + + return ext; + }, + }, { keys: ["scrollPastEnd"], compartments: [scrollPastEndCompartment], From 56636db3933b6ee48d90bd70375a7c34733ec1bc Mon Sep 17 00:00:00 2001 From: Claycuy Date: Fri, 10 Jul 2026 11:41:52 +0800 Subject: [PATCH 3/3] fix linting --- src/lib/editorManager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/editorManager.js b/src/lib/editorManager.js index 1ff6c4251..8f28a2fca 100644 --- a/src/lib/editorManager.js +++ b/src/lib/editorManager.js @@ -7,7 +7,7 @@ import { indentOnInput, syntaxHighlighting, } from "@codemirror/language"; -import { search, highlightSelectionMatches } from "@codemirror/search"; +import { highlightSelectionMatches, search } from "@codemirror/search"; import { Compartment, EditorSelection,