cursive

salam 2025-05-24T04:39:08.911799Z

@aurelien.plazzotta, following up on your question here: https://clojurians.slack.com/archives/C03S1KBA2/p1748053232002429

salam 2025-05-24T04:42:29.608289Z

so i see two problems in your project setup: 1) Cursive didn’t recognize your project as a Clojure Deps project. 2) you are asking Cursive to start a Rebel REPL

salam 2025-05-24T04:50:23.032479Z

for 1), i suggest that you start from scratch and follow the instructions on the following page: https://cursive-ide.com/userguide/first-repl.html to import your project into IntelliJ IDEA. for 2), Rebel REPl is a REPL client that’s meant to be used directly in a terminal, not indirectly from within another REPL client, such as Cursive. if this doesn’t make any sense to you, then just ignore all the Rebel REPL-related stuff in your project for now and focus on getting an nREPL working with Cursive.

Aurélien Plazzotta 2025-05-24T06:03:13.301359Z

I understand what you mean by 2). I will not bother with rebel for the time being when using a text editor in stead of my day-to-day terminal (viz. kitty). I did leave it as is in my deps.edn file never the less as I know not how to start a deps from scratch. On another note, I did succeed to start the REPL as it seems connected from now on but struggling to run it. I managed not to invok the main entry point and thought that calling it using "group-id/artefact-id" nomenclatur would do the trick... Here is a link for a screen shot displaying the REPL log: https://iimg.su/i/UEA9WJ You were right about re-creating a new project as IntelliJ immediatelly brought forth a tool tip suggesting to adding the Deps to the project. The state of affairs is still better than before though so I have hope :-)

p-himik 2025-05-24T06:57:40.048839Z

Following up from StackOverflow - interesting that there was no Add as as Clojure Deps Project option for you. But you have a slightly newer version of Cursive than I do, so maybe the option got renamed. > I managed not to invok the main entry point and thought that calling it using "group-id/artefact-id" nomenclatur would do the trick... It's not "group-id/artefact-id", it's namespace/function. (BTW try to avoid single-segment namespaces like greetings). REPL cannot run (greetings/-main) because you have not required the greetings namespace in the REPL. You can load the greetings.clj file in the REPL and then run (-main) in the context of that file, or you can execute (require 'greetings) in there to require it.

👆 1
salam 2025-05-24T07:36:44.144239Z

On another note, I did succeed to start the REPL as it seems connected from now on but struggling to run it.> I managed not to invok the main entry point and thought that calling it using "group-id/artefact-id" nomenclatur would do the trick... > > Here is a link for a screen shot displaying the REPL log: https://iimg.su/i/UEA9WJ progress! as explained by p-himik above, you’re getting the syntax error because the Clojure compiler couldn’t find that namespace (`greetings`) in the runtime environment (in memory) even though the source file in which the namespace is defined (`src/greetings.clj`) is on your class path (on disk). in order for the Clojure compiler to find a namespace in the runtime environment, you need to first require it in your current namespace (`user`). try the following in the REPL:

;; Do this once first.
(require 'greetings)

;; Now call functions in 'greetings'.
(greetings/-main)

Aurélien Plazzotta 2025-05-24T20:14:24.018459Z

Thank you both! Is that normal that the main namespace will not change even after having added it to the runtime environment? It keep considering user even thought I loaded greet.core into the current context. See my screen shot: https://iimg.su/i/GD6YJn On a side note, creating a project with Leiningen is even worse, it bring another default namespace: `<name_of_project>.core Even after following the mentionned tutorial at https://cursive-ide.com/userguide/first-repl.html, I can not get my head around it and define my own default namespace.

p-himik 2025-05-24T20:18:22.703179Z

That namespace in the input field is specifically for forms evaluated in that input field. Unless you have the "Evaluate forms in REPL namespace" checkbox marked in the settings, or unless you're evaluating forms from a scratch file and not a proper namespace. So if you evaluate some form from greet.core, it will be evaluated within the context of greet.core, even if the current REPL namespace is user or something else.

p-himik 2025-05-24T20:18:55.912989Z

Just don't use the input field inside the REPL panel - edit proper .clj files and evaluate forms from inside those files instead.

Aurélien Plazzotta 2025-05-24T21:05:56.038619Z

What do you mean by form? And what is an input field? Is that the greet.core namespace or user one? I am just a beginner, I can not make sense of your last sentence either. I apologize if I made the impression that I was a profesionnal programmer.

p-himik 2025-05-24T21:17:37.579269Z

A "form" is something that the Clojure reader can read. Something that's a complete expression. Any scalar like 1 or :x, any collection, e.g. [1 2 3], any s-expression - things inside (...). The REPL input field is that input box in the bottom right corner on your screenshot. That's alright. But do note that there's #beginners, although it's usually for things that are more directly related to programming itself and not to some peculiarities of a particular IDE.

Aurélien Plazzotta 2025-05-24T21:46:24.029239Z

Thank you for your time and your patience. I just not yet read about https://clojure.org/reference/reader#_reader_forms as I am still at the early start of the Clojure Journey: https://clojure.org/guides/learn/functions I think I will probably buy Clojure brain teasers book in a few days but I try not to plunge into despair as the mountain of know-how required to carry out even simple things is disorienting.

p-himik 2025-05-24T22:06:24.970189Z

It's a good book but I don't think it's a suitable material for complete beginners. To me, https://www.braveclojure.com/clojure-for-the-brave-and-true/ seems like a good beginner book.

p-himik 2025-05-24T22:08:21.521449Z

And yeah, definitely do check out the #beginners channel and don't hesitate to ask any question, regardless of how stupid you might think they are. And don't bang your head against the wall for more than 15-30 minutes - if there's a complete lack of progress, just reach out and ask.

Aurélien Plazzotta 2025-05-24T04:41:27.396579Z

Thank you for the jump-start 🙂

Aurélien Plazzotta 2025-05-24T06:30:29.794849Z

Is there a way to use Leningen with last version of Clojure? I have Clojure 1.12.0.1488 installed but Leiningen loads the 1.11.1 version.

p-himik 2025-05-24T14:21:35.238239Z

Have there been some changes to how Cursive formats Clojure files? I just noticed that on 2025.1-251 formatting large files is extremely slow. Takes around 6 seconds to format 1.3k lines.

p-himik 2025-05-25T13:19:26.337579Z

Noticed that even non-interactive things like syntax and issue highlighting were also much slower in some files. I think invalidating all the caches has made it much better, so there's probably no need to look into it at the moment.

cfleming 2025-05-25T19:36:45.819589Z

Yeah, sometimes the indexes seem to get corrupted on a version upgrade, I've noticed that in the last couple of upgrades.

cfleming 2025-05-25T19:36:59.126009Z

Let me know if it continues to be a problem.

👍 1
cfleming 2025-05-24T22:14:49.835769Z

No, that hasn't been touched in ages. IntelliJ's underlying engine might have changed in ways that affect it though, I'll take a look.

p-himik 2025-05-24T22:20:35.176989Z

Thanks! Hmm, could also depend on the project, although I have no idea how formatting a single file could be affected by any other files. I just tried on some sources in the Clojure project - 800 line CLJ file was formatted almost instantly, 2.4k line Java file took around a second.

p-himik 2025-05-24T22:21:09.140399Z

Oh, the Java formatter is probably slow due to the editing - it had to change the whole file. Even undoing the change takes almost a second.

Chris Lowe 2025-05-26T09:21:17.691449Z

I’ve noticed a similar performance regressions with formatting. Also, if the form in the editor is badly malformed then performance really slows and frequently causes IntelliJ to report low memory.