EasySettings icon indicating copy to clipboard operation
EasySettings copied to clipboard

JSONDecodeError on Preferences.sublime-settings: default file has a trailing comma (ST4)

Open dpc00 opened this issue 1 month ago • 0 comments

Claude reports: opening Preferences.sublime-settings raises a traceback and no setting names are offered, because the default Preferences.sublime-settings that ships with Sublime Text 4 has a trailing comma, which json.loads in EasySettings.py rejects.

Tested on Sublime Text 4 build 4215 (Windows) with EasySettings 2018.08.30 from Package Control. Opening my User Preferences.sublime-settings printed this in the console (once for on_load_async, once for on_activated_async):

File ".../EasySettings.py", line 93, in parse
    return json.loads(content)
json.decoder.JSONDecodeError: Illegal trailing comma before end of array: line 163 column 58 (char 3029)

Fix, tested here with a loose copy: add import re and remove trailing commas before parsing:

return json.loads(re.sub(r',(\s*[}\]])', r'\1', content))

With that, no traceback is printed and typing "tab_si in the file and pressing Ctrl+Space lists tab_size, enable_tab_scrolling and the other settings.

dpc00 avatar Oct 23 '26 01:10 dpc00