fun with calva's clojure lexer in a ts-node repl: https://gist.github.com/sogaiu/a73aad40bd168810f16dd8b7823f1ce1
> A Clojure Token Cursor. That's a bit terse. What is this?
things in here: https://github.com/BetterThanTomorrow/calva/tree/master/src/cursor-doc
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.
wow, totally didn't know the history!
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
the next step is to hook it up to this: https://github.com/sogaiu/hypothesis-grammar-clojure
Very cool. Why python?
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
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
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.
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?
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.
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
I might have analyzed the problem wrongly. It has been like this since I added the formatter to Calva.
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.
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
Is there any way to do the equivalent of clojure-thread-last-all
from clojure mode in emacs?
No, we should add that too. Please file an issue, @alex395