Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Add JSON5 support #241

Open
sXNA opened this issue Apr 14, 2024 · 3 comments
Open

[Feature request] Add JSON5 support #241

sXNA opened this issue Apr 14, 2024 · 3 comments
Labels
json Caused by the json lexer

Comments

@sXNA
Copy link

sXNA commented Apr 14, 2024

Could you add JSON5? Currently only comments work.

@rdipardo
Copy link
Contributor

A link to a language spcification is needed here, to avoid the misunderstanding that JSON5 is merely "JSON with comments": https://json5.org/#summary-of-features

The original downstream issue notes, for example, that single-quoted strings are lexed as errors: notepad-plus-plus/notepad-plus-plus#14992

@nyamatongwe nyamatongwe added the json Caused by the json lexer label Apr 14, 2024
@genieyr
Copy link

genieyr commented Sep 23, 2024

It's highlighted as red

lineBreaks: "Look, Mom! \
No \\n's!"

are there any news about implementation JSON5?

@pryrt
Copy link

pryrt commented Nov 7, 2024

Because there is no JSON5 option for Lexilla's JSON lexer, it also doesn't handle unquoted keys, which JSON allows.

And as a result, code folding is incorrect on JSON5 with unquoted keys (see this discussion in the Notepad++ forum; verified with SciTE 5.5.3/Lexilla 5.4.1 in that discussion). Here is the example JSON5 text:

    {
      key: 1,
      name: "更新提示",
      quickFind: true,
      matchTime: 10000,
      actionMaximum: 1,
      resetMatch: "app",
      activityIds: [
        "net.csdn.csdnplus.activity.MainActivity",
        "net.csdn.csdnplus.activity.SetActivity",
      ],
      rules: [
        {
          matches: "[id=\"net.csdn.csdnplus:id/update\"] -2 [id=\"net.csdn.csdnplus:id/cancel\"]",
          snapshotUrls: [
            "https://i.gkd.li/import/12673693",
            "https://i.gkd.li/import/12673654",
          ],
        },
      ],
      enable: false,
    }

... which only folds from line1 to line11 instead of line1 to line 22.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
json Caused by the json lexer
Projects
None yet
Development

No branches or pull requests

5 participants