Skip to content

[v4] @utility directive's content css doesn't have intellisense for css properties #1146

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
idan-faibish opened this issue Jan 26, 2025 · 10 comments · Fixed by #1165
Closed

Comments

@idan-faibish
Copy link

What version of Tailwind CSS are you using?

4.0.0

What build tool (or framework if it abstracts the build tool) are you using?

vite 6.0.11

What version of Node.js are you using?

20.13.1

What browser are you using?

Chrome

What operating system are you using?

macOS

Describe your issue

as stated in the title.
when using the new @utility directive, the inner css code doesn't have any intellisense. its like we are not using any css code.
(the code itself is working just fine, its only an intellisense issue)

in the image below, we can even see that the coloring (plain white) indicates it
Image

@idan-faibish idan-faibish changed the title @utility directive's content css doesn't have intellisense for css properties [v4] @utility directive's content css doesn't have intellisense for css properties Jan 27, 2025
@philipp-spiess philipp-spiess transferred this issue from tailwindlabs/tailwindcss Jan 27, 2025
@danwetherald
Copy link

I an also confirm this is not working.

@Eptagone
Copy link

Eptagone commented Feb 1, 2025

It happens to me too

thecrypticace added a commit that referenced this issue Feb 5, 2025
- [x] Support property and variable completions inside `@utility`
(behave like a style rule)
- [x] Support style-rule like completions inside `@custom-variant`
- [x] Support style-rule like completions inside `@variant`
- [x] Make sure `@slot` isn't considered an unknown at-rule

Fixes #1146
@thecrypticace
Copy link
Contributor

This will be fixed in the next release of the extension 👍 (should be later today)

@idan-faibish
Copy link
Author

@thecrypticace it looks like the issue was indeed resolved,
but the coloring is still missing, so both the properties and the values are currently white.

@thecrypticace
Copy link
Contributor

thecrypticace commented Feb 5, 2025

@idan-faibish Ah yeah so syntax coloring is a completely separate process in VSCode and is completely unrelated to the language server. This is primarily related VSCode's own CSS language not supporting nesting. I'm gonna try to fix that for our own CSS language soon though.

@devenini
Copy link

devenini commented Mar 4, 2025

Hey @thecrypticace! Any update on syntax coloring? 🙏 Currently everything is white as soon as you use a directive like @utility, @custom-variant or @variant. Let me know if there is another issue/PR I can follow

@me-nkr
Copy link

me-nkr commented Mar 5, 2025

I am still getting this issue in neovim and vscode

@thecrypticace
Copy link
Contributor

@me-nkr Neovim doesn't run our css language server so this makes sense. As of the last release (or two) of the language server we do actually build & publish the file for this. I might need to add an export for it (but also maybe not). You would have to configure nevoid to use it for CSS files. The language server protocol doesn't allow us to intercept / replace / hide stuff from other language servers which is why it has to operate as a separate server that replaces the existing CSS one.

As for VSCode, if you're seeing this there can you open a separate issue and provide a reproduction please?

@jorgebef
Copy link

jorgebef commented Apr 8, 2025

@me-nkr Neovim doesn't run our css language server so this makes sense. As of the last release (or two) of the language server we do actually build & publish the file for this. I might need to add an export for it (but also maybe not). You would have to configure nevoid to use it for CSS files. The language server protocol doesn't allow us to intercept / replace / hide stuff from other language servers which is why it has to operate as a separate server that replaces the existing CSS one.

As for VSCode, if you're seeing this there can you open a separate issue and provide a reproduction please?

Sorry to bring up an old issue. I use neovim and having intellisense inside @utility would be fantastic.
You mention that we can replace the CSS language server with Tailwind's custom implementation if I understand correctly?

I've checked, but can't find the way to do so.
Would you be able to give any hints as to how we can launch/use this custom language server for tailwind?

Thanks in advance!

@thecrypticace
Copy link
Contributor

@jorgebef So you'll technically get some IntelliSense support inside @utility (completions for things like --value() and --modifier()) but not from the CSS language server which is likely what you're wanting most.

Unfortunately, I don't know enough about Neovim to know how to replace the CSS language server for it but basically what you'd need to do (somehow) is:

  • Configure a custom binary path for CSS files to point to to css-language-server inside the @tailwindcss/language-server package
  • Configure .css files to have a language of tailwindcss instead of css

cc @RobinMalfait any chance you'd know how to reconfigure Nevoim to do this or nah?

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 a pull request may close this issue.

7 participants