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

Also see JSON(5) rewrite in core #1

Closed
michaelblyons opened this issue Nov 15, 2021 · 9 comments
Closed

Also see JSON(5) rewrite in core #1

michaelblyons opened this issue Nov 15, 2021 · 9 comments

Comments

@michaelblyons
Copy link

In case you missed it, there's a JSON/JSONC/JSON5 effort ongoing at sublimehq/Packages#3097

That doesn't mean you should necessarily stop working on this. But if you have some JSON5 familiarity, you could test the proposed changes.

@bschwind
Copy link
Owner

Oh wow, I had no idea this was out there, thanks for the heads up!

I would much rather have it be managed in the official repo, so I'll be checking that out soon.

@jrappen
Copy link

jrappen commented Nov 17, 2021

The test repo for that PR is at https://github.com/jrappen/sublime-json , where I'm currently breaking stuff and trying out a few things. I will delete the test repo though, as soon as that PR moves from "draft" status to "in review".

Trying to get a solid base that works with a few JSON flavors.

If you have any feedback, I'll take it. Thanks.

@bschwind
Copy link
Owner

Thanks, @jrappen ! I'll test out the JSON5 parts now.

@bschwind
Copy link
Owner

@jrappen actually one immediate question since I'm not very familiar with sublime package development - how do I test this properly? Can I clone the test repo somewhere and point sublime to it, or is it more involved than that?

@michaelblyons
Copy link
Author

michaelblyons commented Nov 23, 2021

Clone it somewhere and symlink <sublime-dir>/Packages/JSON to the JSON folder in your clone. See the ReadMe for more detail.

@jrappen
Copy link

jrappen commented Nov 23, 2021

I assume you were confused by the Readme reference, Michael meant the Readme in the packages repo:

https://github.com/sublimehq/Packages

which has a few (more) instructions (for ST3, just remove 3 from the paths).

@bschwind
Copy link
Owner

@jrappen thank you! I was able to get it working. I haven't done a rigorous test yet, but one thing I noticed was all the object keys are highlighted yellow in the Monokai theme (I'll get a screenshot when I'm back on my desktop). Previously I was using an Hjson syntax to highlight JSON5 and it made the object keys blue when they were unquoted which seems a bit nicer, though I realize this is really a matter of opinion. What do you think?

@michaelblyons
Copy link
Author

You can always add a color scheme override (ST4 has a new Command Palette shortcut for this) to tweak the keys to what you want. I think keeping standard scope patterns is more important than a particular color scheme's choice of blue v. yellow. For instance, I use Mariana, but would like my keys to be white. So I have this JSON in an override to Mariana.sublime-color-scheme:

{
    //...
    "rules": [
        //...
        {
            "name": "JSON Keys",
            "scope": "meta.mapping.key.json string",
            "foreground": "var(white3)",
        },
        //...
    ]
}

@bschwind
Copy link
Owner

@michaelblyons ahhh thank you! That's definitely the more proper way to go about that. I haven't done any sublime package dev before and am very much a user of the "standard issue" stuff in sublime, sorry for the amateurish questions.

I'll keep using the current JSON5 syntax for a few days and see if I run into any issues.

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

No branches or pull requests

3 participants