Skip to content

Fix JSON highlighting - #418

Merged
siegfriedpammer merged 1 commit into
icsharpcode:masterfrom
ltrzesniewski:fix-json
Apr 12, 2025
Merged

Fix JSON highlighting#418
siegfriedpammer merged 1 commit into
icsharpcode:masterfrom
ltrzesniewski:fix-json

Conversation

@ltrzesniewski

@ltrzesniewski ltrzesniewski commented Dec 17, 2023

Copy link
Copy Markdown
Contributor

While doing icsharpcode/ILSpy#3138 I noticed the JSON highlighting was wrong (see the last 2 lines in the screenshot), so this PR fixes that.

EDIT: I noticed there's an issue for this, so this fixes #410.

Here's the difference for the following example:

{
    "String": "Value",
    "Bool": true,
    "Null": null,
    "Number:": -42e10,
    "Object": {
        "Foo:": "Bar",
        "Multiline Key"
            :
            "Value"
    },
    "Array": ["Foo", "Bar", "Baz"]
}

Before:

image

After:

image

The rule for numbers adds support for - and reformats the regex.

I also kept the existing single-quoted strings and hex numbers which are not part of the JSON spec.

@DamianSuess

Copy link
Copy Markdown

Any chance on this getting in?

@siegfriedpammer
siegfriedpammer merged commit a579b7d into icsharpcode:master Apr 12, 2025
@ltrzesniewski
ltrzesniewski deleted the fix-json branch April 12, 2025 12:23
@DamianSuess

Copy link
Copy Markdown

Thank you, Siegfried! 💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Json.xshd fix

3 participants