ducminh-phan / reformat-gherkin

Formatter for Gherkin language
MIT License
24 stars 13 forks source link

Make indentation configurable #35

Closed rayjolt closed 4 years ago

rayjolt commented 4 years ago

It would be nice to have an option to change the indentation increment. In a project I'm working on, the standard is 4 spaces, so persuading people to switch to 2 spaces with reformat-gherkin was tricky. Maybe allow people to set a number of spaces between 1 and 10, or tabs?

We could maybe use syntax like reformat-gherkin . --indent 4s, where "4s" means 4 spaces. You could also have "3s" for 3 spaces, "t" for tabs, etc.

ducminh-phan commented 4 years ago

I'm not sure if indenting with multiple tabs is useful. prettier provides only an option to indent with a single tab, and an option to specify the number of spaces per indentation level.

rayjolt commented 4 years ago

I agree that allowing multiple tabs is not a good idea. I didn't intend for it to be possible to specify multiple tabs, but now that you point it out, this is not obvious with my --indent suggestion.

I like the --tab-width and --use-tabs options from Prettier. How about we copy those, instead of using --indent?

ducminh-phan commented 4 years ago

Sounds good to me. I'm working on the implementation now.