Fork me on GitHub

silly question, but thinking I'm missing something. Is there any way to send the current form to the repl ? I have send top-form and form before caret what I want sometimes is to just send the current form that I'm in. ex:

(comment (let [x (mount-app app)]
   (prn (:a1 x))) ) 


I run send top form but, after that I just want to send the prn to the repl (I do form before caret, but it's a bit annoying)


@claudiu If you select the form both Send to… forms will send the selection instead of what they would normally do.


yeah, but to do that you need to either: - format code the way which allows you to just triple-click the form (line) to send it to repl - or precise-click specifically after the form to send form-before-caret - or precise-select form - or multiple steps of shift+alt+left/right all of which break the flow harold


what really would be cool, is sending to repl all forms, current selection is touching. the same way formatting works now: select nothing – file is formatted, select few lines of a hash map - only that hash map will be formatted


otherwise it is tricky to "send current form": you are in the nested form, how many layers to send? 1? what if caret is in the middle of symbol? send just symbol? or always send form around it? unless it is top-form-symbol with nothing around it? ugh...


(prn (:a1 x)) was just thinking the current form I'm in depending on the cursor. Basically the one that has the first ( to the left. If my cursor is on n send the prn, if my cursor is on 1 send (:a1 x).


selecting it works nicely 🙂 thank you


Right, it’s tricky - a few people have asked about a “send current form” which would be the immediately surrounding form as @claudiu describes. Or something that allows you to select the scope you want, something like the introduce refactoring does.


@misha Generally I find the best option is to be somewhere in the form (or at the end of it) and use Expand Selection


I have a project with a directory structure like this:

  > src
    > clj
    > cljs
      > foo
        > bar
  > test
    > cljs
      > foo
        > bar
The test directory gets marked as Test Sources Root, but then none of my tests will run because they’re all in, not So I click on test and do “Unmark as Test Sources Root,” click on cljs underneath it, and select “Mark Test Sources Root” and everything works, except I come back to my project later, and discover that test is back to being marked as the Test Sources Root. How can I convince it that I want the Test Sources Root to be cljs and not test?


(This behavior is happening across multiple iterations of Invalidate Caches / Restart, btw — IDEA 2018.2.4, Cursive 1.8.0-eap7-2018.2)


Aha, caught it in the act! If I make changes to project.clj, and import changes, it jumps back to selecting the test dir as the Test Sources Root.


Interesting: if I rename test to tst, then when I import lein changes, it unmarks cljs, but does not mark tst. Saves me a step, at least.


have you tried :test-paths, :resource-paths and :source-paths? I find that cursive ignores changes done through Project Structure, but obeys project.clj


Woot, didn’t know about :test-paths in the project.clj, that fixes it perfectly! Thanks much, one less mystery in my way.


Einstein said there are only two things that are truly infinite: the universe and the number of possible keys in project.clj...and he's not sure about the universe


Einstein was wise.


what does this error mean? Error running 'REPL': Error creating RunProfileState


(i'm using clojure.main repl with deps.edn)


@cfleming can you comment on why Cursive marks directories defined in :resource-paths in the project.clj as source roots rather than resource roots? I have a java+clojure project and when I run the junit tests in intellij, none of my resources are available because of this.


@manutter51 Right, Cursive obeys project.clj - that’s the source of truth. If you want to change how directories are marked it has to be done there for reproducibility.


That’s also how e.g. the Maven integration works.


@stijn It means you should send me your log file 🙂


That’s cool — I didn’t have a :test-paths key at all (didn’t know there was one) and apparently there’s a default value.


Yeah, that can be tricky actually. Lein has defaults for :source-paths and :test-paths but Cursive will also pick paths up from e.g. cljsbuild config. So if you have src/cljs configured in cljsbuild Cursive will mark both src (from the :source-paths default) and src/cljs (from cljsbuild), and confusion will ensue.


Especially since if you have no :source-paths at all it’s confusing that the value for it comes from defaults.


I did thorough restructuring of my project with local/root deps and removing/importing of modules, so that might have caused it. when I import the project from scratch it worked


@t.denley I’ll reply over on your GH issue, but the tl;dr is that it’s by design due to unfortunate differences between IntelliJ’s and Leiningen’s understanding of what a resource folder is.


The original issue with gory details is here:


There’s a workaround which is described in that issue and also which might work for you, which is modifying the compiler resource patterns.


Depending on what it is that you need copied.


thanks -- #833 pretty much describes my issue entirely


I'll try that workaround. Sad that I have to get everybody in my team to apply this though.


@t.denley Yeah, it’s unfortunate. Let me know if you can’t work around it and I can look at it again, but IIRC there wasn’t really a good fix which wouldn’t significantly break someone’s use case.


I've already applied the workaround, and it does solve my immediate issue, thanks


Oh great. If you’re sharing some or all of your .idea config in your VCS, the change should get to your coworkers.