If I want to use a library in my alire project I do a alr with fancylib, for example. In the editor (Emacs with ada-ts-mode) I have to look up some of the details of fancylib’s interface. I usually first try to find some specs on Github in a parallel browser window and eventually I have to get a parallel copy of the lib just to open the files in Emacs (i.e. cd ..; alr get fancylib, then in Emacs open the spec file at ..\fancylib_xxxx\src\fancylib.ads).
I have the feeling that there must be an easier way to find the spec files for a withed (i.e. imported) library, a way that is not tied to a special environment (Emacs ada-ts-mode, VS code, GPS, etc.)
When I import a package from alire repository, the language server lets me inspect the imported declarations and implementations with single keystrokes.
Those imports are stored under $cache.dir/builds/, where cache.dir[1] is alire’s storage directory that defaults to ${XDG_DATA_HOME:-$HOME/.local/share}/alire on Linux/macOS and $LocalAppData\alire ($UserProfile\AppData\Local) on Windows.
I used to be an Emacs poweruser and I’m sure it has good support for LSP. The language server is sure to be supported and offers all the ergonomics you need to quickly browse the sources. If you don’t use the language server, you could write a simple elisp function that opens a dired buffer in cache.dir or even searches the cache.dir for relevant package sources.
Thanks. I’ll play with that and see if I can get it working. I wasn’t able to right click the one in the earlier post as Firefox didn’t even try to load it due to the MIME type issues, so no right click save/as.
I’m happy where it stands, it’s really well done and works with helix (the editor I use).
~
As for Emacs, I haven’t used it for some time, but if I were going to, I’d start by installing lsp-mode and ada-ts-mode.
The only question is how well do they cooperate with alr and ada_language_server to extract the information necessary to find library imports…
Exact setup steps are illustratory, every emacser knows best how to configure the editor
For reasons unknown, lsp-mode bombarded me with warnings - so I increased the minimum warning level.
There is a ~20s compilation process for lsp-mode package around 1m20s timestamp. This thing seems to download and compile all the available LSPs. This is bad, perhaps something can be done.
The lsp-mode does not automatically detect the correct project root for me - so I modify it with option ‘I’ when I open a file in src/. The alternative is to use M-xlsp-workspace-folders-add in the project directory, or perhaps(?) to configure the lsp-mode to detect properly.
This works as shown in the video, assuming ada_language_server and alr are in PATH (though I think lsp-mode supports installing the language server automatically).
~
I also realised that the original question was really about alire and it wouldn’t hurt to have an alr project-level subcommand that lists all the dependencies with optional switch for pringing paths in cache.dir. In unixy systems we could then just invoke alr with --paths | grep 'libhello' | xargs vim. Assuming that alr with already fetches the sources and stores them in cache.dir, I see no reason why we should need to alr get them separately.