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

Customising symbol resolution with defn style #1440

Closed
pbzdyl opened this issue Jun 20, 2016 · 4 comments
Closed

Customising symbol resolution with defn style #1440

pbzdyl opened this issue Jun 20, 2016 · 4 comments
Milestone

Comments

@pbzdyl
Copy link

pbzdyl commented Jun 20, 2016

Currently custom symbol resolution supports following styles: def, let, for, -> and ->>.

It would be useful to also support defn style. It would work in cases like defcommand for Hystrix. Currently function (Hystrix command) arguments are not resolved and are shown as unresolved symbols in the args vector and function body.

Example Hystrix function/command:

(defcommand shorten-url
  {:hystrix/command-key "ShortenUrl"
   :hystrix/group-key GoogleApi}
  [long-url api-key]
  (println long-url api-key))
@mtruyens
Copy link

mtruyens commented Jul 8, 2016

  • 1

    I was just about to ask for the same feature...

@favila
Copy link

favila commented Jul 14, 2016

+1 "Works like defn" is a very common macro pattern. I currently set these to "works like def" but the locals they define in the vector are still unresolved.

Interestingly, I was able to edit the config file where these are stored (IDEA_CONFIG_DIR/config/options/ClojureResolveSettings.xml) and change resolve-as to clojure.core/if-let, clojure.core/when-let, (I have two macros with the same shape as if-let and when-let) and clojure.core/defn and Cursive appears to understand correctly the binding and scope of the local vars my macros create.

@cursive-ide
Copy link
Owner

I'll add defn to the list of options.

@favila, yes, you can hack your config file as you've discovered, and it will work as you expect in the meantime.

@cursive-ide cursive-ide added this to the 1.3.1-eap1 milestone Jul 17, 2016
@cursive-ide
Copy link
Owner

@favila One thing to note with that hack - if you fiddle with that file and add a modification which requires indexing more vars (i.e. not just local bindings), you’ll need to do a File->Invalidate Caches.

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

4 participants