cursive

p-himik 2025-09-23T14:03:12.730649Z

An idea to facilitate debugging and navigating around code. When dealing with protocols and multimethods, you almost never want to navigate from a particular call site to the protocol itself or the defmulti. You usually want to get to a particular impl. Maybe it's already possible and I am simply not aware of this. But what if there was a dialog/pop-up between you navigating to such a symbol and the navigation itself, prompting you to choose where you actually want to go? So, suppose there's this:

(ns proto)

(defprotocol P
  (f [_]))

(ns a
  (:require [proto]))

(defrecord A
  P
  (f [_] ...))

(ns b
  (:require [proto]))

(defrecord B
  P
  (f [_] ...))
If you have (proto/f) somewhere and navigate to f, you'll land at defprotocol. But what if there was a pop-up that showed something like this
-> (defprotocol P (f [_]))
   (defrecord A P (f [_] ...))
   (defrecord B P (f [_] ...))
and you could choose where you want to go immediately? Same with multimethods, with the pop-up showing all the statically known locations. Of course, it wouldn't work with macros that write such code. And in the case with multimethods, it might show not-so-useful (defmethod m some-value-from-a-loop ...). But macros have always had that trait, and at least dynamically created multimethod specifications seem to be rare. There's this issue that intersects with what I'm suggesting: https://github.com/cursive-ide/cursive/issues/437 But it's only about protocols and only about finding impls, not about navigating.

cfleming 2025-09-24T09:05:07.999249Z

Yes, this should definitely work, it's been on my list to fix for the longest time. I'll fix this soon.

❤️ 3
imre 2025-09-23T15:45:33.072469Z

Ideally this would tie in to IntelliJ's gutter icon implementations/override thing that's clickable

p-himik 2025-09-23T15:47:15.112029Z

Oh, for sure!