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

syntax/json: Add comment support to the syntax highlighting #3434

Merged
merged 2 commits into from
Aug 19, 2024

Conversation

JoeKar
Copy link
Collaborator

@JoeKar JoeKar commented Aug 19, 2024

This feature already has a quite long story:

Since micro already uses json5 to parse his own internal json configurations and we changed the default behavior of the comment plugin to set // as the default comment type within json via #3388 it's just a logical step to highlight it correctly in json's (reused #2736). It was and it will be up to the user if he/she places comments with micro in json, because he/she should know if the file is parsed with a json5 parser or not.
Especially since #3343 it's much more easy to edit micro's own configurations in micro itself by just reloading the changed files. As long as set, reset, bind and unbind (hopefully I didn't forget anything) isn't used micro doesn't rewrite the settings by his own and the comments are kept.

Additionally we can think about adding hjson (#2203) and jsonc (#2704) to the same json syntax definition, instead of creating new file types. The latter one is arguable, since via syntax includes it's also easy to extend/override definitions.

@JoeKar
Copy link
Collaborator Author

JoeKar commented Aug 19, 2024

Adding hjson to json seems to go too far, since # (supported as comment in hjson) is not allowed by a json5 parser. So #2203 is still valid, but can be reduced afterwards.
Most probably it's the same for jsonc, which allows unquoted values.

For now we keep the PR as is and maybe consider the rest afterwards.

@JoeKar JoeKar merged commit cc195b6 into zyedidia:master Aug 19, 2024
3 checks passed
@JoeKar JoeKar deleted the feature/json-comments branch August 19, 2024 20:16
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.

3 participants