Open lovesegfault opened 5 years ago
That would mean breaking the compatibility with all installs of waybar. The user-base might be small, but this still would cause a lot of troubles.
@cafehaine Not necessarily, the old config could remain, but be removed from wiki/readme and left alongside the TOML one for some time. If you load the old config format it works with a deprecation warning.
A breaking change nonetheless, but with a nice adaption period.
The great thing about yaml is that you can actually use a yaml parser to parse json. So that would kind of ensure backwards compatibility with older configs, the only problem being the //
comments.
A dirty way to convert old config to yaml:
cat ~/.config/waybar/config | sed 's|//.*$||' | yq -y .
(this won't work if you have //
in a string somewhere, but you get the idea)
+10 i'm really confused about that choice...
Toml is a bad choice too : https://hitchdev.com/strictyaml/why-not/toml/ Yaml is still the easier and cleaner human readable configuration language and would be a great choice for that kind of project.
@eoli3n Agree to disagree and I'll avoid bikeshedding this :laughing:
FWIW, current format is just "a JSON variation", it's called jsonc
, and actually used by plenty of tools. So I wouldn't discredit is as non-standard.
Any news ?
FWIW, current format is just "a JSON variation", it's called
jsonc
, and actually used by plenty of tools. So I wouldn't discredit is as non-standard.
I was only able to find that VS Code uses this format for configuration. What other tools were you talking about here?
Off the top of my head, nvim-coc
uses jsonc
, as do flatpak manifests (example). I guess waybar
also counts on this list really. There's plenty of libraries for working with jsonc
in various languages too.
I'm sure I've seen other applications, but my memory is bad.
Most of these tools use the .json
extension, which is a bit annoying since editors are bad at figuring out it's actually jsonc
.
I don't think popularity is that important though; it's very easy to explain that jsonc
is just "json with comments", and it's not like end users have to learn an entirely new format.
That said, I don't disagree with the initial criticism of JSON. But there's also a lot of valid criticism for YAML (e.g.: type handling). TOML is bad for highly nested structures, or when you have a large set of files that share a schema. For a configuration format like waybars, it's actually not a bad candidate.
Ultimately though, I think this falls into bikeshedding a bit. A PR showing pros and cons of a change is probably best at this point.
I think it is unnecessary to criticize json or jsonc now, but it is necessary to add support for yaml files, and the format of yaml is obviously more beautiful
It boggles my mind that I can't get syntax highlighting...
It boggles my mind that I can't get syntax highlighting...
May I ask which editor you use? For vim you can use the jsonc syntax highliting by installing vim-polyglot.
+1 for yaml configuration
It boggles my mind that I can't get syntax highlighting...
May I ask which editor you use? For vim you can use the jsonc syntax highliting by installing vim-polyglot.
Did you read this issue thread at all?
I just wanted to ask if we can have a defined schema too, especially in the current JSON config. The schema can be included in with the $schema
key (See https://json-schema.org/).
Right now the configuration file's format is a weird JSON variation with
//
comments, at least as I understand it.It'd be nice if we, instead, used a more config-friendly format (such as TOML or even YAML) that allowed for things like comments. Moreover, it'd be useful if the file was called
config.json
orconfig.toml
so that editors can pick-up the filetype automatically.I'll leave a link to an article I enjoy on why JSON is a poor choice for a configuration language: https://www.lucidchart.com/techblog/2018/07/16/why-json-isnt-a-good-configuration-language/