Sublime Forum

Reset_font_size creates block comments in Preferences.sublime-settings

#1

In Sublime Text 4, executing reset_font_size commands, alternating with the increase_font_size command, would generate block comments in Preferences.sublime-settings like below

    /*"font_size": 15,*/
    /*"font_size": 13,*/
    /*"font_size": 13,*/

This causes burden, because Preferences.sublime-settings could change when there is no actual change.

If I remember it correctly, the behavior was not like this in ST3. The previous behavior was just removing the font_size key-value pair, if any, which is the behavior that I hope for.

Moreover, when I look into the implementation of the reset_font_size command in the Default/font.py in the current ST4, there seems to be no changes:

class ResetFontSizeCommand(sublime_plugin.ApplicationCommand):
    def run(self):
        s = sublime.load_settings("Preferences.sublime-settings")
        s.erase("font_size")

        sublime.save_settings("Preferences.sublime-settings")

Can anyone please explain the rationale for this (i.e. block commenting instead of removing)? Is this intended or can this be restored as before?

0 Likes

#2

This is how ST API and saving settings is designed to work. Erased keys are commented out to prevent their information from being lost.

0 Likes

#3

Thank you for the reply and clarification. For the reason above, to me this is not a good design, frankly.

0 Likes