Skip to content

Syntax highlighting #6

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

Closed
benface opened this issue Aug 27, 2018 · 9 comments
Closed

Syntax highlighting #6

benface opened this issue Aug 27, 2018 · 9 comments

Comments

@benface
Copy link

benface commented Aug 27, 2018

First of all, thank you so much for this.

It would be cool if not only the linter didn't mark Tailwind's "additions" to CSS as invalid (for instance it doesn't like @apply .some-class, complaining with [css] identifier expected), but to go one step further and highlight @apply and the utilities following it. Similarly, config() could be highlighted the same way other CSS "functions" such as calc() are.

I don't know if that's possible, but if it is, it would make this awesome extension even better. :) Thanks!

EDIT: I forgot to mention @tailwind and @screen.

@bradlc
Copy link
Contributor

bradlc commented Aug 27, 2018

Hey Benoît, thanks for the feedback!

I’m not sure you can extend syntax definitions like that. I might be wrong though. I think you’d have to define a brand new "language," which I don’t really want to do.

I use this extension and then set VS Code to associate CSS files with PostCSS: "files.associations": { "*.css": "postcss" } If you do that it won’t complain about the syntax you mentioned.

Alternatively you can disable the built-in CSS validation: "css.validate": false

@benface
Copy link
Author

benface commented Aug 28, 2018

I use this extension and then set VS Code to associate CSS files with PostCSS: "files.associations": { "*.css": "postcss" } If you do that it won’t complain about the syntax you mentioned.

Hmm, I don't think that's gonna work for me, as I'm also using Sass (.scss files) with Tailwind.

No big deal. Thank you for your quick response :)

@benface benface closed this as completed Aug 28, 2018
@bradlc bradlc reopened this Aug 28, 2018
@bradlc
Copy link
Contributor

bradlc commented Aug 28, 2018

Okay so I misspoke earlier 😅 apologies!

You can actually do this.

Before:
image

After:
image

@bradlc
Copy link
Contributor

bradlc commented Aug 28, 2018

Although, after some digging I still can’t find a way around the validation issue.

If you require validation I would recommend disabling the built-in validation, and using stylelint instead, which allows defining custom at-rules.

In terms of syntax highlighting.. how do you imagine the class names after an @apply looking?

@benface
Copy link
Author

benface commented Aug 28, 2018

If you require validation I would recommend disabling the built-in validation, and using stylelint instead, which allows defining custom at-rules.

Nice, I will look at that, thanks!

In terms of syntax highlighting.. how do you imagine the class names after an @apply looking?

Maybe similar to how they appear in a selector?

@bradlc
Copy link
Contributor

bradlc commented Aug 28, 2018

Before:
image

After:
image

What do you think?

bradlc added a commit that referenced this issue Aug 28, 2018
@benface
Copy link
Author

benface commented Aug 28, 2018

Looks perfect! :)

@bradlc
Copy link
Contributor

bradlc commented Aug 28, 2018

Sweet! This is released now so let me know if you run in to any issues :)

@benface
Copy link
Author

benface commented Sep 18, 2018

Re-closing this, everything seems to work well :) Thanks again

@benface benface closed this as completed Sep 18, 2018
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