Skip to content

fix: make plugin option persistence configurable - #4241

Open
sb123sb123 wants to merge 1 commit into
micro-editor:masterfrom
sb123sb123:fix/4041-writesettings
Open

sb123sb123 wants to merge 1 commit into
micro-editor:masterfrom
sb123sb123:fix/4041-writesettings

Conversation

@sb123sb123

Copy link
Copy Markdown

Fixes #4041

Issue: #4041

Problem

config.SetGlobalOption is exposed to plugins through SetGlobalOption and SetGlobalOptionNative, but plugin changes no longer persist to settings.json after the plugin-write regression. Plugins can change the current session but cannot opt into the previous persistent behavior.

Cause

The plugin wrappers hard-code writeToFile to false, while command-driven option changes pass true. There is no user-configurable distinction between those two callers.

Fix

Add the global writesettings option. It defaults to set to preserve command behavior; plugins or set,plugins enables persistence for plugin API changes, and an empty value disables both. The policy is applied centrally to string and native setters, and the option is documented.

Tests

  • Added TestSetGlobalOptionPlugWritesSettingsWhenEnabled, covering the default session-only behavior and opt-in persistence to a temporary settings.json.
  • gofmt -l internal/action/command.go internal/action/command_test.go internal/config/settings.go (passed).
  • git diff --check (passed).
  • go test -count=1 ./internal/action ./internal/config and go vet ./internal/action ./internal/config were attempted.

Limitations

The focused Go test and vet commands could not build because this host could not download the repository's required modules: connections to https://proxy.golang.org failed with Windows connectex errors.

AI assistance

This pull request was prepared with assistance from OpenAI Codex. The author reviewed the changes, tests, and limitations before submission.

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.

config.SetGlobalOption no longer allows writing to settings.json

1 participant