This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-08-16
Channels
- # announcements (1)
- # beginners (83)
- # boot (10)
- # cider (23)
- # cljdoc (24)
- # cljs-dev (3)
- # clojure (138)
- # clojure-finland (1)
- # clojure-italy (12)
- # clojure-losangeles (2)
- # clojure-mexico (1)
- # clojure-nl (18)
- # clojure-russia (23)
- # clojure-sg (1)
- # clojure-spec (15)
- # clojure-uk (126)
- # clojurescript (94)
- # cloverage (2)
- # core-async (1)
- # cursive (98)
- # datomic (54)
- # figwheel-main (19)
- # hyperfiddle (21)
- # jobs (1)
- # jobs-rus (4)
- # leiningen (4)
- # liberator (4)
- # off-topic (15)
- # parinfer (9)
- # re-frame (23)
- # reagent (19)
- # reitit (2)
- # ring-swagger (3)
- # rum (3)
- # shadow-cljs (244)
- # sql (4)
When creating a new local REPL in a Deps project, the UI does not auto select your module if there is only one module in your project. Seems like it should do that.
Also @kenny, I think you asked about this one a while back: https://github.com/cursive-ide/cursive/issues/2031
BTW another thing I keep into (even with the auto-import in the latest release) is changing my deps.edn and it not refreshing or not refreshing before I start my REPL. This, of course, causes the REPL classpath to be out of date with what my deps.edn has and can lead to very confusing results. Would it be possible to have a check to see if the current deps.edn is different than the deps.edn that Cursive knows about when starting a REPL?
Yeah, the auto-import stuff is based on IntelliJ infrastructure, and I can’t figure out exactly when it actually requests a refresh - it seems like it’s not very aggressive.
Hi. Is there a list of good IDEA setting when using Cursive on osx? Got a new computer and after installing the latest Ultimate + Cursive UI the editor seems bit slow (changing tabs, opening large EDN-files etc.). The default memory max setting is some hundreads on Mbs.
There is some documentation for lein-figwheel, but it does not seem to be relevant.
@dottedmag it works with the new https://figwheel.org/docs/scripting_api.html You will need to adjust the following instructions to work with it: https://github.com/bhauman/lein-figwheel/wiki/Running-figwheel-in-a-Cursive-Clojure-REPL
@bhauman It seems that Cursive does not run clj
, so the main question is how to bring in the dependencies.
I believe it can now, but you could use lein
in the short term to validate it can be done.
@dottedmag (and @bhauman) If you are willing to use the EAP of Cursive (which has support for deps.edn
), setting up a figwheel.main
REPL in Cursive is trivial.
Just pick “Use clojure.main in normal JVM process” and in the Parameters box put something like
-m figwheel.main -b base
or however you start your REPL. Leave off the -r
as Cursive supplies it.Does anyone know of a way to get the code inspection to also warn/show globally unused vars instead of just local ones? It’s 🔪 day for the codebase and I’d like to knock off as much dead code as possible.
(only pinging you so that this doesn’t completely fall off your :satellite_antenna: since it’s late in your tmz)
@U344U5FNH Yeah, the offline inspection doesn’t work for Clojure and I don’t know why. Thanks for the prompt, I’ll ask about it in the JetBrains forum and hopefully it’ll be a quick fix.
Cursive actually does mark some global symbols as unused in the editor, but not all of them for performance reasons. It shouldn’t have false positives (i.e. if it’s marked as unused there, it’s unused, but it won’t mark them all)
Yeah, I mainly wanted to get it in the inspector. Getting it in the editor is muy bueno, but being able to review all the ish at a high level :thumbsup: :thumbsup: :thumbsup:
@mfikes Do I need to do something else to make it work (maybe some checkbox in project settings)? I have installed EAP build, put -A:fig
into parameters field of REPL, and it runs runs java -classpath <...> clojure.main -A:fig -r
(I effectively just copied the :main-opts
from what would be in the :fig
alias into the Parameters box.)
Right, it can be done. But now I need to get all the libraries from the deps.edn
and add them as libraries to the project manually?
No. With the EAP build you should be able to refresh your deps (from the Deps tab on the right), and they will automatically be added
Hey people! 🙂 Would you know ? currently in intellij: double clicking or ctrl-w on aa - selects the whole symbol or namespace how to select only ‘aa’ in? http://aa.bb.cc aa-bb-cc :aa
Has anyone bumped into an issue with unresolved symbols when using Luminus? I have just created a new project through lein new luminus my-app
, but when I import it in Cursive (Personal license on latest community IDEA version) I get lots of unresolved symbols, mostly coming in courtesy of mount
.
I'll take any suggestions on how to resolve this as it's rendering Cursive unusable for this little project of mine.
Hello, I just added java sources to my project in Cursive and now when I go to start the REPL, I get the following error: Error running 'REPL for ag': Cannot run program "java"
.
When I run leiningen from the command line things work. When I run lein compile
it works too and then I can start the REPL. Looks like I don't have JAVA_HOME set in IntelliJ or for the Cursive plugin. I tried to set the environment variable in the runner but that didn't work.
@ikitommi I have my IntelliJ set to use 2G (on a 16G laptop) and that works well - it’s probably overkill, but I usually have 2-3 big projects open at the same time.
@chris.schreiner When you say “not showing” the symbols, what do you mean?
@dottedmag @mfikes Yes, you’ll need to use a Deps project for this. I also need to add support for running REPLs with aliases, which is not there yet.
@vim55k Currently that’s only possible by dragging with the mouse. That’s been a little contentious, but on balance for Clojure I find it more useful than selecting segments when using “expand selection”.
@sgerguri I’ll try that today and see if I can reproduce. Sometimes the Cursive indexes can get messed up, and the best way to fix them is to use File->Invalidate caches/Restart, but if the symbols are defined using macros or in other dynamic ways Cursive can struggle too.
Is there a way to run some code in the REPL using the test fixtures for the namespace you're in?
Because I have this:
(defmacro test-env
"Executes `body` after running all fixtures."
[& body]
`(let [once-fixtures# (join-fixtures (:clojure.test/once-fixtures (meta *ns*)))
each-fixtures# (join-fixtures (:clojure.test/each-fixtures (meta *ns*)))
fixtures# (join-fixtures [once-fixtures# each-fixtures#])]
(fixtures#
(fn []
~@body))))
@cfleming Thanks! The issue specifically seems to happen with mount
only - and can be easily reproduced on a fresh luminus
app if you just jump through to mount.core
.
You might be able to do it using an internal function from clojure.test
, but I can’t remember well enough how all that works.
That triggers a StackOverflowException inside IntelliJ, and it does the same when you navigate back. I've tested this across different IDEA versions - 2017.2, 2018.2.1 community and ultimate.
The macro I sent initializes the test env. I just need a way to get the form before the caret.
@sgerguri Which Cursive version are you on? The recent EAPs have a fix for at least one SOE problem.
@kenny They’re stored in repl-commands.xml
- if you share that file, then I think that should work, yes.
Is there a way to have typed (
, {
or [
wrap current selection instead of replacing it?
@dottedmag Settings->Editor->General->Smart Keys->Surround selection on typing quote or brace
@cfleming the EAP definitely fixes that issue. Thanks for the stellar support here on Slack, Colin - looking forward to the next stable release.
@sgerguri Great, thanks for letting me know! Next stable should be out in a week or two.
Just realised I mixed two issues together - the SO and the symbols not resolving. I reported the former, which I ultimately discovered by trying to resolve the latter, so apologies about the confusion!
Invalidating caches does not help. The symbols are effectively defined using macros, so I'm guessing that is expected behaviour for now - but if there's any possibility of this getting better in the future then I will certainly very much appreciate it! 🙂
@sgerguri What does the macro look like? There is some support for telling Cursive to resolve a macro form like def
, defn
etc, which may be sufficient.
#?(:clj
(defmacro defstate
"Defines a state. Restarts on recompilation.
Pass ^{:on-reload :noop} to prevent auto-restart
on ns recompilation, or :stop to stop on recompilation."
[state & body]
(let [[state params] (macro/name-with-attributes state body)
{:keys [start stop] :as lifecycle} (apply hash-map params)
state-name (with-ns *ns* state)
order (make-state-seq state-name)]
(validate lifecycle)
(let [s-meta (cond-> {:order order
:start `(fn [] ~start)
:status #{:stopped}}
stop (assoc :stop `(fn [] ~stop)))]
`(do
;; (log (str "|| mounting... " ~state-name))
;; only create/redefine a new state iff this is not a running ^{:on-reload :noop}
(if-not (running-noop? ~state-name)
(do
(~'defonce ~state (DerefableState. ~state-name))
(mount-it (~'var ~state) ~state-name ~s-meta))
(~'defonce ~state (current-state ~state-name)))
(~'var ~state))))))
That’s possible, the cljc support can be flakey sometimes - it’s a tricky problem. Let me generate a luminus project now actually, and I’ll try it out - one sec.
@sgerguri Ok, I have a luminus project open, where am I looking for the unresolved symbols?
Yeah, you can choose to resolve defstate
as def
and that works well - see https://cursive-ide.com/userguide/macros.html