cursive-ide / cursive

Cursive: The IDE for beautiful Clojure code
574 stars 7 forks source link

defn and friends not recognised in CLJS buffers (Shadow-CLJS, deps.edn) #2888

Closed gerdint closed 3 months ago

gerdint commented 3 months ago

Cursive appear to be confused over basic CLJS forms for me (see screenshot). I am aware that Shadow-CLJS support is spotty but is it really the case that unresolved deps break basic language forms like defn? (and with that its indetation rules etc). I have my CLJS deps managed via Shadow's deps.edn support, as this will make Cursive resolve the non-NPM ones it seems.

cursive cljs

I use IntelliJ IDEA 2023.3.4+Cursive 1.13.1-2023.3

gerdint commented 3 months ago

@cursive-ide Do you need more info here (deps.edn or such?) or have any idea of what's up?

cursive-ide commented 3 months ago

@gerdint There's a section in the doc dealing with problems like this: https://cursive-ide.com/userguide/troubleshooting.html#help-lots-of-symbols-don-t-resolve. In your case, I suspect the project is not added correctly (step 3). Could you check that and let me know what you find?

gerdint commented 3 months ago

@cursive-ide I checked the stuff in the user guide and no progress. It's a full-stack project and all the CLJ files are fine. As you can see some stuff in the above CLJS file is resolved, but odd that core forms like 'defn' and 'let' are not I think.

cursive-ide commented 3 months ago

Could you try File | Cache Recovery | Repair IDE and follow the steps there to see if that helps?

If not, could you send a screenshot of your deps toolwindow with the dependencies expanded?

gerdint commented 3 months ago

I only have File | Repair IDE and File | Invalidate caches. I tried them with same result. Do you want to expand the whole deps tree? That looks like 10 screenfuls of content, onerous to screenshot! But below you have the non-expanded view:

Skärmavbild 2024-03-28 kl  11 05 03 Skärmavbild 2024-03-28 kl  11 06 07
cursive-ide commented 3 months ago

What I don't see in that list is ClojureScript itself. If you go to File | Project Structure, then choose Modules and select your problematic module, does it have the ClojureScript library attached under Dependencies?

gerdint commented 3 months ago

Good catch! I put shadow-cljs with its dependancy on clojurescript under a cljs alias in my deps.edn, which was not selected in the deps aliases sidebar. I selected it and now all the core CLJS forms are indeed resolved! Now it's just the NPM deps and DOM API functions which are not resolved, and there are already existing issues for that I believe. Cheers!

gerdint commented 3 months ago

@cursive-ide Some more docs on how to work with CLJS projects (such as the Shadow deps.edn hack) would be good I think (though I admit that in this case I was pretty stupid).