This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-09-28
Channels
- # 100-days-of-code (10)
- # announcements (2)
- # architecture (16)
- # beginners (51)
- # bitcoin (3)
- # calva (1)
- # cider (6)
- # cljdoc (8)
- # cljs-dev (14)
- # cljsrn (4)
- # clojure (59)
- # clojure-italy (26)
- # clojure-losangeles (1)
- # clojure-nl (13)
- # clojure-spec (54)
- # clojure-uk (81)
- # clojurebridge (4)
- # clojurescript (20)
- # core-async (16)
- # cursive (39)
- # datomic (27)
- # emacs (12)
- # events (1)
- # figwheel-main (20)
- # fulcro (35)
- # funcool (1)
- # graphql (9)
- # hyperfiddle (10)
- # jobs (1)
- # jobs-discuss (7)
- # keechma (10)
- # lumo (22)
- # nrepl (18)
- # off-topic (28)
- # onyx (3)
- # pedestal (4)
- # re-frame (8)
- # reagent (8)
- # ring (4)
- # rum (3)
- # shadow-cljs (29)
- # testing (5)
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
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)
.
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:
project
> src
> clj
> cljs
> foo
> bar
thing.cljs
> test
> cljs
> foo
> bar
thing-test.cljs
The test
directory gets marked as Test Sources Root, but then none of my tests will run because they’re all in foo.bar.thing-test
, not cljs.foo.bar.thing-test
. 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.
@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 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: https://github.com/cursive-ide/cursive/issues/241
There’s a workaround which is described in that issue and also https://github.com/cursive-ide/cursive/issues/833 which might work for you, which is modifying the compiler resource patterns.
I'll try that workaround. Sad that I have to get everybody in my team to apply this though.