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

docs: Update intellisense regex to handle inner brackets #332

Merged
merged 2 commits into from
Jan 22, 2025

Conversation

longzheng
Copy link
Contributor

Description

The current Tailwind CSS Intellisense regex doesn't handle inner brackets, for example if I have a class value of

'bg-background focus:shadow-[0_0_15px_0_rgba(0,0,0,0.1)] text-foreground'

Then the current regex will stop matching after the rgba(0,0,0,0.1) because of the end bracket.

You can see a more elaborate example and the behaviour of the current regex here https://regex101.com/r/QSAKAA/1

This updated regex handles inner brackets. Demo https://regex101.com/r/TyIbT9/1

Additional context

I've submitted a similar PR to the clsx library for consistency.


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Follow the Style Guide.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).

Copy link

vercel bot commented Jan 22, 2025

@longzheng is attempting to deploy a commit to the Joe Bell OSS Team on Vercel.

A member of the Team first needs to authorize it.

@joe-bell
Copy link
Owner

Amazing work, thanks @longzheng! Seems like this is future-proof for beta.cva.style too

Copy link

vercel bot commented Jan 22, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview Jan 22, 2025 10:33am
docs-beta ✅ Ready (Inspect) Visit Preview Jan 22, 2025 10:33am

@longzheng
Copy link
Contributor Author

longzheng commented Jan 22, 2025

Amazing work, thanks @longzheng! Seems like this is future-proof for beta.cva.style too

Oh interesting I didn't know about this new syntax but yes it looks like it will work too https://regex101.com/r/kpzHQR/1

@longzheng
Copy link
Contributor Author

longzheng commented Jan 22, 2025

Oh wait I see the beta docs are different, I'll update the beta page equivalent too.

Copy link
Owner

@joe-bell joe-bell left a comment

Choose a reason for hiding this comment

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

Thanks again for this @longzheng!

@joe-bell joe-bell merged commit 40d0bab into joe-bell:main Jan 22, 2025
11 checks passed
@longzheng longzheng deleted the patch-1 branch January 22, 2025 11:10
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.

2 participants