Skip to content

Commit 23bd724

Browse files
claudesinelaw
authored andcommitted
feat(plugins): adopt config_changed in git_explorer and vi_mode
The two shipped plugins whose settings could not take effect until the editor restarted. Both needed more than "re-read the value": git_explorer already re-read `colorNames` — but only inside `refreshGitExplorerDecorations`, which runs on file open/save/explorer change/init/focus. Nothing re-ran it on a settings save, so ticking the box left the explorer painted with the old colors until the user happened to save a file. One more subscription, alongside its five existing ones. vi_mode bakes `arrowKeys` and `searchWordUnderCursor` into the mode binding tables at `defineMode` time, so re-reading them changes nothing by itself — the modes have to be re-emitted. The seven top-level `defineMode` calls move into `defineViModes()`, called at load and again from the `config_changed` handler when either value actually changed. Re-emitting is safe: `handle_define_mode` clears the mode's existing plugin defaults before re-registering, so the call is idempotent. `autoStart` is deliberately left load-time. It means "enable vi when the editor starts"; switching vi on mid-session because a startup preference changed is a different behaviour than the setting promises, and that's the maintainer's call, not a bug fix. Audited every other shipped plugin. flash (`labelPool`, `skipRule`) and dashboard (`autoOpen`) already read at point of use and need nothing; pkg and theme_editor read host config inside functions, likewise. The orchestrator dock's settings live on their own branch and get the same treatment there. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CstcifC5JjgznkUK8L8dm2
1 parent 2332bdc commit 23bd724

4 files changed

Lines changed: 633 additions & 377 deletions

File tree

crates/fresh-editor/plugins/git_explorer.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,5 +240,11 @@ editor.on("editor_initialized", () => {
240240
editor.on("focus_gained", () => {
241241
refreshGitExplorerDecorations();
242242
});
243+
// `colorNames` is read inside the refresh, so without this the setting
244+
// changes nothing until the next file open/save/explorer change — the
245+
// user ticks the box in Settings and the explorer just sits there.
246+
editor.on("config_changed", () => {
247+
refreshGitExplorerDecorations();
248+
});
243249

244250
refreshGitExplorerDecorations();

0 commit comments

Comments
 (0)