chlorine-clover

About Chlorine for Atom and Clover for VS Code: https://atom.io/packages/chlorine and https://marketplace.visualstudio.com/items?itemName=mauricioszabo.clover
2019-09-04T00:18:37.026900Z

thanks for sharing 🙂 for future reference, iiuc, the unification / merge effort of rewrite-clj / rewrite-cljs may involve more feature parity and api being more similar.

2019-09-04T00:22:57.027800Z

i am not sure what the state of namespaced keyword handling is atm but iiuc there used to be issues (and there a few other things that might be good to be aware of): https://github.com/clj-commons/rewrite-cljs/issues

mauricio.szabo 2019-09-04T01:49:51.027900Z

I've tested here, seems working for me. I also tested and detects sets and reader macros, so it seems I can use it. I'll test this new implementation on my current Clojure project I'm working with and see if there are any issues

mauricio.szabo 2019-09-04T03:09:18.030900Z

One question: I'm writing a new way of detecting forms. Now, the command evaluate-block should detect the "current block". The meaning of "block" differs from person to person, so I'm gonna ask here: what do you think: #?(:cljs 10) should probably be interpreted as-is, not (:cljs 10) #(+ 1 2) should be #(+ 1 2) or (+ 1 2)? @(:s state) should be @(:s state) or (:s state)?

mauricio.szabo 2019-09-04T03:10:18.031900Z

What about '(+ 1 2 3), should be '(+ 1 2 3) (as a list) or (+ 1 2 3) (as a function call)?

seancorfield 2019-09-04T04:14:12.034800Z

My first reaction was that the reader macro should be included in the block "of course". But then I thought a bit more about it and I'm not so sure. The "form" is the bit without the reader macro -- and the reader macro takes that form and turns it into another form. So here's what I think I expect:

seancorfield 2019-09-04T04:17:47.036100Z

|#?(:cljs 10) => eval sends whole expression; #?(:cljs 10)| => eval sends just (:cljs 10) so that leaves a couple of interesting situations...

seancorfield 2019-09-04T04:18:23.036700Z

#|?(:cljs 10) => eval sends whole expression (I think that's non-controversial)...

seancorfield 2019-09-04T04:19:14.037600Z

#?|(:cljs 10) => ??? I can see arguments on both sides but I'd lean to sending the whole expression...

seancorfield 2019-09-04T04:20:58.038400Z

... but that also feels like an inconsistency because what is evaluated depends on where the cursor is?

➕ 1
2019-09-04T04:54:27.043200Z

@mauricio.szabo for '(+ 1 2 3), for one example of something done elsewhere, in emacs, i believe putting the cursor after the right-most paren and invoking M-x eval-last-sexp returns (+ 1 2 3) -- not 6. so it appears to be treating it as a list. perhaps emacs folk have punted on the idea of a block (unless there's a region defined) and decided to support only the case of looking back from where the cursor is. may be other folks know better.

2019-09-04T04:59:26.047Z

it seems to me that for #(+ 1 2), it's more frequently going to be useful to interpret it as #(+ 1 2) -- if (+ 1 2) is desired, making a selection and using the evaluate selection command seems like it's not too bad.

2019-09-04T04:59:46.047500Z

similar story for @(:s state)

seancorfield 2019-09-04T04:59:50.047700Z

So the eval there includes the ' so it is (quot (+ 1 2 3)) that is sent for evaluation essentially.

2019-09-04T05:00:04.047900Z

yes, i think so

seancorfield 2019-09-04T05:00:35.048500Z

That would remove the inconsistency I was talking about above -- and would move me back to my initial "of course" position before I started overthinking it 🙂

2019-09-04T05:01:07.049Z

lol

jaihindhreddy 2019-09-04T06:09:51.049200Z

Inspired from Nikita Prokopov's syntax highlighting rules for Sublime, I began writing a Tree Sitter parser for EDN. Writing it for Clojure(Script) will probably be more difficult. Will that fix this?

jaihindhreddy 2019-09-04T06:10:21.049400Z

Anyways, I'll ping here if I get anything working.

jaihindhreddy 2019-09-04T06:13:16.050100Z

Agreed. All relevant reader syntax should be included IMHO.

jaihindhreddy 2019-09-04T06:13:35.050500Z

Selection can always be done to get just the form.

👍 1
mauricio.szabo 2019-09-04T12:59:14.055900Z

Great, I'll look at all the cases. It's interesting to notice that if you're in the inner parenthesis, the reader syntaxes will behave differently than the expanded form - (quote (+ 1 2)) will evaluate to 3, as we're evaluating the inner block. Does it makes sense?

✔️ 1
henrik 2019-09-04T13:27:07.057600Z

When working in a .cljc file (in this case, I’m working on routing, so I’m building the I/O on both sides concurrently), is there a key binding to quickly switch between “evaluate CLJ”/“evaluate CLJS”, as in the settings?

mauricio.szabo 2019-09-04T13:49:50.060Z

@henrik not yet, I'll add on newer version. I'll probably add a command to toggle between two configuration I'm also adding on a new version: "Prefer CLJ" and "Prefer CLJS" (the first one will evaluate .cljc as Clojure, and the second, evaluate as ClojureScript). There'll be also "Clojure only" and "ClojureScript only", that will ignore the file extension

henrik 2019-09-04T13:57:10.060800Z

👍 With four options, it might be better with four different optional keybindings, rather than toggling through each sequentially.

mauricio.szabo 2019-09-04T13:58:28.061500Z

I thought about only toggling between the "Prefer CLJ" or "Prefer CLJS" versions, wdyt?

henrik 2019-09-04T14:03:00.064700Z

That’s enough for my particular requirements, but OTOH, there might be use cases for the other two that I’m not aware of. You could set it up to CMD+ALT+[1-4] for example, and know that CMD+ALT+2 shifts you into Prefer-CLJS without having to check the UI (because that’s what it is bound to). For toggling, you may need to check the UI to understand what mode it just switched you into.

mauricio.szabo 2019-09-04T20:28:35.067400Z

Good news: I was able to implement the reader for evaluate-block that is able to understand the reader symbols!

👍 2
mauricio.szabo 2019-09-04T20:28:57.067500Z

Only a single side-effect ocurred: if you use #_(+ 1 2) I'm evaluating the inner form (it seems right to return it than just ignore it at all). But the "evaluate-top-block" is parsing the full form, with the #_. It probably is not what someone would want... ¯\(ツ)

2
seancorfield 2019-09-04T20:32:23.068200Z

I think that's a reasonable compromise. I tend to use (comment ,,,) Rich Comment Forms for stuff I'm experimenting with rather than #_ anyway.

➕ 1
mauricio.szabo 2019-09-04T22:49:57.071100Z

Nevermind, I was able to work-around it 😄 The thing is that I use the #_ a lot to test code, so it would not work that well for me 🙂

👍 2