| ▲ | SebastianKra 3 days ago |
| Assuming this takes off, there would be a prettier-plugin that corrects any weird formatting. When I think about it, any language should come with a strict, non-configurable built-in formatter anyways. |
|
| ▲ | theamk 2 days ago | parent | next [-] |
| Or you can have languages which do not depend on plugin or formatters to be correct. If you supposedly human writable config file format is unusable without external tools, there is something wrong with it. |
| |
| ▲ | SebastianKra 2 days ago | parent [-] | | I don't know what weird utopian language you're using, but I have yet to see a one that can't be made unreadable by bad formatting. Just use a formatter and stop bikeshedding please. | | |
| ▲ | theamk 2 days ago | parent [-] | | it's config file, so they are often edited in unusual configurations without normal editors present. And they are often not checked in the source code, so there is no standard way to add linter. And KSON is pretty unique in how bad is it. For example, go to playground and remove a single dot in line 11 (after the books list). Look how the parse tree changes - this 1-character edit means the file is still valid, but the rest of the file is now filed under one of the books. Do you know of any other config language with this property - a single character removed yields a syntactically correct file which yet parses absolutely incorrectly? I don't. Worst I can think of is maybe one section parses weirdly, or next element of a list. But something like _entire rest of file_ is broken is unique to KSON. | | |
| ▲ | SebastianKra 2 days ago | parent [-] | | Not sure how big of a deal that would actually be when you consider schema validation by the app, but you have a point. Btw, I love JetBrain's SSH sync for keeping my config files in VCS and editing them with proper tooling. |
|
|
|
|
| ▲ | stronglikedan 3 days ago | parent | prev [-] |
| > any language should come with a strict, non-configurable built-in formatter Would that be on the language, or the IDEs that support it? Seems out of scope to the language itself, but maybe I'm misunderstanding. |
| |
| ▲ | hiccuphippo 2 days ago | parent | next [-] | | I'd say a program or subcommand tha comes with the compiler/interpreter. Go has gofmt, zig has zig fmt.
The compiler already parses the language so a formatter is only a few steps from that. And being part of the compiler means it's always up to date, there's less bikeshedding, all IDEs and text editors get formatter support easily. | |
| ▲ | Kinrany 2 days ago | parent | prev [-] | | The languave server, which in this age of LSP should come from the same project as the language itself. |
|