Fork me on GitHub
#cursive
<
2017-03-06
>
shaun-mahood16:03:30

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

vikeri19:03:26

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?

favila19:03:36

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)

favila19:03:37

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)

favila19:03:52

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

favila19:03:20

(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.)

cfleming20:03:18

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

cfleming20:03:47

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

vikeri20:03:29

@cfleming Okok! Good to hear

cfleming20:03:48

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

cfleming20:03:06

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

favila20:03:48

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

cfleming20:03:15

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

cfleming20:03:29

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

cfleming20:03:55

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