This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-03-02
Channels
- # beginners (7)
- # calva (10)
- # cider (9)
- # cljdoc (2)
- # cljsrn (10)
- # clojure (35)
- # clojure-europe (1)
- # clojure-greece (1)
- # clojure-spec (31)
- # clojure-uk (6)
- # clojurescript (3)
- # community-development (2)
- # cursive (37)
- # duct (5)
- # emacs (7)
- # fulcro (40)
- # hoplon (7)
- # off-topic (8)
- # parinfer (1)
- # quil (6)
- # re-frame (7)
- # reagent (7)
- # shadow-cljs (45)
- # sql (17)
- # tools-deps (12)
- # yada (3)
@mattmorten Oops, sorry, I initially thought that was what you were talking about, then realised it was probably JVM but didn’t go back to edit my message. Yes, I mean JVM.
@dnolen e.g. if I have the following:
(s/def ::date inst?)
(s/valid? ::date (java.util.Date.))
(doc ::date)
Then from the usages of ::date
in the second and third lines I can Cmd-Click to go to the definition on the first line, and find usages etc works too.
I already had an opened Clojure project when I decided to open another one in another window. I was immediately greeted by the cheery "Indexing..." but not only in the second window - also in the first one! I can see this in IDEA logs:
INFO - il.indexing.FileBasedIndexImpl - Rebuild requested for index ClojureSymbolMeta
java.lang.Throwable
at com.intellij.util.indexing.FileBasedIndex.requestRebuild(FileBasedIndex.java:70)
at cursive.intentions.resolve$rebuild_all_indexes_BANG_.invoke(resolve.clj:142)
at clojure.lang.Var.invoke(Var.java:383)
at cursive.api.DelayedFn.invoke(DelayedFn.java:36)
at cursive.settings.ClojureProjectResolveSettings$loadState$1.run(ClojureResolveSettings.kt:95)
at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:314)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Why though? Why does Cursive have to rebuild-all-indexes!
(my guess is that's the culprit) when I open a project and rebuild the indexes of the already opened project?@dnolen It does work with CLJS, I just tested that exact code in a CLJS ns and it worked. Are you seeing something different?
@p-himik I’ll take a look at that, but I think that is because indexes are a curious mix of global and project-specific in IntelliJ. Clojure is an unusual case in that the contents of the index require configuration (in this case, you configuring which forms def global things) in order to index correctly. Almost no other language is like that. When that configuration is changed (in this case, by loading a project which customises resolution) I have no choice but to invalidate the index and reindex, which I think is a global operation.
Thanks! > configuring which forms def global things But how can a project influence another, completely unrelated, project in such way?
It can’t really, but when that config is changed I have to force IntelliJ to reindex, and it’s not designed to do that in a project-specific way.
I see, thank you. Yeah, it's been my pet peeve (and not mine only) when it comes to reindexing in IDEA - you can't make it reindex a single project via UI. And not being able to do that even in code explains that.
Yes, it’s because the indexes are actually global, but when you retrieve values for them you restrict the set of files it searches to a particular project.
It’s possible I could force it to just reindex a particular set of files, but I’d have to look at whether that’s possible.
Is there a way in Cursive to search a function through its fully qualified name?
1) If you’re looking at a usage, and you want to jump to declaration: Navigate -> Declaration
2) If you have a declaration, and you want to find usages: Edit -> Find -> Find Usages
3) If you only have a fully qualified name (i.e. you’re not looking at a usage) and you want to go to declaration, the easiest thing is probably: Navigate -> Symbol
note that this doesn’t support fully-qualified symbols like you asked, but it tends to narrow it down pretty well for me
4) If you really wanna search by fully qualified symbol, you can type it into a clj file and: Navigate -> Declaration
I know 4) is directly closest to what you asked, but I thought you might find it useful for me to give an answer in order of what I actually use most.
@dnolen The following appears to work for me: keyword :a/foo
(kw ns is from ns A), spec in ns B, at a usage in ns C: Navigate -> Declaration goes to spec in ns B
@potetm Thanks for the detailed answer.
Navigate -> Symbol is the closest to what I need. But it is a bit annoying that it doesn’t support fully qualified name.
My use case is that I look for the a function named audyx.body.patients-autocomplete/init
and when I type init
in the Navigate -> Symbol, I get lots of suggestions:
I am wondering why fully qualified name search is not supported/
It should even be simpler. What do you thing @cfleming?