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.

Daniel Compton
  • 13,878
  • 4
  • 40
  • 60
  • 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. – noisesmith Dec 28 '14 at 20:49

3 Answers3

9

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.

Colin
  • 1,112
  • 2
  • 7
  • 16
  • 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. – Carcigenicate May 14 '16 at 18:24
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.

Carcigenicate
  • 43,494
  • 9
  • 68
  • 117
  • 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. – Colin May 16 '16 at 22:47
  • @Colin Sorry, I shouldn't have said that this was better than your answer. I wrote this at the peak of my frustration. – Carcigenicate May 16 '16 at 22:52
  • No problem, and thanks for providing the instructions for how to bind the keys. I should add that to the doc. – Colin May 18 '16 at 03:44
0

Alt + Shift + R is the keybinding.

derloopkat
  • 6,232
  • 16
  • 38
  • 45
dev-Bilal
  • 1
  • 1