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

Merge preferences with default ones #6

Open
tbruckmaier opened this issue Jul 18, 2021 · 4 comments
Open

Merge preferences with default ones #6

tbruckmaier opened this issue Jul 18, 2021 · 4 comments

Comments

@tbruckmaier
Copy link

Hi, thanks for your package, very useful! I think it would be even more handy, if the preferences of a certain profile would be merged with the default ones in User/Preferences.sublime-settings (and not completly overwritten).

There are some settings, which make sense to be the same in all profiles (hardware_acceleration, ignored_packages, dictionary, ...). Right now, I have to manually sync them.

This would be a breaking change, but maybe it can be an option per profile at least?

@tonsky
Copy link
Owner

tonsky commented Jul 19, 2021

My motivation for not merging was that I specifically didn’t wanted to undo settings that I make in my default profile.

But your use-case seems valid as well. Maybe non-default profiles can have a key in them that would define if default should be merged in? Something like profiles.merge_default which defaults to false if not specified?

Would you be willing to provide a PR?

@tbruckmaier
Copy link
Author

Yes, I can do that, though it might take a while.. if anyone else wants to step in, go for it

@tbruckmaier
Copy link
Author

Hey, just had a look at the code. It seems that right now, the config files get just renamed, and the config values itselves are never touched/parsed in python.

For this issue to be solved, we would have to implement the parsing & merging in python, and write the resulting merged dictionary to Preferences.sublime-settings. That would loose all formatting in that file though (order & comments). I have a lot of comments in my Preferences.sublime-settings file and would like to keep them. If we dont want to loose that information, we would need a workflow which backs up all profile files, and some way to switch back to the original?

I don't see a clean way how that could be implemented, so I leave it like that for now and just copy the duplicated config values. No need to make this perfectly fine plugin too bloated for little functionality gain, what do you think?

@tonsky
Copy link
Owner

tonsky commented Sep 14, 2021

Interesting! I lost hope in keeping comments in the config long ago. I think if you change anything through command (e.g. color scheme) ST reformats and deletes any comments? Anyways, I learned the hard way not to keep anything there.

But I agree it’s a loot of work and a lot of decisions. We’ll also need a way to store default prefs somewhere, as well as unmodified versions of profiles and merged ones.

It was a nice idea though, thank you for it! One day, maybe...

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

No branches or pull requests

2 participants