r/programminghorror • • 12d ago

VSCode JSON javascript and java? i prefer json instead

173 Upvotes

17 comments sorted by

80

u/MCWizardYT 12d ago

I could see this being a thing if it's being serialized from some sort of graphical editor but man.... If this exists as some kind of public thing I'd like to see it lol

42

u/JPBM1357 12d ago

This is how VSCode does things, if I'm not wrong this is how you define commands for it. Any public VSCode extension will probably have this

13

u/i_hate_shitposting 11d ago edited 11d ago

Yeah, this is just VS Code's schema for defining shortcuts that trigger custom commands. The vast majority of custom keybindings are way simpler, like so:

{
    "key": "alt+w",
    "command": "workbench.action.files.save"
},

The runCommands thing looks kind of gnarly if you're not expecting it, but honestly it feels like a pretty smart solution to allow more customizable bindings without having to support script evaluation and without forcing users to write custom extensions.

10

u/GoddammitDontShootMe [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” 11d ago

Is this just your VSCode keybindings?

4

u/NotAMeatPopsicle 11d ago

Ever worked with JSON holding serialized JavaScript that’s to be run to modify other elements and their properties?

Not sure if that’s special or a special kind of hell.

4

u/Sexy_Koala_Juice 10d ago

This isn’t horror at all.

3

u/Itchy_Tiger2497 11d ago

This person needs s-expressions in their life.

2

u/ArturJD96 10d ago

It exists and called JSONata - programming using jsonlike code for queries. I like it actually.

2

u/still_not_deleted 9d ago

This is genius, Tom's a genius

1

u/21Ali-ANinja69 8d ago

Ball knowledge

3

u/asmanel 12d ago

Can this works.

1

u/great_escape_fleur 8d ago

Any sufficiently advanced configuration language is turing complete

0

u/Environmental-Ear391 11d ago

JavaScriptObjectNotation ... Isn't it in the name that JSON is a subset of JavaScript...

between JavaScript and JSON... aren't they effectively the same thing?

I can understand the whole Java != JavaScript argument...

But JSON != JS ... like, come again? what!?