ktfmt
ktfmt copied to clipboard
Canonical .editorconfig
This is kind of the opposite of #45 -- it'd be convenient to have a complete .editorconfig based on the plugin's current formatting rules, including editor-specific config properties for IntelliJ and any other editors people care to contribute.
Obviously this doesn't have to be generated by the plugin; it could be a hand-maintained file in the plugin source.
Do you mean emit an .editorconfig from the plugin? or store one in the plugin that matches the plugin's config?
Maintaining it as a standalone file people can download may be easier than making the plugin emit it on the fly, but either way would be useful.
Basically the idea is to make it easy to include editor settings in a project that uses ktfmt, such that the editor gets as close as possible to ktfmt's rules and ktfmt needs to make fewer changes. That's likely to be less error-prone than trying to tell people which editor settings to change manually.
I assume the target audience is users using an IDE other than IntelliJ, since there's a ktfmt plugin for IntelliJ?
The target audience I had in mind is actually IntelliJ users. To be clear, this is definitely a low-priority thing, but I'd want this for a few reasons:
- My experience is that there's often one person on a team who ends up not running ktfmt before committing code for whatever reason, so having the editor produce mostly-ktfmt-style code to begin with means that the subsequent cleanup commit won't churn the file's blame history as much.
- While I'm editing code, it's nice when the new code I'm typing looks similar to the existing ktfmt-formatted code. Otherwise I find myself hitting the Reformat hotkey pretty often to make everything line up.
- It will serve as a kind of machine-readable documentation of ktfmt's formatting rules.
Got it, thanks for clarifying! It sounds like it's possible to hand-write the file, or maybe export it from IntelliJ after tweaking its formatter?
On Mon, Jan 4, 2021 at 7:51 PM Steven Grimm [email protected] wrote:
The target audience I had in mind is actually IntelliJ users. To be clear, this is definitely a low-priority thing, but I'd want this for a few reasons:
- My experience is that there's often one person on a team who ends up not running ktfmt before committing code for whatever reason, so having the editor produce mostly-ktfmt-style code to begin with means that the subsequent cleanup commit won't churn the file's blame history as much.
- While I'm editing code, it's nice when the new code I'm typing looks similar to the existing ktfmt-formatted code. Otherwise I find myself hitting the Reformat hotkey pretty often to make everything line up.
- It will serve as a kind of machine-readable documentation of ktfmt's formatting rules.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/facebookincubator/ktfmt/issues/158#issuecomment-754119645, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPH6YJW5I3D6FRZEFUWFH3SYH5ZZANCNFSM4VNR6JZQ .
Here's a hand-tweaked export of my IntelliJ settings; it isn't too far off, I think, but I am not confident I've gotten everything right (certainly not confident enough to want to submit it as a PR, but if you like, I can do that.)
- A PR sounds great, even if it's not perfect, especially if there's a way to add this as a comment in the file.
- Is this for the default style or dropbox style?
- Should we name the file
.editorconfig-ktfmt.txtor something like that? I want to emphasize that it's not used for the ktfmt project itself, but instead be downloaded and used in other projects. Maybe put it in a subdirectory? editorconfigs? but then it's less discoverable. Anyway, I'm open to ideas :)
On Mon, Jan 4, 2021 at 10:59 PM Steven Grimm [email protected] wrote:
Here's a hand-tweaked export of my IntelliJ settings; it isn't too far off, I think, but I am not confident I've gotten everything right (certainly not confident enough to want to submit it as a PR, but if you like, I can do that.)
editorconfig.txt https://github.com/facebookincubator/ktfmt/files/5766761/editorconfig.txt
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/facebookincubator/ktfmt/issues/158#issuecomment-754215347, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPH6YKKO4TKBCTFHBBTQC3SYIT3DANCNFSM4VNR6JZQ .
Before closing this issue, should be great to add .editorconfig for all styles (Google and Kotlinlang).
Personally, instead of having only one file with comments to change from one style to another, I think should be better to have 4 files:
- .editorconfig-default
- .editorconfig-dropbox
- .editorconfig-google-internal
- .editorconfig-kotlinlang
@sgrimm, could you work on what @JavierSegoviaCordoba proposed? I think that is a good idea.
@JavierSegoviaCordoba, if you feel adventurous and want to take a stab at this, I'd be happy to help ship it.
I should have time to have a crack at that this weekend.
@sgrimm feel free to submit a PR when you have something
I found .editorconfig files for all code styles in https://github.com/facebook/ktfmt/tree/main/docs/editorconfig. Looks like this issue is done already?
Looks like we do, we just need to clean up the dropbox one, let me do that