Fork me on GitHub
#cursive
<
2022-02-22
>
onetom01:02:28

is there any issue with naming vars starting with a $ sign? clojure itself doesn't seem to mind it, but cursive underlines them as "no usages found", while others are properly resolved and navigable. eg, in this snippet:

(def $cfg (-> :local api.env/cfg-rmap valuate! remove-nils (dissoc :ssm/params)))
(def $user-email (=> "" "" ""))
(def $user-ref [:google.user/email $user-email])
(defonce ^{:doc "... service for `$user-ref`"} svc (-> svc/kit (assoc :cfg $cfg) valuate! ...
$cfg is ok, but both $user-email and $user-ref are marked as Unused global declaration, while $user-ref is clearly using $user-email right away on the next line.

cfleming04:02:50

I’d have to check, but I have a vague recollection that Cursive might treat those as logic variables, with different symbol resolution.

cfleming07:02:42

No, I misremembered - that’s only in the context of Clara macros. I’ll try your snippet.

onetom20:02:45

i tried it on 1.12.2-eap5-2022.1 and the problem still persist. i've narrowed it further down; the symbol has to have a dash in it for the problem to manifest. eg, this all resolves nicely:

(def user-email 123)
(def qwe user-email)
[qwe]
then i do a rename refactoring on user-email -> $user-email and this is what i get:

onetom20:02:37

funnily enough, i can navigate from the usage to the definition, but not the other way around. this smells like interference of special-case handling logic with something fundamental about symbol indexing.

cfleming21:02:55

That is super weird.

cfleming21:02:04

I’ll try with all those cases, thanks.

wegi12:02:09

Is there any way to resolve vanilla js functions? For example the .preventDefault function of events and others are not recognized at all.

wegi09:02:00

Thank you for the link

AJ Jaro14:02:20

We have a custom CLJS macro called defevent and I’ve resolved that as defn. I’m pretty sure I should then be able to do code navigation when calling that macro however it doesn’t seem to work. It worked previously at some point. Current Plugin Version: 1.12.1-2021.3 Also verified on: 1.12.2-eap5-2021.3

imre14:02:57

I saw similar behaviour today. What ended up working was getting Cursive resolve the macro as def, then when it finished indexing, telling it to resolve as defn again

imre14:02:49

@U0567Q30W could this have anything to do with the recent config structure change?

AJ Jaro17:02:53

huh, thanks for the suggestion @U08BJGV6E!! That worked for me!

onetom20:02:13

i've also noticed something similar a few weeks back. i set a symbol resolution to defn and an hour later i had to set it again.

imre08:02:01

Will see if the issue comes back after yesterday's def/n dance

imre12:02:34

the workaround I suggested here doesn't appear to stick unfortunately, I opened the project again where I had done this earlier and now I have to do it again