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 highlighting stops after a markdown block #81

Open
DannyBen opened this issue Dec 20, 2021 · 8 comments
Open

Syntax highlighting stops after a markdown block #81

DannyBen opened this issue Dec 20, 2021 · 8 comments

Comments

@DannyBen
Copy link

This used to work well in previous versions of sublime (or the plugin), but now markdown blocks break the syntax highlighting.

image

@deathaxe
Copy link

This issue is fixed in Slim 2.0.

Slim 2.0 for ST4 has been released at Package Control, with source moved to https://github.com/SublimeText/Slim.

@DannyBen
Copy link
Author

Thanks - I noticed that my slim syntax changed, but in my opinion - it changed for the worst. Not sure if it is another bug or the intended highlighting.

I don't remember exactly how it was before, but class names now have a different color. It throws the entire balance for me.

image

@deathaxe
Copy link

The scopes used for various tokens are equal to those which HTML uses for same semantically constructs.

As .row.grow.scroll expands to <div class="row grow scroll" a meta.attribute-with-value-class string scope has been choosen.

grafik

Tags such as div, a, img are scoped meta.tag entity.name.tag as they are in HTML. Them not being highlighted seems to be a color scheme issue.

The following screenshots show your code snippet with Mariana and a tweaked Brackets Dark:

grafik

grafik

I agree string scope for class names to probably be a bit overused. Not quite sure about proper alternatives though.

@DannyBen
Copy link
Author

DannyBen commented Jan 13, 2023

I think that previously, they received the same color as div, which made more sense to me, as the below snippet would render all in the same color, except #bloomberg-logo - which felt right, since they all do the same thing of opening a new block.

The fact that these classes are strings in another format are arguably less relevant, no?

.row.grow.scroll
  .panel.side-panel
    div#bloomberg-logo

I am not 100% sure how it was - maybe just the first class was with the same color as div?
I remember it was easy to read: .row then .panel then div.

@deathaxe
Copy link

With former Slim the first class name was not scoped and the following ones received entity.other.attribute-name which is semantically wrong, IMHO. Those are rather attribute values.

grafik

grafik

The fact that these classes are strings in another format are arguably less relevant, no?

This is basically correct and I've spend some time to come up with a proper decision.

I guess something like entity.name.class and entity.name.id would be appropriate as tags are already scoped entity.name.tag. Need however to make sure nothing bad happens as entity.name.class is used for class definitions in all kinds of source syntaxes. But I guess anything would be better than string.

@DannyBen
Copy link
Author

I understand your point. These last screenshots are as I remember it. They made much more sense to me.

I know that the classes in .row.grow.scroll are "the same" - but since 'row is first, it made it clear and semantic.
I guess I subconsciously also developed my classes so that they work well with the slim syntax.

I feel that the first class (if it appears on its own row, like in our example) should be in a different color, like any other "block starter" - but I totally understand the dilemma.

The thing is, that the new syntax sort of reminds me of how sublime looks when you "borrow" a syntax from another language, since the language you are using does not have proper highlighting (imaging using YAML highlighting for TOML files). It feels very off balance, like the highlighting logic does not "understand" the importance of the tokens.

@deathaxe
Copy link

Attribute shortcuts are scoped meta.attribute-shortcut entity.name.attribute as of Slim 2.0.1.

So they can be highlighted with a unique color. The first one in a line won't however receive a dedicated scope as it doesn't have a special meaning semantically.

grafik

grafik

Note:

Different highlighting of classes and ids can be configured by a color scheme via following scopes:

  • #id is scoped entity.name.attribute.id
  • #class is scoped entity.name.attribute.class

@DannyBen
Copy link
Author

Cool. The screenshot looks better already, thanks for that.
I will be waiting for it to reach package control.

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

2 participants