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 for nested elements is broken #5

Open
marcofugaro opened this issue Jul 15, 2020 · 4 comments
Open

Syntax highlighting for nested elements is broken #5

marcofugaro opened this issue Jul 15, 2020 · 4 comments

Comments

@marcofugaro
Copy link

When using nesting, the selectors are highlighted as css properties. They should be highlighted as selectors instead.

Current behaviour Expected behaviour
Screenshot 2020-07-15 at 17 29 45 Screenshot 2020-07-15 at 17 30 20
@jonathantneal
Copy link
Collaborator

jonathantneal commented Jul 17, 2020

@marcofugaro, you are correct. A goal of this language extension is to handle both the syntactically valid possibilities of https://www.w3.org/TR/css-syntax-3/ as well as those achievable in most PostCSS plugins.

As defined in the CSS syntax, your example would produce a faulty img declaration (thus the color coding) that never ends until the .wrapper closes. Reference: https://drafts.csswg.org/css-syntax/#consume-list-of-declarations

However, I believe PostCSS performs a special "look-ahead" to reconsume your code (lines 2-4) as an inner-rule. I think I can and should add this same ability to this language extension. Thanks for bringing this to my attention.

@Shaker-Hamdi
Copy link

Any updates on this?

@toddprouty
Copy link

toddprouty commented Jan 18, 2023

@Shaker-Hamdi, I ended up installing an alternative extension, PostCSS Intellisense and Highlighting. It handles nested syntax highlighting and Emmet abbreviations, and I haven't noticed any other issues.

From the description:

This extension is a mixed of two famous extensions postcss-language and vscode-postcss-language.

@SceptreData
Copy link

@toddprouty this is what I ended up doing, albeit with some minor grumbling. As far as I know it uses the scss language server. I don't know enough about any of this to say if that's good or bad but it's probably not ideal!

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

5 participants