-
Notifications
You must be signed in to change notification settings - Fork 177
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
Cider's namespaces and vars filtered from ns-list and apropos #347
Cider's namespaces and vars filtered from ns-list and apropos #347
Conversation
@@ -39,24 +39,22 @@ | |||
(filter #(.startsWith (str %) project-root)) | |||
(mapcat ns-find/find-namespaces-in-dir)))) | |||
|
|||
(defn inlined-dependency? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would still have the inlided-deps filtered separately for clarity's sake.
In general the approach sounds reasonable. Maybe it'd be better to use filter regular expressions instead, so people would have more flexibility. Even this is better than the current situation, though. |
@bbatsov Ok. I'll make all the changes today and finalise this PR with tests and stuff. You mean accept regexp from the emacs custom var ? |
A list of regexps. |
@Malabarba what do you think about the config? |
I agree with using a regexp, though I have no opinion on whether it's better to have a list or a single one (they're pretty interchangeable).
|
Is that really a detail you have to ah inflict upon the users? Is it unreasonable to re-compile on the Clojure side? |
@arrdem Still, I'm pretty sure the regexp engines are not identical in terms of features, so we'd still need to tell users some detail about what they can't use. |
Seems to me a few regexps are more readable than one huge regexp.
True. I don't think that's a big deal provided it's explained in the docstrings. |
Yeah, I agree. A list would be easier to understand. I've tested this with regexps like |
@@ -52,11 +52,22 @@ | |||
;; rewritten by dolly | |||
(.startsWith ns-name "eastwood.copieddeps")))) | |||
|
|||
(defn internal-namespace? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just a regex matcher on a list now. But I think this name makes it easier to read functions where this is used.
The ns-list and apropos op's take an optional `filter-regexps` param. All namespaces matching any regexp from this list is dropped from the result. The apropos op drops vars contained in such namespaces.
;; If we don't pass the second arg, some cider ns will be returned | ||
(is (some #(re-find #".*nrepl" %) (n/loaded-namespaces))) | ||
;; Shouldn't return any cider.nrepl namespaces | ||
(is (not-any? #(re-find #".*nrepl" %) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Malabarba Changed it :-) . I got an email about your comment. But cannot actually see it on GH. Weird.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the comment was on a commit. The rebase must have cleared everything.
Apart from the odd test failure, everything looks good to me here. |
Me too. |
Great :-) This can be merged then ? I'll submit the cider PR tomorrow. |
For clojure-emacs/cider#1564. I still have to write the tests, update documentation etc. But is the basic idea correct ?
And on emacs, we can have a custom var like,
which will be nil, if we want all the internals visible. Also, if we jack-in from
cider-nrepl
project, we don't have to set it to nil. It picks up the un-inlined versions of deps. But its good to keep it configurable.Some screenshots;
ns-browser
apropos
If the user types out the entire ns form the ns-browser, he'll still get the vars listed. But thats ok I guess.