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

Request for ktfmt Pre-commit Hook to Manage Trailing Commas #244

Open
connor-27 opened this issue Sep 24, 2024 · 1 comment
Open

Request for ktfmt Pre-commit Hook to Manage Trailing Commas #244

connor-27 opened this issue Sep 24, 2024 · 1 comment

Comments

@connor-27
Copy link

Feature Description

As of ktfmt version 0.52 in IntelliJ, users can select "Custom" under "Code style," which provides the ability to customize certain formatting options. One significant feature seen in this version is the ability to manage trailing commas.

Feature Request

I would like to have this functionality available in the ktfmt pre-commit hooks as well. It would be beneficial for users to be able to enable or disable trailing commas during the pre-commit checks, providing more flexibility and adherence to varying code style preferences.

Additionally, it would be great to set a base configuration for the custom style using one of the predefined styles such as Meta, Google, or kotlinlang.

Inquiry

Is there any plan to update the pre-commit hooks to include this feature? If not, could this be considered for future updates?

Thank you for considering this enhancement to ktfmt pre-commit hooks.

@macisamuele
Copy link
Owner

I'm generally of the opinion that a good formatting tool (especially if embedded in pre-commits) should be very strict in terms on how many features to expose.

At the same time ktfmt supports already code styles (even if meta is not included yet).

I think it would be fair to expose a configuration toggle to allow trailing comma.

For what concerns exposing meta style, I think that we could allow it (but we would need to make sure that we gate for a min ktfmt version).

I won't be able to promise a realistic timeline on when I could be working on this, but PR are welcome.
If you have some time and you are interested on implementing this feature, please go ahead and create a PR, I'll be happy to review.

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