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

Configurable namespace sorting #268

Open
hxegon opened this issue Jun 29, 2022 · 1 comment
Open

Configurable namespace sorting #268

hxegon opened this issue Jun 29, 2022 · 1 comment

Comments

@hxegon
Copy link

hxegon commented Jun 29, 2022

I'd like to sort the namespaces in a non-alphabetical way: clojure core libraries first, followed by external namespaces, and then internal namespaces. Feels like it'd be simple to add on top of #251, after that's merged I can take a crack at it.

Thinking it could be configured by either:

  • user supplied fn arg to sort-by passed to sort-ns-references (not sure how a user supplied fn would work in an edn config)
  • a :sort-ns-regexes option, a vector of regexes matching the required namespaces in order of sorting rank

This would let me do that while opening it up to whatever order people would like, and could default to alphabetical sorting

@sirmspencer
Copy link

sirmspencer commented Jun 29, 2022

I had issues with regex in edn when testing some things with indentation rules. Maybe something like

{:clojure       :top
 :project-ns :bottom}

or just using prefix instead of full regex in the config

[{:prefix "clojure" :order 0}
 {:prefix "my.proj" :order 10}

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