-
-
Notifications
You must be signed in to change notification settings - Fork 357
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
Add config file for editor integration #358
Comments
Wouldn't you have the same issue with lots of other tools and plugins?
Can you clarify why a script is not enough?
Please clarify what you mean by project-wide. It's still unclear to me why an editor would have an easier time integrating with a config file than a script file or a set of string arguments. |
For example, the editor runs Now I'm working on two projects. One indents files with When the editor formats a file, the wrapper will look for So, why not let For instance, there is a project called foobar:
When the editor runs A lot of formatters support project-wide config files: |
If your IDE cannot apply different settings for different projects, that seems like the root of the problem to me. I realise that's just placing the blame elsewhere, but please realise that I think that's backwards; each project shouldn't need a dozen config files to set up each of the tools. That makes the tools more complex, and clutters the git repositories with tiny config files. In particular, this tool only has six flags that could fit into a config file. Supporting config files adds a lot more complexity in the long run than you'd expect, so I don't think it's worth it. To name a few:
All in all, if passing different flags per project from the IDE is impossible, I still don't see why scripts are not an option. You could even make them pretty like a config file:
Then you can configure your IDE to run Something also worth mentioning is that there are "meta-formatters" out there which support formatting many languages, and unify all of their settings into one per-project config file. I think that would be the cleanest approach, if one of those tools was well written. |
Many formatters have config file support because their languages don't have a unified style and have lots of legacy code. The problem of scripts is that there's no "standard" location: every project will have its own location for scripts. Actually, letting the editor read a config file also have this problem. In my opinion, the editor should not access scripts or config files at all. What it should do is just running a simple command like I see you want to keep shfmt simple. Yes we should. But, at least, a formatter should allow the users to customize the indentation in config file. We often work on projects with different indentations. An acceptable approach is a universal wrapper or a meta formatter, as you suggest. But they are dependencies too (for users). And what about the users who use shfmt only? |
Correct; this is why command line flags are a dumb, but simple and reasonable approach.
I'm getting mixed signals. Yes, the settings are configurable (via flags). At the same time you don't want to add yet another config file. But you want
I personally think this is the tradeoff decision a user must make. They can use the language tools directly; each will have their own ways to be configured, and the user will have to use scripts or custom IDE configuration to set them up. On the other hand is something higher-level and more powerful like a multi-language formatter. Sure, they're an extra dependency, but they abstract all this away. If you have many languages and want to keep the formatting settings in a single config file, it sounds like the simplest approach to me. |
I see your idea. You want to make shfmt do one thing and do it well, but I want to do all things by one command. It's about philosophy of tool design. I'm not sure which one is right though I still prefer the latter. You're the maintainer, so I respect your decision. I will write a wrapper to support config file. Now I close the issue here. Thank you for your patience! |
I use shfmt in Emacs for several projects with different indentations. It's hard to let Emacs append options to shfmt based on projects.
I've read #234, I know you recommend a wrapper script. But I think a project-wide config file would be better for editor integration. Could you please add config file support?
The text was updated successfully, but these errors were encountered: