Skip to content

Language server stops working completely when there is an invalid @apply rule #1265

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
rChaoz opened this issue Mar 15, 2025 · 1 comment
Closed

Comments

@rChaoz
Copy link

rChaoz commented Mar 15, 2025

My Tailwind intellisense broke completely after I upgraded to v4. After long struggles, I tracked down the issue to this line, in a separate css file imported from my main css file:

@apply base-font-color;

The utility name is not important, it's important that it used to exist but disappeared after I upgraded to Tailwind 4 and Skeleton 3. It seems like an @apply rule with an invalid utility name completely breaks the intellisense. I don't know if there's any errors displayed in VS Code, I know that there are none in WebStorm, and it usually displays them. But, even if there is a crash error, it would be better to red squiggle underline the offending class name instead.

I'm using the latest version of everything at the moment (LS 0.14.9, Tailwind 4.0.14, latest WebStorm beta), with yarn on Windows. I hope someone can confirm this reproduces on VS Code as well.

@thecrypticace
Copy link
Contributor

Hi! Yeah this one is a known issue right now. I opened a reminder issue myself for this a while back in #1121.

In v3 we had a config file to rely on. Now it did still had to be valid but it also changed much less than your CSS files do.

v4 works a bit differently where it has to compile your CSS into a valid "design system" to actually be usable. The DX experience when developing is roughly the same because similar issues were also errors in v3. However, the difference is that the CSS has to be valid to even be loaded in IntelliSense (Tailwind CSS itself is throwing the errors). We combat this a bit by gracefully handling the errors while you're editing as long as your CSS was valid initially — basically we keep the last valid version in memory and use it until the next version is valid. But it indeed breaks when you first open a project that has invalid CSS or at least CSS in some manner that would break the build (like an invalid @apply).

I definitely recognize the DX here is quite poor and it is something I want to address soon. It'll definitely require changes in Tailwind CSS though.

I'm going to close this issue in favor of #1121 though since it's the exact same problem.

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