calva

Wednesdays you might find @U0ETXRFEW in the Gather Calva space. Invite is https://gather.town/invite?token=GZqrm7CR and the password is `Be kind`.
2020-09-22T05:01:00.082300Z

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

1
borkdude 2020-09-22T11:41:59.083Z

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

pez 2020-09-22T12:51:01.083400Z

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.

2020-09-22T12:58:05.083600Z

wow, totally didn't know the history!

2020-09-22T12:59:39.083900Z

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

2020-09-22T13:00:45.084100Z

the next step is to hook it up to this: https://github.com/sogaiu/hypothesis-grammar-clojure

bringe 2020-09-22T16:29:17.098Z

Very cool. Why python?

2020-09-22T22:21:19.098200Z

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

👍 1
pez 2020-09-22T05:59:47.082500Z

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

2020-09-22T06:32:27.082800Z

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.

jefffriesen 2020-09-22T15:26:26.086700Z

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?

jefffriesen 2020-09-22T15:26:27.086800Z

pez 2020-09-22T15:31:58.089600Z

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.

jefffriesen 2020-09-22T15:34:22.091600Z

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

pez 2020-09-22T15:35:50.092300Z

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

pez 2020-09-22T15:37:12.093700Z

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.

jefffriesen 2020-09-22T15:39:33.095600Z

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

alexdavis 2020-09-22T15:50:36.096900Z

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

pez 2020-09-22T16:27:00.097700Z

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

👍 1