Fork me on GitHub
#cursive
<
2019-03-02
>
cfleming02:03:05

@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.

cfleming02:03:37

@dnolen Standard navigation should work, Cmd-Click sorry, not Ctrl-Click.

cfleming02:03:04

@dnolen e.g. if I have the following:

(s/def ::date inst?)

(s/valid? ::date (java.util.Date.))

(doc ::date)

cfleming02:03:48

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.

cfleming02:03:58

If that’s not what you mean, let me know.

dnolen03:03:44

So it doesn’t work for ClojureScript specs?

p-himik08:03:23

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?

p-himik08:03:01

And if I open 5 projects? I won't even try - my laptop doesn't have enough RAM.

cfleming08:03:06

@dnolen It does work with CLJS, I just tested that exact code in a CLJS ns and it worked. Are you seeing something different?

cfleming08:03:40

@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.

cfleming08:03:55

Note that it will only reindex Clojure indexes though, not e.g. Java ones.

cfleming08:03:17

But I will check when I have the code in front of me to check my understanding.

p-himik08:03:53

Thanks! > configuring which forms def global things But how can a project influence another, completely unrelated, project in such way?

cfleming08:03:40

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.

cfleming08:03:53

(again, I think)

p-himik08:03:47

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.

cfleming08:03:42

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.

cfleming08:03:10

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.

dnolen12:03:04

@cfleming and it works when the spec is in a different file?

viebel16:03:22

Is there a way in Cursive to search a function through its fully qualified name?

potetm18:03:13

@viebel in what context? Like, find usages?

potetm18:03:35

or go to declaration

potetm18:03:21

I’ll just spew out what I know 🙂

potetm18:03:23

1) If you’re looking at a usage, and you want to jump to declaration: Navigate -> Declaration

potetm18:03:09

2) If you have a declaration, and you want to find usages: Edit -> Find -> Find Usages

potetm18:03:42

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

potetm18:03:04

note that this doesn’t support fully-qualified symbols like you asked, but it tends to narrow it down pretty well for me

potetm18:03:44

4) If you really wanna search by fully qualified symbol, you can type it into a clj file and: Navigate -> Declaration

potetm18:03:28

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.

potetm18:03:02

@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

dnolen19:03:33

I see what's going on - this doesn't work for deps.edn git libs

viebel20:03:55

@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/

potetm21:03:39

yeah, a “nav to symbol” that works like the “nav to namespace” would be bananadance

potetm21:03:23

also, wtf, I just learned about “nav to keyword”

potetm21:03:46

I assume if “nav to keyword” is possible, “nav to symbol” should be as well

viebel21:03:43

It should even be simpler. What do you thing @cfleming?