vscode_deno icon indicating copy to clipboard operation
vscode_deno copied to clipboard

HTML formatter doesn't work without opening JS/TS file

Open mfulton26 opened this issue 9 months ago • 3 comments

Is your feature request related to a problem? Please describe.

Deno CLI supports formatting HTML files now but VS Code doesn't recognize vscode_deno as an HTML formatter.

Describe the solution you'd like

Ability to format code in VS Code using vscode_deno.

mfulton26 avatar Mar 01 '25 16:03 mfulton26

This should be supported, can you share the error you're seeing?

nayeemrmn avatar Mar 01 '25 16:03 nayeemrmn

There is no formatter for 'html' files installed.

I think I might have an idea of what is happening though. If I open VS Code and open an HTML file I will get the alert that there is no formatter for 'html' files installed but if I open a TS file, format it with Deno, and then come back to the HTML file it then works as expected.

In fact, if I reload the developer window in VS Code and immediately try to format a TS file I will get the same alert. It is as if Deno is lazily loaded as a formatter and fails to get registered on HTML files but does eventually get registered on TS files and once registered it works as expected on HTML files but only if a TS file is formatted first.

mfulton26 avatar Mar 03 '25 12:03 mfulton26

Oh, it's because the language server isn't being started because a JS/TS file hasn't been opened yet...

nayeemrmn avatar Mar 03 '25 16:03 nayeemrmn