Thanks Simon, I really appreciate your vote of confidence in this package and your recommendation of it to others, that is a real stamp of approval! I use ada-ts-mode on a near daily basis, and so I’d like to think that I’m eating my own dog food and trying to continually improve the Ada experience in Emacs.
The pop-up you show above actually belongs to lsp-mode
. It’s mode map contains a right-click entry to display it’s own context menu. ada-ts-mode
doesn’t currently contain a mapping for right-click, although Emacs 28 added the context-menu-mode
, which when actived (or when you press “S-f10”), seems to show the top-level menus as a pop-up window. I kind of like the lsp-mode
context menu though, so I guess it’s up to you which one you prefer.
Just this week I’ve released a new version of the ada-ts-mode
package and wanted to highlight some of the changes that I believe people may be interested in.
- There is now intrinsic support for tree-sitter based indentation. You no longer need to be running a Language Server to have indentation support, although Language Server formatting is still an option if
ada-ts-mode-indentation-backend
is configured to use it. Additionally, if you are using the Language Server for indentation, indentation of empty lines after pressing RET and when the Language Server returns an error during formatting (i.e., GNATformat won’t format with syntax errors) will fallback to using the tree-sitter indentation support. In these scenarios, the tree-sitter fallback provides better indentation than was previously provided with the LSP-based indentation, which just indented the same as the previous line. The hope is to provide a seamless experience, no matter which back-end is configured.
- The mode map no longer needs to be explicitly specified, as commands are now registered by default. In addition, the keymap prefix (i.e., “C-c”) is configurable in case you want to map it somewhere else. See
ada-ts-mode-keymap-prefix
to change this. To see all the mapped commands, type “C-h m” when visiting an Ada file (or see the manual or README for the full list). Furthermore, a top-level “Ada” menu is provided to help in discoverability.
- There are new casing commands and an auto-casing minor mode (
ada-ts-auto-case-mode
) for those who like to have casing automatically adjusted for them. This works similarly to legacy solutions which provided casing support (i.e., specified formatting function with exception list/file). If you want a “casing as declared” solution, consider ada_caser from @simonjwright. There are also commands for adjusting the case of the buffer, region or point. See the documentation for full details. FYI, gpr-ts-mode
also supports casing commands and contains an auto-casing minor mode too.
There have been some changes to the example Emacs configuration over the last couple months. I initially started out calling it a “Minimal Emacs Configuration for Ada”, but I have now renamed it to a “Small Emacs Configuration for Ada”. I was not happy with the User Experience of that configuration, as it was initially conceived only to demonstrate how to configure ada-ts-mode
and gpr-ts-mode
, but I didn’t use that configuration myself. When I eventually did, I wasn’t happy with it. The reason I didn’t use that configuration is because I had my own custom configuration, but it was full of opinionated settings (e.g., theme, nerd icons, doom-modeline
, etc.) and was full of old cruft that I really need to cleanup. I regularly use this configuration now to checkout changes in ada-ts-mode
and gpr-ts-mode
.
More recently, I’ve been trying to build up this configuration to be one that I wouldn’t mind using on a daily basis. This meant adding in a few packages I personally liked (without being too opinionated, lol), and in the process of doing so, I’ve added additional configuration to select between multiple solutions which are mutually exclusive. For instance, you could already configure which LSP client you wanted (Eglot or lsp-mode), but there are other settings as well (see the README for the full list). For instance, you can choose between Company and Corfu for your completion-at-point pop-up. Personally, I’ve run across a number of issues in Company, and therefore prefer Corfu, but you can uncomment a single line in early-init.el
to use Company if you like. You can also choose between Flymake and Flycheck for your diagnostics provider. See the “defcustoms” at the beginning of init.el
and the commented out alternatives in early-init.el
.
In addition to providing a number of alternatives, I’ve included packages which enhance your experience. For instance, with Flymake or Flycheck, there is now consult-flymake and consult-flycheck mapped to “M-g M-d” which provides mini-buffer completion for diagnostics in the buffer, with live preview. Similarly, there are at least 3 different ways to get Imenu information. The first is the top-level “Index” menu, but there is still the original Imenu command (mapped at “M-g i”). I personally recommend consult-imenu (mapped at “M-g M-i”) as I find it supercharges your Imenu usage. You can filter by category, filter on partial input, as well as see live previews in the buffer for any of the candidates. Checkout the config to find other gems.
This configuration also contains a number of workarounds for either bugs in Emacs, bugs in the Ada Language Server, or just settings which are useful for working with Ada. Even if you maintain your own configuration, you might find some of that useful as a reference for the struggles I’ve gone through striving for a satisfying Ada experience in Emacs.
Finally, I’ve removed the setting of ada-ts-mode-indent-backed
to “LSP”, therefore this configuration will use Tree-sitter indentation by default. Uncomment the configuration in early-init.el
to restore the previous setting if desired.
As always, I’m open to suggestions for future enhancements. Please report any bugs you encounter as an issue on the Github page.