Skip to content

Add settings for CodeMirror themes and keybindings - #216

Merged
vogelsgesang merged 3 commits into
mainfrom
codemirror-settings
Oct 8, 2026
Merged

vogelsgesang merged 3 commits into
mainfrom
codemirror-settings

Conversation

@vogelsgesang

@vogelsgesang vogelsgesang commented Oct 8, 2026 •

Copy link
Copy Markdown
Collaborator

Users can now choose a CodeMirror theme (Light, Dark) and CodeMirror key
bindings (Vim, Emacs).

Currently, the theming option only affects CodeMirror. In the future, we
want to support theming the full application via this setting. In
preparation for that, the underlying setting is already named theme.
while labeling it as "CodeMirror theme" until that broader support exists.

Reconfigure theme and keyboard extensions through CodeMirror compartments
instead of recreating the editor. This preserves selection, scrolling,
folds, search state, and mode-specific keybinding state when preferences
change. Reject document-changing transactions because the third-party modes
do not consistently honor CodeMirror's read-only facet.

Users can now choose a System, Light, or Dark CodeMirror theme and switch
between Standard, Vim, and Emacs keybindings. These preferences persist and
synchronize across tabs, while documents remain read-only in every keyboard
mode.

Keep application settings, their panel, and persistence in the standalone
app, which is the only consumer of the CodeMirror preferences. The reusable
QueryGraph renderer instead accepts its animation speed explicitly and
provides a generic controls slot for host UI. This avoids imposing application
state and local-storage behavior on library embedders.

The underlying theme setting is intentionally named `theme` so it can
eventually style the full application, although the UI currently labels it
"CodeMirror theme". System mode follows live browser color-scheme changes,
and dark mode uses One Dark. Semantic theme colors keep search controls and
linked ranges legible while allowing future themes to provide their own
palette.

Reconfigure theme and keyboard extensions through CodeMirror compartments
instead of recreating the editor. This preserves selection, scrolling, folds,
search state, and mode-specific keybinding state when preferences change.
Reject document-changing transactions because the third-party modes do not
consistently honor CodeMirror's read-only facet.

Review consideration:

* Do not add a React Flow integration test solely for the direct
  `additionalControls` and `animationSpeed` prop forwarding. The standalone
  production build verifies their composition, while focused tests cover
  animation-duration resolution and the complete settings panel.
Comment thread query-graphs/README.md Outdated
Comment thread standalone-app/src/CodeMirrorDocument.tsx Outdated
Comment thread standalone-app/src/CodeMirrorDocument.tsx Outdated
@vogelsgesang
vogelsgesang merged commit 22f7831 into main Oct 8, 2026
5 checks passed
@vogelsgesang
vogelsgesang deleted the codemirror-settings branch October 8, 2026 23:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant