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

Filter non file urls from classpath response #667

Merged
merged 2 commits into from
Jul 12, 2020

Conversation

fp7
Copy link
Contributor

@fp7 fp7 commented Feb 24, 2020

Not all urls on a classpath are necessarily files. Eg. spring boot
adds "jar:file:..." urls

This can only be merged after clojure-emacs/orchard@9fe7a70 was released.

This is at least related to clojure-emacs/orchard#83

@bbatsov
Copy link
Member

bbatsov commented Mar 1, 2020

This can only be merged after clojure-emacs/orchard@9fe7a70 was released.

👍 I'll probably cut a new release in a week or so.

Not all urls on a classpath are necessarily files. Eg. spring boot
adds "jar:file:..." urls
@fp7 fp7 marked this pull request as ready for review March 5, 2020 18:44
@fp7
Copy link
Contributor Author

fp7 commented Mar 5, 2020

Here we go

[orchard.java.classpath :as cp]
[orchard.misc :as misc]))

(defn file-url?
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, doesn't it make more sense for this to be in orchard as well? Or at least a private function here?

(defn file-url?
[u]
(and (misc/url? u)
(= (.getProtocol ^java.net.URL u) "file")))

(defn classpath-reply [msg]
{:classpath (->> (cp/classpath)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've also been thinking we can just add a classpath-files function to orchard.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if that would filter out too much for other clients of orchard. Maybe some clients want to fix this problem instead of just removing the classpath entries which causes this function to fail. Would it not take that possibility from them if we filter on the orchard side?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, adding the function there wouldn't mean that people are forced to use it. It simply seems to me like something that's generally useful outside cider-nrepl.

@fp7
Copy link
Contributor Author

fp7 commented Mar 22, 2020

Sorry for the late reply. Was busy the last two weeks

@bbatsov bbatsov merged commit df6f165 into clojure-emacs:master Jul 12, 2020
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

Successfully merging this pull request may close these issues.

2 participants