Closed keith-hall closed 7 years ago
While on the subject, maybe if one clicks to edit a boolean value, do you think it should automatically invert the value in the user preferences? i.e. in my example, I clicked scroll_past_end
, which defaults to true
- should it automatically copy it with a false
value into my user preferences? Or is there a case when people like to copy default values into their user preferences to make it clear that they want it configured that way? EDIT: sorry, probably should have put this as a separate issue as an RFC.
There was some code to detect whether the last setting value had a trailing comma, but I butchered it in some commit ago when I added the comma to the value scope selector for autocompletions. I fixed that and made the snippet append a comma to the added setting entry if the previous entry had one.
Regarding boolean values, I agree that it makes sense to toggle them in most cases, but I prefer consistency here because we can't do anything like this for the other value types.
I still don't think that this is quite right btw when there is no trailing comma, it seems to add a comma at col 0, followed by a newline, followed by the preference, so you end up with something like this:
from
"word_wrap": "auto"
}
to
"word_wrap": "auto"
,
"wrap_width": 0}
I fixed that in https://github.com/SublimeText/PackageDev/commit/8a3cf5c516d1f6e52f81fb0d78be4e5163ca3d6e already (which also led to me merging PRs since I was working on PD anyway).
I like to keep a trailing comma at the end of my settings to make it easier to add more key/value pairs without a diff affecting the previous line.
If I click the "edit"/pencil phantom on a setting that doesn't currently exist in my user preferences, it adds a new setting with an additional comma on the previous line (invalid syntax - defect) and not a trailing comma like I would like (valid syntax for ST JSON).
Please could this be smarter about when to add commas - i.e. keep the same style as is on the current last line before the plugin adds the new line (enhancement).