[inspect] Add support for printing compact qualified keywords#354
Conversation
57cb7ef to
3e2d15b
Compare
| (if-some [matched-alias (some (fn [[alias ns]] | ||
| (when (= kw-ns (name (ns-name ns))) | ||
| alias)) | ||
| (ns-aliases *pov-ns*))] |
There was a problem hiding this comment.
This stuff is O(N) from the number of namespace aliases in the POV-ns, so it banks on the assumption that people don't alias hundreds of namespaces. I think it is good enough for now, can improve later.
There was a problem hiding this comment.
Yeah, I think that's fine. Perhaps you can leave this in the code as a comment for future reference.
| "When displaying collection diffs, whether to hide matching values." | ||
| false) | ||
|
|
||
| (def ^:dynamic *pov-ns* |
There was a problem hiding this comment.
Maybe mention in the docstring that pov stands for "point-of-view", so people don't wonder about this?
|
Isn't this conceptually similar to the notion of 'tidy' output from the macroexpand middleware? https://github.com/clojure-emacs/cider-nrepl/blob/master/src/cider/nrepl/middleware/macroexpand.clj I haven't looked into it closely, but this might be a good opportunity to extract some common logic or at least compare the impls for semantic alignment - eg whether keywords and symbols should be handled differently and how |
|
Good point, I should take a look if something can be reused between the two. |
|
Looks like they are far enough after all. I will try to reconcile them some other day. |
3e2d15b to
e8758df
Compare
e8758df to
15054f3
Compare
This is an idea to address clojure-emacs/cider#3841. I think most of the time when people use long qualified keywords, it happens when using shortened syntax
::fooor::alias/foo. The proposed feature tries to reconstruct the shortened syntax by providing a config paramter:pov-ns(Point-of-View namespace) from where the inspection is initiated. Example, inspecting thisYields this: