microsoft / microsoft/node-jsonc-parser

Perhaps trailing commas should be enabled by default

Offen
#103 2 Kommentare 8 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
TypeScript
Sterne
759
Forks
66
Ø Merge
5 T. 10 Std.
Gemergte PRs (30 T.)
7

Beschreibung

For any use of JSONC that is user-facing in VS code, for example in a .jsonc file saved by the user, or even the user settings JSONC file, trailing commas don't trigger an error:

  1. User config example:

    Image
  2. Standalone .jsonc file example:

    Image
  3. Only in .json is it shown as an error:

    Image

Visual Studio Code's own uses of JSONC seem for uses where trailing commas are desired, like the user config. An intended strength of the JSONC format seems to be easy user editing and writing. For "strict" uses of automatically generated files where the syntax is meant to stay super correct, there's still JSON as there always was as the more common choice.

Based on this, I would suggest that perhaps trailing commas should be enabled in the parser by default, so that e.g. parsing the VS Code config in JSONC works without manual changes.

I'm sure some will disagree, but the option to turn it off would remain in any case.

(Please note I'm not suggesting to remove the warning in the VS Code UI about trailing commas as discussed here, since I realize other JSONC parsers might still treat this differently.)

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit dem Standardwert der Parser-Option in src/impl/parser.ts an der verlinkten Stelle und untersuche anschließend, wie nachgestellte Kommas an anderer Stelle im Repository abgedeckt sind. Ermittle, ob ihre standardmäßige Aktivierung das Opt-out-Verhalten beibehält, und aktualisiere die relevanten Parser-Tests, um beide Standardwerte zu bestätigen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
typescript
Bereich
devtools
Issue-Typ
Feature
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Aktiv
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.