Editors
Setting up your editor
The command alr edit
launches your editor on the current crate, with the appropriate enviroment variables and settings.
You can adjust the editor that gets started by alr edit
with Alire's
editor.cmd
setting.
Language server
Ada has a language server. Some of the editors can be configured or have a plugin to use this so you might not need to install this directly.
GNAT Studio
- Linux
- Windows
- macOS
Alire is configured to work with GNAT Studio by default if you have it installed.
Alire is configured to work with GNAT Studio by default if you have it installed.
Find a community-provided version of GNAT Studio for macOS here.
There's a slight problem with macOS Sequoia.
For earlier versions of macOS, use this:
alr settings --set editor.cmd 'open -n -a gnatstudio -- ${GPR_FILE}'
For later versions, use this workround (you'll need to change the /Applications
part if you've installed GNATStudio somewhere else):
alr settings --set editor.cmd '/Applications/GNATStudio.app/Contents/MacOS/gnatstudio_launcher ${GPR_FILE}'
To edit your project, run this from your project directory:
alr edit
Visual Studio Code
Make a workspace.code-workspace
in your project folder with the name of your gpr file.
{
"folders": [
{
"path": "."
}
],
"settings": {
"ada.projectFile": "my_project_name.gpr"
}
}
Set Alire to look for a workspace.code-workspace in whatever directory you're trying to open.
- Windows
- Linux
- macOS
alr settings --set editor.cmd "code workspace.code-workspace"
alr settings --set editor.cmd "code workspace.code-workspace"
alr settings --set editor.cmd "/Applications/VisualStudioCode.app/Contents/Resources/app/bin/code workspace.code-workspace"
As long as you make a workspace file, you can now edit your projects with:
alr edit
Vim
- Ada Bundle - A set of plugins for using Ada with VIM.
Emacs
Install the ada-mode
extension from GNU ELPA.
Set Alire to use Emacs when invoking alr edit
:
- Linux
- macOS
alr settings --set --global editor.cmd 'emacs --eval=(ada-build-prompt-select-prj-file"${GPR_FILE}") ${GPR_FILE}'
alr settings --set editor.cmd 'open -n -a emacs ${GPR_FILE}'
Note, you still need to find one of the project's Ada source files and then select the relevant GPR file. Investigations continue.