cursive

2food 2025-03-24T10:24:23.529749Z

In custom repl commands, is there a way to get hold of the surrounding list? The only relevant vars I see is ~top-level-form and ~form-before-caret. I see that you can pick "Surrounding list" in the exection selection, but I would like to alter the form before executing it. (I'm trying to implement a command to "eval the surrounding thread macro up to here")

2food 2025-03-24T10:30:40.967519Z

Currently my command looks like this:

(->> '~top-level-form
     (reverse)
     (drop-while #(not= % '~form-before-caret))
     (reverse)
     (eval))
But I'd like to replace the ~top-level-form with a ~surrounding-list so that it works everywhere.

Hugh Powell 2025-03-24T21:29:25.069139Z

Is there a way to get Cursive to recognise a var has been exposed with https://github.com/clj-commons/potemkin import-vars macro? Say we have the following namespaces

(ns foo)

(defn x [...] ...)

(ns bar
  (:require [foo :as f]
            [potemkin :as p]))
            
(p/import-vars [f x])

(ns baz
  (:require [bar :as b]))

(defn y [...]
  (b/x ...))
At the moment Cursive shows x in the foo namespace as unused (grey-out and can't find the use by potemkin using the :action FindUsages command) and doesn't show if bar/x is unused nor can it find of bar/x. Ideally Cursive would understand usage by potemkin (`foo/x`, not grey-out, can find usages) and usages of the potemkin version (`bar/x`, grey-out when not used and able to find usages).

onetom 2025-03-25T10:41:36.410399Z

is it possible, that potemkin is a dependency added by some tools.deps alias, which is not enabled in the Clojure Deps tool window under the Aliases tree leaf?

Hugh Powell 2025-03-25T21:54:33.489529Z

@onetom We explicitly include it in our projects, so I don't think that's the issue.

cfleming 2025-03-25T04:42:26.614929Z

I actually did add support for potemkin way back in the day, but it's possible something has broken. I'll try to reproduce with that example, thanks.

Hugh Powell 2025-03-25T05:57:45.625009Z

Awesome, thanks @cfleming 🙇