Hello, I’m a Wikipedia editor and I need to configure a working environment to test code with Ada for an article that I’m writing about Ada on the Hebrew Wikipedia.
I followed the instructions that are posted on the extension manual. But Visual Studio Code reports an error in the .gpr file that reads:
can’t find a toolchain for the following configuration: language ‘Ada’, target ‘x86_64-linux’, default runtime
Nonetheless, when I press F5 to run the project, the program compiles and shows the output Hello World!. But IntelliSense does not work even on Ada.* libraries.
Here is the local settings.json file of the workspace:
Although the PATH seems to me redundant, I merely followed the instructions. This is where the GNAT binaries from APT are located as far as I understand. This configuration includes Debian 13 with GNAT 13.3.0 and gprbuild 18.0 provided by APT.
I also attempted to install Ada’s toolchain with alr, which I tested both from APT and from the Alire website. However, APT’s alr refused to work due to an error that reads Unexpected Property Count: 0. Whereas the alr binary that is provided by the Alire website successfully downloaded and installed the toolchain in my .local directory. I did not add that path to my settings.json file, because it is located within my home directory. Is this how it’s supposed to work?
I am sadly no VS Code user, however, I may be able to help here…
Are you launching the editor with alr edit? That Alire command will launch the editor with the required environment for things to just work. Also you may need to install some crates such as libadalang_tools for some bits of the editor to work to its full extent (most likely also ada_language_server, if that is its correct name).
I have seen that sometimes the GPRbuild installation from Alire fails to recognise the system installed toolchain, so that may be why you are not getting a successful compilation with the Debian package. But this is just a guess. Also, I have never seen that apt error and it may not be related with Alire, but who knows…
Hopefully this helps you a bit, but I will let others lend you a better hand.
It seems that alr edit solved the problem. I launched Visual Studio Code via alr edit. A sample project from Alire called hello that I fetched previously has loaded correctly, and the IntelliSense in Visual Studio Code works too. I can run and debug the code.
Thank you for the encouragement. The article I’m writing on the Hebrew Wikipedia is not a translation of the English article. It’s a new article in Hebrew based on what I have read from the Ada Reference Manual earlier this year. After a long break due to university schedule, I am now ready to resume the article. I want to study the language by-the-book and test it as I write the article. Hopefully, my Hebrew article will surpass the English article by far. It will be succinct as well as comprehensive.
I tried to match APT’s GNAT version with APT’s GCC version, but unfortunately, it did not work. My current system configuration requires two versions of GCC. I tried both GNAT 13 and GNAT 14. Each one installed without the other, but neither of them worked (given that two GCC versions were installed at the same time). In any case, I followed the advice given in the previous reply, and using alr edit seems to have solved the problem for Visual Studio Code.