workbenchdev / Workbench

Code playground for GNOME 🛠️
https://apps.gnome.org/Workbench
GNU General Public License v3.0
677 stars 87 forks source link

TypeScript needs a code formatter #956

Closed sonnyp closed 2 days ago

sonnyp commented 2 weeks ago

In https://github.com/workbenchdev/Workbench/pull/946 we replaced Biome with typescript-language server

Formatting was provided by Biome and it works fine with TypeScript, unfortunately using 2 language servers isn't easily done.

We should add a formatter to typescript-language-server or use Biome and typescript-language-server together.

We could also use prettier which is mostly compatible with Biome formatter.

vixalien commented 2 weeks ago

I might be wrong but I think tsserver has a built-in formatter. I think it's the default in VSCode and you can invoke it manually

image

Also evidenced by https://github.com/typescript-language-server/typescript-language-server/issues/10

But in practice it seems less than perfect for the task. It's very lax.

sonnyp commented 1 week ago

You're right - might be enough for now but I'd like something closer to prettier/biome. We can do without for now it's really just nice to have :+1:

sonnyp commented 2 days ago

We now use typescript-language-server for both TS and JS

https://github.com/workbenchdev/Workbench/pull/972

we removed biome

https://github.com/workbenchdev/Workbench/pull/973

The typescript-language-server formatter looks good enoguh for now