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

Maintain alphabetical ordering #18

Open
stefan-toubia opened this issue Jun 21, 2022 · 5 comments
Open

Maintain alphabetical ordering #18

stefan-toubia opened this issue Jun 21, 2022 · 5 comments

Comments

@stefan-toubia
Copy link

It would be very useful to be able to programmatically manage deps.edn files but it's somewhat of a dealbreaker that we cannot currently maintain alphabetical ordering since the config files should remain human readable as well.

@borkdude
Copy link
Owner

@stefan-toubia I'm open to a PR for this

@borkdude
Copy link
Owner

I think we can make an explicit sort-map function that takes a map and sorts it, or a more general sort-alphabetical that takes a collection. Clojure-lsp has some logic for it which we could borrow:

https://github.com/clojure-lsp/clojure-lsp/blob/6fc2636affc18254c503f8182d9b0685aec19086/lib/src/clojure_lsp/feature/sort_clauses.clj

@borkdude
Copy link
Owner

Here is some more info by @lread on the challenges of sorting a map:

https://nextjournal.com/lread/sorting-maps-by-key-with-rewrite-clj

@borkdude
Copy link
Owner

@lread That code you got there isn't maybe so bad and better than nothing? Maybe I'll just add it and then refine it as we come across issues...

@lread
Copy link
Contributor

lread commented Jan 31, 2023

It might be an OK start.
@mainej has done a lot more thinking on this than I have.

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

3 participants