Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Handle syntax highlighting of custom at-rules for Microsoft/vscode-css-languageservice#51 #142

Merged
merged 2 commits into from
Apr 4, 2019

Conversation

octref
Copy link
Contributor

@octref octref commented Jun 26, 2018

Description of the Change

This gives some basic highlighting to unknown at-rules. The rules are modeled after @media.

For example,

@some-rule () {

}

Will now receive correct highlighting on

  • @some-rule as keyword.control.at-rule.css
  • some-rule as punctuation.definition.keyword.css
  • Everything between { and } is tokenized as normal css
  • There is no tokenization between ( and ), as we don't know the argument format for the unknown at rule

Before:

image

After:

image

Spec: https://www.w3.org/TR/css-syntax-3/#consume-an-at-rule
Related: microsoft/vscode-css-languageservice#51
Motivation: Pre-processors that define custom at-rules, for example https://github.com/css-modules/postcss-icss-values

Benefits

Better syntax highlighting of unknown css rules.

Possible Drawbacks

None.

Applicable Issues

microsoft/vscode-css-languageservice#51

@lee-dohm
Copy link
Contributor

@50Wliu what do you think?

@winstliu winstliu self-assigned this Sep 12, 2018
@nathansobo nathansobo self-assigned this Apr 4, 2019
@nathansobo
Copy link
Contributor

Thanks very much!

@nathansobo nathansobo merged commit 6abc0a2 into atom:master Apr 4, 2019
@lleheny0
Copy link

@50Wliu @nathansobo I think this might have caused this bug:
image
Lines 2, 3, 5-7 are not highlighted properly.
On line 1, from is normally pink, and 'shared/responsive.css' is normally yellow, if that helps.
And lines 5-7 normally look pretty similar to lines 9-11.

@Arcanemagus
Copy link

@lleheny0 Please file a new issue about that, making sure to fill out the template. Thanks!

@octref
Copy link
Contributor Author

octref commented May 17, 2019

@lleheny0 Tag me in the issue, and I'll take a look today.

@octref octref mentioned this pull request May 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants