I saw somewhere that some formatter has a limit of 100 lines before it gives up trying to format a function
Yes, if you have <https://github.com/guns/vim-clojure-static>
installed
There is a fork of that project, <https://github.com/clojure-vim/clojure.vim>
which makes it faster and extends the limit to 300 lines
And you can extend the limit to whatever you want BTW
:thumbsup:
All those latest gen CPUs and GB of RAM now allow highlighting more than 300 of lines of code? 😱
Only if you're lucky...
Vim syntax parsing is using regexes and doesn't know about s-expressions so it is not the most efficient way to handle clojure code. (Indent code uses syntax rules to find out the form and element types etc.)
And the indentation code is written in vimscript.
We could perhaps implement indentation for Neovim in Lua, but might have to reimplement quite many parts to be able to move indentation logic there. But in some microbenchmarks Lua is 2000 times faster than Vimscript so it could be worth it.
I've been compiling fennel into Lua for all my nvim work for ages now, can recommend 😄
Do you have your workflow documented? Or do you compile to lua and then just provide that to nvim
https://github.com/Olical/aniseed all here
Thank you 🙂
clever name
@juhoteperi I think NeoVim 0.5 brings treesitter precisely for this, right? In the sense that the treesitter parser will expose a low-level AST (even for malformed code, apparently) that you can them manipulate for indentation etc.
@dev964 highlighting is still wonky, but formattingindenting is possible 🙂
I guess so. I haven't yet looked how well that will work with Clojure.
How is the treesitter impl for Clojure implemented?
I have clojure-treesitter running here but haven't bothered to use it for anything (even highlighting) because I ran out of steam 😉
Here's what used: https://github.com/sogaiu/tree-sitter-clojure
Some JS, some C and JS is compiled to WebAssembly? Seems really complicated.
That's a treesitter requirement. It's targeting C. NeoVim bundles all this internally somehow, or at least can auto-install the binaries for you.
tbh, sorry for a snarky comment - it wasn’t meant to target speciffically clojure highlighting or even vim - just computing in general
and yes, from what I understand tree-sitter is just around the corner 🙂