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

Settings v2 #5815

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft

Settings v2 #5815

wants to merge 7 commits into from

Conversation

krlvi
Copy link
Member

@krlvi krlvi commented Dec 11, 2024

The broader goal here is to create a good setup for application settings that is ergonomic for users, easy to work with and not error prone. In general, what VSCode does with settings is great and probably a good target - a user can use the UI or edit the JSON, the settings are portable.

Requirements:

  • Settings file is user-editable
  • If the settings file contains mistakes (eg. missing commas etc) it does not break the app
  • The settings file should not contain entries for all defaults values in existence
  • Allow nesting/grouping of related configs
  • The settings should be editable via the UI as well and have those changes reflected in the same file (similar to VSCode)
  • The app should watch/listen for updates in the settings file and upon change reflect that in it's behavior (e.g. need to update the UI)
  • Clear /discoverable defaults
  • Within Rust, settings structs fields should not be Options if there are well defined defaults (development ergonomics)
  • Should be hard to mess something up when adding new config structs or fields to existing structs and their respective update APIs
  • If the settings json file contains comments, the app should not mess with those upon settings changes via the UI

Outstanding questions:

  • Where should the settings file live? ~/.config/gitbutler/settings.json, ~/.gitbutler.json? Somewhere else? How about Windows?
  • Maybe temporarily skip the requirement for preserving comments in the json to simplify implementing?

TODOs:

  • More tests
  • APIs for UI
  • Filesystem watching for the settings file & appropriate actions
  • Preserve comments in the json

Out of scope here:

  • Adopt in typescript
  • Migrate existing settings to the new format
  • Remove LegacySettings and the tauri store plugin

Copy link

vercel bot commented Dec 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
gitbutler-components ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 17, 2024 10:31am
gitbutler-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 17, 2024 10:31am

Copy link
Collaborator

@Byron Byron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am really excited to see this new settings system come to life!

Given our recent conversation I felt compelled to comment early, despite the draft status and hope you don't mind.

crates/gitbutler-settings/src/persistence.rs Outdated Show resolved Hide resolved
crates/gitbutler-settings/src/persistence.rs Show resolved Hide resolved
crates/gitbutler-settings/vendor/util/src/lib.rs Outdated Show resolved Hide resolved
crates/gitbutler-settings/Cargo.toml Outdated Show resolved Hide resolved
crates/gitbutler-settings/vendor/util/src/lib.rs Outdated Show resolved Hide resolved
@krlvi
Copy link
Member Author

krlvi commented Dec 12, 2024

I am really excited to see this new settings system come to life!

Given our recent conversation I felt compelled to comment early, despite the draft status and hope you don't mind.

Thank you, this was really helpful. I have now implemented your feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rust Pull requests that update Rust code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants