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

Certain attribute name and value combinations crash the VS Code extension #2206

Closed
4 tasks done
jozefmery opened this issue Feb 17, 2023 · 4 comments · Fixed by #2207
Closed
4 tasks done

Certain attribute name and value combinations crash the VS Code extension #2206

jozefmery opened this issue Feb 17, 2023 · 4 comments · Fixed by #2207
Labels

Comments

@jozefmery
Copy link

jozefmery commented Feb 17, 2023

UnoCSS version

Started in v0.49.5, present also in v0.49.6.

Describe the bug

Using attributify mode, certain (very specific) attribute name and value combinations crash the VS Code extension with the following message:

⚠️ Error on annotation
TypeError: Cannot read properties of undefined (reading 'match')

Based on the change-log and the error message, my best guess is that the issue is caused somewhere in #2186.

Generated CSS seems to be correct.

Reproduction

The minimal reproduction I was able to find is the following: <div p="1" gap="md:1" />.
See playground reproduction, where the problem is observable by the missing underline. Minimal changes, e.g. removing either attribute, or removing the md variant, or changing p="1" to p="2", or gap="md:1" to gap="md:2" wierdly resolve the issue.

System Info

No response

Validations

@zyyv
Copy link
Member

zyyv commented Feb 17, 2023

We don't have this rule gap="md:1", the correct class name is md="gap-1" or md-gap="1", the error may be caused by wrong rule.

@jozefmery
Copy link
Author

jozefmery commented Feb 17, 2023

I'm not so sure the rule is wrong. It is actually just gap="1" with the md variant. Also, notice that if you change gap="md:1" to gap="md:2" everything works. Furthermore, the generated CSS is correct in both cases, and it works with version 0.49.4.

@zyyv
Copy link
Member

zyyv commented Feb 17, 2023

You can refer to the interactive docs.

And you should follow the hermit writing rules for atomic classes in UnoCSS. variant-rule

@sibbng
Copy link
Member

sibbng commented Feb 17, 2023

I confirm this is a bug. Should be fixed when #2207 is merged.

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

Successfully merging a pull request may close this issue.

3 participants