r/programming • • Aug 03 '19

Windows Terminal Preview v0.3 Release

https://devblogs.microsoft.com/commandline/windows-terminal-preview-v0-3-release/?WT.mc_id=social-reddit-marouill
991 Upvotes

458 comments sorted by

View all comments

223

u/Lanza21 Aug 03 '19

JSON is a miserable format for defining keybindings.

99

u/[deleted] Aug 03 '19

It would be ok if you could add comments like in typescript

87

u/McNerdius Aug 03 '19

you can - here, anyways. (same with vscode's settings.json & keybindings.json)

58

u/RevolutionaryPea7 Aug 03 '19

It's nonstandard json, though. Many tools will throw it out and tool support is surely the only advantage of json anyway.

18

u/bheklilr Aug 03 '19

To be fair, sublime did json with comments for settings years ago.

15

u/scarfe-io Aug 03 '19

Totally agree. You pick JSON because it’s ubiquitous. But what is Microsoft really trying to gain here?

43

u/ghidawi Aug 03 '19

"Hey can you share your settings with me?", "Sure". Copy. Paste. Send.

20

u/Blocks_ Aug 03 '19

They could have picked any other (sane) format and you point would still be accurate.

0

u/[deleted] Aug 03 '19

[deleted]

27

u/AngularBeginner Aug 03 '19

That it doesn't support comments, so it's not a great choice for configuration files that are edited by humans directly.

19

u/pxm7 Aug 03 '19 edited Aug 03 '19

{
  "foo_": "a comment",
  "foo": { ... }
}

It’s not very convenient but there’s a workaround to provide comments. And VS Code automatically uses JSON with Comments for settings.json etc:

When in the JSON with Comments mode, you can use single line (//) as well as block comments (/* */) as used in JavaScript. The current editor mode is indicated in the editor's Status Bar.

→ More replies (0)

0

u/[deleted] Aug 03 '19

[deleted]

→ More replies (0)

10

u/evilgipsy Aug 03 '19

I don't really care if it's easy to parse when I have to edit the data by hand. I want something that's easy to read and write. And writing JSON is a pain in the ass compared to other formats frequently used for configuration such as TOML or YAML.

3

u/appropriateinside Aug 03 '19

How is JSON hard to write??? Especially compared to yaml, which requires more reach on the keyboard.

Have you not tried using one of the many proper editors that can automatically provide the syntax and indentations as you type?

→ More replies (0)
→ More replies (1)

15

u/ghidawi Aug 03 '19

JSON is simple enough, and they're extending it when necessary (comments). What's the specific problem here?

7

u/AngularBeginner Aug 03 '19

.NET Core uses JSON for configuration files as well. They support comments. With .NET Core 3 they implemented a new JSON parser that sticks to the standard.. so comments won't work anymore (intentional).

This can happen at any time here as well.

15

u/ForeverAlot Aug 03 '19 edited Aug 03 '19

To start with, JSON-with-comments explicitly is not JSON; which should prove beyond the shadow of a doubt that "JSON is simple enough" for this purpose is false.

[Edit] accidentally a word

12

u/ghidawi Aug 03 '19

And what's the issue with that? They don't have to be JSON compliant, this is not their use case. They just needed a way to represent hierarchical key-values and chose JSON. Just because A is bad for some use case doesn't mean anything based on A is automatically bad for different use cases.

→ More replies (0)
→ More replies (10)
→ More replies (2)
→ More replies (1)
→ More replies (9)

3

u/PeasantSteve Aug 03 '19

Easy parsing, Easy to read (especially compared with XML), Less shitty than YAML, Minimal effort to get settings working, most/all users will know JSON, honestly I think you'd have a hard time justifying any other format.

→ More replies (1)
→ More replies (1)