Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no code navigation in the VS Code extension when using Alire projects #1192

Open
dalybrown opened this issue Apr 17, 2024 · 10 comments
Open
Assignees
Labels

Comments

@dalybrown
Copy link

We lost the ability to navigate code sometime a couple months ago (rough estimate) using the VS Code extension. We exclusively use Alire to manage our projects and dependencies. We develop in a remote container using dev containers and the VS code extension.

It might have something to do with the version of Alire we are using (2.0.1) or the version of the extension (v24.0.5).

We have tried adjusting where the dependencies are cached using:

alr settings --global --set dependencies.shared false

and this still does not fix it. The VS Code extension complains it can't find any of the project files we depend on. These dependencies are managed by Alire.

Somewhere a regression has been introduced. Our environment used to work with SPARK/Ada and Alire, and still works for every other language we develop with.

We see this behaviour on both amd64 and arm64 platforms and with different Alire projects.

@dalybrown
Copy link
Author

Here is a reproducer ... just open this folder in VS code and, using the dev container extension, it will build the the dev container automatically and install the Ada VS code extension. You'll notice you can't navigate code but building with alire works fine.

reproducer.tar.gz

@reznikmm
Copy link
Member

Hello @dalybrown

Thank you for self-contained reproducer! I'm able to reproduce. Probably, the reason is that ALS launches two instances of alr simultaneously (alr show and alr printenv) and this doesn't work with alr 2.0 any more.

To unblock you I propose to rename alr to alr2 and create a shell wrapper for alr:

#!/bin/bash

LOCK=/tmp/alr.lock

if [[ "$1/$2" =~ --non-interactive/(show|printenv) ]] ; then
  while ! { set -C; 2>/dev/null >$LOCK; } ; do sleep 0.5 ; done
  trap "rm -f $LOCK" EXIT
fi

${0}2 "$@"

I guess you also may need to add alr -n build after alr -n update to let Alire run pre/post build actions. Or you can run alr build in the terminal and then launch "Ada: Reload project" from vscode command palette.

Please let us know if this works for you.

@dalybrown
Copy link
Author

Thanks for the reply.

Before we start implementing workarounds (this affects more than just me), is this something that is planned to be fixed soon (ish)? We can live without code navigation for a bit longer...

Let me know! Thanks!

@reznikmm
Copy link
Member

I'm going to change ALS code to launch alr sequentially, but it has not been decided when we will release v24.0.6 yet.

@dalybrown
Copy link
Author

Thanks for the response! I'll try out your proposal this week (and monitor for the updated extension). Cheers!

adacore-bot pushed a commit that referenced this issue Apr 23, 2024
instead of as concurrent processes.

Fixes ada_language_server#1339, refs #1192 on github
@dalybrown
Copy link
Author

dalybrown commented May 10, 2024

I also see this error quite a bit in the console (not sure it's related):

alr_env.gpr[Ln 1, Col 1]: Project file has errors and can't be loaded.
[Ln 2, Col 2]: project file "/path/to/project/alire/alr_env.gpr" not found

I didn't get a chance to try the workaround - I haven't been able to do much development the past couple of weeks :(. I'll try to get around to it today or next week.

@reznikmm
Copy link
Member

Could you try 24.0.6 version?

@dalybrown
Copy link
Author

I will try this next week when I (hopefully) get back to coding. Thanks!

@dalybrown
Copy link
Author

dalybrown commented Jul 8, 2024

I get this error when using 24.0.6:

project file "/workspaces/XXX/alire/alr_env.gpr" not found

and this error:

Project file has errors and can't be loaded.

This is with a fresh crate. Something doesn't seem right still.

Also other things don't work: formatting code, etc.

I'm not sure what I'm missing here, and how others are using this. This is with a completely fresh environment, a brand new fresh crate, etc.

@dalybrown
Copy link
Author

I'm not sure what I'm missing here: code navigation doesn't work reliably for me, nor does it work reliably for my colleague. I think there is a race condition somewhere still, or I am just doing something incorrect. If I reload the window, I can get it to work sometimes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants