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

Create jump-to-resource function #22

Closed
technomancy opened this issue Jul 19, 2012 · 6 comments
Closed

Create jump-to-resource function #22

technomancy opened this issue Jul 19, 2012 · 6 comments

Comments

@technomancy
Copy link
Contributor

The idea here is that if you have a resource being loaded off the classpath (say by clojure.java.io/resource, but it could also be by something like enlive's deftemplate) that you should be able to jump to it with a single keystroke.

It's possible that the existing M-. functionality could be enhanced to do this as long as there's no ambiguity. Perhaps if M-. is invoked when the point is on a string, it could be interpreted as a classpath lookup? We'd also want it to work on namespaces I think, which would be on symbols, but maybe that's separate.

@gtrak
Copy link
Contributor

gtrak commented Feb 17, 2014

I like this idea, I've already written some code to try and determine if a string's a file path or a classpath resource for the 'info' op. This is used to provide file-and-line information either within jars or on the FS.

https://github.com/gtrak/cider-nrepl/blob/master/src/cider/nrepl/middleware/info.clj#L48

I could pull it out into an nrepl op, what do you think a good name would be?

My vote's on 'resource'.

I'm not sure how to retrofit the elisp to handle this case, but I'll be thinking about it. M-. seems natural.

@bbatsov
Copy link
Member

bbatsov commented Mar 19, 2014

Yeah, a resource op sounds like a good idea to me.

@bbatsov
Copy link
Member

bbatsov commented Jun 17, 2014

@jeffvalk What are your thoughts about this?

@jeffvalk
Copy link
Contributor

I like the idea. Regarding cider-jump, though, I wouldn't want to see resource behavior preferred to info within strings -- I find it really handy to be able to jump to var/class names in docstrings and comments. Perhaps cider-jump could try info first and then resource?

@bbatsov
Copy link
Member

bbatsov commented Jun 17, 2014

Yeah, I think we should have separate functions. Perhaps we should rename cider-jump to cider-jump-to-definition or something else more descriptive and the other command would be cider-jump-to-resource. Btw, do we need anything more than io/resource to make a resource middleware?

@jeffvalk
Copy link
Contributor

Nope, calling io/resource would essentially be the entire op handler.

dgtized pushed a commit to dgtized/cider that referenced this issue Jun 24, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants