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

Formatter doesn't work with JSON, Tailwind CSS, and other language modes #1238

Open
pattobrien opened this issue Jan 6, 2025 · 2 comments
Open

Comments

@pattobrien
Copy link

pattobrien commented Jan 6, 2025

Describe the bug

I'd like to use deno as the default formatter for all web-related files and languages.

However, not all languages in the formatter docs seem to be supported, and more "fringe" language modes like Post CSS don't seem to be supported either, even though the file has a supported extension (e.g. .css).

I'm not familiar with this part of the VSCode language client / protocol, but since these file extensions do seem to be supported (e.g. when running deno formatter via cli), presumably this should just be as simple as adding JSON, Post CSS and Tailwind CSS as supported formatting languages in this extension.

Steps to Reproduce

In VSCode, when a .css file is identified as either Post CSS or Tailwind CSS language modes, the following error is observed:

FormattingExtension 'Deno' is configured as formatter but it cannot format 'PostCSS'-files

All works fine if the language mode is identified as CSS instead. Similarly, running deno fmt foo.css works fine, even with @tailwind annotations in the file.

Expected behavior

Deno extension should be able to format all extensions / "languages" supported by deno fmt, including .css, .json.

Screenshots

Screenshot 2025-01-06 at 10 42 18 AM

Versions

vscode: 1.96.2 deno: 2.1.4 extension: 3.43.2

@pattobrien pattobrien changed the title Formatter doesn't work with Tailwind CSS and Post CSS language modes Formatter doesn't work with JSON, Tailwind CSS, and other language modes Jan 6, 2025
@pattobrien
Copy link
Author

pattobrien commented Jan 6, 2025

After some more investigation, when I select deno via Format Document With..., all works fine... I'm not sure if that alludes to this being a VSCode issue, or if there is some further configuration that the deno extension needs to do to register the deno formatter to the file association.

@vicary
Copy link

vicary commented Jan 14, 2025

Maybe related to #1170. Since Deno can already format these files, it could be a matter of this extension to report the capability to VS Code.

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