Fork me on GitHub
#calva
<
2020-09-22
>
sogaiu05:09:00

fun with calva's clojure lexer in a ts-node repl: https://gist.github.com/sogaiu/a73aad40bd168810f16dd8b7823f1ce1

calva 3
pez05:09:47

That is cool! Reminds me that I did try to extract the lexer and more to an npm module some while ago. Got stuck on something, but there is this: https://www.npmjs.com/package/calva-clojure-cursor-doc

sogaiu06:09:27

ah cool -- thanks for that. part of my motivation is to see if i can hook it up to some testing i'm doing of other similarish things.

borkdude11:09:59

> A Clojure Token Cursor. That's a bit terse. What is this?

pez12:09:01

Haha, yes, very terse. There’s a reason the version still is 0.0.1-test-4. Anyway, I think the token cursor goes back to an implementation of zmacs on some old Symbolic LISP Machine back somewhere between the 70s and the 80s. I think it still exists in emacs something like it as well. It’s a very nice way to navigate in LISP code, and powers about everything todo with s-expressions in Calva.

sogaiu12:09:05

wow, totally didn't know the history!

sogaiu12:09:39

after compiling to js, i patched together two of the files so i could run them in v8 inside of python: https://gist.github.com/sogaiu/71cca66261fe3b7b5f21278eec909b1c

bringe16:09:17

Very cool. Why python?

sogaiu22:09:19

here are some reasons: 1) test.check has a long-standing issue (the bind problem): https://github.com/clojure/test.check/blob/master/doc/growth-and-shrinking.md#unnecessary-bind -- apparently hypothesis does not have this issue 2) i am using it for tree-sitter-clojure which can be used from py-tree-sitter (not as easy to use tree-sitter stuff from clojure) 3) i was able to also get hypothesis to test parcera (which is clojure) via libpython-clj

👍 3
Jeff Friesen15:09:26

Has anyone been having trouble getting “format on save” working? I am so used to using that with Prettier in JS. I love it. But I can’t get it working in Calva. I’m using a vanilla Lein app template, REPL working and no linting errors. Format on Save is enabled. But saving the file doesn’t format it. Tab will format it. Any suggestions?

pez15:09:58

It is because the Calva formatter is a bit slow. VS Code only gives the extension so much time to perform the formatting. I think that we could get around it by adding a format-file-then-save command that the user can bind to the cmd+save. File an issue about it, please.

Jeff Friesen15:09:22

Ok, slow is relative I guess because using tab to format it is instant from a human perspective. But I get that it may not format before the save. Then the save kills that format command. I guess? I’ll file a ticket. Thanks

pez15:09:50

I might have analyzed the problem wrongly. It has been like this since I added the formatter to Calva.

pez15:09:12

Also, my experience is that Calva is so good at keeping the forms you edit formatted, that if it is a formatted file to begin with format-on-save doesn’t do anything most often. But ymmv.

Jeff Friesen15:09:33

Ok. I could see that for some people. Maybe its me that needs to get better at Paredit. I’ll make a ticket and you all can decide if you want it fixed or now. At the very least it will be on record for other people hitting the same problem. Thanks again

alexdavis15:09:36

Is there any way to do the equivalent of clojure-thread-last-all from clojure mode in emacs?

pez16:09:00

No, we should add that too. Please file an issue, @alex395

👍 3