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

feat: Use closest stylua.toml config to file being formatted #831

Open
gabyx opened this issue Dec 12, 2023 · 7 comments
Open

feat: Use closest stylua.toml config to file being formatted #831

gabyx opened this issue Dec 12, 2023 · 7 comments
Labels
enhancement New feature or request
Milestone

Comments

@gabyx
Copy link

gabyx commented Dec 12, 2023

It would be nice if the formatter can be configured to stop looking for config files when reached a Git root (e.g. git rev-parse --show-toplevel) this will be useful such that when inside a lua repo and inside submodule, we stop at first .stylelua file, somehow it does not stop and merges? with the config file in the main repo, which contains the submodule...

@gabyx gabyx changed the title feat: Stop searchin config file on git root feat: Stop searching config file on git root Dec 12, 2023
@JohnnyMorganz
Copy link
Owner

we stop at first .stylelua file, somehow it does not stop and merges

this sounds incorrect to me, we don't merge two stylua files together. That sounds like the underlying issue here, rather than adding something else to stop at git roots.

@gabyx
Copy link
Author

gabyx commented Dec 23, 2023

Ah maybe you start the discovery of the style file from the current working directory, which IMO is wrong. Could that be the issue here?

@JohnnyMorganz
Copy link
Owner

Ah yes, that seems more like it. Indeed, we just use the config found at the cwd across all the code.

I have been thinking about this though - maybe we should be using the closest configuration to the file.

I do question why you are running stylua on a sub module though. I typically think sub modules are vendored code, hence should be ignored by style tools, but maybe that is not the case for you.

@gabyx
Copy link
Author

gabyx commented Dec 23, 2023 via email

@gabyx
Copy link
Author

gabyx commented Dec 23, 2023

Ehm, hehe 😉 yes thats true, bitbthe astronvim distribution works differently :). But tou are right I meant I always executed the format with the cwd in the submodule and since it has a config file that one should be found, strange, I check again in a few days.

Anyway, all format tools actually do this as far as I know from clang-format - start from the file. Please check again, now a bit unsure.

@JohnnyMorganz
Copy link
Owner

Yes, I think it is valid still. I will restructure your feature request to "Use closest configuration to file"

@JohnnyMorganz JohnnyMorganz changed the title feat: Stop searching config file on git root feat: Use closest stylua.toml config to file being formatted Dec 23, 2023
@JohnnyMorganz JohnnyMorganz added the enhancement New feature or request label Dec 23, 2023
@JohnnyMorganz JohnnyMorganz added this to the 2.0 milestone Jan 27, 2024
@gabyx
Copy link
Author

gabyx commented Mar 27, 2024

@JohnnyMorganz : Would improve tooling much, since it will pick up the closest .stylelua.toml file and make an astronvim user install much nicer! Looking forward to this. BR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants