biomejs/biome-vscode

๐Ÿ› Not working for Tailwind CSS files

Closed this issue ยท 9 comments

VS Code version

0.41.3 (Cursor)

Extension version

2.3.0

Biome version

1.9.3

Operating system

  • Windows
  • macOS
  • Linux

Description

I don't get the extension to format/lint my CSS files (the Biome CLI works) despite having this in my VSCode settings:

  "[css]": {
    "editor.defaultFormatter": "biomejs.biome"
  },

CleanShot 2024-10-08 at 16 54 06@2x

The extension is working seamlessly for all other file types.

And I'm not having any stuff ignored in biome.js.

Steps to reproduce

see above

Expected behavior

see above

Does this issue occur when using the CLI directly?

No

Link to a minimal reproduction

No response

Logs

No response

To create a reproduction, you can use our new CLI tool, which should help you to create a very quick repository with what you need: npm create @biomejs/biome-reproduction

Did create a repro here: https://github.com/wottpal/biome-repro-1728407341600 โ€“ But it's really just a very plain project with some VSCode settings (that work for all other extensions).

Btw, would suggest adding a .gitignore with your CLI as well.

If I'm not mistaken, the language identifier of your file is "Tailwind CSS" (seen in your status bar). The tailwindcss extension may be taking over. You may have to force the CSS language type assignment for .css files.

Did create a repro here: https://github.com/wottpal/biome-repro-1728407341600 โ€“ But it's really just a very plain project with some VSCode settings (that work for all other extensions).

Btw, would suggest adding a .gitignore with your CLI as well.

Also, tailwind CSS files use unofficial syntax, so you're better off ignoring these files from Biome

Oh, that seems to be the case indeed. Good catch!

But tbh that's the default for a lot of projects these days and also the recommended way when using Tailwind CSS.

It also seems to be supported at least did everything work seamlessly with Biome when switching to CSS (though I loose all the Tailwind features now).

I would reframe this issue then to support Tailwind CSS (tailwindcss) type within the extension (again, CLI works fine).

I also think Tailwind CSS is just a subset of valid CSS (@-rules are a native CSS feature).

To work around this issue, we could add tailwindcss as a supported language, but we want to ensure the parser won't choke on them. I believe this would have to be handled LSP-side, not in the extension, though.

But even though tailwindcss is not an actual file extension (the file name still ends with .css and works just fine with Biomes CLI). It's just kind of an ephermal language for their extension purposes, so IMO it sounds as an extension thing.

Is there any workaround I can do right now on my end to get this working (and keeping Tailwind CSS)?

You're correct, I was thinking of something else.

Fixed in f2c4e1a. Will release a new pre-release in a bit.

I still have this issue. How can I fix it?

CleanShot 2024-10-25 at 05 54 30@2x