Good day folks!
Is this canonical Ada formatting or is there a way to improve it in Visual Studio Code?
type Size is
(Device, Config, Intface, Endpoint, Audio_Endpoint, HUB_NonVAR,
SS_Endpoint_Companion, BOS, Capability);
for Size use
(Device => 18, Config => 9, Intface => 9, Endpoint => 7,
Audio_Endpoint => 9, HUB_NonVAR => 7, SS_Endpoint_Companion => 6,
BOS => 5, Capability => 3);
for Size'Size use Interfaces.C.unsigned_char'Size;
The formatting is OK (personally I’d put each enumeration vaue on its own line).
It doesn’t compile, because the enumeration values (
Endpoint => 7, etc) need to be (a) ordered the same as the enumerals (as you have it,
Capability would have to be first) and (b) distinct.
The naming looks a bit odd. I don’t know what
Config etc are, but they’re probably not sizes.
type Thing is (Device, Config, ...);
Thing_Size: constant array (Thing) of Interfaces.C.unsigned_char :=
(Device => 18,
Config => 9,
This is a chunk of my libusb bindings code which I extracted out of context.
To narrow down my question, how do I make the VSCode Ada extension formatter put enumeration values each on a separate line? The formatting I posted is the one I get from the extension.
The only way I found to get the formatting I want is to put a comment after each enumeration value which is not ideal from my perspective.
It looks as though the formatting is done by
gnatpp, which has an option (
--vertical-enum-types) to put each enumeral on a separate line, but none that do what you want.
Thank you Simon!
As you said, it doesn’t
quite do what I want. It verticall formats
type ... is but doesn’t touch
for ... use at all :-(.
Github issue was very helpful.
That said, I cannot figure out how this works as I can’t find
gnatpp in my Linux installation.
Anybody knows where it is?
It’s in crate
I couldn’t find where gnatpp gets installed by alr but
--use-on-new-line formats use clauses the way I want it. Thanks Simon!
You can have
gnatpp options in your project file and VSCode extension will take them into account. I have these for example:
package Pretty_Printer is
for Default_Switches ("ada") use
libadalang_tools is installed using
alr with libadalang_tools. That
seems to be a per-project installation, rather than a toolchain installation. Do I understand that correctly? Will I have to re-install it for each project I work on, and if so, will it install multiple copies of the same thing?
Using Alire 2.0.0-beta1, you can install binary crates:
alr install libadalang_tools
This file has been truncated.
# User-facing changes log
This document is a development diary summarizing changes in `alr` that notably
affect the user experience. It is intended as a one-stop point for users to
stay on top of `alr` new features.
## Release `2.0-dev`
### Enable shared dependencies by default
Pre-2.0, Alire worked always in "sandboxed" mode; that is, all source
dependencies were found under `<workspace>/alire/cache`. This behavior can be
now enabled with `alr config --set dependencies.shared false`, locally or
By default, post-2.0, Alire works in "shared" mode, where sources are
downloaded once (to `~/.cache/alire/releases`) and unique builds are created
(under `~/.cache/alire/builds`) for unique configurations. This should minimize
excellent, worked for me, thanks
--no-vertical-enum-types option not yet available in
gnatpp? It’s listed as a Legacy option on the documentation page at AdaCore.