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

Plugin overrides .editorconfig settings #326

Open
j127 opened this issue Aug 31, 2019 · 5 comments
Open

Plugin overrides .editorconfig settings #326

j127 opened this issue Aug 31, 2019 · 5 comments

Comments

@j127
Copy link

j127 commented Aug 31, 2019

The plugin formats the code with 2-space indentation even when .editorconfig is set to 4 spaces.

To reproduce:

  • Create an .editorconfig file set for 4-space indentation.
  • Create a Reason file. (4 space indentation will work.)
  • Save the file with format-on-save turned on.

Expected result: maintain the indentation levels of .editorconfig.
Actual result: the plugin overrides .editorconfig settings.

@TheSpyder
Copy link

This isn't the plugin, it's refmt (the ReasonML formatting/parsing tool). It is very opinionated, the only configuration option is line length (default 80).

@j127
Copy link
Author

j127 commented Sep 22, 2019

Thanks, I will see if they will change it, or else fork it and try to add options. (I'm not sure if this is the section.) 2-space indentation is much harder to skim in languages with "noisy" syntax. If they want people to use it they should make it easier to integrate it into existing projects.

@TheSpyder
Copy link

They're unlikely to change it, and forking seems a bit extreme 🤔

Two spaces is what I see everywhere in JS projects and those are the people reason is trying to appeal to.

You're not forced to use it, but similar to gofmt it is designed to standardise code across the whole ecosystem and will also apply minor optimisations.

@j127
Copy link
Author

j127 commented Sep 23, 2019

Two spaces is what I see everywhere in JS projects

There is no standard in JS. 2-spaces makes the code less skimmable, especially in languages that have a lot of noise (like curly braces).

It should be easier to build a copy of refmt that has options than to work without any formatter at all.

Facebook's relationship to OCaml isn't like Google's relationship to Go. If ReasonML is supposed to be incrementally added to existing projects, then it should be configurable to follow the coding guidelines of existing projects.

@TheSpyder
Copy link

Two spaces is what I see everywhere in JS projects

There is no standard in JS. 2-spaces makes the code less skimmable, especially in languages that have a lot of noise (like curly braces).

For the record I agree about skimmable code, but every open source JS project I've ever seen is two spaces. Of course there's no standard, unless you're using a language where indentation is relevant there's never a standard, but I believe two spaces is what the majority of developers use. It's a fate that I accepted long ago.

If you don't want curly braces OCaml is great; quite literally everything you can do in ReasonML you can also do in OCaml. Reason just offers some shortcuts and comfortable syntax for JS developers.

It should be easier to build a copy of refmt that has options than to work without any formatter at all.

If it was purely a formatter, sure. But it's not. Reason is just syntax, and refmt is the implementation of that syntax. It can both format code and convert it to other forms, in particular it's used to feed binary AST into two compilers (ocaml native and bucklescript).

The effect of this is that your fork will need to be kept up to date with the refmt being used to compile your project (bucklescript ships this as bsrefmt) or you might end up with weird syntax errors and compile failures.

Facebook's relationship to OCaml isn't like Google's relationship to Go.

Now we're getting way off topic.

I don't think they really have a relationship with OCaml, but even if they did that's not relevant imo. They are related but separate languages... How is Google's relationship to go related to refmt taking inspiration from gofmt and deliberately removing all configurability?

If ReasonML is supposed to be incrementally added to existing projects, then it should be configurable to follow the coding guidelines of existing projects.

I don't see that as incrementally fitting in; it's more incrementally replacing the code like a trojan horse. Most coding standards include more than just indent style so that argument is a bit of a slippery slope.

You don't have to listen to me, I'm not in any way an authority on reason or the community, but I've been around a long time and these are my observations / expectations.

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