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

(Inline) Descendant combinator is not recognised properly #41

Open
futursolo opened this issue Sep 12, 2021 · 3 comments · Fixed by #42
Open

(Inline) Descendant combinator is not recognised properly #41

futursolo opened this issue Sep 12, 2021 · 3 comments · Fixed by #42
Labels
bug Something isn't working postponed

Comments

@futursolo
Copy link
Owner

For the following stylesheet:

.class-a.class-b {
    color: red;
}
.class-a .class-b {
    color: blue
}

For inline syntax, the input above yields the following stylesheet:

.class-a.class-b {
    color: red;
}
.class-a.class-b {
    color: blue;
}

After consulting the documentation of proc_macro2, I am not sure what's the best course of action to solve this issue.
(I don't think possible to detect spaces between Ident and Punct.)

@WorldSEnder Any ideas?

@futursolo futursolo added the bug Something isn't working label Sep 12, 2021
@WorldSEnder
Copy link
Collaborator

Detecting spaces in token-trees is a hard thing to do. I think the best course right now is to heavily document this. A simply workaround without ambiguity (I think) and not having to detect the space is to prefer the following syntax:

.class-a *.class-b {
    color: blue
}

which is actionable and could be implemented to act correctly (possible have to adjust fragment_spacing). Also, in nightly rust, this can be detected. To give another example where also spacing mucks up the current implementation, although I can't think of an actual css that uses it:

prop: ident --ident;
   // ------------- parsed as a single identifier `ident--ident`

Same underlying reason that it's not possible to detect the spacing in stable rust.

@futursolo
Copy link
Owner Author

This issue is mitigated in #42.

The proper solution requires rust-lang/rust#54725 to become available in stable Rust.

@WorldSEnder
Copy link
Collaborator

Proc macro's source_text has been stabilized, so this might be feasible to implement now. At least recognizing spaces is now no problem any longer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working postponed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants