Skip to content

Support prefixed / non-standard class names #113

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

Open
onetrev opened this issue Jan 26, 2018 · 2 comments
Open

Support prefixed / non-standard class names #113

onetrev opened this issue Jan 26, 2018 · 2 comments

Comments

@onetrev
Copy link

onetrev commented Jan 26, 2018

Currently the regex used for this extension -> const classNameRegex: RegExp = /[.]([\w-]+)/g; will only accept standard class name characters. However, you can (as of CSS 2.1) escape non-standard characters in your CSS. So hopefully support for this can be added. This is also applicable for anyone using TailwindCSS, but there are lots of other use cases for classes such as:

.md\:absolute
.sm\:w-1\/2

Of course when you are autocompleting they need to show up sanitized, with the escape character removed so like so:

.md:absolute
.sm:w-1/2

I've noticed this is supported in this extention I believe using the two functions at the bottom of this file.

@onetrev onetrev changed the title HTML class completion issues with TailwindCSS prefix classes HTML & CSS completion issues with prefixed / non-standard classes Feb 8, 2018
@onetrev onetrev changed the title HTML & CSS completion issues with prefixed / non-standard classes Support prefixed / non-standard class names Feb 13, 2018
@skyrpex
Copy link

skyrpex commented Apr 10, 2019

Is this the regexp that parses the class names? Maybe it just needs to be less restrictive.

https://github.com/zignd/HTML-CSS-Class-Completion/blob/master/src/parse-engines/common/css-class-extractor.ts#L9

@LoranKloeze
Copy link

I have fixed this in my fork: https://github.com/LoranKloeze/HTML-CSS-Class-Completion-Reworked

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants