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

Support regexp pattern matching in cljfmt.clj config file #79

Open
mrkam2 opened this issue Jan 20, 2021 · 1 comment
Open

Support regexp pattern matching in cljfmt.clj config file #79

mrkam2 opened this issue Jan 20, 2021 · 1 comment

Comments

@mrkam2
Copy link
Collaborator

mrkam2 commented Jan 20, 2021

In my recent PR https://github.com/liftoffio/liftoff/pull/12386 I added more than a 100 functions to the indent-overrides. All of them could've been specified with a single regexp expression. See the corresponding PR comment.

@cespare
Copy link
Owner

cespare commented Jan 21, 2021

Sure, I'm open to this. Could you be a bit more specific, though? How would the configuration work? Right now there's an optional namespace qualifier; how would that work if we gave a regex instead of a string?

Another option might be to be a bit more restrictive and instead of allowing arbitrary regular expressions, allow for matching certain prefixes. I think that covers all the existing use cases. It also covers the built-in indentation rules that cljfmt uses -- certain special prefixes (def, let, send-, and so on) get IndentListBody rather than IndentList.

Perhaps after we add this generalization, we could change the way the default indents work to being a default cljfmt config file rather than being hardcoded.

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