vscode_deno icon indicating copy to clipboard operation
vscode_deno copied to clipboard

feat: allow using the formatter even if `"deno.enable"` is missing

Open KnorpelSenf opened this issue 1 year ago • 6 comments

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

For some libraries I work with .d.ts files. Many related projects are written in Deno, so I'd like to use the Deno formatter for the .d.ts files, too. While I can type deno fmt in the terminal to format the declaration files, the VSCode extension for some reason does not register as a plugin that is able to format the files.

Describe the solution you'd like

Configure this extension as the default formatter for declaration files, and then be able to use it to format the files.

KnorpelSenf avatar Dec 30 '22 14:12 KnorpelSenf

Can you provide the steps to reproduce the problem? I was able to format a .d.ts file with the Deno extension.

Leokuma avatar Jan 07 '23 01:01 Leokuma

  1. Open a .d.ts file
  2. Press Ctrl+Shift+I
  3. See an error message that no formatter is installed for .d.ts files

I'll try to play around with my setup, perhaps some combination with other extensions breaks this?

KnorpelSenf avatar Jan 07 '23 06:01 KnorpelSenf

Thanks for the steps.

Ctrl+Shift+I doesn't do anything in my VSC.

Shift+Alt+F works (default VSC shortcut).

Leokuma avatar Jan 10 '23 01:01 Leokuma

Right, I'm also using whatever is the default on my machine, but I see that these could differ. Shift+Alt+F doesn't do anything for me. Doing Ctrl+Shift+P and formatting the code via that panel used to reproduce the issue, too.

I didn't find time to play around further with this, will get back to you then.

KnorpelSenf avatar Jan 10 '23 07:01 KnorpelSenf

This is the error I get: image

I now also found out why the formatter isn't available. I am only allowed to use it if the Deno extension is enabled for the respective project. This behaviour is understandable for many other LSP features, but IMO formatting in particular should be an exception here.

KnorpelSenf avatar Jan 16 '23 14:01 KnorpelSenf

Related #657

Leokuma avatar Jan 20 '23 02:01 Leokuma