Fork me on GitHub

@cfleming: Worked! I have to say that it's a much more enjoyable experience than paying for Visual Studio 🙂


A question about syntax highlighting in the REPL, it does not seem to work for the output when using a Nodejs repl through `Use clojure.main in normal JVM process´. I vaguely recall this being an issue when I tried it a while back. Does anyone know what the issue is?


I see some super-odd behavior with code with this pattern:

(defn aaaa []) ;; displays as "used var"

(defn bar []
  (aaaa)) ;; "Jump to source" goes to the "declare" below

(declare aaaa)


But even stranger, if the var name is > 4 characters, the first declaration is reported as "unused' (greyed-out, whatever):

(defn aaaaa []) ;; displays as "UN-used var"

(defn bar []
  (aaaaa)) ;; "Jump to source" goes to the "declare" below

(declare aaaaa)


(I grant that the declare should not be there. It's a mistake I found in my code.)


(In general, I think "jump to source" should ignore declares and go to the actual var, and declare should instead be considered a "use" of the var. I know that's not actually what's going on.)


@vikeri No, that doesn’t work right now, because of the way the clojure.main REPL works.


I’m getting close to implementing a proper CLJS REPL, and it will work at that point.


@cfleming Okok! Good to hear


@favila Yes, there are all sorts of edge cases here, and I’m really not sure how to handle var redefinition either. Currently Cursive assumes that the last definition is the actual one, but I agree that declare shouldn’t be taken into account there.


I’m not sure how to handle declare either, perhaps it should be a usage.


The thing that really surprises me is var length making the "unused" detection act differently


@favila Here’s how that works. The unused var detection isn’t perfect (the same is true of public vars in Java BTW), but it should never produce false positives. Basically what it does is it does a simple word search on the name of the var, which is indexed and fast. If that returns more than some threshold number of values (10 IIRC) then it bails and does nothing. If there are sufficiently few results, then it does a full resolve on those to see if any of them actually refer to the var.


So vars with more unusual names will get better results for this inspection.


This is just for the online in-editor one, obviously a full unused decl offline inspection can take as long as you want.