Fork me on GitHub
#cursive
<
2023-04-16
>
tobias22:04:38

Can I add another item to the wish list for Electric Clojure support? It would be awesome to get Cursive "jump to definition" working on an Electric function when that function is e/defn'd in another namespace. Example:

(ns app.greet
  (:require [hyperfiddle.electric :as e]
            [hyperfiddle.electric-dom2 :as dom]))

(e/defn Hello []
  (dom/p (dom/text "Hello World")))
(ns app.todo-list
  (:require [hyperfiddle.electric :as e]
            [hyperfiddle.electric-dom2 :as dom]
            [hyperfiddle.electric-ui4 :as ui]
            [app.greet :as greet]))

(e/defn Todo-list []
  (e/client (greet/Hello.)))
Desired behaviour: I could command-click greet/Hello. to jump to it's definition (this works in Calva according to @dustingetz). Actual behaviour: I see an error message "greet/Hello. cannot be resolved". Note that if I use (new greet/Hello) instead of dot notation then jump to definition works as usual. Also, jump to definition already works for Electric functions defined in the current namespace. Thanks for considering this 🙂

grav05:04:33

Not sure as I've never used the feature, but isn't this already supported via Macro Support? https://cursive-ide.com/userguide/macros.html

tobias05:04:32

Unfortunately that doesn't solve the problem. I've resolved e/defn as defn which gets rid of warnings but still doesn't fix the jump to definition feature

👍 2
grav05:04:12

I recall someone getting this to work with Reframe's subscriptions, though. I'm pretty sure it was configured via this feature. I wonder if re-indexing is needed?

tobias06:04:18

Sounds worth a try, thanks for the suggestion. How do I reindex?

tobias06:04:20

I tried invalidating caches and restarting (is that what you meant by re-indexing?) but it didn't fix the issue.

grav07:04:57

alright, yeah that's what I meant.

grav07:04:11

Might also be worth a try to x-post in #C7Q9GSHFV