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

Initial implementaiton of Alire support breaks 23.0.13 preset alire configuration #1129

Closed TamaMcGlinn closed 1 year ago

TamaMcGlinn commented 1 year ago

With version 23.0.13 of the Ada extension, I was able to get openvscode-server to find the AdaBots alire environment by setting explicitly all the necessary environment variables inside the Dockerfile. However, with the release of 23.0.14 that no longer works - it works for a few minutes, until VSCode decides to update to the latest version and then I get a popup with an error relating to Alire, syntax highlighting is gone and I can no longer navigate to definitions from subprogram calls.

My suggestion to fix this is to make the extension check this environment variable, and not do anything automatically if it is already set: export ALIRE="True". If this env variable is already set, it signifies the system already has the alire environment set up.

TamaMcGlinn commented 1 year ago

The error says "alr --non-interactive show":

alr_vscode_error

$ alr version
APPLICATION                                                                                         
alr version:               1.2.2                                                                    
libalire version:          1.2.2                                                                    
compilation date:          2023-01-12 20:53:49                                                      
compiler version:          Community 2021 (20210519-103)
reznikmm commented 1 year ago

How can I reproduce this?

TamaMcGlinn commented 1 year ago

docker run -it --init -p 3000:3000 -p 7112:7112 -v "$(pwd):/home/workspace/src/user_src" tmcglinn/adabots_openvscode:1.0.0

Then open http://localhost:3000/?folder=/home/workspace and open any adb file in src, for example src/construction/build_house.adb. If you are quick, you can cntrl click Adabots.Create_Turtle; but on the left under Extensions you can see it automatically starts updating to version 14, and after that is done it won't work anymore.

reznikmm commented 1 year ago

Your alr is broken and ALS can't launch it. The file contains:

$ cat /home/.openvscode-server/bin/alr
/home/.openvscode-server/tools/alr --appimage-extract-and-run $@

Without shell shebang #!/bin/sh OS (execve call) can't launch it. When I add the shebang alr --non-interactive show works fine, but alr --non-interactive printenv fails with message:

Failed to clean up cache directory

I think, this is because you are using AppArmor version of alr. If I replace it with Linux binary (even with bash wrapper), ALS works as expected.

Can you replace AppArmor with Linux binary?

Your idea of checking ALIRE=True is worth to implement, I guess. Thank you.

reznikmm commented 1 year ago

Should be fixed in 23.0.15