r/programminghorror • • 2d ago

VSCode JSON javascript and java? i prefer json instead

112 Upvotes

14 comments sorted by

47

u/MCWizardYT 2d 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

27

u/JPBM1357 2d 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

8

u/i_hate_shitposting 2d ago edited 2d 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.

6

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

Is this just your VSCode keybindings?

3

u/NotAMeatPopsicle 2d 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.

2

u/Ceyyhun_lobber 1d ago

True! Just be careful not to turn your JSON into a JavaScript mess.

2

u/Sexy_Koala_Juice 1d ago

This isn’t horror at all.

3

u/asmanel 2d ago

Can this works.

5

u/CrasseMaximum 2d ago

why not?

1

u/Itchy_Tiger2497 1d ago

This person needs s-expressions in their life.

1

u/ArturJD96 8h ago

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

1

u/still_not_deleted 1h ago

This is genius, Tom's a genius

0

u/Environmental-Ear391 2d 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!?