This is a very cool effort which has the potential to solve a large number of long-standing bugs in julia-mode as well as providing features that the mode hasn’t even attempted like structural navigation (although I don’t think this is setup yet). I encourage anyone who’s remotely interested to give it a try. Huge props to @Ronis_BR for pushing this forward and rapidly working out kinks as well as to the several people who’ve written the tree-sitter-julia grammar (@savq, @maxbrunsfeld, @pfitzseb, as well as several others who don’t appear to have discourse accounts)!
(I will note in passing that @Ronis_BR is giving me far too much credit here; my contribution has been the programming equivalent of backseat driving)
And mine was merely sitting in the backseat, going along for the ride. Great work!
I think the Julia experience in emacs is excellent thanks to your work!
As an example I enjoyed recently, a little bit of code (and a few dependencies like TestEnv.jl):
allow me to run a package’s test suite with a keybinding (C-x p c – the standard compile-project keybinding), and then get the code coverage to display on the left fringe next to the code, so I can immediately see what is and isn’t covered.
All the standard IDE features like jump to definition and linting work well. If anyone is on the fence about giving emacs a try, I’d say it is well worth it in the long run.
I think we could add it already. The Julia parser (GitHub - tree-sitter/tree-sitter-julia: Julia grammar for Tree-sitter) is in very good shape! There is some rough edges, but they are minor. In fact, I think that the current state of the Julia grammar is already much better than we had in the regex-based approach in both Vim and Emacs.
Emacs v29 has not even been released yet. Is your mode really not usable with the version of tree-sitter available from Melpa for ordinary Emacs users?
LOL! Indeed, I was using Neovim until mid-2022 I think? I switched to Neovim from Emacs because from the user point of view, Emacs development seems stalled, whereas Neovim was advancing very fast.
I could not be more wrong. Emacs 29 is just an incredible work! Tree-sitter, native compilation, LSP, etc.
By the way, for those how want to see how the new mode looks like, here is a picture with all highlighting (this is not the default):
It can be a separate package for the time being, when it matures enough it can be merged into the “standard” julia-mode and removed from MELPA (they aren’t picky like the General registry about removal of packages). I don’t see any reasons for not having your package in MELPA right now, it’d only make adoption easier.
C-x n d (narrow-to-defun) works properly! It’s very broken in the standard julia-mode for functions spanning over more than a few lines. I presume it’s because scanning for the function boundaries fails, but I never had similar problems with long functions in any other language modes, I’m glad this works with this tree-sitter-based mode
one-line function definitions like f() = nothing aren’t found by imenu (this is also shared with standard julia-mode).
It should be working now, can you please test? The problem was that the tree-sitter grammar differentiates a “normal” function definition from a short function definition.