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

Add formatters for Elm, Haskell, Python, and TypeScript #12096

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

heyakyra
Copy link
Contributor

@heyakyra heyakyra commented Nov 20, 2024

This commit adds elm-format for Elm, ormolu for Haskell, ruff for Python, and prettier for TypeScript, Javascript, TSX, JSX, etc.

@David-Else
Copy link
Contributor

I am not sure making biome default for the JavaScript family is a good idea, the real standard is Prettier, and that does a whole load of other languages too. The only problem with Prettier as an amazing default is it is a bit slow, but that is changing soon and Prettier 4 will be much faster, so it will definitely be the best default then: https://prettier.io/blog/2023/11/30/cli-deep-dive

@NikitaRevenco
Copy link

I am not sure making biome default for the JavaScript family is a good idea, the real standard is Prettier, and that does a whole load of other languages too. The only problem with Prettier as an amazing default is it is a bit slow, but that is changing soon and Prettier 4 will be much faster, so it will definitely be the best default then: https://prettier.io/blog/2023/11/30/cli-deep-dive

In the meantime use prettierd

@the-mikedavis the-mikedavis added the A-language-support Area: Support for programming/text languages label Nov 20, 2024
@darshanCommits
Copy link

I am not sure making biome default for the JavaScript family is a good idea, the real standard is Prettier

I personally use biome but this is correct. Prettier maybe slow but as it stands, it's the de facto standard.

Plus last I checked status of biome it wasn't fully compatible with prettier.

@heyakyra
Copy link
Contributor Author

Hm, I figured people are swinging towards Biome, and it would be better to set it as the default given there is none set now than to use Prettier and swap it out later. As of last year when they won the Prettier challenge, Biome had already hit 96% compatibility with Prettier.

I updated the PR since I appear to be the outlier here.

@RoloEdits
Copy link
Contributor

I think there are too many alternatives for some of these to make these the formatters for the languages. For example I use ruff over black and deno fmt over the alternatives right now.

@heyakyra
Copy link
Contributor Author

These are simply defaults not 'the' formatters. Helix differs from other editors by providing nice defaults rather than leaving a completely blank slate for the user to deal with. Users that have a different preference can set their own, as I and others will do for biome, deno, etc.

@NikitaRevenco
Copy link

NikitaRevenco commented Nov 22, 2024

These are simply defaults not 'the' formatters. Helix differs from other editors by providing nice defaults rather than leaving a completely blank slate for the user to deal with. Users that have a different preference can set their own, as I and others will do for biome, deno, etc.

I will even add that it would be nice for helix to configure multiple formatters, if it makes sense for the language

So there will be a default one, but switching to another is just one line of config

@David-Else
Copy link
Contributor

If defaults are necessary, they should align with the most widely used formatter. In this case, Prettier is the clear choice, as it is already installed by the majority of users.

This commit adds `elm-format` for Elm, `ormolu` for Haskell, `ruff`
for Python (with `black` as a backup), and `prettier` (with `biome`
and `deno` as backups) for TypeScript, Javascript, TSX, JSX, etc.
@heyakyra
Copy link
Contributor Author

heyakyra commented Nov 22, 2024

@NikitaRevenco commented:

It would be nice for helix to configure multiple formatters, if it makes sense for the language

So there will be a default one, but switching to another is just one line of config

The documentation specifies how to add a local languages.toml file, but I added comments to the root file in this PR to assist.

@David-Else commented:

defaults […] should align with the most widely used formatter. In this case, Prettier…

This was included in the first update to the PR a couple of days ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-language-support Area: Support for programming/text languages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants