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

Add the regex language parser for JSON #34

Merged
merged 1 commit into from
Jul 13, 2023

Conversation

daxian-dbw
Copy link
Contributor

  • Add a regex parser for JSON, to generate tokens for keys, strings, numbers, and constants of a Json code block.
  • Removed the json alias from the JavaScript language parser.

Before this change

Keys and value strings are NOT differentiated, and number is not highlighted:

image

After the change

Keys and value strings are differentiated, and number is highlighted:

Dark theme screenshot:

image

Light theme screenshot:

image

@daxian-dbw
Copy link
Contributor Author

@michael-hawker gentle ping :) Can you please review this PR? Thanks!

Copy link
Member

@michael-hawker michael-hawker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@niels9001 any thoughts on the coloring scheme. @daxian-dbw were these picked to match an existing editor, arbitrarily, or from some guidance somewhere?

@daxian-dbw
Copy link
Contributor Author

daxian-dbw commented Jul 10, 2023

It's sort of picked with the reference of how JSON code block is displayed in bat and glow:

I chose to use the same color as bat for JSON keys, but the color used for string value in bat doesn't look good in white background. bat doesn't differentiate JSON constant from numbers, so I borrowed the number color used in glow for that.

bat

image

glow

image

@michael-hawker michael-hawker merged commit 34878ac into CommunityToolkit:main Jul 13, 2023
3 checks passed
@daxian-dbw daxian-dbw deleted the json branch July 13, 2023 17:24
@daxian-dbw
Copy link
Contributor Author

Thanks for the review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants