Home Download Buy Blog Forum Support

Preferences json not yaml?

Preferences json not yaml?

Postby delucia on Wed Apr 13, 2011 1:34 am

I noticed that the preferences are written in json which is nice and easy to edit. However I think yaml would be a better choice because it relies on indentation which makes it easy to read like python syntax. I see json more of a transport protocol and yaml for human readable markup.

Thanks
delucia
 
Posts: 16
Joined: Wed Apr 13, 2011 1:29 am

Re: Preferences json not yaml?

Postby jbrooksuk on Wed Apr 13, 2011 8:14 am

To change it now would be a big change.

There is also nothing wrong with JSON and it's regarded as the most popular format for such things :)
jbrooksuk
 
Posts: 775
Joined: Sun Apr 11, 2010 10:37 am
Location: England

Re: Preferences json not yaml?

Postby delucia on Wed Apr 13, 2011 1:16 pm

json is good but yaml is better (in this case). Isn't your goal to be sublime?

I would like you to take a look at it because many times a big change ends up being not that bad after it's done.
delucia
 
Posts: 16
Joined: Wed Apr 13, 2011 1:29 am

Re: Preferences json not yaml?

Postby jbrooksuk on Wed Apr 13, 2011 1:58 pm

delucia wrote:json is good but yaml is better (in this case). Isn't your goal to be sublime?

I would like you to take a look at it because many times a big change ends up being not that bad after it's done.

I know how YAML works, it's not bad, but to me, and I'm sure others JSON makes it far easier to understand what is going on.
jbrooksuk
 
Posts: 775
Joined: Sun Apr 11, 2010 10:37 am
Location: England

Re: Preferences json not yaml?

Postby delucia on Wed Apr 13, 2011 2:57 pm

Can we see sublime-keymap in json and yaml and compare?
delucia
 
Posts: 16
Joined: Wed Apr 13, 2011 1:29 am

Re: Preferences json not yaml?

Postby jbrooksuk on Wed Apr 13, 2011 4:27 pm

delucia wrote:Can we see sublime-keymap in json and yaml and compare?

If you'd like to convert it then ok.
jbrooksuk
 
Posts: 775
Joined: Sun Apr 11, 2010 10:37 am
Location: England

Re: Preferences json not yaml?

Postby Anomareh on Wed Apr 13, 2011 5:43 pm

Aye, I agree YAML would have been a much better choice. Off the top of my end I think there would be a lot less escaping needs and it'd be much more readable and easier to maintain, which is good for config files. Right now with JSON it's rather curly brace hell and it's very easy to get lost in all the nested brackets and braces.

Perhaps there was a technical limitation of some sort?
Anomareh
 
Posts: 222
Joined: Thu Oct 01, 2009 7:32 pm

Re: Preferences json not yaml?

Postby delucia on Thu Apr 14, 2011 2:00 pm

Ok here is segment of the keymap file and the equivalent in yaml. I think the yaml is leaner and easier to read.

JSON:

[
{ "keys": ["backspace"], "command": "left_delete" },
{ "keys": ["shift+backspace"], "command": "left_delete" },
{ "keys": ["ctrl+shift+backspace"], "command": "left_delete" },
{ "keys": ["delete"], "command": "right_delete" },
{ "keys": ["enter"], "command": "insert", "args": {"characters": "\n"} },
{ "keys": ["shift+enter"], "command": "insert", "args": {"characters": "\n"} }
]

YAML:

- keys: [backspace]
command: left_delete
- keys: [shift+backspace]
command: left_delete
- keys: [ctrl+shift+backspace]
command: left_delete
- keys: [delete]
command: right_delete
- keys: [enter]
command: insert
args: {characters : "\n"}
- keys: [shift+enter]
command: insert
args: {characters : "\n"}
delucia
 
Posts: 16
Joined: Wed Apr 13, 2011 1:29 am

Re: Preferences json not yaml?

Postby ironcladlou on Tue Apr 26, 2011 3:38 pm

As a programmer, I can appreciate the convenience of JSON as a portable and well-supported format.

As an end-user, I struggle to imagine a more unreadable mess for dealing with a large configuration system such as Sublime's. I never thought I'd find myself missing XML (for the keymaps).

To me this is brace/bracket/quoted literal/string escaping-hell. Definitely a step backwards from the previous "custom directive" syntax (or whatever it was in ST1) in terms of usability, IMO.

YAML is slightly better.

Anything that uses symbols rather than quoted string literals for keys would be a slight improvement. Like Ruby hashes, or even Javascript associative arrays, all of which are painlessly converted to JSON or other associative array structures.

Maybe I'm missing something, but I think this is a case where there's a benefit to eating the pain of conversion on the backend (from a proprietary syntax) for the sake of the user.
ironcladlou
 
Posts: 2
Joined: Thu Feb 24, 2011 5:48 pm

Re: Preferences json not yaml?

Postby Pwipwi on Tue Feb 07, 2012 10:36 am

Is the debate over already ?

I'd also like to throw in some support for YaML. After all, the resulting data type are the same, and not only do we avoid the { } hell, we also avoid the " " hell for property names.

Maybe would it be possible to at least give us the choice ? Like an option that says "Read .yml config files, then .json" or the inverse or so ?
Pwipwi
 
Posts: 11
Joined: Tue Feb 07, 2012 10:31 am

Next

Return to Ideas and Feature Requests

Who is online

Users browsing this forum: No registered users and 9 guests