A Less Trivial Trie Library

Yes, there is one mode based on tree-sitter, see this: Re: Still problems with ada-mode-8.1.0

I haven’t tried it, and I don’t know if you have to uninstall ada-mode to use ada-ts-mode. If you try it, please share your thoughts.

Ah! Thank you for bringing this to my attention. i’ve just tried it; more on that below. But to add some of that post into this discussion, the author of ada-ts-mode wrote:

I had the same issues previously mentioned where I wanted the ada-mode package to be installed and work immediately, not have to then build from source as a follow-on activity. I often hesitated updating ada-mode because I didn’t want to rebuild it. I had thought this
would have gotten better with the Alire integration, but by that time I had moved on. However, I’ve still seen a number of complaints on the mailing list even with Alire integration. The issue of building from source becomes compounded when you are running on multiple Operating Systems.

My main goal with ada-ts-mode was to remove the friction I felt in ada-mode. In addition to installation issues, I didn’t like the opinionated defaults and some of them were more involved to disable than others. I’ve mentioned some of these defaults that I didn’t like
in past posts. I also had other problems such as ada-mode’s trouble handling files with mixed LF/CRLF end-of-line markers. Working on legacy code bases where this occurs is troublesome with ada-mode.

So, what i did just now was install ada-ts-mode via Emacs’ package manager, without uninstalling ada-mode. It installed without issues. i then opened less_trivial_trie.adb - in doing so, i was informed that there was no tree-sitter grammar installed, and would i like to install one from <url>? i answered yes, it installed without issues, and the file was syntax-highlighted. :slight_smile: A very quick and painless process.

That said, indentation is very obviously not yet working (as of the 20240426.256 version), as the mode’s author wrote:

I believe the only thing missing from ada-ts-mode (at least for me) is indentation support (which I have a significant portion of this implemented, just not publicly available yet as I wanted to have a complete implementation before releasing it). If desired, you can use
the Ada Language Server indentation support.

i haven’t tried using the ALS yet. i’ll try to test it out and report back.

Looking at the source of ada-ts-mode.el, it doesn’t depend on ada-mode. It does, however, basically make itself the provider of ada-mode.

All in all, i’d say ada-ts-mode feels very promising indeed - here’s the repo README. But of course, i say that as someone new to Ada who isn’t currently actively using it for any projects; i’d be interested to hear the opinions of experienced Ada devs who use Emacs.

I wonder whether the rebuilding caused by alr install after being built on alr build is an issue of ada-mode or Alire. In general, this doesn’t happen for a crate, gprbuild is called again, but nothing is rebuilt (it says gprbuild: "crate" up to date). Thinking more about it, if gprbuild is called again, it should be called with the same options as a previous alr build command, otherwise it should support also the same build options.

Hmm, well, grepping for instances of gprbuild in the ada-mode directory makes me realise that the mode and its build process are very complex; i suspect it would take me quite some time to try to get my head around how all the pieces fit together. One thing of note though: the use of Alire by build.sh results in a second copy of ada-mode being created inside the original ada-mode directory, and that might be related to the rebuilding you mention.