loading namespace in cursive REPL
Asked Answered
W

3

5

I have loaded up Intellij and Cursive on my computer, all appears to work well except for the fact that I can not load a namespace in to the REPL nor can I run with Leinigen.

When I load the code into the REPL the REPL loads up but nothing is loaded into the REPL. I can then use the REPL though.

when I edit configurations I can only select normal processes and I can not run with Leiningen.

any help would be appreciated.

Whoa answered 28/12, 2014 at 12:22 Comment(1)
Do you expect any of your namespaces to be loaded in the repl at startup? This is not a standard behavior, and you need special config (like the :init-ns key in project.clj) to invoke it. The default is you get the user namespace, and then whatever other namespaces you manually require.Lazarolazaruk
C
11

Cursive, like most Clojure environments, doesn't load anything into your REPL by default. You can load code into the REPL using Tools→REPL→Load file in REPL. Note that this will not, by default, switch your REPL namespace to that of the loaded file - you'll need to use Tools→REPL→Switch REPL NS to current file for that, or you can require the loaded namespace into user as usual.

You should be able to create Leiningen Run Configurations, there is an option there to run specific tasks with Lein - if this doesn't work, please provide more information about exactly what you tried and what happened.

Ciera answered 29/12, 2014 at 0:39 Comment(1)
Seems rather silly that you're required to navigate that same menu twice considering if you're doing one, you're probably doing the other, and that you'll likely need to do this every time you start the IDE.Shawn
S
0

An extension of the above answer that helped me:

  • File -> Settings -> Keybindings

  • In the search box, type REPL (to easily find the relevant bindings).

  • Find the bindings associated with the two needed menu options ("load file in REPL" and "switch REPL NS to current file").

  • Give them simple, similar bindings. I'm using ctrl+shift+L and ctrl+shift+M

I tried giving them the same keys, then ignoring the conflict warning in an attempt to have them both activate at once, but it seems to ignore the second one that was bound.

This is the best solution I've found so far.

Shawn answered 14/5, 2016 at 19:16 Comment(3)
Sure, you can bind keys to any action in IntelliJ and everyone does, I just use the menu names so that people can find the actions they're interested in.Ciera
@Ciera Sorry, I shouldn't have said that this was better than your answer. I wrote this at the peak of my frustration.Shawn
No problem, and thanks for providing the instructions for how to bind the keys. I should add that to the doc.Ciera
O
0

Alt + Shift + R is the keybinding.

Oil answered 23/10, 2020 at 19:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.