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

Question about Configuration Options #48

Closed
Stanzilla opened this issue Feb 5, 2021 · 7 comments
Closed

Question about Configuration Options #48

Stanzilla opened this issue Feb 5, 2021 · 7 comments

Comments

@Stanzilla
Copy link

Hey there! I know you said this is very opinionated but I was wondering which configuration options you are going to/willing to add in the future. I'm very interested in using this as a replacement for LuaFormatter which does allow the following https://github.com/Koihik/LuaFormatter#default-configuration

@JohnnyMorganz
Copy link
Owner

Hey there, thanks for the interest in StyLua!

I feel as though, in regards to configuration options, I do not wish to add too many. The project was originally inspired by Prettier, and I feel as though their range of options (where applicable to Lua) are a reasonable set personally (but they do regret some of them, as explained here)

That being said, I am happy to facilitate discussion around specific formatting points, and if there's a style which is common in a lot of places, I'm happy to think about supporting it. This might lead on to add a configuration if the general consensus agrees (see #28 - there was a further discussion off GitHub too), but I'll be hesitant at first.

Do you mind explaining specifically the configuration you use from LuaFormatter that you would like to see in StyLua?

@JohnnyMorganz
Copy link
Owner

Oh, and a point to mention, I follow the Roblox Lua Style Guide when implementing the style choices, so it would be unlikely that anything going against that would be supported. But again, I'm happy for discussion.

@Stanzilla
Copy link
Author

Ah so I just tested it on a file and noticed these things:

  • Quote style (you are already working on this)
  • max line length

Assuming break ups like these are line length related?

image

and then possible the comma placement for these

image

@JohnnyMorganz
Copy link
Owner

Quote Style - yeah, there was some discussion here, and I'll probably add it in (feel free to react with your support on #28 just so I have a better indication)

Line length - this is actually all over the place inside of the codebase right now, as there isn't a single best way to do this with the current way everything has set up (see, #5). Its all based on best-guess heuristics at the moment. I know Prettier has a configuration option here, and I think I can agree on this case to add an option too.

From your screenshots, was this the ouput of StyLua or LuaFormatter? In the first screenshot, you're right in saying that's line length related. The second one though, that doesn't look like StyLua output - are you saying the addition is how you would've liked it to be laid out?

@Stanzilla
Copy link
Author

Stanzilla commented Feb 5, 2021

that's Stylua output from a codebase that did not use any auto formatter before: https://github.com/WeakAuras/WeakAuras2/blob/main/WeakAuras/WeakAuras.lua

@JohnnyMorganz
Copy link
Owner

Hm I just tested that now, and that is not what I was expecting (I thought StyLua would actually just stick it on one big line, which in itself isn't great either).

For the second screenshot, I would agree that what you had originally would actually be the best style here - feel free to open up a separate issue for this, and I can check it out soon.

@JohnnyMorganz
Copy link
Owner

I will be closing this issue - to track the column width setting, see #5, and for quotation style, see #28.
If you have any further questions/bugs to report, feel free to open a new issue

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