question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[json] add commas automatically

See original GitHub issue

Test case

untitledb2

Expected behavior

  • After typing age <kbd>TAB</kbd>, the comma should be added to the end of the previous line.
  • After typing " for the next object property, the comma should be added to the end of the previous line.

Actual behavior

The autocomplete does not produce valid text.

Discussion

In general, the autocomplete should strive to produce output that is maximally valid in whatever language grammar it is using.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:16
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
peteruithovencommented, Jan 28, 2022

It’s most annoying when you add a { and VS Code auto adds the } at the end. Screen record from 2022-01-28 15 17 53

I get in this situation all the time:

const value = {
  a: "a",
  b: {
    
  }
  c: "c"
}

It’s very common in Vue’s option syntax for example.

0reactions
fulldecentcommented, Nov 30, 2022

Got it @zardoy, I have updated the expected behavior above and added another behavior that doesn’t require auto complete

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add commas to list of JSON object - Stack Overflow
5 Answers 5 ; 3 · A sloppy but simple solution in Python: import json tmp = '{ "a" · "1" ; 1...
Read more >
Auto Insert Comma - Visual Studio Marketplace
Automatically insert JSON /javascript Object comma. ... Launch VS Code Quick Open ( Ctrl+P ), paste the following command, and press enter. Copy....
Read more >
How do add comma between two json objects when saving ...
Hello, This is how you will do this. JavaScript. function createData() { //original, single json object var dataToSave = {"result": '"' + ...
Read more >
Extra comma and line break added when formatting JSON ...
WEB-43410 JSON formatting adds trailing commas if "Insert missing commas on ... Run auto-formatting (Opt+Cmd+L) ... A line break is added after the...
Read more >
Trailing commas - JavaScript - MDN Web Docs
Trailing commas (sometimes called "final commas") can be useful when adding new elements, parameters, or properties to JavaScript code.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found