icsharpcode / AvalonEdit

The WPF-based text editor component used in SharpDevelop
http://avalonedit.net/
MIT License
1.85k stars 469 forks source link

Json.xshd fix #410

Open JNaumann86 opened 1 year ago

JNaumann86 commented 1 year ago

Hi people,

I just found an error in the json color scheme.

Bug If the json value is an object and the opening brace of the object begins on next line after the colon, then the next key value pairs will be treated as String / value and not as FieldName / key.

Json.xshd: Fix This is the fix for the bug, but I am not allowed to create a new branch / pull request :(

We would like to use this control in our app. But therefor the color scheme should be corrected :)

I hope to hear from you :)

Thank you very much!

Partial style with fixes:

<?xml version="1.0" encoding="utf-8" ?>

" " ' ' : , , true false null " " ' ' \{ \} \[ \] \b0[xX][0-9a-fA-F]+|(\b\d+(\.[0-9]+)?|\.[0-9]+)([eE][+-]?[0-9]+)?
JNaumann86 commented 1 year ago

We found also another bug with json arrays: Bug2 The second element of the array in a single line will not be recognized and all keys following the array will be treated as string.

This is the fix: Fix2

Partial style with both fixes: <?xml version="1.0" encoding="utf-8" ?>

" " ' ' : , , true false null " " ' ' \{ \} \[ \] \b0[xX][0-9a-fA-F]+|(\b\d+(\.[0-9]+)?|\.[0-9]+)([eE][+-]?[0-9]+)?

We are already using this style in our app and it works good :)

ltrzesniewski commented 9 months ago

I didn't notice this issue at first, but I made a PR which fixes this (albeit in a different way): #418.