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

YAML not working very well? #11

Closed
avesst opened this issue Sep 4, 2023 · 7 comments · Fixed by #18
Closed

YAML not working very well? #11

avesst opened this issue Sep 4, 2023 · 7 comments · Fixed by #18

Comments

@avesst
Copy link

avesst commented Sep 4, 2023

Tried installing this on Sublime Text 4. It does not handle YAML very well:
image

@MatthiasPortzel
Copy link
Member

sublimehq/sublime_text#3590 has an example of what rule needs to be added for this.

@avesst
Copy link
Author

avesst commented Mar 3, 2024

Ah so this is a Sublime Text issue. Closing.

@avesst avesst closed this as not planned Won't fix, can't repro, duplicate, stale Mar 3, 2024
@MatthiasPortzel
Copy link
Member

MatthiasPortzel commented Mar 3, 2024

I don't think it's a Sublime Text issue—it's an issue with Sublime Text's default color schemes, that Catppuccin also suffers from. I'll take a stab at it. (Edit: not right now but at some point if I remember.)

@avesst avesst reopened this Mar 3, 2024
@MatthiasPortzel
Copy link
Member

MatthiasPortzel commented Mar 4, 2024

I'm not sure what the best path forward is so I'm going to post a bunch of screenshots and ask in the Catppuccin Discord for thoughts. Ideally we don't want to mess up JS that much, so I've got JS as a control on the right, next to JSON and YAML. The scopes that Sublime applies are totally different from VSCode. The weird part in my opinion is that in JSON and YAML, there's a "string" scope applied after (with more specificity) than the meta.mapping.key scope, so you have to target it explicitly or it gets highlighted as a string.

This is Sublime right now:
Screenshot 2024-03-03 at 7 12 50 PM

This is VSCode right now:
Screenshot 2024-03-03 at 7 16 14 PM

Option 1:
Screenshot 2024-03-03 at 9 30 49 PM

Option 2:
option2

I prefer Option 1, because it's more consistent and more semantic when programming. It makes keys everywhere blue. Option 2 kind of highlights the quoted keys in YAML and JSON, which some people might like.

Code block for both options
// Option 1:
{
    "name": "awdawd",
    "scope": "meta.mapping.key string, meta.mapping.key",
    "foreground": "var(blue)"
},
{
    "scope": "meta.mapping.key punctuation.definition.string.begin, meta.mapping.key punctuation.definition.string.end",
    "foreground": "var(overlay2)"
},

// Option 2:
{
    "name": "awdawd",
    "scope": "meta.mapping.key, meta.mapping.key.json string, meta.mapping.key string.unquoted",
    "foreground": "var(blue)"
},
{
    "scope": "meta.mapping.key punctuation.definition.string.begin.json, meta.mapping.key punctuation.definition.string.end.json",
    "foreground": "var(overlay2)"
}

@sgoudham
Copy link
Contributor

Hey @MatthiasPortzel, sorry meant to reply officially to this.

I believe @ghostx31 and I agree that Option 2 would be the way forward here as it seems to match VSCode the most under the various files. Little bit odd that "key" is always blue in JSON files but that seems to be a limitation across both options so not much we can do.

@ghostx31
Copy link
Member

Yep Option 2 is much better since we have to try to be as close as possible to VSCode.

Sublime's texmate engine has some limitations so there's nothing that we can do about it so it's cool to match VSCode as much as we can.

@MatthiasPortzel
Copy link
Member

MatthiasPortzel commented Mar 30, 2024

We can also match VSCode exactly. There are no Sublime limitations here. (The limitations in Sublime's engine come up in edge cases like JS arrow function definitions that have been split over multiple lines. And Sublime's engine, although backward-compatible with TextMate's, has become a lot more sophisticated.)

The difference between Sublime and VSCode is just how things are scoped. VSCode applies different scopes and scope precedences to things than Sublime does. So VSCode's coloring is natural in VSCode-land by just coloring "keys" as blue, and VSCode doesn't scope keys in JS objects as keys. Sublime does scope keys in JS objects as keys and so if we want them to not be colored, we need an extra rule to re-color keys in JS as text.

I can put up a PR today to match VSCode and we can see what it looks like.

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 a pull request may close this issue.

4 participants