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

Added container at-rule support #15

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

wileycoyote78
Copy link

The @container rule is similar enough (if not down right identical) to the @media rule. Copied and pasted the @media lines, replaced the regex to look for @container instead of @media. All other patterns should work the same, so no need to create new ones.

The @container rule is similar enough  (if not down right identical) to the @media rule. Copied and pasted the @media lines, replaced the regex to look for @container instead of @media. All other patterns should work the same, so no need to create new ones.
@wileycoyote78
Copy link
Author

@microsoft-github-policy-service agree

Added comments on what I changed.
Added 'aspect-ratio' to the Standard CSS list
Comment on lines +14 to +15
Saw that someone had created a pull request to add color syntax to the properties, but not the at-rule (see PR#14). After studying the cson file, I realized that the existing @media rule is basically identical to the new @container rule. Just copied and pasted the @media rule lines, and changed the regex lines to look for 'container' instead of 'media'.
This, however, still does not correct the problem that any properties (i.e. padding, margin, etc.) inside an @container block do not display a description thumbnail thingy when hovering over them.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@container preludes are completely different from @media preludes.

Does this change account for this difference?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also agree with @romainmenke above. Media queries and container queries are different, and should be treated differently.

As an aside, this text excerpt should not be put in the repo's README. Rather, it should be in the PR's description.

@romainmenke
Copy link
Contributor

Also try to keep in mind that any at-rule that you reference here on GitHub is a ping to some person/account :)

You can wrap them in backticks to prevent that.

@wileycoyote78
Copy link
Author

wileycoyote78 commented Sep 8, 2023 via email

@andreamah
Copy link
Contributor

If it should not be in the Readme, please remove it from the PR.

Is there any way that you can add a more concise way of incorporating syntax highlighting for @container? Although adopting the rules for @media would be a quick fix, I'd prefer something more accurate so that it works long-term.

@wileycoyote78
Copy link
Author

wileycoyote78 commented Sep 8, 2023 via email

@andreamah
Copy link
Contributor

If you look at the differences between media queries and container queries in their docs, you can see that they use different keywords (ie: media features vs. the specific container descriptors).

The CSON file specifically addresses media features for @media, hence using the exact same ones for container may be strange.

'media-features':

@wileycoyote78
Copy link
Author

If you look at the differences between media queries and container queries in their docs, you can see that they use different keywords (ie: media features vs. the specific container descriptors).

The CSON file specifically addresses media features for @media, hence using the exact same ones for container may be strange.

'media-features':

I get what you are saying, however, this solution would only be "strange" if people start writing up something like @container mycontainer (prefers-reduced-motion: reduce) ...

'name': 'support.type.property-name.media.css'

I am assuming from line 1198 that there would be another file involved to help support a specific section for "container-features," though that would be beyond my expertise if so.

So it is a patch for now until full support for the rule is added.

@wileycoyote78
Copy link
Author

By the way, I seem to be unable to remove the README from the PR..?

@andreamah
Copy link
Contributor

If you look at the differences between media queries and container queries in their docs, you can see that they use different keywords (ie: media features vs. the specific container descriptors).
The CSON file specifically addresses media features for @media, hence using the exact same ones for container may be strange.

'media-features':

I get what you are saying, however, this solution would only be "strange" if people start writing up something like @container mycontainer (prefers-reduced-motion: reduce) ...

'name': 'support.type.property-name.media.css'

I am assuming from line 1198 that there would be another file involved to help support a specific section for "container-features," though that would be beyond my expertise if so.

So it is a patch for now until full support for the rule is added.

We don't want to highlight invalid syntax as if it were valid. Even if we were to introduce a patch, I would prefer something incomplete (ie: not covering all container queries and cases) rather than something that is incorrect. This way, we can try to keep the grammar better in the long-term.

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 this pull request may close these issues.

5 participants