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

Search parent directories for stylua.toml #127

Closed
mirryi opened this issue Apr 22, 2021 · 3 comments · Fixed by #147
Closed

Search parent directories for stylua.toml #127

mirryi opened this issue Apr 22, 2021 · 3 comments · Fixed by #147

Comments

@mirryi
Copy link

mirryi commented Apr 22, 2021

Currently, stylua.toml must be in the same directory that stylua is run from.

It would be useful to have it also search the parent directories for the configuration file if it's not found.

@JohnnyMorganz
Copy link
Owner

I'm a little hesitant about adding this as a feature. I normally expect stylua.toml to be in the root of a project/workspace, and I was expecting this was most likely the place where stylua would be run. If we were to search parent directories, then this essentially becomes a "global" configuration (e.g. if you put it in your home directory). The consequences of that, is that you may be applying some specific configuration for the project you are currently working on, and if someone else is to then work on it (e.g. cloning a public repo), they won't have the same configuration as you, as the stylua.toml isn't present in the repo. This can lead to conflicting formatting.
Also, if you have a stylua.toml in a ancestor directory, and you yourself clone a public repo which uses stylua, but with no configuration (i.e. no config file), then it would fall back to the stylua.toml file you have present, not the formatting that the project itself wants to enforce.

Do you have a specific use case in mind for this?

@tiagovla
Copy link

tiagovla commented May 6, 2021

Would it be possible to make it look for both stylua.toml and .stylua.toml?

@JohnnyMorganz
Copy link
Owner

Would it be possible to make it look for both stylua.toml and .stylua.toml?

That should be possible, but it's a separate issue to this one. I'll create a new one for it

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

Successfully merging a pull request may close this issue.

3 participants