Skip to content

settings.json parsing fails on the IDE2 backend if settings.json has comments #1945

Closed
@kittaakos

Description

@kittaakos

Describe the problem

VS Code, Theia, and IDE2 use a relaxed version of JSON for storing the settings in the settings.json file: https://code.visualstudio.com/Docs/languages/json#_json-with-comments

If I have the following settings.json content, it is entirely valid but does not work on the IDE2's backend:

JSONC:

{
  // "arduino.cli.daemon.debug": false
  // it's a valid jsonc
}

VS.

JSON:

{
  // "arduino.cli.daemon.debug": false
  // it's an invalid json
}

To reproduce

There are multiple silent problems, but here is a user-facing bug:

  • Enable arduino.sketch.inoBlueprint and verify that it works:| when you create a new sketch, your preferred default .ino content is used for the new sketch.
  • Open the settings.json and command out any other preference with //.
  • Restart IDE2 and create a new sketch. IDE2 creates the new sketch with the default content, not the user-defined one.

Expected behavior

  • IDE2 backend can handle JSONC in settings.json, not only JSON.
  • The suboptimal setting parsing on the IDE2 backend is single-sourced.

Arduino IDE version

2.0.4

Operating system

macOS

Operating system version

12.6.3

Additional context

No response

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest nightly build
  • My report contains all necessary details

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions