Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor settings #45

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Refactor settings #45

wants to merge 9 commits into from

Conversation

Nimaoth
Copy link
Owner

@Nimaoth Nimaoth commented Mar 22, 2025

Old behaviour

  • Settings are merged when loading the config files
  • When reloading config files from disk the settings changed at runtime with setOption etc are overridden (which might not be desired)
  • Only one global config, can't change settings for specific editors/documents
  • Some settings for editors are not stored in json config and must be exposed separately to the plugin API

New behaviour

  • Settings are not merged when loading, but instead each config file is stored, and linked to the parent config file
  • There is a base config which is not loaded from a file but acts as the root of the linked list of config files
  • There is a runtime config which is not loaded from a file, but has the last config file as the next link.
    When changing settings at runtime with setOption etc they are changed in the runtime config
  • Settings are merged when reading specific settings, on the fly. Most settings are simple values which don't merge (only objects and arrays do), so this should be fast enough
  • Each editor and document have their own config with the runtime config as the parent, so settings can be overriden per editor and document
  • The settings browser can show every config (base/runtime config, config files, editor/document config), both the merged settings up to a specific config or just the changes a specific config applies
  • Removed setOption, getOption, ConfigProvider, setValue, getValue APIs, new access is through ConfigStore (no change to plugin API)
  • Most settings are defined at compile time (runtime only settings are still posible), so default values, documentation etc only have to be provided once in the source code, and markdown documentation for settings can be auto generated (TODO)

Unrelated changes

  • Fixed some bugs with LSP documents getting out of sync, diagnostics not updating when editing, etc

TODO

  • generated markdown documentation for all settings declared at compile time
  • declare all known settings at compile time

Closes #11

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.

Improve how settings are handled
1 participant