AdaCore / ada_language_server

Server implementing the Microsoft Language Protocol for Ada and SPARK
GNU General Public License v3.0
226 stars 54 forks source link

Automatically set GPR_PROJECT_PATH #1142

Closed NicoPy closed 7 months ago

NicoPy commented 1 year ago

In the case that ALIRE is not set but an Alire project is detected (ALS run outside Alire terminal), could ALS automatically set GPR_PROJECT_PATH ?

reznikmm commented 1 year ago

I'm not sure if it worth it. You can get in in just one line in the terminal:

alr exec bash
NicoPy commented 1 year ago

The target application is with Eclipse editor. This editor is multi-projects. Running Eclipse from Alire works but only for one project.

reznikmm commented 1 year ago

Then I don't quite understand what to do. Now alire sets the GPR_PROJECT_PATH environment variable for the processes it starts (such as gnatls and gcc to detect installed toolchain). In which processes should the server set this variable?

NicoPy commented 1 year ago

Using the last ALS version (23.0.19), at starup, I get the following output :

[ALS.MAIN] Check alire:
[ALS.MAIN] Project:hello.gpr
[ALS.MAIN] ALS version: 23.0.19
[ALS.MAIN] Initializing server ...
[ALS.MAIN] GPR PATH: 
[ALS.MAIN] PATH: C:/Program Files/Alire\bin;C:\Users\Nicolas\.cache\alire\msys64\mingw64\bin;C:/Users/Nicolas/.p2/pool/plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.6.v20230204-1729/jre/bin/server;C:/Users/Nicolas/.p2/pool/plugins/org.eclipse.justj.openjdk.hotspot.jre.full.win32.x86_64_17.0.6.v20230204-1729/jre/bin;C:\Program Files (x86)\VMware\VMware Player\bin\;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;PATH=C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Common Files\microsoft shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Common Files\Roxio Shared\OEM\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\OEM\12.0\DLLShared\;C:\Program Files (x86)\Roxio\OEM\AudioCore\;C:\Program Files\TortoiseSVN\bin;C:\Python311;C:\Python311\Scripts;C:\Program Files (x86)\Tesseract-OCR;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Dell\Dell Data Protection\Access\Advanced\Wave\Gemalto\Access Client\v5\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Windows;C:\Program Files\TortoiseHg\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Common Files\GTK\2.0\bin;C:\Users\Nicolas\AppData\Local\Microsoft\WindowsApps;C:\Users\Nicolas\AppData\Local\GitHubDesktop\bin;C:\Users\Nicolas\AppData\Roaming\npm;C:\Users\Nicolas\AppData\Local\Programs\Microsoft VS Code\bin;;C:\Users\Nicolas\Desktop;
[ALS.MAIN] Ada version used for predefined completion: ADA_2020
[ALS.MAIN] Initialize_Request: Request 1 /Z:/ada/eclipse_test/hello/
[ALS.MAIN] Context root: Z:\ada\eclipse_test\hello

The project file is set through a toml configuration file.

What does the line [ALS.MAIN] GPR PATH: mean ? I guess it means the _GPRPATH env variable is not set. In this case, does ALS discover GPR PATH itself (using Alire) ?

reznikmm commented 7 months ago

GPR PATH: trace outputs the value of GPR_PROJECT_PATH environment variable at the moment of ALS launch. ALS starts alr to discover proper environment variables and uses them to load the project.

I'm closing the issue, but if you have other questions or improvement ideas don't hesitate to reopen/continue.

NicoPy commented 7 months ago

It looks like it works as expected. Thanks.